MPRX
TransCore Proprietary
6–13
unsigned short calccrc(char *message)
{
unsigned short crc = 0;
for ( ; *message != (char)0;+) crc =
updcrc(*message & 0xff, crc);
return (crc)
}
Example 2 shows an example of UPDCRC that does not require a lookup table.
#define 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);
}
Example 3 contains an example of UPDCRC that does require a lookup table.
#define updcrc(cp, crc)( crctab[((crc >> 8) & 255)]^ (crc << 8) ^ cp static
unsigned short crctab [256] = {
0x0000,
0x1021, 0x2042, 0x3063, 0x4048, 0x50a5,
0x60c6,
0x70e7,
0x8108,
0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad,
0xe1ce,
0xf1ef,
0x1231,
0x0210, 0x3273, 0x2252, 0x52b5, 0x4294,
0x72f7,
0x62d6,
0x9339,
0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c,
0xf3ff,
0xe3de,
0x2462,
0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7,
0x44a4,
0x5485,
0xa56a,
0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf,
0xc5ac,
0xd58d,
0x3653,
0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6,
0x5695,
0x46b4,
0xb75b,
0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe,
0xd79d,
0xc7bc,
0x48c4,
0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861,
0x2802,
0x3823,
0xc9cc,
0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969,
0xa90a,
0xb92b,
0x5af5,
0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50,
0x3a33,
0x2a12,
0xdbfd,
0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58,
0xbb3b,
0xab1a,
0x6ca6,
0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03,
0x0c60,
0x1c41,
Summary of Contents for MPRX
Page 19: ...Chapter 1 Introduction...
Page 23: ...MPRX TransCore Proprietary 1 5...
Page 24: ...Chapter 2 Developing the Site Plan...
Page 37: ...Choosing Installing and Removing Tags Chapter 3...
Page 48: ...Installing the MPRX Chapter 4...
Page 64: ...MPRX TransCore Proprietary 4 17...
Page 65: ...General Software Information 5...
Page 70: ...System Guide TransCore Proprietary 5 6...
Page 71: ...Communication Protocols Chapter 6...
Page 87: ...MPRX TransCore Proprietary 6 17...
Page 88: ...Chapter 7 Commands...
Page 127: ...Chapter 8 Configuring the MPRX...
Page 146: ...Chapter 9 Troubleshooting and Maintenance...
Page 152: ...System Guide TransCore Proprietary 9 6...
Page 153: ...Chapter 10 Interface to Train Recording Unit...
Page 158: ...Chapter 11 Check Tag to MPRX Assembly...
Page 164: ...MPRX TransCore Proprietary 11 7...
Page 165: ...Appendix A Glossary...
Page 171: ...MPRX TransCore Proprietary A 7...
Page 172: ...Technical Specifications Appendix B...
Page 175: ...Wiring Diagram C...
Page 179: ...Command Quick Reference Appendix D...
Page 203: ...MPRX TransCore Proprietary D 25...
Page 204: ...Compatible Tag Information E...
Page 208: ...MPRX TransCore Proprietary E 5...