#include regx52.h #include stdio.h #include string.h void InitUART(void) { TMOD=0x20;//Timer 1,Mode 2 TH1 = -3;// 9600 baud rate at 11.059 MHz TR1=1; // Start Timer1 TL1=-3; SCON=0x52;// 8-bit UART mode 1 } void Delay2mSec() { unsigned char i; for(i=0;i<30;i++); } void getline (char *line) { while ((*line++ = getchar()) != '\n'); } void main() { unsigned char AT[] = "AT+CMGS="; unsigned char response[2]; InitUART(); printf("AT+CMGF="); putchar('1'); putchar(0x0d); putchar(0x0a); Delay2mSec(); printf("AT+CMGS="); putchar('"'); printf("9566224266"); putchar('"'); putchar(0x0d); putchar(0x0a); Delay2mSec(); printf("Hii welcome!!"); putchar(0x1A); getline(response); }
Tuesday, March 2, 2010
Send sms using GSM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment