K-Patents SeedMaster 2 User Manual

Page 83

Advertising
background image

11 COMMUNICATION

83

83

ASCII Framing

In ASCII mode messages start with a ‘colon’ ( : ) , and end with a ‘carriage return – line feed’ (CRLF) pair.
Coding System: One hexadecimal character contained in each ASCII character of the message, i.e. 1 byte
data transmission requires transmission of 2 characters.
The allowable characters transmitted for all other fields are hexadecimal 0–9, A–F.
Networked devices monitor the network bus continuously for the ‘colon’ character.
When one is received each device decodes the next field (the address field) to find out if it was its own device
address.
Intervals of up to one second can elapse between characters within the message.
If a greater interval occurs the receiving device assumes an error has occurred.

A typical message frame is shown below.

START:

: (colon, 3A hex)

ADDRESS (device)

: 2 hex characters

FUNCTION code

: 2 hex characters code

DATA

: 2…2N characters

LRC CHECK

: 2 characters

END

: CRLF (0D and 0A hex)

LRC

: is the Error Check Field, Longitudinal Redundancy Check

(LRC) is used.

LRC Checking

Messages include an error checking field that is based on the Longitudinal Redundancy Check (LRC)
method. The LRC field checks the contents of the message exclusive of the colon start and CRLF end pair. It
is applied regardless of any parity check method used for the individual characters of the message. The LRC
field is one byte containing an 8 bit binary value. The LRC value is calculated by the transmitting device
which appends the LRC to the message. The receiving device calculates an LRC during receipt of the
message and compares the calculated value to the actual value it received in the LRC field. If the two values
are not equal an error will result. The LRC is calculated by adding together successive 8 bit bytes of the
message discarding any carries, and then two’s complementing the result. It is performed on the ASCII
message field contents excluding the colon character that starts the message, and excluding the CRLF pair
at the end of the message.

RTU Framing

In RTU mode messages start with a silent interval of at least 3.5 character times.
The first field then transmitted is the device address.
The data transmitted are bytes represented as 2 hexadecimal characters. The allowable characters
transmitted for all fields are hexadecimal 0-9 and A-F.
Networked devices monitor the network bus continuously including the silent intervals, too. When the first
field (the address field) was received, each device decodes it to find out if it was its own device address.
Following the last transmitted character a similar interval of at least 3.5 character times marks the end of the
message. The final CRC field has to be valid for a successful receive / transmit operation.

A typical message frame is shown below

DEVICE ADDRESS

1 byte hexadecimal address

FUNCTION CODE

1 byte hexadecimal code

DATA FIELD

N bytes hexadecimal data

CRC CHECK

2 bytes hexadecimal CRC


CRC is the Error Check Field, 2 bytes. Cyclical Redundancy Check (CRC) is used.

CRC checking

In RTU mode messages include an error checking field that is based on a Cyclical Redundancy Check (CRC)
method. The CRC field checks the contents of the entire message. It is applied regardless of any parity check
method used for the individual characters of the message. Messages include a 2 bytes long CRC field.

CRC has to be calculated on the message except the CRC itself.

The polynomial used for calculation: A001H.

The next steps perform the CRC calculations:

1. Fill the CRC word with FFFF (hex) start value.

Advertising