The pseudo code for calculation of the CRC-16 is given below.
Preset byte count for data to be sent.
Initialize the 16-bit remainder (CRC) register to all ones.
XOR the first 8-bit data byte with the high order byte of the 16-bit CRC register. The
result is the current CRC.
INIT SHIFT:
Initialize the shift counter to 0.
SHIFT:
Shift the current CRC register 1 bit to the right.
Increment shift count.
Is the bit shifted out to the right (flag) a 1 or a 0?
If it is a 1, XOR the generating polynomial with the current CRC.
If it is a 0, continue.
Is shift counter equal to 8?
If NO, return to SHIFT.
If YES, increment byte count.
Is byte count greater than the data length?
If NO, XOR the next 8-bit data byte with the current CRC and go to INIT SHIFT.
If YES, add current CRC to end of data message for transmission and exit.
When the message is transmitted, the receiver performs the same CRC operation on all the data bits
and the transmitted CRC. If the information is received correctly the resulting remainder (receiver
CRC) is 0.
Sample CRC-16 Calculation
The RTU device transmits the rightmost byte (of registers or discrete data) first. The first bit of the
CRC-16 transmitted is the MSB. Therefore, in the example the MSB of the CRC polynomial is to the
extreme right. The X16 term is dropped because it affects only the quotient (which is discarded) and
not the remainder (the CRC characters). The generating polynomial is therefore 1010 0000 0000
- The remainder is initialized to all 1s.
Query:
▪ An address of 0 is not allowed because this cannot be a broadcast request.
▪ The function code is 01.
▪ The starting point number is two bytes in length and may be any value less than the highest
output point number available in the attached CPU. The starting point number is equal to one
less than the number of the first output point returned in the normal response to this request.
▪ The number of points value is two bytes in length. It specifies the number of output points
returned in the normal response. The sum of the starting point value and the number of points
value must be less than or equal to the highest output point number available in the attached
CPU. The high order byte of the Starting Point Number and Number of Points fields is sent as the
first byte. The low order byte is the second byte in each of these fields.
Response:
▪ The byte count is a binary number from 1 to 256 (0 = 256). It is the number of bytes in the normal
response following the byte count and preceding the error check.
▪ The Data field of the normal response is packed output status data. Each byte contains eight
output point values. The least significant bit (LSB) of the first byte contains the value of the output
point whose number is equal to the starting point number plus one. The values of the output
points are ordered by number starting with the LSB of the first byte of the Data field and ending
with the most significant bit (MSB) of the last byte of the Data field. If the number of points is not a
multiple of 8, the last data byte contains zeroes in one to seven of its highest order bits.
The prices of all products of Zhangzhou Fengyun may fluctuate at any time. The specific price is subject to the customer service quotation. Please confirm the model, product, price and other details with the customer service before placing the order. Second-hand and brand-new products are sold in the store. Please contact the customer service for details.
Recommended GE related models:
GE UR-1HH |
GE UR-3CH |
GE UR-3PH |
GE UR-4CH |
GE UR-4DH |
GE UR-4LH |
GE UR-5CH |
GE UR-67H |
GE UR6AH |
GE UR-6AV |
GE UR6CH |
GE UR-6CH |
GE UR6DH |
GE UR-6DH |
GE UR6EH |
GE UR-6EH |
GE UR-6FH |
GE UR-6GH |
GE UR-6HH |
GE UR-6LH |
GE UR-6NH |
GE UR-6PH |
GE UR-6RH |
GE UR-6TH |
GE UR6UH |
GE UR-6UH |
GE UR-7DH |
GE UR-7GH |
GE UR-7HH |
GE UR-7IH |
GE UR-7KH |
GE UR-7QH |
GE UR-7SH |
GE UR-81H |
GE UR8AH |
GE UR-8AH |
GE UR8CH |
GE UR-8CH |
GE UR8FH |
GE UR-8FH |
GE UR-8FV |
There are no reviews yet.