This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

not getting messages from gsm modem

i am using atmel at89s52 and a sim 300 gsm modem.i just want to sent a message to my cell phone.i am new to microcontroller programming.here is my code-

#include<reg51.h>

void serialcomm()
{

  TMOD=0x20;        // Mode=2
 TH1=0xfd;   // 9600 baud
 SCON=0x50;        // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit  , Receiving on
 TR1=1;           // Start timer
}

void delay(unsigned int value)
   {
     unsigned int i,j;
     for(i=0;i<value;i++)
       for(j=0;j<1275;j++);
   }


void serial(unsigned char x)
 {
  SBUF=x;
  while(TI==0);
  TI=0;
 }


void Send2Gsm(char *aaa)
 {
 unsigned int i;
 for(i=0;aaa[i]!=0;i++)
  {
  serial(aaa[i]);
  }
 }


void main()
{



serialcomm();

Send2Gsm("AT\r\n");
delay(2);


Send2Gsm("AT+CMGF=1\r\n");
delay(2);

Send2Gsm("AT+CMGS=\"+918762357075;\"\r\n");
delay(2);

Send2Gsm("hy");
serial(0x1a);


  while(1);

 }

the code looks fine to me,and i did as per the procedure.but,when i tried it in my circuit,i am not getting any messages.gsm works fine and i tested it in hyperterminal.any mistakes in code ?? please help

0