vinmenn/Crc16

A problem about modubus crc

jayking0912 opened this issue · 2 comments

byte data[9]={0x01,0x04,0x04,0x00,0xFB,0x00,0x00,0x8A,0x75};
unsigned short value = crc.Modbus((data),0,7);

I get value is 0x84FB, not corrct 0x758A

I test another data,get the same wrong value
//value =0x84FB corrct 0xB52B
{0x01,0x04,0x04,0x00,0xF9,0x00,0x00,0x2B,0xB5}

I don't know what is wrong and how to fix it.
I'd appreciate it if you could help me

byte data[9]={0x01,0x04,0x04,0x00,0xFB,0x00,0x00,0x8A,0x75};
unsigned short value = crc.Modbus((data),0,7);

I get value is 0x84FB, not corrct 0x758A

I test another data,get the same wrong value
//value =0x84FB corrct 0xB52B
{0x01,0x04,0x04,0x00,0xF9,0x00,0x00,0x2B,0xB5}

I don't know what is wrong and how to fix it.
I'd appreciate it if you could help me

i know why.
i use uint8_t data[9]={0x01,0x04,0x04,0x00,0xFB,0x00,0x00,0x8A,0x75};`
it'ok

Good, you solved before i even started to check !
Btw i noted that you checked crc on 7 bytes, and array was 9 bytes