Checksum¶
Sending with block COM_SEND
With Checksum < > none, the selected checksum is appended when sending. If the parameter Telegram ending selection is set to String (check receive), the checksum of the ending character(s) is entered. The character(s) is/are appended according to the inputs END_LEN and END_CH of the Function Block COM_SEND.
Receiving with block COM_REC
With Checksum < > none, the selected checksum is checked during reception. If the parameter Telegram ending selection is set to String (check receive), the checksum of the ending character(s) is expected.
The ending character(s) and the checksum are not output, i.e., they are not contained in the DATA area.
A telegram should look as follows:
Data 0 | Data 1 | Data 2 | .. | Data n | Check 1 | [Check 2] | End 1 | [End 2] |
The values enclosed in [ ] are only relevant for 16 bit checksum or 2 ending characters.
At the blocks COM_SEND and COM_REC, the area addressed via the input DATA contains the following values:
Data 0 | Data 1 | Data 2 | .. | Data n |
Example
Setting in PLC configuration:
“Telegram ending selection” = String
“Telegram ending character” = 2
“Telegram ending value” = 16#0d0a
“Checksum” = CRC16 (i.e., Motorola format)
Send with COM_SEND:
LEN = n+1 END_LEN = 2 END_CH = 16#0d0a
The area addressed via input DATA contains the following data:
Data 0 | Data 1 | Data 2 | .. | Data n |
The following data are sent via the interface:
Data 0 | Data 1 | Data 2 | .. | Data n | CRC16 high | CRC16 low | 16#0d | 16#0a |
Reception with COM_REC:
The interface receives the following telegram:
Data 0 | Data 1 | Data 2 | .. | Data n | CRC16high | CRC16 low | 16#0d | 16#0a |
The following data are written to the area addressed via DATA:
Data 0 | Data 1 | Data 2 | .. | Data n |