Showing posts with label Project. Show all posts
Showing posts with label Project. Show all posts
Receive SMS and turn on and off the devices
void main () { clear(); lcdinit(); lcdcmd(0x80); lcddata('K'); delay(10); init(); SMSString("AT\r"); // AT commands to initialize gsm modem delay(50); SMSString( "ATe0\r"); // turn off echo delay(50); SMSString( "AT&W\r"); // save settings delay(50); SMSString( "AT+CMGF=1\r"); // select text mode for sms delay(50); SMSString( "AT+CNMI=2,1,0,0,0\r"); // notification of new sms delay(10); //New msg indication. // +CMTI: "SM",3 while(1) { clear(); IE=0X90; // Enable serial interrupt delay(10); read_notification(msg1); IE=0x00; } } |
void read_notification(unsigned char *msg) { unsigned char array[15],i,index_no; i=0; do { msg++; i++; }while(*msg!='+' && i!=15); // to check for first '+'. i=0; do { array[i]=*msg++; i++; }while(*msg!='\n' && i!=15); // Check for new line. if(strncmp(array, "+CMTI", 5) == 0) { array[14] = '\0'; IE=0x00; lcdcmd(0x80); lcdstr("NEW MSG");// Just for indication. delay(50); SMSString("AT+CMGR="); tx0(array[12]); SMSString("\r"); IE=0x90; delay(80); read_text(msg1,rec_no,time_date); delay(100); } return; } |
How to send SMS using AT89c51
#include <REGX51.H>
#include <AT89X51.H>
unsigned char *command_AT = "AT\r";
unsigned char *command_CMGF = "AT+CMGF=1\r";
unsigned char *command_CMGS = "AT+CMGS=\"+910123456789\"\r";
unsigned char *message = "Hello Dear";
unsigned char CTRLZ = 0x1A;
void puts(unsigned char* ptr);
void putc(unsigned char chr);
void sendsms(void);
void initialize();
main()
{
initialize();
sendsms();
while(1);
}
void initialize()
{
SCON = 0x50; /*SCON: mode 1, 8-bit UART, enable receive */
TMOD |= 0x20; /*TMOD: timer 1, mode 2, 8-bit */
TH1 = 0xFD; /*TH1: for 9600 baud */
TR1 = 1; /*TR1: timer 1 run */
}
void sendsms()
{
puts(command_AT);
puts(command_CMGF);
puts(command_CMGS);
puts(message);
putc(CTRLZ);
}
void puts(char* p)
{
char *temp = p; /*temp pointer so that the actual pointer is not displaced */
while(*temp != 0x00)
{
putc(*temp);
temp++;
}
}
void putc(unsigned char chr)
{
SBUF = chr;
while(TI==0); /*Wait until the character is completely sent */
TI=0; /*Reset the flag */
}
#include <AT89X51.H>
unsigned char *command_AT = "AT\r";
unsigned char *command_CMGF = "AT+CMGF=1\r";
unsigned char *command_CMGS = "AT+CMGS=\"+910123456789\"\r";
unsigned char *message = "Hello Dear";
unsigned char CTRLZ = 0x1A;
void puts(unsigned char* ptr);
void putc(unsigned char chr);
void sendsms(void);
void initialize();
main()
{
initialize();
sendsms();
while(1);
}
void initialize()
{
SCON = 0x50; /*SCON: mode 1, 8-bit UART, enable receive */
TMOD |= 0x20; /*TMOD: timer 1, mode 2, 8-bit */
TH1 = 0xFD; /*TH1: for 9600 baud */
TR1 = 1; /*TR1: timer 1 run */
}
void sendsms()
{
puts(command_AT);
puts(command_CMGF);
puts(command_CMGS);
puts(message);
putc(CTRLZ);
}
void puts(char* p)
{
char *temp = p; /*temp pointer so that the actual pointer is not displaced */
while(*temp != 0x00)
{
putc(*temp);
temp++;
}
}
void putc(unsigned char chr)
{
SBUF = chr;
while(TI==0); /*Wait until the character is completely sent */
TI=0; /*Reset the flag */
}
simple music bell
This is the simplest ever musical calling bell that can be easily built. It uses the
musical 3 pin IC UM66 and a popularly known Transistor BC548b. The circuit
FM Transmitter
This circuit is a simple two transistor (2N2222) FM transmitter. No
license is required for this transmitter according to FCC regulations
regarding wireless microphones. If powered by a 9 volt battery and used
with an antenna no longer than 12 inches, the transmitter will be within
the FCC limits. The microphone is amplified by Q1. Q2, C5, and L1 form
an oscillator that operates in the 80 to 130 MHz range. The
Electronics projects
http://electronicsready4u.blogspot.in/
BUILDING THE
ELECTRONIC PROJECTS
The
information given here is meant for to understand the function of various
electronics components and basic principal and procedure to understand the electronic circuits.
Electronic
components are represented by symbols with the help of these symbols an
electronic circuit can be read.
Subscribe to:
Posts (Atom)