computing a simple checksum


Recommended Posts

I am trying to communicate with an electronic load. The protocol is very simple and requires a 26-byte set. The 26th byte is a checksum that adds the previous 25 bytes, but only keeps the two least sig figs. For example, if the sum of the 25 bytes is 0x3af, the checksum would be 0xaf.

I am having trouble efficiently computing this sum. Right now I just have the 26 bytes as 26 different local variables. I then have the following line of code:

Byte26 = Sum({Byte01, Byte02, Byte03, Byte04, Byte05, Byte06, ... Byte23, Byte24, Byte26})

Byte26 = Byte26 & 0xFF //I do this to get the byte back down to 8 bits

It is throwing a C1072 error for the first line. I looked this error up and it says I am missing a bracket.

Am I going about this incorrectly? Thanks for your help...

Marshall

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.