I have a sample from 3rd party code which already calculated the checksum. They are using HDLC protocol, I want to figure out how they calculating checksum
Example:
How is msgOut[6] can be calculated automatic or manually
Note: deviceAdress change so it should not be important (I think )
msgOut[0] = 0x7E;
msgOut[1] = 0x06;
msgOut[2] = deviceAddr;
msgOut[3] = 0xBF;
msgOut[4] = 0x17;
msgOut[5] = cmdCode;
if(cmdCode == 0x00)
msgOut[6] = 0x7B;
else if(cmdCode == 0x04)
msgOut[6] = 0x67;
else if(cmdCode == 0x11)
msgOut[6] = 0x0C;
else if(cmdCode == 0x12)
msgOut[6] = 0x05;
msgOut[7] = 0x7E;
rs485WriteHex(msgOut);
cmdCode = 0;