Keil Logo Arm Logo

Discussion Forum

at command

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Rajesh kumar
Posted
15-Mar-2012 15:32 GMT
Toolset
C51
New! 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;
} }
}

Read-Only
Author
erik malund
Posted
15-Mar-2012 16:15 GMT
Toolset
C51
New! program?

My program was given below
1) was given by whom
2) it is not a program, programs have indentions and comments, what you show is scribbles.

Erik

PS NO tabs and READ (I know that is difficult) the instructions in the "Enter Message Details Below" window

Next Thread | Thread List | Previous Thread Start a Thread | Settings

arm-logo-small

Keil logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.