Jestin Kuriakose
Newbie level 6
- Joined
- Dec 21, 2013
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 97
i am using atmel AT89S52 ,SIM300 gsm modem . i just want to send a sms from the GSM modem without using pc.here is my code-
when i tried this code,i am not getting SMS from the gsm modem.can anyone point out the mistakes in my code ??
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)
{
while(*aaa!='\0')
{
serial(*aaa);
aaa++;
}
}
void main()
{
serialcomm();
Send2Gsm("AT\r\n");
delay(2);
Send2Gsm("AT+CMGF=1\r\n");
delay(2);
Send2Gsm("AT+CMGS=8762357075\r\n");
delay(2);
Send2Gsm("Hello");
serial(0x1a);
}
when i tried this code,i am not getting SMS from the gsm modem.can anyone point out the mistakes in my code ??