LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Checksum (Cumulative Sum) Calculation 16- bit

Dear All, 
I hope you all are doing well.

Basically, I want to implement a 16-bit checksum technique.

Data Received = 15 Bytes 
AA55 0102 0B21 1101 3E00 0000 0001 7E

01 7E is the Checksum

All data is in HEX format.

I want a cumulative sum from Byte 1 to Byte 13.
Checksum is 16-bit.

170674studentsauedupk_0-1723997967466.png

 

I am facing issue in LabVIEW as my end result is showing me 8-bit result where as I've chosen the format as U16.
File is attached for your reference.

Please guide I want the calculated checksum and received checksum to be same.

0 Kudos
Message 1 of 7
(936 Views)

Hello,

I have modified your code to check the checksum. Please try to use the snippet. 

 


Don't forget to mark as solution, if you feel that the code helped you complete the task.

Kudos are welcome. 

Atul G.

India

0 Kudos
Message 2 of 7
(915 Views)

Dear Atul,
Thanks for your kind response and the time you've given to modify the file. 
I have compatibility issues while opening the file. I am using LabVIEW 2017. Can you please share the compatible version?

Thanks!

0 Kudos
Message 3 of 7
(896 Views)
0 Kudos
Message 4 of 7
(890 Views)

Dear Atul,
Thanks for your time.
Unfortunately, it's the same as mine.

170674studentsauedupk_0-1724014268710.png

See the checksum shown here is just 7E
whereas the actual checksum is 01 7E.

01 is missing again.

It's just showing the LSB of the checksum i.e. 7E
MSB of checksum is missing i.e 01.

Please modify the below file.
Version: 2017

 

0 Kudos
Message 5 of 7
(877 Views)

This worked for me.  The real trick is to make sure you are adding U16 instead of U8.  When adding U8, you will get a rollover.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 6 of 7
(850 Views)

Looking at your data, I'm guessing that the "data" are 13 8-bit quantities, and the Checksum is a 16-bit sum of the preceding 8-bit values.  That turns out to work -- if you simply sum the first 13 quantities into a U16, you get 017E.

 

Bob Schor

0 Kudos
Message 7 of 7
(821 Views)