aliraza786
Full Member level 4
- Joined
- Nov 10, 2009
- Messages
- 210
- Helped
- 14
- Reputation
- 28
- Reaction score
- 14
- Trophy points
- 1,298
- Location
- Lahore, Pakistan, Pakistan
- Activity points
- 2,914
hi anyone can help me out...plz tell me is this code is right for sending "AT" to mobile and the check wht the mobile reply and if the mobile reply "ok"....led on some port will light up...plz check my code....thnks in advance.
___________________________________________________________
#include<reg51.h>
unsigned char at[]="AT";
unsigned char dt[]="ATDT 03134495084" ;
sbit sw=P1^1; unsigned char dta[2];
char y,l;
sbit led=P2^0;
void main()
{
TMOD=0x20;
TH1=-3;
SCON=0x50;
TR1=1;
if(sw==0)
{
for (y=0;y<2;y++)
{
SBUF=at[y];
while(T1==0)
T1=0;
}
for(l=0;l<2;l++)
{
while(RI==0)
dta[l]=SBUF;
RI=0;
}
if(dta[0]=='o' && dta[1]=='k')
{ led=0; }
}
}
___________________________________________________________
#include<reg51.h>
unsigned char at[]="AT";
unsigned char dt[]="ATDT 03134495084" ;
sbit sw=P1^1; unsigned char dta[2];
char y,l;
sbit led=P2^0;
void main()
{
TMOD=0x20;
TH1=-3;
SCON=0x50;
TR1=1;
if(sw==0)
{
for (y=0;y<2;y++)
{
SBUF=at[y];
while(T1==0)
T1=0;
}
for(l=0;l<2;l++)
{
while(RI==0)
dta[l]=SBUF;
RI=0;
}
if(dta[0]=='o' && dta[1]=='k')
{ led=0; }
}
}