Nor-Cal SDC15 Controller User Manual

Page 178

Advertising
background image

(2) Take 2'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 word address)

'3'

: 33H (second byte of the start word address)

'E'

: 45H (third byte of the start word address)

'9'

: 39H (fourth byte of the start word address)

'0'

: 30H (first byte of the read count)

'0'

: 30H (second byte of the read count)

'0'

: 30H (third byte of the read count)

'2'

: 32H (fourth byte of the read count)

(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 2'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. Immediately after LF is received, the

device immediately stands by for permission to process the received message.

8-4

Chapter 8. MODBUS COMMUNICATIONS FUNCTIONS

Advertising