how to use at command in c programming of keil compiler . i use 89s52 micro controller . my concept is if any fire accident occurring in my home means it send sms to me . so please send program to my email id (rk9047545247@gmail.com)
/*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; } } }
twice here and also in a separte post
my comments in the separate post apply to all 3
Erik
"My question is whether this AT command is common for all type of gsm modum"
That question has nothing whatsoever to do with the 8051, or Keil, or 'C' source code!
If that's your question, what was the point in burying it in illegible source code?
You can find the answer to that question by studying the GSM Standard AT Command documents:
07.07 - AT command set for GSM Mobile Equipment www.3gpp.org/.../0707.htm
07.05 - Use of DTE-DCE Interface for Short Message Services (SMS) www.3gpp.org/.../0705.htm
"I will wait for your reply"
Don't just sit there waiting - start doing some research of your own!
There's plenty already out there; eg, www.8052.com/.../161632