Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem in receiving sms from gsm to microcontroller

Status
Not open for further replies.

desalegn

Newbie level 2
Joined
Mar 19, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
i write my code in c to read sms from gsm modem using proteus simulation.but i got the following on one of the virtual terminals and nothing on the other.
AT
AT+CMGF=1
AT+CMGR=1
but the response from the modem expected to be displayed on the 2nd virtual terminal.the code is as folows

void sms_read();
void sms_send();
char output[70];
void main() {
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(2000); // Wait for UART module to stabilize
sms_read();
}
void sms_read()
{
UART1_Write_Text("AT\n\r");
delay_ms(500);
UART1_Write_Text("AT+CMGF=1\n\r");
delay_ms(500);
UART1_Write_Text("AT+CMGR=1\n\r");
delay_ms(500);
while (1) {
if (UART1_Data_Ready() == 1) { // if data is received
UART1_Read_Text(output, "OK",90); // reads text until 'OK' is found
// sends back tex
sms_send();
}
}
}

void sms_send()
{
int i;
UART1_Write_Text("AT+CMGS=");
UART1_Write(0x22);
UART1_Write_Text("0912811798");
UART1_Write(0x22);
UART1_Write_Text("\n\r");
delay_ms(500);
UART1_Write_Text(output);
UART1_Write(26);// send ctrl + Z

}
plzzzz any help is appreciated
 

to see the reply of GSM modem you have to connect the Rx of COM-PIM to Rx of virtual terminal.(hope you know what is COM-PIM.).GSM modem should be connected to serial port of the computer.COM -PIM is used to access serial port of system in ISIS simulation..
 

tnx for ur response,i connected the RX of com-pim to rx of the MCU and Tx of the com-pim to the Tx of the MCU.
Then i connected the TX of the virtual terminal to RX of com-pim, i am using nokia 3110c as GSM modem but still no response from the modem side.
please help me.
 

connect RX of compim to RX of virtual terminal.if u wanna see something on virtual terminal you want to connect to its RX only
 

Hi,
I am worked on the GPRS/GSm modem, first check the RX & TX pins of the modem correctly connected to the micro controllers RX & TX pins are not,check that hardware connections.

when you are sending that AT command the modem definitely reply as "OK" string,you should wait for the reply of the every command after the expected reply you are eligible to send another command.

check the USART functionality,if you have any doubt check the data at the RX & TX pins with the oscilloscope. at the time you observe the valid data coming or any garbage.

Thanks & Regards,
Chandu.Kurapati.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top