8-4
Chapter 8. Modbus COMMUNICATION FUNCTION
(2) Take two's complement of the addition result.
(3) Convert the low-order one byte of the addition result to a character code.
The following is a sample checksum calculation:
[Sample message]
: : 3AH (start of the message)
'0' : 30H (first byte of the station address)
'A' : 41H (second byte of the station address)
'0' : 30H (first byte of the read command)
'3' : 33H (second byte of the read command)
'0' : 30H (first byte of the start data address)
'3' : 33H (second byte of the start data address)
'E' : 45H (third byte of the start data address)
'9' : 39H (fourth byte of the start data address)
'0' : 30H (first byte of the number of read data)
'0' : 30H (second byte of the number of read data)
'0' : 30H (third byte of the number of read data)
'2' : 32H (fourth byte of the number of read data)
(1) Add the data from the top up to just before the checksum.
The add operation is as follows:
0AH + 03H + 03H + E9H + 00H + 02H
The result is FBH.
(2) The low-order byte of the addition result FBH is FBH as is. The two's
complement of FBH is 05H.
(3) Convert the obtained 05H to a two-byte ASCII code.
The result is:
'0' : 30H
'5' : 35H,
and the two bytes, '0' (30H) and '5' (35H), are the checksum.
• CR/LF
This indicates the end of the message. After LF is received, the device
immediately stands by for permission to process the received message.