10 years, 1 month ago.

i can send sms through serial pins but i can't read sms from those pins

hi i'm using SIM900 gsm module for SMS interaction with the M0 (LPC11U24),through serial pins of M0(p9,p10),to TTL UART pins of SIM900,by this setup i am able to send sms through them but i can't able to read the recieved sms through these pins

please anybody help me about this!

code?

posted by Christian Lerche 29 Apr 2014

1 Answer

10 years, 1 month ago.

If your program is using AT commands to speak with the modem, you have to setup the reaction to a received sms. Also you can ask the modem if there are unread sms. Reading a sms out of the memory is done by specify the memory number.

actually itried the following code but i didn't get the sms

  1. include "mbed.h"

char inputbuffer[100];

Serial GSM(p9,p10); tx, rx Serial pc(USBTX,USBRX);

char sm[3]="SM"; char all[4]="ALL"; int i=0;

int main() {

GSM.baud(9600); pc.baud(9600);

GSM.printf("\n\rAT+IPR=9600\n\r"); wait(2); GSM.format(8,Serial::None,1); wait(2); GSM.printf("AT\n\r"); wait(2); GSM.printf("AT+CMGF=1\n\r"); wait(3); GSM.printf("AT+CMGR=1\n\r"); wait(3); while(GSM.readable()) { if(GSM.readable()) { inputbuffer[i]=GSM.getc(); i++;} } wait(3); pc.printf(inputbuffer); }

posted by gowrishankar N J 30 Apr 2014