Vetrino checksum calculation
by
pfaerber
—
last modified
Jul 19, 2007 12:39 PM
I try to calculate the checksum of the Vectrion volocity data record.
But I find no way to calculate the right sum.
I try this
iChecksumme = 0xa596;
for (I=0;I<20;I++) iChecksumme = iChecksumme + (byte)cQuelldata[I];
iCheckTest = CHARTOWORD(&cQuelldata[20]);
if (iCheckTest == iChecksumme)
but I have never the right sum
Paul Färber
Sorry for my bad english
But I find no way to calculate the right sum.
I try this
iChecksumme = 0xa596;
for (I=0;I<20;I++) iChecksumme = iChecksumme + (byte)cQuelldata[I];
iCheckTest = CHARTOWORD(&cQuelldata[20]);
if (iCheckTest == iChecksumme)
but I have never the right sum
Paul Färber
Sorry for my bad english
Current state:
Being created
Hi Paul,
There seems to be a couple of problems in your code. I suggest that you take a look at this thread. It contains detailed examples on how to calculate the checksum for Nortek instruments. If you prefer to handle the data as a byte structure you should use the cChecksum() function.
Note that since there is no length field in the Vectrino data you must set the length value yourself. When the sync (0xA5) and identification byte (0x51) for Vectrino data is encountered you must use len = 22 in the example with unsigned char data.
Best regards,
Sven Nylund
There seems to be a couple of problems in your code. I suggest that you take a look at this thread. It contains detailed examples on how to calculate the checksum for Nortek instruments. If you prefer to handle the data as a byte structure you should use the cChecksum() function.
Note that since there is no length field in the Vectrino data you must set the length value yourself. When the sync (0xA5) and identification byte (0x51) for Vectrino data is encountered you must use len = 22 in the example with unsigned char data.
Best regards,
Sven Nylund
Current state:
Being created
Thanks for the hind Sven
I have the solution
My main error was not to use 16 Bit Data for the checksum (in the old ADV it was 8 bit). Then I forgot to cut things over 16 Bit better use short int .
And I use the wrong constant 0xb58c is right
The start constant I use was not right.
And yes you are right the data size is 22 (but without checksum 20)
Paul
I have the solution

My main error was not to use 16 Bit Data for the checksum (in the old ADV it was 8 bit). Then I forgot to cut things over 16 Bit better use short int .
And I use the wrong constant 0xb58c is right
The start constant I use was not right.
And yes you are right the data size is 22 (but without checksum 20)
Paul
Current state:
Being created
Powered by
Ploneboard

