
32
IX. Appendix
Appendix 1 Top Loose Communication Protocol
The loose communication protocol is a master-slave protocol based on Ascii code bytes.
Each lower computer (instrument) has a unique address, and the upper computer sends
instructions to the lower computer at the specified address. After receiving the instructions, the
lower computer returns the corresponding information if the verification is correct. After
receiving the correct answer, the upper computer will process it. If it is not received for a certain
period of time, it will be regarded as communication timeout.
1. Format of protocol data frame
Whether it is the upper computer or the lower computer, the data of each frame has the
same structure as the start byte and the end byte, as shown in the following two sections.
1.1 upper computer sends data frame format
Frame
1
2
3
4
5
6
symbol
XON
ADDR
CMD
DATA
CHK
XOFF
meaning
leading
flag
address
order
data
check
End mark
Number
of bytes
1
1
1
n
1
1
numerical
value
0x02
A-Z
A-Z
*
*
0x03
Table 9.1 data frame format of upper computer transmitter
The first part (Xon), fixed at 0x2, indicates the beginning of the data frame.
The second part (addr) is the instrument address. The value range is A-Z of the ASCII code,
corresponding to 1-26 of the corresponding address parameter. After receiving the command, the
lower computer will distinguish whether the local data is based on the address.
In part 4 (data), the number of bytes is uncertain. Most commands are 0 bytes.
The fifth part is the check code, which takes up one byte
XOR all byte data before the check code of this data frame, and then carry out or operation
with 0x40, that is
(CHK) = (XON) xor (ADDR) xor (CMD) xor (DATA1) xor (DATA2) xor
…
xor (DATAn) or (0x40)
Part 6 (XOFF), end of data frame marker.
2.1 format of response data frame
Frame
1
2
3
4
5
6
symbol
XON
ADDR
CMD
DATA
CHK
XOFF
meaning
leading
flag
address
order
data
check
End mark
Number
of bytes
1
1
1
n
1
1