unsigned char newStr[5][12] =
{
{0x01, 0x21, ‘T’, ‘E’, ‘S’, ‘T’, ‘ ‘, ‘T’, ‘A’, ‘G’, ‘ ‘, ‘1’},
{0x01, 0x01, ‘T’, ‘E’, ‘S’, ‘T’, ‘ ‘, ‘T’, ‘A’, ‘G’, ‘ ‘, ‘1’},
{0x01, 0x23, ‘T’, ‘E’, ‘S’, ‘T’, ‘ ‘, ‘T’, ‘A’, ‘G’, ‘ ‘, ‘1’},
{0x01, 0x24, ‘R’, ‘I’, ‘C’, ‘H’, ‘A’, ‘R’, ‘D’, ‘ ‘, ‘0’, ‘2’},
{0x01, 0x22, ‘R’, ‘I’, ‘C’, ‘H’, ‘A’, ‘R’, ‘D’, ‘ ‘, ‘0’, ‘2’}
};
unsigned char newCrc = 0x00;
for (j = 0; j < 5; j++)
{
for (i = 0; i < sizeof(newStr[j]); i++)
{
newCrc = generateCrc(newStr[j][i], newCrc);
printf(“0x%02X (%c)\n”, newStr[j][i], newStr[j][i]);
}
printf(“crc: 0x%02X (%c)\n”, newCrc, newCrc);
printf(“\n”);
newCrc = 0x00;
}
}
;Computed CRCs for the previous examples
;
string 1 CRC = 0xAC
;
string 2 CRC = 0xC1
;
string 3 CRC = 0x70
;
string 4 CRC = 0x34
;
string 5 CRC = 0xD5
Appendix E Cyclic Redundancy Check
TransCore Proprietary
E–85