Microcontroller › AVR › By using GSM SIM 300M and Atmega8 , How to write coding for sending SMS to 3 Persons when any one the port pin gets high …? › Finally i have changed my
Finally i have changed my controller .This time i am using 89s52 with [email protected] .I have compiled the below code sucessfully and checked the output on Keil UART terminal window . But when i have dumped the same code into the controller its not sending any SMS …….. Plz suggest me any solution …..waiting fot ur reply ….!!!
#include<at89x52.h>
#define key P2^0
void delay(int time);
void init();
void SMSString(unsigned char* text);
void tx0(unsigned char x);
void main()
{
P2=0x00;
init();
while(1)
{
if(key==1)
{
SMSString(“ATr”);
delay(1000);
delay(1000);
SMSString(“AT+CMGF=1r”);
delay(1000);
delay(1000);
SMSString(“AT+CMGS=”8080808080″r”);
delay(1000);
SMSString(“This is a test messag “);
delay(1000);
tx0(0x1A);
delay(1000);
delay(1000);
delay(1000);
}
}
}
void delay(int time) //This function produces a delay in msec.
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1000;j++);
}
void init()
{
TMOD=0x20;
SCON=0x50;
TL1=0XFD; //9600 @ 11.0592
TH1=0xFD;
TR1=1;
}
void SMSString(unsigned char* text) //function to send SMS using GSM modem
{
unsigned char count = 0;
while (text[count])
{
tx0(text[count++]);
}
}
void tx0(unsigned char x) //send data to serial port 0
{
EA=0;
SBUF=x;
while(TI==0);
TI=0;
EA=1;
}
Important Note :From the GSM module i have removed Max 232 and using its 11 pin as TX and 12 pin as Rx pin , conncting directly to the microcontroller in Cross fasion ( i mean Tx 2 Rx and Rx to Tx and Gnd 2 Gnd )