#include
#include
unsigned char x=0,i,g[20];
unsigned char s1[9]=”AT\r\n”; //send “AT” command modem will response
unsigned char s2[18]=”AT+CIPMODE=0\r\n”;//Select TCPIP Application mode
unsigned char s3[30]=”AT+CLPORT=\”UDP\”,\”3500\”\r\n”; //set Local Port
unsigned char s4[45]=”AT+CIPCSGP=1,\”airtelgprs.com\”\r\n”;//set csd or GPRS for Connection mode “ur GPRS provide address”
unsigned char s5[15]=”AT+CSTT\r”;//Start Task and set apn
unsigned char s6[15]=”AT+CIICR\r”;//Bring up wireless connection with GPRS or CSD
unsigned char s7[15]=”AT+CIFSR\r”; // Get Local Ip Address “is assign for GPRS Modem”
code unsigned char s8[50]=”AT+CIPSTART=\”UDP\”,\”219.64.118.125\”,\”3500\”\r\n”; // Start Up TCP or Udp Connection
unsigned char s9[15]=”AT+CIPSEND\r\n”; //Send Datat Through TCP or UDP Connection
unsigned char sd[46]=”193308950\r\n”; // This is the Example Data Send through GPRS Modem
void call(unsigned char *z)
{
while(z[x]!=’\0′)
{
SBUF=z[x];
while(TI==0);
TI=0;
x++;
}
}
void send(unsigned char a)
{
SBUF=a;
while(TI==0);
TI=0;
}
void delay(unsigned int t)
{
unsigned int x1,y1;
for(x1=0;x1
for(y1=0;y1<498;y1++);
}
void baud_rate_init()
{
TMOD=0×20;// Use Timer 1 8-bit Auto Reload mode
TH1=0xfd; //Baud Rate 9600
SCON=0X50;// 8 bit,1 stop bit
TR1=1; // Start Timer 1 for Serial communication
}
void main()
{
baud_rate_init();
while(1)
{
x=0;
call(s1);
send(0×0d);
delay(1000);
x=0;
call(s2);
send(0×0d);
delay(2000);
x=0;
call(s3);
send(0×0d);
delay(3000);
x=0;
call(s4);
send(0×0d);
delay(5000);
x=0;
call(s5);
send(0×0d);
delay(6000);
x=0;
call(s6);
send(0×0d);
delay(10000);
delay(10000);
x=0;
call(s7);
send(0×0d);
delay(10000);
delay(10000);
x=0;
call(s8);
send(0×0d);
x=0;
call(s9);
send(0×0d);
x=0;
call(sd);
send(0×1a);
delay(1000);
} }
No comments:
Post a Comment