Delta Electronics DVP15MC11T Operation Manual page 539

Table of Contents

Advertisement

DVP15MC11T Operation Manual
A
CRC check (check sum)
CRC check starts from "Communication address" to the last "Data content". The calculation
method is shown below.
Step 1: Download a 16-bit hex register (CRC register) with the content value FFFF.
Step 2: Make the XOR operation between the 8-bit data of the first byte in the command and
the 8-bit data of the low byte in CRC register and then store the operation result in CRC
register.
Step 3: Move the content value of CRC register by one bit towards the right and fill 0 in the
highest bit.
Step 4: Check the value of the lowest bit in CRC register. If the value is 0, repeat the action of
step 3; if 1, make XOR operation between the content in CRC register and hex. A001 and then
store the result in CRC register.
Step 5: Repeat step 3 and step 4 till the content in CRC register is moved by 8 bits towards the
right. At this moment, the processing of the first byte of the command message is finished.
Step 6: Repeat the action of step 2 to step 5 for the next byte in the command message till the
processing of all bytes is finished. The last content in CRC register is CRC check value. When
CRC check value in command message is transmitted, the high and low bytes in calculated
CRC check value must exchange with each other, i.e. the low byte is transmitted first.
Example on calculation of CRC check value with C language
If (reg_crc & 0x01) reg_crc=(reg_crc>>1) ^ 0Xa001; /* LSB(b0)=1 */
A-6
Response message:
Field name
Start
Communication address
Function code
Read data number(Counted by bytes)
Read high byte of data content
Read low byte of data content
Read high byte of data content
Read low byte of data content
Low byte of CRC check sum
High byte of CRC check sum
End
 // Pointer of command message content
unsigned char* data
unsigned char length  // Length of command message content
unsigned int crc_chk(unsigned char* data, unsigned char length)
{
int j;
unsigned int reg_crc=0Xffff;
while(length--)
{
reg_crc ^= *data++;
for (j=0;j<8;j++)
{
else reg_crc=reg_crc >>1;
Character
No input data for more than 10ms
01
03
04
00
01
00
02
2A
32
No input data for more than 10ms

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents