Checksum and USO

Open a thread for a question about the simulator control software.
If you cannot receive any data in the input setup use the upper two forums!

Checksum and USO

Postby Wanegain » Mon 6. Jan 2014, 23:43

Hi all,

I am writing a code for an Arduino Uno wich will drive 4 motors (maybe 6 later) using 2 sabertooth in serial mode.

I would like understand what I need to write in my "Datapacket with axis informations" shield :
- I chose 8 bit resolution and dezimal output.
- I named my axis with A, B, C and D

If I want a checksum only for data from axis (I don't need to verify the A, B, C and D characters because I check them in my code to get the data), is this correct : A~a01~c01~B~a02~c01~C~a03~c01~D~a04~c01~ ??

Currently I didn't test it because I didn't finish my code. But please tell me if something wrong !

Thank you !
User avatar
Wanegain
 
Posts: 55
Images: 1
Joined: Mon 19. Nov 2012, 17:55
Has thanked: 1 time
Been thanked: 0 time

Re: Checksum and USO

Postby sirnoname » Tue 7. Jan 2014, 02:12

xor of all bytes
If a answer is correct or did help you for a solution, please use the solve button.
User avatar
sirnoname
Site Admin
 
Posts: 1829
Images: 45
Joined: Thu 1. Sep 2011, 22:02
Location: Munich, Germany
Has thanked: 35 times
Been thanked: 128 times

Re: Checksum and USO

Postby Wanegain » Tue 7. Jan 2014, 11:24

Thank you for your answer, but this is what I need to do in my code, isn't it ?

I want to know if A~a01~c01~ will make a XOR checksum of only a01 ?
And if I well understood, A~a01~c02~ will make a XOR checksum of A and a01, right ?

Just to be sure...
User avatar
Wanegain
 
Posts: 55
Images: 1
Joined: Mon 19. Nov 2012, 17:55
Has thanked: 1 time
Been thanked: 0 time

Re: Checksum and USO

Postby Wanegain » Tue 7. Jan 2014, 15:30

If I chose 16 bit resolution, do I need to add +1 to the ~c0x~ (e.g. A~a01~~c03~) ?

Do I have to put ~~ between a01 and c02 ?
User avatar
Wanegain
 
Posts: 55
Images: 1
Joined: Mon 19. Nov 2012, 17:55
Has thanked: 1 time
Been thanked: 0 time

Re: Checksum and USO

Postby sirnoname » Wed 8. Jan 2014, 02:04

good question, I think yes.
Use the free serial port monitor, it is good to sniff the datas while connected to a device.
If a answer is correct or did help you for a solution, please use the solve button.
User avatar
sirnoname
Site Admin
 
Posts: 1829
Images: 45
Joined: Thu 1. Sep 2011, 22:02
Location: Munich, Germany
Has thanked: 35 times
Been thanked: 128 times

Re: Checksum and USO

Postby Wanegain » Wed 8. Jan 2014, 15:41

This is really good idea !
Thanks again for your answer.

I will try it.
User avatar
Wanegain
 
Posts: 55
Images: 1
Joined: Mon 19. Nov 2012, 17:55
Has thanked: 1 time
Been thanked: 0 time


Return to Converter questions

Who is online

Users browsing this forum: No registered users and 1 guest