Jump to content

Checksum generation for serial data


Recommended Posts

Hello,

I have a character string to send to a device over a serial link.

the string is in the following format

$nnRDaaaabbbbzz

The nn is a number from 0 to 99

the aaaa is a number from 0000 to 0016

the bbbb is a number from 0000 to 0016

zz is the checksum in hex, and is generated from exclusive ORing each of the preceding bytes.

Any tips on how I generate this checksum ?

Cheers

Mat

Link to comment
Hello,

I have a character string to send to a device over a serial link.

the string is in the following format

$nnRDaaaabbbbzz

The nn is a number from 0 to 99

the aaaa is a number from 0000 to 0016

the bbbb is a number from 0000 to 0016

zz is the checksum in hex, and is generated from exclusive ORing each of the preceding bytes.

Any tips on how I generate this checksum ?

Cheers

Mat

Mat,

process the checksum in a for loop like in attached snippet.

Greetings

Manfred

post-831-1153377321.jpg?width=400

Download File:post-831-1153377427.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.