7-
15
CRC Checking:
CRC check code is from Slave Address to end of the data. The calculation method is
illustrated as follow:
(1) Load a 16-bit register with FFFF hex (all1’s). Call this the CRC register.
(2) Exclusive OR the first 8-bit byte of the message with the low-order byte of the 16-bit
CRC register, putting the result in the CRC register.
(3) Shift the CRC register one bit to the right (toward the LSB), Zero-filling the MSB,
Extract and examines the LSB.
(4) (If the LSB was 0): Repeat Steps (3) (another shift) (If the LSB was 1):
Exclusive OR the CRC register with the polynomial value A001 hex (1010 0000
0000 0001).
(5) Repeat Steps (3) and (4) until 8 shifts been performed. When this is done, a complete
8-bit byte will be processed.
(6) Repeat Steps (2) through (5) for next 8-bit byte of the message, Continue doing this
until all bytes have been processed. The final content of the CRC register is the CRC value.
Placing the CRC into the message:
When the 16-bit CRC (2 8-bit bytes) is transmitted in the message, the low-order byte
will be transmitted first, followed by the high-order byte, For example, if the CRC value
is 1241 hex, the CRC-16 (Low) put the 41h, the CRC-16 (Hi) put the 12h.
Example :
An example of a C language function performing CRC generation is shown on the following
pages. All of the possible CRC values are preloaded into two arrays, which are simply indexed
as the function increments through the message buffer. One array contains all of the 256
possible CRC values for the high byte of the 16-bit CRC field, and the other array contains all
of the values for the low byte.
Indexing the CRC in this way provides faster execution than would be achieved by calculating a
new CRC value with each new character from the message buffer.
Note
This function performs the swapping of the high/low CRC bytes internally. The bytes are
already swapped in the CRC value that is returned from the function.
Therefore the CRC value returned from the function can be directly placed into the message for
transmission.
The function takes two arguments:
unsigned char *puchMsg ;
A pointer to the message buffer containing binary data
to be used for generating the CRC
unsigned short usDataLen ;
The quantity of bytes in the message buffer.
The function returns the CRC as a type unsigned short.
Содержание JSDAP Series
Страница 1: ......
Страница 17: ...1 11 1 2 Surface and Panel Board JSDAP 10A 15A 20A 30A JSDAP 50A3 75A3 100A3 25B 35B 50B ...
Страница 21: ...1 15 1 4 2 Direction and Distance ...
Страница 25: ...2 2 400V Class ...
Страница 98: ...5 12 PA PB PZ 90 PA PB PZ 90 TIME A leads B CW CCW B leads A TIME ...
Страница 236: ...9 5 Dimensions for JSDAP 150A3 75B 100B Dimensions for JSDAP 200A3 300A3 ...
Страница 249: ...A 1 Appendix A Accessories ...
Страница 250: ...A 2 ...
Страница 251: ...A 3 ...
Страница 255: ......