30
<CC
n
>
Check Code
System
Description
Command terminator with 8-bit checksum
Parameters
The parameter is an 8 bit checksum of all the characters in the preceding command string.
To calculate the value of the parameter, sum the ASCII values of all the characters in the command
string up to but not including the <CC
n
> command. Divide this sum by 256 decimal (0x100 hex).
The checksum is the remainder after the division and is sent as a single byte.
Modes
Operational Mode 3 only
Notes
This command is the signal to verify the checksum of the preceding command string and, if correct,
action the commands.
If the checksum is not correct, no commands are actioned and an error response is returned.
The <CC
n
> command terminator is used in the most basic of the error checked modes, Operational
Mode 3. If higher data security is required consider using Operational Mode 4 which has two
parameters in the <CR
nn
> command terminator, representing a 16 bit CRC of the preceding
command string.
Uses
The <CC
n
> command allows:
•
Commands to be queued but not actioned until required
•
Basic message error checking
Example
Assume the text display is in operational mode 3.
In order to clear the screen, a <CS> command must be sent followed by the <CC
n
> command where
n represents the 8-bit sum of the characters “<”, “C”, “S”, “>”
ASCII values of the example command are:
“<”
=
60 decimal
(3C hex )
“C”
=
67 decimal
(43 hex)
“S”
=
83 decimal
(53 hex)
“>”
=
62 decimal
(3E hex)
In decimal notation:
The sum is 60+67+83+62 = 272 and the checksum is the remainder after division by 256.
Hence the checksum is remainder of the division 272/256 = 16
In hexadecimal notation:
The sum is 3C+43+53+3E =110 hex and the checksum is the Least Significant Byte (LSB)
of this sum.
Hence the checksum is 10 hex.
The checksum must be sent as a single byte 16 decimal (10 hex).
Hence the full command string is:
<CS><CC[16]>
Note! The square brackets are not sent, they are just there to
emphasise that a single byte 16 is sent. The checksum, as
in this case, may not be a printable ASCII character.
Gotchas!
The checksum is always a single byte, and may be an unprintable character.
See Also
CI
Command Implement
CR
Cyclic Redundancy Check