A
Abby
I have an array which contain Hex no. in each position.
For examples,
unsigned char data[5];
data[0] = 0x00;
data[1] = 0x01;
data[2] = 0x02;
data[3] = 0xE;
data[4] = 0xEF; --> This is the checksum value
checksum value at data[4] is the checksum calculated from data[0] -
data[3]. I would like to know what is the algorithm to do the 2's
complement for 8 bits checksum, and how can I write the code for it.
I'm still a newbie. Please advise. Thank you.
For examples,
unsigned char data[5];
data[0] = 0x00;
data[1] = 0x01;
data[2] = 0x02;
data[3] = 0xE;
data[4] = 0xEF; --> This is the checksum value
checksum value at data[4] is the checksum calculated from data[0] -
data[3]. I would like to know what is the algorithm to do the 2's
complement for 8 bits checksum, and how can I write the code for it.
I'm still a newbie. Please advise. Thank you.