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

at command

/*My program was given below my concept is to connect the gas sensor to P3^7 pin of micro controller and alarm connected to P3^6 pin of micro controller. P3^6 is low means the alarm is on. When the gas leakage is occure in home means the gas sensor give low (0) to micro controller it check the sensor input and send sms message to the
User number in the program also switch on alarm. My question is whether this AT command is common for all type of gsm modum ,
I have a nokia mobile if my mobile used in the circuit means how to modify my program. Please tell me low cost gsm modem model , I will wait for your replay,
Thank you [rk9047545247@gmail.com]*/

#include<at89x51.h>
#include<stdio.h>
#include<stdlib.h>
sbit gassensor = P3^7;
sbit alarm = P3^6;
void GSM_modem(void)
{ delay2();
puts(Command_AT);
delay2();
puts(Command_CMGF);
delay2();
puts(Command_CMGS);
delay2();
puts(msg02);
delay2();
while(!TI); TI = 0;SBUF = 0x1A;
} void serialcommunication(void)
{ TMOD = 0x20;
SCON = 0x50;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
} unsigned char Command_AT[]="AT\r";
unsigned char Command_CMGF[]="AT+CMGF=1\r";
unsigned char Command_CMGS[]="AT+CMGS =+9190475xxxxx\r";
unsigned char CtrlZ=0x1A;
unsigned char msg02[]="Gas Leakage occure!";
void delay2(void)
{ int i;
for(i=0;i<25000;i++} {}
} void main(void)
{ P3=0xff; while(1)
{ if(gassensor==0)
{ alarm=0;
serialcommunication();
GSM_modem();
} else
{ alarm=1;
} }
}

0