using analog pins on xbee

Hello friends,
We are using 2 analog pins of X-bee for reading the sensor. This data is being transmitted from end device xbee to coordinator xbee.
A 24 byte packet data is being transmitted. We require 4 data bytes numbered 20,21,22,23. This is the code we have used in order to accomplish this.
The problem we are facing is that we receive the first two bytes correctly i.e 20,21 but the next two bytes are not read correctly.
Please suggest changes in the code for it to work correctly.


float temp1; float temp2;
void setup()

void loop()
if(Serial.available() >= 21)
if( 0x7E)
for(int i=1;i<19;i++)
int msb1 =;
int lsb1 =;
int msb2 =;
int lsb2 =;
int analog1= lsb1+(msb1256);
temp1 = analog1/ 1023.0 * 1.23;
int analog2= lsb2+(msb2
temp2 = analog2/ 1023.0 * 1.23;
Serial.print(" ");


i think code is ok problem is in your sensor output. do you see the incoming packets in xctu?