#include
#include
#define uchar unsigned char
uchar distab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uchar led=0xfe,num=0,times=0,sel=0,segw=0;
void t0isr() interrupt 1
{
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
if(sel==2){P2=0xfd<
if(times>200)
{
times=0;
if(sel==1){P2=0xfe;P0=led;led=_crol_(led,1);}
}
}
void uart() interrupt 4
{
if(RI)
{
RI=0;
sel=SBUF;
}
}
main()
{
TMOD=0x21;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TH1=0xfd;
TL1=0xfd;
TR0=1;
TR1=1;
ET0=1;
ES=1;
EA=1;
while(1)
}
很简单啊。一个232,然后用串口接收。然后显示出来就好了。