Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
• AT commands should be followed by Carriage return i.e. \r (0D in hex), like “AT+CMGS\r”
• if your module has RX and TX (with GND) Pins on board then it can work on TTL logic
• Carriage return special code that moves the cursor (or print head) to the beginning of the current
line.
• AT+CMGS=\”+ZZ XXXXXXXXXX\”\r, The SMS will send to the 10 digit number written as XXXXXXXXXX
with 2 digit country code ZZ
PROGRAM:
#include<reg51.h>
sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
sbit sensor=P1^5;
void delay()
{ for(a1=0;a1<32000;a1++); }
void cmmd()
{ rs=0;rw=0;en=1;delay();en=0; }
void dat()
{ rs=1;rw=0;en=1;delay();delay();en=0; }
void nexline()
{ SBUF=0x0d;while(TI==0);TI=0; }
void main()
while(1)
TMOD=0x20;
SCON=0x50;
TR1=1;
TH1=0xfd;
for(c=0;c<2;c++)
{ SBUF=at1[c];while(TI==0);TI=0; }
nexline();
delay();
for(c=0;c<9;c++)
{ SBUF=at2[c];while(TI==0);TI=0; }
nexline();
delay();
while (sensor==1);
for(c=0;c<23;c++)
{ SBUF=at3[c];while(TI==0);TI=0; }
nexline();
delay();
for(c=0;c<14;c++)
{ SBUF=at4[c];while(TI==0);TI=0; }
SBUF=0x1a;//used to send the control character called EOF (End of File) to mark the end
of message
while(TI==0);
TI=0;
delay();
for(a=0;a<5;a++)
{ P2=cmd[a];cmmd(); }
for(c=0;c<11;c++)
{ P2=lcdmsg[c];dat(); }
}
BLUETOOTH MODULE (HC-05)
* Frequency: 2.4GHz
* Range: 50-150m
* Txd & Rxd- These two pins acts as an UART interface for
communication
* STATE: It acts as a status indicator. When the module is not
connected to / paired with any other Bluetooth device, signal
goes Low. At this low state, the led flashes continuously which
denotes that the module is not paired with other device. When
this module is connected to/paired with any other Bluetooth
device, the signal goes High. At this high state, the led blinks with
a constant delay say for example 2s delay which indicates that the
module is paired.