I get 9 bytes for the serial where the last two are the CRC-16, I need to check this CRC to see 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 difficulty moving bits dealing with values in hex (beginner thing rsrsr)
The algorithm for this is to make an XOR of the first 16 bits with 0x8005 (in the case of a CRC-16)?
Does include include crc16.h?