Other examples – Grass Valley XSwitch Feb 08 2006 User Manual
Page 39

XSWITCH Installation and Operation Manual
39
Calculating the CRC
value: 04
SRC: 254 decimal value --> convert to ASCII character of
value: 254
LEN: 03 decimal value --> convert to ASCII character of
value: 03
Input string for CRC program:
Chr$(4)+Chr$(254)+Chr$(3)+ “2,L”
Returned hexadecimal CRC value returned from basic
program under Visual Basic: “FFFFFA92”
LSB needed from CRC is 92
MSB needed from CRC is FA
Using the standard protocol
Where the CRCL is the LSB needed from CRC and the CRCH is the MSB
needed from CRC, the entire packet is now in the form (using values from
previous example):
packet string = Chr$(4)+Chr$(254)+Chr$(3)+
“2,L”+Chr$(&HFA)
Note
LSB and MSB of CRC are hexadecimal values. Remember to change back to
decimal form to use Chr$ or use hexadecimal notation.
Basic eliminates leading zeros. Therefore if CRC returns only 3 characters,
the last two are LSB and the first character from CRC is MSB.
i.e.: CRC= “3FE”, LSB=FE MSB=3
i.e.: CRC= “2E”, LSB=2E MSB=0
OTHER EXAMPLES
Known: For the remaining examples, DEST=4, SRC=254.
1.
command string = “4”
LEN = 1
input string for CRC = Chr$(4)+Chr$(254)+Chr$(LEN)+com-
mand string
CRC program returns:
complete CRC string = “FFFF80BC”
LSB needed from CRC = “BC”
MSB needed from CRC = “80”
packet string = Chr$(4)+Chr$(254)+Chr$(LEN)+command
string+Chr$(&HLSB)+Chr$(&HMSB)
DEST
SRC
LEN
C/C
DATA1
...
DATAn
CRCL
CRCH