Decoding XBee Series 1 API Packet

arduinolilypadxbee

I'm having issues trying to decode a XBee API packet. I start decoding it, but I'm not sure what my actual analog data should be. Several of them look like:

7E 00 12 83 56 78 43 00 05 02 00 00 00 03 FF 03 FF 00 00 00 00 60 
7E 00 12 83 56 78 43 00 05 02 00 03 E8 03 FF 00 2A 00 00 01 C8 84 
7E 00 12 83 56 78 43 00 05 02 00 03 FF 02 DE 00 0D 00 00 03 FF 73 
7E 00 12 83 56 78 42 00 05 02 00 03 FF 00 00 00 00 03 DB 03 FF 83  

So far I have:

7E - start
00 - length byte 1
12 - length byte 2
83 - API identifier
56 - source address byte 1
78 - source address byte 2
43 - RSSI value bytes
00 - option byte
05 - sample quantity byte
02 00 - channel indicator 0000 0010 0000 0000  (A0 is active) (IO header) (I'm not sure if this is right)
last byte is chechsum

I'm using the XBee series 1 using XB24 firmware. I have a Lilypad temperature sensor based on the MCP9700.

The documentation for the XBee module is:
http://ftp1.digi.com/support/documentation/90000982_G.pdf

Every time I try to get the ADC data I get a huge number like 51228675.

The doc also says if any of the DIO lines are the first two bytes are the DIO sample. Why do I get "03 FF" or "E8 03" and sometimes "00 00" if I don't have any of the DIO lines active?

Schematic: Lilypad Temperature Sensor (pin S) –> Xbee (pin AD0)

Any help is greatly appreciated trying to find the sensor output.

Best Answer

You are doing something very wrong if you get a large number like 51228675 - the datasheet you linked to says that the ADC output is a 10 bit number right-justified inside of two byte (16 bits). That means that the maximum value should be 0000 0011 1111 1111b which is equivalent to 1,023 decimal. So if you get something that large you're including more bits than you should.

Which bytes do you think are the ADC data in your examples above?