101501-695 REV B
6
475 Wireless Boulevard • Hauppauge, New York 11788, USA • www.spellmanhv.com • T:+1 631.630.3000 • F:+1 631.435.1620
4.3 CHECKSUMS
The checksum is used for RS-232 communication only and is computed
as follows:
•
Add the <CMD>, <;>, and <ARG> bytes excluding the <STX>
byte into a 16 bit (or larger) word. The bytes are added as
unsigned integers.
•
Take the 2’s compliment (negate it) and add the value of 1 to the
resulting value.
•
Truncate the result down to the eight least significant bits.
•
Clear the most significant bit (bit 7) of the resultant byte, (bitwise
AND with 0x7F).
•
Set the next most significant bit (bit 6) of the resultant byte (bitwise
OR with 0x40).
Using this method, the checksum is always a number between 0x40 and
0x7F. The checksum can never be confused with the <STX> or <ETX>
control characters, since these have non-overlapping ASCII values.
If the DSP detects a checksum error, the received message is ignored
–
no acknowledge or data is sent back to the host. A timeout will act as an
implied NACK.
CheckSum Calulate Example for VREF command:
VREF<SP>1000; = 0x24F
total sum in Hex
.
= 0x31
(0x100
– total sum) AND with 0x7F.
= 0x71
OR with 0x40.
CheckSum = 0x71.