Data exchange protocol of Programming and Reporting line mode
ECRHelper 2 - Software for programming and reporting ECRSoftware for detecting ZEKA products
General Description
This mode is designed for programming of names and parameters of articles, header and footer lines, department names and prices, operator names.
In this mode the PC initiates the communication and the cash register checks data validation and stores it. If data is correct ECR returns ACK, else - NACK.
The protocol allows following options:
- Programming of header and footer lines
- Programming of operator names
- Programming of names and prices of departments
- Programming of names and parameters of articles
- Uploading of graphical logo - BMP file
- Article report
- Department report
- Daily X report
The application developed by Tremol ltd, which covers the entire functionality granted by this protocol is called ECR Helper and can be found in the download section.
Ecr Helper has the ability to be used automatically by any software application for programming of information and reports receiving! More information...
Protocol description
Note: the protocol format is same as the communication protocol for fiscal printer operation mode
Connection parameters:
Baud rate 9600 bps, 8 bits, no parity
Message format:
<marker><ECR number><command><information><crc><LF>
The exact data fields, enclosed by < and > are described in the following table:
| Field | Bytes | Value |
| marker | 1 | Start of message – always 0xАА |
| machine number | 6 | ASCII ('nnnnnn') ECR manufacture number |
| command | 1 | 'a'..'z' command |
| information | ? | variable character length in range 0x20 .. 0x8F |
| crc | 2 | XOR over all bytes, including marker, formed in the following manner: XOR over all bytes - the result is byte of type 0xHL, which is converted to 0x3H, 0x3L. |
| LF | 1 | End of message - always - 0x0A |
Acknowledgment format:
<type><machine number><crc><LF>
The exact data fields, enclosed by < and > are described in the following table:
| Field | Bytes | Value |
| type | 1 | Acknowledgement type – 0x06 = ACK (possitve), 0x15 = NACK (negative), 0x0Е = RETRY (request re-sending of the command) |
| machine number | 6 | ASCII ('nnnnnn') ECR manufacture number |
| crc | 2 | XOR over all bytes, including marker, formed in the following manner: XOR over all bytes - the result is byte of type 0xHL, which is converted to 0x3H, 0x3L. |
| LF | 1 | End of message - always - 0x0A |
Communication sequence:
| PC | Response (ECR) |
| command „START" | |
| ACK | |
| command „Programming" | |
| ACK | |
| Command „Programming" | |
| ACK | |
| ........................ | |
| ACK | |
| Command „STOP" | |
| ACK |
Short list of PC commands:
| command | value |
| а | START |
| w | Header / footer line programming |
| o | Operator name programming |
| r | Article programming |
| y | Department programming |
| G | Daily X report in text format |
| f | Article report |
| F | Department report |
| V | Protocol version |
| z | STOP |
PC Commands description
Command "start":
<a>
data fields:
| a | 1 byte command - 'a' |
ECR response: ACK or NACK
note: This command shall precedes all other commands.
Header / Footer line programming: 'w'
<w><line number><'0'><line contents>
data fields:
| w | 1 byte command - 'w' |
| line number | 1 byte line number ASCII number '1' .. '9' - depends of ECR model |
| '0' | '0' = received for further usage |
| line contents | 18 .. 24 ASCII characters - depends of ECR model |
ECR response: ACK or NACK
Operator name programming: 'о'
<o><operator number><name>
data fields:
| o | 1 byte command - 'o' |
| operator number | 1 byte operator number - ASCII number '1' .. '9' |
| name | 12 bytes ASCII operator name |
ECR response: ACK or NACK
Article programming: 'r'
<r><article number><name><barcode><price><decimal point><quantity>
<tax group><department>
data fields:
| r | 1 byte command - 'r' |
| article number | 4 bytes article number ASCII format - for example "00123" |
| name | 12 bytes article name or """""""""""", if it is not programmed |
| barcode | 12 bytes ASCII number or """""""""""", if it is not programmed |
| price | 8 bytes price (without decimal point) ASCII format or """", if it is not programmed |
| decimal point | 1 byte decimal point position - ASCII number '0' or '2' '0' = without decimal point, sum = ХХХХХХХХ '2' = with decimal point, sum = ХХХХХХ.ХХ |
| quantity | 9 bytes quantity ASCII format without decimal point (decimal point is with fixed position ) - example "123456789" => the quantity is 123456.789); or """""""""""", if it is not programmed |
tax group | byte tax group - '0' .. '4' or " if not programmed |
| department | 1 byte department number ASCII number '0' to '9', or " if not programmed |
ECR response: ACK or NACK
Department programming: 'y'
<y><department number><name><price><decimal point><tax group>
data fields:
| y | 1 byte command - 'y' |
| department number | 1 byte department number. ASCII number '0' to '9' |
| name | 12-18 bytes department name or """""""", if not programmed |
| price | 8 bytes price (without decimal point) ASCII format or """", if it is not programmed |
| decimal point | 1 byte decimal point position - ASCII number '0' or '2' '0' = without decimal point, sum = ХХХХХХХХ '2' = with decimal point, sum = ХХХХХХ.ХХ |
tax group | byte tax group - '0' .. '4' or " if not programmed |
ECR response: ACK or NACK
Uploading of graphical logo: 'R'
<R><image data>
data fields:
| R | 1 byte command - 'R' |
| image data | Image data in .BMP format with size 2302 or 3902 bytes depending on the cash register model. BMP file with dimensions 224x80 or 384x80 pixels, 2 colors (1 bpp). |
notice: when using command 'R' it is not necessary to use Start and Stop
ECR response: ACK or NACK
Daily Х and operator report in text receipt- like format: 'G'
<G>
data fields:
| G | 1 byte command - 'G' |
note: It is not neccessary to use Start and Stop commands before and after command 'G'
ECR response: ASCII text data in format as Daily Report receipt.
Article report: 'f'
<f>
data fileds:
| f | 1 byte command - 'f' |
ECR response:
<article number><;><name><;><barcode><;><price with dp><;>
<tax group><;>department><;><payment><;><sale sum><;><sold qty>
note: Every data field is separated with ';'
data fields:
| article number | 4 bytes article number ASCII format - for example "00123" |
| name | 12 bytes article name - ASCII format |
| barcode | 12 bytes ASCII number |
| price | 9 bytes price with decimal point included - format хххххх.хх ASCII |
tax group | byte tax group - '0' .. '4' or " if not programmed |
| department | 1 byte department number ASCII number '0' to '9', or " if not programmed |
| payment | 1 byte payment type number - always '0' |
| sale sum | 11 bytes accumulated through sales sum with decimal point - ASCII format. type - хххххх.хх |
| sold qty | 11 ASCII digits corresponding to the sold quantity |
Department report: 'F'
<F>
data fields:
| F | 1 byte command - 'F' |
ECR response:
<number><;><name><;><barcode><;><price with dp><;><tax group><;>
<department><;><payment><;><sale sum><;><sold qty>
note: Every data field is separated with ';'
data field:
| number | 1 byte ASCII digit |
| name | 12-18 bytes (в зависимост от модела) име на артикула |
| barcode | 12 bytes ASCII number |
| price | 9 bytes price with decimal point included - format хххххх.хх ASCII |
tax group | byte tax group - '0' .. '4' or " if not programmed |
| payment | 1 byte payment type number - always '0' |
| sale sum | 11 bytes accumulated through sales sum with decimal point - ASCII format. type - хххххх.хх |
| sold qty | 11 ASCII digits corresponding to the sold quantity |
Command Stop : 'z' : end of communication
<z>
data field:
| z | 1 byte command - 'z' |
ECR response: ACK or NACK
CRC calculation
The CRC is calculated by XOR over all bytes, including marker, formed in the following manner: XOR over all bytes - the result is byte of type 0xHL, which is converted to 0x3H, 0x3L.
C/C++ Example:
// AddCRC: Adds CRC & END marker to a command
void AddCRC(unsigned char* cmd, unsigned int len)
{
unsigned int i;
unsigned char xor = 0;
for (i = 0; i < len; i++)
xor ^= cmd[i];
cmd[i++] = (xor >> 4) | 0x30; // Calculate HIGH byte of CRC
cmd[i++] = (xor & 0x0F) | 0x30; // Calculate LOW byte of CRC
cmd[i++] = 0x0A; // Add end marker
cmd[i] = 0; // Add zero to make it zero terminated
}
Auxiliary commands:
Command '?' - information about the serial number
<0xАА><'?'><crc><LF>
The exact data fields, enclosed by < and > are described in the following table:
| Field | Bytes | Value |
| marker | 1 | start of message – 0x02 for Zeka S03, all other - 0xАА |
| comand | 1 | '?' |
| crc | 2 | XOR over all bytes, including marker, formed in the following manner: XOR over all bytes - the result is byte of type 0xHL, which is converted to 0x3H, 0x3L. |
| LF | 1 | End of message - always - 0x0A |
These five bytes are used to find out the presence of Zeka communication protocol, as well as finding out the serial number of the attached device.
Notice that the message format is differs from the standard format by missing ECR serial number.
ECR response:
| Field | Bytes | Value |
| type | 1 | Response type – 0x0E = RETRY |
| ECR Number | 6 | ASCII ('nnnnnn') ECR serial number |
| crc | 2 | XOR over all bytes, including marker, formed in the following manner: XOR over all bytes - the result is byte of type 0xHL, which is converted to 0x3H, 0x3L. |
| LF | 1 | End of message - always - 0x0A |
This is the way for the application software to find attached cash register Zeka and its serial number.
Command 'V' - gets information for the protocol and software version and country of operation
<V>
fields:
| V | 1 byte command - 'V' |
ECR Response (only information datafields):
<V><protocol><country><reserved><version>
| Field | Bytes | Value |
| V | 1 | 1 byte 'V' |
| protocol | 2 | 2 bytes protocol number in ASCII format digits for example '3' и '2' = 32 |
| country | 1 | 1 byte country ('B' for Bulgaria) |
| reserved | 1 | 1 byte reserved for further use |
| version | 30 | 30 bytes text presentation of the firmware version |
Protocol version:
V14B – Zeka M03, marker 0xAA
V15B – Zeka M02, Zeka 02, marker 0xAA
V30B – Zeka S02, marker 0x02
V32B – Zeka S03, marker 0x02
Different protocol versions have different fields length. Respectively if the data in certain filed must be kept the same, the same number of " (quotation marks) must be entered.
command | argument | bytes | |||||||
| V14B | V15B | V30B | V32B | V19B | V24B | V33B | V34B | ||
| ‘w' Header line | line contents | 24 | 18 | 18 | 38 | 18 | 24 | 18 | 38 |
| ‘o' operator name | name | 12 | 12 | 12 | 20 | 12 | 12 | 12 | 20 |
| ‘r' article | name | 18 | 12 | 12 | 18 | 18 | 18 | 18 | 18 |
| not used | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | |
| ‘y' department | name | 18 | 12 | 12 | 18 | 18 | 18 | 18 | 18 |
| ‘R' logo | *.BMP file | 3902 | 2302 | 2302 | 3902 | 2302 | 3902 | 2302 | 390 |
‘G' Daily X report | none | no | no | no | no | yes | yes | yes | yes |
| Marker | 0xAA | 0xAA | 0xAA | 0xAA | 0x02 | 0x02 | 0x02 | 0x02 | |
| ECR Model | ZekaM02 | Zeka02 | ZekaS02 | ZekaS03 | Zeka02E | ZekaM03E | ZekaS02E | ZekaS03E | |
Notes:
- If the data in certain filed must be kept the same, the same number of " (quotation marks) must be entered. This guarantees that the data will remain unaffected. The quotation marks can't be used for fields that define the command (for example article - command 'r', or department number - command 'y').
<last revision 17.12.2007>