I\'m implementing a software where I read and write data in Modbus RTU protocolo via serial. For that, I need to calculate the two CRC byte at the end of the string of bytes
Here are my two cents. First thing you cant return two values to a function so
Proccess return value as follow
WORD n = CRC16(nData,wLength);
WORD x = (0xFF00&n)>>8,y=0x00FF&n;
printf("0x%04x\n", n); // to check original value
printf("0x%02x\t0x%02x\n",x,y); // to check separated values
Try this and let me know.