#include
#include
#define uchar unsigned char;
uchar distab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00}; //0到f
uchar number,dat,time;
void t0isr() interrupt 1
{
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
number++;
if(number>1)number=0;
switch(number)
{
case 0:P2=0x02;P0=distab[dat/10];
break;
case 1:P2=0x01;P0=distab[dat%10];
break;
default:break;
}
}
void t1isr() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
time++;
if(time%2)P1=_crol_(P1,1);
if(time%4)dat++;
dat%=100;
}
main()
{
TMOD=0x11;
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
time=0;
dat=0;
TR1=1;
ET1=1;
TR0=1;
ET0=1;
EA=1;
P1=0xfe;
while(1);
}
一分钱没有?