![ABB NMBA-01 Скачать руководство пользователя страница 58](http://html.mh-extra.com/html/abb/nmba-01/nmba-01_installation-and-startup-manual_2753058.webp)
Appendix B – Modbus Protocol
B-20
NMBA-01 Installation and Start-up Guide
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 (0001 0010 0100 0001):
Figure B-12 CRC Byte Sequence
Example
An example of a C language function performing CRC generation is
shown on the following pages. All of the possible CRC values are pre-
loaded into two arrays, which are simply indexed as the function incre-
ments 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 contains all of the values for the low byte. Indexing the CRC in
this way provides faster execution than would be achieved by calculat-
ing a new CRC value with each new character from the message
buffer.
The function takes two arguments:
XQVLJQHGFKDUSXFK0VJ
A pointer to the message buffer containing binary
data to be used for generating the CRC
XQVLJQHGVKRUWXV'DWD/HQ
The quantity of bytes in the message buffer.
The function returns the CRC as a type unsigned short.
Addr
Func
Data
Count
Data
Data
Data
Data
CRC
Lo
41
CRC
Hi
12
efesotomasyon.com - Control Techniques,emerson,saftronics -ac drive-servo motor