10
Chapter 4. COMMUNICATION PROCEDURE
• How to calculate a checksum
(1) Add the character codes in the message from STX through ETX in single
byte units.
(2) Take two's complement of the low-order one byte of the addition result.
(3) Convert the obtained two's complement to a two-byte ASCII code.
The following is a sample checksum calculation:
[Sample message]
STX: 02H
'0':
30H (first byte of the station address)
'1':
31H (second byte of the station address)
'0':
30H (first byte of the sub-address)
'0':
30H (second byte of the sub-address)
'X':
58H (device code)
'R':
52H (first byte of the command)
'S':
53H (second byte of the command)
(omitted)
ETX: 03H
(1) Add the character codes in the message from STX through ETX in single
byte units.
The add operation in single byte units is as follows:
02H + 30H + 31H + 30H + 30H + 58H + 52H + 53H + • • • + 03H.
Assume that the result is 376H.
(2) The low-order one byte of the addition result 376H is 76H. The two's
complement of 76H is 8AH.
(3) Convert the obtained 8AH to a two-byte ASCII code.
The result is:
'8': 38H
'A': 41H,
and the two bytes, '8'(38H) and 'A'(41H), are the checksum.
• CR/LF
This indicates the end of the message. Immediately after LF is received, the
device enters a state allowed to process the received message.
■
Application layer
The table below shows the configuration of the application layer.
Item
Description
Command
"RS" (decimal number format continuous address data read command)
"WS" (decimal number format continuous address data write command)
"RD" (hexadecimal number format continuous address data read command)
"WD" (hexadecimal number format continuous address data write command)
Data delimiter
RS, WS: "," (comma)
RD, WD: None
Word address
RS, WS: "501W", etc.
RD, WD: "01F5", etc.
Read count
Numerical value of characters expressed as "1" for example
Numerical value
RS, WS: Numerical value of characters expressed as "100" for example
to be written
RD, WD: Numerical value of characters expressed in hexadecimal as
"0064" for example
Содержание Azbil CMQ-V Series
Страница 43: ...35 Chapter 6 COMMUNICATION PROGRAM FOR MASTER STATION ...
Страница 44: ...36 Chapter 6 COMMUNICATION PROGRAM FOR MASTER STATION ...
Страница 45: ...37 Chapter 6 COMMUNICATION PROGRAM FOR MASTER STATION ...
Страница 46: ...38 Chapter 6 COMMUNICATION PROGRAM FOR MASTER STATION ...
Страница 52: ......
Страница 53: ...Revision History Printed Manual Number Edition Revised pages Description date Jan 2007 CP SP 1197E 1st Edition ...
Страница 54: ......
Страница 55: ......