Hello I have connected SIM 900 (GSM Modem) with 89S52 Controller, via RS232 Communication. If I send AT from controller to Modem , it is replying with AT OK but my controller is just able to receive character “A”, (in below given cod if “A” is replace by “T” then it will not work)
I am using method in which , after a time period Interrupt will generate and it will check if data is received from RS232 . Please help me where m I wrong.
Code is given below :
//Interupt code void sEOS_ISR() interrupt INTERRUPT_Timer_2_Overflow { TF2 = 0; // Must manually reset the T2 flag if(i == 1) { check_connection(); //sending "AT" Command to Modem, send this command only 1 time time_stamp = 0; i = 0; //i is global variable ones it become 0 again it will not become 1 } rec_from_wire(); }
void rec_from_wire(void) {
if(RI == 1) { RI = 0; temp = SBUF; }
if(temp == 'A') { port_0_0 = 1; //LED 0 ON port_0_1 = 0; //LED 1 OFF
} else { port_0_0 = 0; //LED 0 OFF port_0_1 = 1; //LED 1 ON }
}
void check_connection(void) { send_on_wire('A'); send_on_wire('T'); send_on_wire(0x0D); send_on_wire(0X0A); }
Thank you very much for paying attention to my query,
as you suggested i changed Receiving data on UART Interrupt (interrupt 4) and now i am able to receive all the characters into buffer.
i will get back here for more doubts in future
thank you sanjyot