INFICON Guardian EIES Controller User Manual
Page 148
![background image](/manuals/562525/148/background.png)
7 - 10
IP
N 07
4-
51
7-
P1
D
Guardian Co-Deposition Controller Operating Manual
The CRC is computed using the following algorithm:
·
The CRC is initialized to 3FFF hex.
·
Each character in the message is examined, bit by bit, and added to the
CRC in the following manner:
·
The character is exclusive OR'd with the CRC.
·
The CRC is shifted right one bit position.
·
If a character's least significant bit is a 0 then the CRC is exclusive OR'd
with 2001h.
·
Steps b and c are repeated for each of the 8 bits in the character.
The CRC contains 14 significant bits. This is split into two characters of 7 bits
each, and then a decimal 34 is added to offset the character outside the range of
the Sync Character.
All messages are terminated with a LF character (0x0a).
The following is notional software (in java form) which describes the generation
and decoding of Guardian messages
public class SigmaAPI_Guardian
{
public static boolean useCheckSum = true;
private static short calcCRC (byte[] str) {
short crc = 0;
short tmpCRC;
int length = str[1] - 34;
if (length > 0) {
crc = (short) 0x3fff;
for (int jx = 1; jx <= length; jx++) {
crc = (short) (crc ^ (short) str[jx]);
for (int ix = 0; ix < 8; ix++) {
tmpCRC = crc;
crc = (short) (crc >> 1);
if ((tmpCRC & 0x1) == 1) {
crc = (short) (crc ^ 0x2001);
}
}
crc = (short) (crc & 0x3fff);
}
}
// 14 bit CRC of contents of str
return crc;
}