Hi All!
Firstly sorry for my bad English, I'm Hungarian.
I already spend 4days to solve my "porblem" without any luck
I would like to calc checksum of string array, or byte array, I do not how to start.
I have one example what I need, but I can't solve it,
What I get on serial port is
:7001000C80076 <- The last 2 character is the checksum (76)
( 0x3a, 0x37, 0x30, 0x30, 0x31, 0x30, 0x30, 0x30, 0x43, 0x38, 0x30, 0x30, 0x37, 0x36 )
Always start byte is "0x55" then start the string first character "7" see below:
So add the checksum first -> 0x55 (then->) – 0x7 – 0x0 – 0x10 – 0x0 – 0xC8 – 0x0 = 0x76 which is correct.
If I put this to array:
byte test[] = {0x3a, 0x37, 0x30, 0x30, 0x31, 0x30, 0x30, 0x30, 0x43, 0x38, 0x30, 0x30};
I left the last 2 bytes "0x37, 0x36" --which is 0x76-- then I wrote the code, but always computing the arrays byte to byte..
I think I need to computing 2bytes to 2 bytes, but not sure(?)
Thanks in advance who spend a little time to help me out!