News:

  • August 28, 2026, 09:27:50 PM

Login with username, password and session length

Author Topic: Help with a Checksum  (Read 11634 times)

plcnut

  • Hero Member
  • *****
  • Posts: 815
    • premiersi.com
Help with a Checksum
« on: March 19, 2013, 11:00:38 AM »
I have to calculate a checksum for some data that I will be transmitting. The communication manual says:

"Checksum
This represents an "OR exsclusive" of all preceding bytes (identification, length and data bytes)"

I was hoping to use the CHECKSUM command, but didn't find a function that will produce this result. Can I use MATH in a FOR/NEXT loop to cycle through each of the Bytes of data with an "^" to XOR each Byte with the next?
Any advice is appreciated.
« Last Edit: March 19, 2013, 11:30:27 AM by plcnut »
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
https://premiersi.com

plcnut

  • Hero Member
  • *****
  • Posts: 815
    • premiersi.com
Re: Help with a Checksum
« Reply #1 on: March 19, 2013, 11:58:44 AM »
Here is what I have come up with so far, but surely there is a better way.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
https://premiersi.com

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: Help with a Checksum
« Reply #2 on: March 19, 2013, 02:44:15 PM »
Looks good!  I would definitely look for a valid example from their manual to make sure it's correct.

It's really not a checkSUM, but a byte-wide odd-parity value for all 8 bit positions across all the bytes.   ;D