Data exchange protocol of Programming and Reporting line mode

ECRHelper 2 - Software for programming and reporting ECR
Software 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:

  1. Programming of header and footer lines
  2. Programming of operator names
  3. Programming of names and prices of departments
  4. Programming of names and parameters of articles
  5. Uploading of graphical logo - BMP file
  6. Article report
  7. Department report
  8. 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:

FieldBytes Value
marker1Start of message – always 0xАА
machine number
6ASCII ('nnnnnn') ECR manufacture number
command1'a'..'z' command
information
?variable character length in range 0x20 .. 0x8F
crc2 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.
LF1 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:


FieldBytes Value
type
1Acknowledgement type – 0x06 = ACK (possitve), 0x15 = NACK (negative), 0x0Е = RETRY (request re-sending of the command)
machine number
6ASCII ('nnnnnn') ECR manufacture number
crc2 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.
LF1 End of message - always - 0x0A

Communication sequence:

PCResponse (ECR)
command „START" 
 ACK
command „Programming" 
 ACK
Command „Programming" 
 ACK
 ........................ 
 ACK
Command „STOP" 
 ACK

Short list of PC commands: 

commandvalue
аSTART
wHeader / footer line programming
oOperator name programming
rArticle programming
yDepartment programming
 GDaily X report in text format
 f Article report
 F Department report
 V Protocol version
zSTOP

PC Commands description 

Command "start":

 <a>

data fields:

a1 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:

w1 byte command - 'w'
line number
1 byte line number ASCII number '1' .. '9' - depends of ECR model
'0''0' = received for further usage
line contents18 .. 24 ASCII characters - depends of ECR model

ECR response: ACK or NACK

Operator name programming: 'о'

<o><operator number><name>

data fields:

o1 byte command - 'o'
operator number
1 byte operator number - ASCII number '1' .. '9'
name12 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:

r1 byte command - 'r'
article number4 bytes article number ASCII format - for example "00123"
name12 bytes article name or """""""""""", if it is not programmed
barcode12 bytes ASCII number or """""""""""", if it is not programmed
price8 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
'0'  - no tax
'1' .. '4' - A,B,C,D

department1 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:

y1 byte command - 'y'
department number 1 byte department number. ASCII number '0' to '9'
name12-18 bytes department name or """""""", if not programmed
price8 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
'0'  - no tax
'1' .. '4' - A,B,C,D

ECR response: ACK or NACK

Uploading of graphical logo: 'R'

<R><image data>

data fields:

R1 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:

f1 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 number4 bytes article number ASCII format - for example "00123"
name12 bytes article name - ASCII format
barcode12 bytes ASCII number
price9 bytes price with decimal point included -  format хххххх.хх ASCII 

tax group

byte tax group - '0' .. '4' or " if not programmed
'0'  - no tax
'1' .. '4' - A,B,C,D

department1 byte department number ASCII number '0' to '9', or " if not programmed
payment 1 byte payment type number - always '0'
sale sum11 bytes accumulated through sales sum with decimal point - ASCII format. type - хххххх.хх
sold qty11 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:

number1 byte ASCII digit
name12-18 bytes (в зависимост от модела) име на артикула 
barcode12 bytes ASCII number
price9 bytes price with decimal point included -  format хххххх.хх ASCII 

tax group

byte tax group - '0' .. '4' or " if not programmed
'0'  - no tax
'1' .. '4' - A,B,C,D

payment 1 byte payment type number - always '0'
sale sum11 bytes accumulated through sales sum with decimal point - ASCII format. type - хххххх.хх
sold qty11 ASCII digits corresponding to the sold quantity


Command Stop
: 'z'  :  end of communication

 <z>

data field:

z1 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:

FieldBytes Value
marker1start of message – 0x02 for Zeka S03, all other - 0xАА
comand1'?'
crc2 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.
LF1 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:

FieldBytes Value
type1Response type – 0x0E = RETRY
ECR Number
6ASCII ('nnnnnn') ECR serial number
crc2 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.
LF1 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:

V1 byte command - 'V'

ECR Response (only information datafields):

<V><protocol><country><reserved><version>
FieldBytes Value
V11 byte 'V'
protocol 22 bytes protocol number in ASCII format digits for example '3' и '2' = 32
country1 1 byte country ('B' for Bulgaria)
reserved1

1 byte reserved for further use

version3030 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 2418  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 nono
no
no
yes
yes
yes
yes
 Marker0xAA0xAA 0xAA 0xAA 0x020x02 0x02

0x02 

 ECR Model
 ZekaM02

Zeka02
ZekaM02

ZekaS02
ZekaS03

Zeka02E
ZekaM02E

 ZekaM03E ZekaS02EZekaS03E

 


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>