EasyManua.ls Logo

TransCore MPRX Series - Page 52

TransCore MPRX Series
138 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The MPRX accepts four ASCII < ` > characters (60 hex) as a wild card CRC value in lieu of a valid four-
character CRC value to facilitate testing and diagnostic checkout.
The MPRX implements the algorithm with a 512-byte lookup table to reduce the processing overhead
requirements.
To simplify the implementation of the CRC algorithm by host software developers, several examples of the
calculation are provided in C source code on the following pages. The calculation may be performed with
or without a lookup table, depending on the trade-o between code memory and processing overhead.
Example 1 presents an example of a function (CALCCRC) that calculates the CRC value through a call to a
separate function (UPDCRC).
unsigned short calccrc(char *message)
{
unsigned short crc = 0;
for ( ; *message != (char)0;message++) crc =
updcrc(*message & 0xff, crc);
return (crc)
}
Example 2 shows an example of UPDCRC that does not require a lookup table.
#dene BITS_PER_CHAR 8
unsigned short updcrc (unsigned short ch, unsigned short crc)
{
register short counter = BITS_PER_CHAR;
register short temp = crc;
while (--counter >= 0) if
(temp & 0x8000) {
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
temp ^= 0x1021;
}
else { temp
<<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
}
return(temp);
}
MPRX User Guide
TransCore Proprietary
4–52

Table of Contents

Related product manuals