118153-001 Rev. B
475 Wireless Boulevard • Hauppauge, New York 11788, USA • www.spellmanhv.com • T:+1 631.630.3000 • F:+1 631.435.1620
The following is sample code, written in C#, for the generation of checksums:
for
(
int
n
=
begin;
n
<
end;
n++)
{
checksum
+=
buf[n];
}
if
(
Config
.includeEndCharInChecksum)
{
checksum
+=
buf[end];
}
checksum
=
(((0x100
‐
checksum)
&
0x7F)
|
0x40);
Here
is an example of an actual Checksum calculation for command 10
(Program kV setpoint)
The original message with a placeholder for the checksum is
<STX>10,4095,<CSUM><ETX>
First, you add up all the characters starting with the ‘1’ in the command
number, to the comma before the checksum with their ASCII values (in
hexadecimal):
0x31 + 0x30 + 0x2C + 0x34 + 0x30 + 0x39 + 0x35 + 0x2C = 0x18B
Next, you then take the two’s complement of that number by negating it,
by subtracting it from 0x100 (decimal 256), and only retain the lowest 7
bits by bitwise AND the results with 0x7F.
NOTE: This combines the steps of getting the twos complement, truncating the
result to 8 bits and clearing the 8
th
bit.
(0x100 – 0x18B) & 0x7F = 0x75
Finally, bitwise OR the result with 0x40:
0x75 | 0x40 = 0x75
The checksum byte is 0x75 (Decimal 117, ASCII: u)
Содержание uX SERIES
Страница 11: ...uX MANUAL 4 118151 001 REV A Figure 2 1 50kV uX DIMENSIONS ...
Страница 12: ...uX MANUAL 5 118151 001 REV A Figure 2 2 65kVuX DIMENSIONS ...
Страница 16: ...uX MANUAL 9 118151 001 REV A Table 3 2 DC Input Filament Connections ...
Страница 17: ...uX MANUAL 10 118151 001 REV A Figure 3 3 Monitors Voltage Current Control Connections ...
Страница 18: ...uX MANUAL 11 118151 001 REV A Figure 3 4 Recommended Interlock HV on Configurations ...