Application layer – Nor-Cal SDC15 Controller User Manual

Page 163

Advertising
background image

7-5

• How to calculate a checksum

(1) Add the character codes in the message from STX through ETX in single

byte units.

(2) Take 2's complement of the low-order one byte of the addition result.
(3) Convert the obtained 2'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 ID 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 2'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.

Chapter 7. CPL COMMUNICATIONS FUNCTIONS

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)

"RU" (hexadecimal number format random address data read command)

"WU" (hexadecimal number format random address data write command)

Data delimiter

RS, WS: "," (comma)
Other commands: None

Word address

RS, WS: "501W", etc.
Other commands: "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

Other commands: Numerical value of characters expressed in hexadecimal
as "0064" for example

Advertising