EasyManua.ls Logo

degdrive DGI900 - Read Command Frame; Read Command Response Frame

degdrive DGI900
251 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
248
the following is to achieve CRC-16 C language source code, pay attention to the final result
has been exchanged high and low byte, that is, the result is to send the CRC checksum .
uint16 CrcValueByteCaA0(const uint16 *data, uint16 len)
{
uint16 CRCValue = 0xFFFF;
uint16 tmp;
uint16 a;
while (len--)
{
tmp = *(data++);
a = (CRCValue ^ tmp) & 0x000F;
CRCValue >>= 4;
CRCValue ^= crc16Table[a];
a = (CRCValue & 0x000F) ^ (tmp >> 4);
CRCValue >>= 4;
CRCValue ^= crc16Table[a];
} return crcValue;
}
Application examples
Read command frame: The request frame is to read two consecutive parameter values from
P0.02 function code of No.1 engine.
address Order code Register
address
Number of bytes of
operation
Checksum
0x01 0x03 0x00 0x02 0x00 0x02 To be calculated
Read command response frame:

Table of Contents