Xbee series 2 trying to communicate in API mode

i am still trying to get this xbee module to work in API mode but with no success so far. So, instead of trying to make the both radios work at the same time i am just using coordinator for now. I will explain the configuration.

It is a series 2 xbee module. I have configured it to be coordinator API in X-CTU. The code is simple. Forgive my code, i know its ugly. I am writing hastily just to check communication.

What i am trying to do is first make a trasmit request then after some delay i am reading the bytes expecting it to be the zigbee transmit status packet. The book says that after making the transmit request a status packet is received that gives information about the status of the transmit. For now i am just reading few bytes from the buffer and compare it to make sure i am getting the status packet back. Any help is appreciated! Thank you!


#include  

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 


int BUTTON1 = 7; 


void setup(){ 

//this is a button that i have in the circuit. Upon pressing it, i send a transmit request. 
pinMode(BUTTON1, INPUT); 


//i have hooked a lcd module for debug purpose 
lcd.begin(16, 2); 
      

Serial.begin(9600); 
  
} 





void sendData(){ 
  
  
  //start 
  Serial.write(0x7E); 
  
  //length 
  Serial.write(0x00); 
  Serial.write(0x16); 
  
  
  //frame type   0x10 = tx request 
  Serial.write(0x10); 
  
  //frame id 
  Serial.write(0x01); 
  

  //64 bit destination address 
  Serial.write(0x00); 
  Serial.write(0x13); 
  Serial.write(0xA2); 
  Serial.write(0x00); 
  Serial.write(0x40); 
  Serial.write(0x8C); 
  Serial.write(0xC6); 
  Serial.write(0xD4); 
  
//16 bit destination address  
  Serial.write(0x20); 
  Serial.write(0x01); 
  
  //broadcast radius - if 0 then maximum no of hops..default 
  Serial.write(0x00); 
  
  //default 
  Serial.write(0x00); 
  
  //data 
  Serial.write(0x54); 
  Serial.write(0x78); 
  Serial.write(0x44); 
  Serial.write(0x61); 
  Serial.write(0x74); 
  Serial.write(0x61); 
  Serial.write(0x30); 
  Serial.write(0x41); 
  
  
  //checksum 
  unsigned char sum = 0x10 + 0x01 + 0x13 + 0xA2 + 0x40 + 0x8C + 0xC6 + 0xD4 + 0x20 + 0x01 + 0x54 + 0x78 + 0x44 + 0x61 + 0x74 + 0x61 + 0x30 + 0x41; 
  
  
  Serial.write(0xFF - (sum&0xFF)); 
    
  
  delay(1000); 
  
  
  
} 











void loop(){ 
  
    
if (digitalRead(BUTTON1) == HIGH){ 
  
 sendData(); 
  
} 



if (Serial.available() > 0){ 
  
    
   for(int i=0;i<5;i++){ 
    
   lcd.print(Serial.read()); 
    
    lcd.print(" "); 
    
   } 
  
  
} 

} 

i get nothing in the lcd display. When i press the button. The tx led lights up but there is no content in lcd. One weird thing is when i take out zigbee and hook it back then it shows results…i.e few bytes.