#include
#define uchar unsigned char
#define uint unsigned int
uchar tt=0,flag;
uint i=0;
uchar code table[10] = {0x03, 0x9f, 0x25, 0x0d, 0x99, 0x49, 0x41, 0x1f, 0x01, 0x09};
void display(uint i);
void delay(uint del)
{
uchar i, j;
for(i=0; i for(j=0; j<=148; j++); } main() { TMOD=0X01; TR0=1; //启动定时器 ET0=1; //开定时器 TH0=0X40; TL0=0X00; EA=1; //开总中断 while(1) { if(tt==20) { tt=0; i++; if(i==24) i=0; } display(i); } } void display(uint k) { P2=0X04; P0=table[k/100]; delay(5); P2=0X02; P0=table[k%100/10]; delay(5); P2=0X01; P0=table[k%10]; delay(5); } void timer0() interrupt 1 { TH0=0X40; TL0=0X00; tt++; }