7 DATA COMMUNICATIONS USING BIDIRECTIONAL PROTOCOL
(d)Sum check code
The sum check code expresses the numeric value for the lower two bytes (16 bits) of the results (sum) from the addition of the data length and the data portion in the message as binary code data.
When "Sum check" is specified with the transmission setting in GX Developer, it is necessary to add a sum check code at the end of the message.
1)For data communication from the external device to the Q series C24 The Q series C24 checks and processes the sum check code received. It cannot be read from the sequence program.
When "No sum check" is specified, once a data portion of message corresponding to the data length is received, the succeeding data received will be ignored up to the control code that follows (See (a)). The following example shows the contents of a sum check code in the message.
2)For data communication from the Q series C24 to the external device The sum check code to be transmitted is calculated and added by the Q series C24. When "No sum check" is specified, no sum check code is transmitted.
(Example) The following shows the sum check code when "ABCDEFGHIJ " and the numeric value 100 are sent as data (when the unit is in bytes).
|
|
|
|
|
|
|
| Arbitrary data |
|
|
|
|
|
|
|
|
|
| |||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
|
|
|
|
|
| Data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| E | Data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
| N |
|
|
|
|
|
|
|
|
|
|
|
|
| 100 | Sum |
| ||||
| Q | length | A | B | C | D | E | F |
| G | H | I | J | (0064H) | check |
| |||||
External device side |
| (000CH) |
|
|
|
|
|
|
|
|
|
|
|
|
| code |
| ||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||
| L | H |
|
|
|
|
|
|
|
|
|
|
|
|
| L | H | L | H |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||
| 05H | 0CH | 00H | 41H | 42H | 43H | 44H | 45H | 46H | 47H | 48H | 49H | 4AH | 64H | 00H | 27H | 03H |
|
Q series C24
0CH + 00H + 41H + 42H + 43H + 44H + 45H + 46H +
47H + 48H + 49H + 4AH + 64H + 00H
|
|
|
|
|
|
| Added value = 0327H |
|
|
|
|
| ||||||
|
| b15 |
| (H) |
|
|
| b8 | b7 | (L) |
| b1 | b0 | |||||
|
|
| to |
|
|
| to |
| ||||||||||
Contents of 0327H memory |
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 |
| ||||||||||||||||||
|
|
|
|
| 03H |
|
|
|
|
|
|
| 27H |
|
|
|
(L) (H)
7 - 8 | 7 - 8 |