LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2 digit checksum

Solved!
Go to solution

I have a LED wall paper that i want send values too,i do not have the protocol but monitored the serial communication;

 

<ID01><L1><PA><FE><MA><WC><FE><AD>Test65<E> 

 

65 is some kind of checksum digits,can anyone tell me how to calculate this?

 

another example where 36 is the checksum

<ID01><L1><PA><FE><MA><WC><FE>Hello36<E>

 

Thanks in advance

Philip

0 Kudos
Message 1 of 8
(4,358 Views)
Not without knowing the protocol its running. There are literally dozens of ways to calculate a 8-bit checksum.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(4,356 Views)

Are you sure about the first one?

0 Kudos
Message 3 of 8
(4,346 Views)

Is this some specially formatted binary code or are these the actual strings?

Can you show us the same strings in hex format?

If these are really two digits (65 or 36) you have a 16bit checksum. It could also be a decimally formatted 1byte checksum.

Message 4 of 8
(4,342 Views)
Solution
Accepted by topic author Philip1969

OK, check the answers here.

Message 5 of 8
(4,335 Views)

OK, from the link above, we need to strip the <ID01> and keep only the string up to the checksum.

THe checksum is a byte as a hexadecimal formatted string (, two characters: 00 ..FF)

 

I agree with Darin, the first one seems wrong and should be 0x45.

 

If the string is actually lowercase "test" instead of "Test", we get a 65, so check your capitalization.

 

<ID01><L1><PA><FE><MA><WC><FE><AD>test65<E> would be correct

<ID01><L1><PA><FE><MA><WC><FE><AD>Test45<E> would also be correct

<ID01><L1><PA><FE><MA><WC><FE><AD>Test65<E> would be incorrect <---- your example!

 

Here is some simple code that gives the correct result for your second string as well as for the string on the web site. See if it works for you.

 

 

 

The outer FOR loop iterates over the string choices, so you don't need that.

You still need to add code to strip out the correct substring according to the requirements (not shown).

Message 6 of 8
(4,331 Views)

Thanks got it working

0 Kudos
Message 7 of 8
(4,301 Views)

You know, that <ID01> at the beginning of the string always reminded me of the popular ID10T errors. 😄

0 Kudos
Message 8 of 8
(4,285 Views)