118165-001 REV. A
475 Wireless Boulevard • Hauppauge, New York 11788, USA • www.spellmanhv.com • T:+1 631.630.3000 • F:+1 631.435.1620
5
1.
Serial Communications Interface
Serial communications will use the following protocol:
<STX><CMD><,>ARG><,><CSUM><ETX>
Where:
<STX> = 1 ASCII 0x02 Start of Text character
<CMD> = 2 ASCII characters representing the command ID
<,> = 1 ASCII 0x2C character
<ARG> = Command Argument
<,> = 1 ASCII 0x2C character
<CSUM> = Checksum (see section 1.2 for details)
<ETX> = 1 ASCII 0x03 End of Text character
The serial interface has the following attributes:
•
19.2K baud (Default baud rate, can be changed to 115K baud for
reprogramming of the firmware)
•
No Parity
•
8 Data Bits
•
1 Stop Bit
•
No Hand shaking
1.1
Command Arguments
The format of the numbers for command arguments is a variable length
string. To represent the number 42, the string ‘42’, ‘042’, or ‘0042’ can be
used. This being the case, commands and responses that carry data are
variable in length.
1.2
Check
Sums
The checksum is computed as follows:
• Add the <CMD>, <,>, and <ARG> bytes into a 16 bit (or larger) word.
The bytes are added as unsigned integers.
• Take the 2’s compliment (negate it).
• 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 and the supply
will respond with and error code of 1 (see section 3.4).