1
I get 9 bytes per serial where the last two are CRC-16, I need to check this CRC to know if I received the block correctly.
buffer[0] = 0x2E;
buffer[1] = 0x83;
buffer[2] = 0x82;
buffer[3] = 0x00;
buffer[4] = 0x00;
buffer[5] = 0x00;
buffer[6] = 0x00;
buffer[7] = 0xA9; //CRC-16, LSB
buffer[8] = 0xEF; //CRC-16, MSB
I’m trying to do a function to check and return 0 or 1 but I’m having trouble moving the bits dealing with values in Hex (rsr beginner thing)
The algorithm for this is to go making a XOR of the first 16 bits with 0x8005 (in the case of a CRC-16) ?
Include crc16.h can do this?
A link that can help: https://barrgroup.com/Embedded-Systems/How-To/CRC-Calculation-C-Code
– Leonardo Alves Machado