I'm rookie at arduino , and now I have some ADC problem .
Currently I have " one Arduino uno R3 " , " two series1 XBee (define one call XBee1 , one call XBee2)" and " one 3-axis accelerometer " .
The " 3-axis accelerometer " connection to XBee1 use ADC mode , and XBee1 will sent data to XBee2 .
The XBee2 connection to Arduino , and the Arduino use USB transmission line connection to PC .
Two XBee setting are : (XBee1: DL=0x1234 , MY=0x5678 , D0=D1=D2=2 , IR=0x14 , IT=5) and (XBee2: DL=0x5678 , MY=0x1234 , P0=P1=2 , IU=1 , IA=0x5678or0xFFFF)
Finally use Arduino development software's " Serial Monitor " print result use "16hex" on the screen . For example : 7E 0 26 83 56 78 1C 0 5 E 0 1 55................
My question is described as attachment :
Sorry I have poor English and if someone doesn't understand in the article , welcome to respond .
Hope anyone can give some any suggestions . Let me solve this problem . Thanks a lot .
The 00 26 indicates the message is 38 bytes. It would be good to see more data.
7E Start Delimiter
0026 Length (38 bytes from here to checksum)
83 API Identifier: 16-bit A/D
5678 Source address.
1C RSSI (Received Signal Strength)
00 Option Byte
05 Sample Quantity
0E00 Channel indicators 0E00=0b0000111000000000 = A2, A1, A0
0155 Value 1 for channel A0
xxxx Value 1 for channel A1
xxxx Value 1 for channel A2
xxxx Value 2 for channel A0
xxxx Value 2 for channel A1
xxxx Value 2 for channel A2
xxxx Value 3 for channel A0
xxxx Value 3 for channel A1
xxxx Value 3 for channel A2
xxxx Value 4 for channel A0
xxxx Value 4 for channel A1
xxxx Value 4 for channel A2
xxxx Value 5 for channel A0
xxxx Value 5 for channel A1
xxxx Value 5 for channel A2
xx Checksum (not included in Length)
Perhaps you should show more data, at least three or four messages worth.
It looks like only the first message and half the second message arrive correctly. After that looks like all garbage, mostly 7E and ED bytes.
Yes, a correct message should be 42 bytes but you can't expect to receive every character correctly every time. If you take in 42 characters and then assume you have a correct message then if you ever miss a character or gain a character you will be out of sync forever. When you want to receive a message you should look for 0x7E followed by 0x00 and 0x26. If any of those three don't match you should look for the next 0x7E. If you get to the checksum and that doesn't match you should throw out that message and go back to looking for a 0x7E.
Is it possible that your program is corrupting the data? Either that or your hardware is flakey.