# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## checksum calculation

7e 09 68 00 00 00 00 00 77 88
7e 09 69 00 00 00 00 00 78 88
7e 09 02 00 00 00 00 00 11 88
7e 09 10 00 00 00 00 00 1f 88
7e 09 01 00 00 00 00 00 10 88

68 00  --  command type

00 00 00 00  --  data

77 (blue text)  --  checksum (sum of the 8 bytes before it)

88  --  end

These are some data packet send to an instrument  via a COM port.

I've tried some methods but can't get the right checksum in the example. Please give me a hand!

Thanks~

Message 1 of 5
(1,177 Views)
Highlighted

## Re: checksum calculation

Hi Wanglm,

Regards,

SrikrishnaNF

Regards,
Srikrishna

Message 2 of 5
(1,175 Views)
Highlighted
Solution
Accepted by topic author wanglm

## Re: checksum calculation

Srikrishna,

I don't think your message is what the original poster is looking for.  All you are doing is extracting the checksum from the string of messages, which is actually pretty trivial and can be done more easily than what you have posted.

I'd be willing to bet they are actually asking how to CALCULATE the checksum based on the previous bytes.

That can't be answered with the limited information since there are many different checksum calculation schemes out there.

WangIM, you need to read the communication manual for the instrument.  It should tell you how to calculate the checksum.

Though strangely enough, with the limited sample you provided, if you add up all the bytes except for the checksum, (i.e. the first 8 bytes, plus the final byte of x88) you get the same value as the checksum byte.  This is done if all the bytes are stored in a U8 array and the array elements are summed.

Message 3 of 5
(1,164 Views)
Highlighted

## Re: checksum calculation

Hi SrikrishnaNF:

Thanks!

I'm afraid I haven’t make it clear.

I want a command, but don't know how to calculate the checksum.

for example: 7e 09 01 00 ff 00 ff 00 ?? 88, I need to get the ?? first.  That's my problem.

Message 4 of 5
(1,160 Views)
Highlighted

## Re: checksum calculation

Thanks a lot!

I get a wrong message from the manufacturer, checksum should contain the final byte ox88.

Now the calculation is clear.

Message 5 of 5
(1,157 Views)