題意沒說的太清楚,隨便寫一個(gè)吧。#include
sbitled=P1^0;
main()
{
unsignedchardat;
TMOD=0x20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
SCON=0x50;
while(1)
{
if(RI)
{
RI=0;
dat=SBUF;
if(dat==0x5a)led=0;
if(dat==0xa5)led=1;
}
}
}
題意沒說的太清楚,隨便寫一個(gè)吧。#include
sbitled=P1^0;
main()
{
unsignedchardat;
TMOD=0x20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
SCON=0x50;
while(1)
{
if(RI)
{
RI=0;
dat=SBUF;
if(dat==0x5a)led=0;
if(dat==0xa5)led=1;
}
}
}