24
Computing the Checksum
The serial command sent to the ARIA A6600 is a packet. A packet is a sequence of instructions with an address
similar to the way a letter gets addressed. The address on the letter tells who is allowed to open the envelope and
view the contents. With A6600, this function is performed by a field called the 'HEADER'. The header is always
the same (like a street address) and is defined as the HEX codes 0x16 and 0x39 sent together. Once the A6600
sees this, it will 'wake up' and listen to what follows. What follows the header is a byte of data telling the unit
how many instructions are contained in the packet -envelope. Once the unit knows that, it will open the letter and
begin to read its contents. The letter’s contents are the codes for the commands you want carried out. Use the
Command Definition
page included in this instruction book to pick out the commands you want and their corre-
sponding codes. Make a list of all the codes and put them in the order you want them to be done. (The first com-
mand to be executed is the one following the length byte.) After the last instruction is a 'Checksum' field that the
A6600 uses to make sure it received the same instructions that you desired. Computing this code or value is the
subject of this note.
Checksum Calculation:
Begin by laying out the packet in a format similar to the example under the
ARIA Command Protocol
Definition
page in the instruction book. Make a little chart to keep track of everything.
Now count the number of commands you are sending. This number is the number that goes in the length byte.
You probably counted using the decimal system, but computers only think in a world of ON/OFF or what we call
1's and 0's. To translate your value to a number the computer prefers, use the
Decimal to Hexadecimal
Conversion Table
. Convert your count into a Hex number. Do this by finding the decimal value in the chart and
following it across to its HEX value. This is the number that goes into the length field of the packet.
Next, to find the checksum, convert all the
command codes
into decimal numbers (again using the conversion
chart-but in reverse). Total the value of all these numbers as if they were deposits to your bank account. To this
sum subtract 1.
Now, take this total (of the values of all the command codes minus one), and convert it into a
Hex
number using
the conversion chart. This number is what goes into the Checksum field. Sounds tough but here is an example:
Using the packet illustrated under
Aria Command Protocol Definition
--
We see that we are sending a total of 3 commands, so 3 is the number that goes in the length field. Using the
chart we see that decimal 3 is the same as Hex 3. So 3 goes in the length field. (Hex notation uses 0x in front of
the value to indicate that were talking in HEX. The digit 0 precedes any single digit as a matter of style. Thus the
hex number for 3 becomes 0x03)
Now, converting the command codes to decimal values, -again using the chart-, we have:
0x20 = 32
0x4B =75
0x3A = 58
Adding the decimal values together yields: 32 + 75 + 58 = 165. This is the total for the
commands
.
Now we subtract 1 from the value yielding 164. We convert 164 to Hex and obtain A4.
Therefore, we place 0xA4 in the checksum field and we are ready to transmit the packet.
Содержание Aria A6600
Страница 35: ...INSTALLER S NOTES 33...