#include
#define uchar unsigned char
uchar code ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//0-9
uchar scanled;
void t1isr() interrupt 3 //显示
{
TH1=(65536-5000)/256;
TL1=(65536-5000)%256;
switch(scanled)
{
case 0:
P2=0x01;
P0=ledtab[0];
break;
case 1:
P2=0x80;
P0=ledtab[3];
break;
case 2:
P2=0x40;
P0=ledtab[5];
break;
case 3:
P2=0x20;
P0=ledtab[0];
break;
case 4:
P2=0x10;
P0=ledtab[6];
break;
case 5:
P2=0x08;
P0=ledtab[1];
break;
case 6:
P2=0x04;
P0=ledtab[0];
break;
case 7:
P2=0x02;
P0=ledtab[2];
break;
default:break;
}
scanled++;
scanled%=8;
}
main()
{
TMOD=0x10;
TH1=(65536-5000)/256;
TL1=(65536-5000)%256;
ET1=1;
TR1=1;
EA=1;
scanled=0;
while(1);
}
你好!你的数码管是怎么驱动的,发一下仿真图看看