03-23-2013 10:52 PM
Hello,
I am writing some data to a LCD display via serial port through LabVIEW. This requires calculation of chksum. The method to calculate checksum is mentioned in the manual of Display as
"CHKSUM: Checksum byte; this byte is calculated by taking each byte and XOR’ing all bytes in the
message from (and including) the COMMAND byte to the last parameter byte. Then, the result is appended
to the end to yield the checksum byte."
A typical string such as 070F000007 should generate a checksum of 09.
Based on the method of calculation, I converted the string to a byte array and then XORed each bytes. I am not clear enough what it meant by result id appended to yield the checksum byte, but I found that sending 070F00000709 form the terminal writes correct data to the display, so I assume that XORing as above should yield the checksum. However, I dont get the correct result. I appreciate, if anyone could suggest how I can get it correct.
Many thanks in advance
Zach
Solved! Go to Solution.
03-24-2013 01:27 AM - edited 03-24-2013 01:28 AM
A couple of things are not clear.
Above you are talking about a string of 070F000007, but in the VI, the data is a string of 010F000007. However, you are using a plain string of these formatted characters (10 bytes) and I suspect that you should set the text constant to hex display (5 bytes). Once you do this, the checksum is 9 as expected.
03-24-2013 11:10 AM
Altenbach,
Sorry for confusion, the data should be 010F0000007 instead of "07..". Thank you very much for the solution! It works...