#include unsigned char code tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}; unsigned char code digittab[12][8]={{0x00,0x7c,0x92,0x92,0x92,0x4c,0x00,0x00}, //9 {0x00,0x6c,0x92,0x92,0x92,0x6c,0x00,0x00}, //8 {0x00,0x0e,0xf2,0x02,0x02,0x02,0x00,0x00}, //7 {0x00,0x64,0x92,0x92,0x92,0x7c,0x00,0x00}, //6 {0x00,0x72,0x8a,0x8a,0x8a,0x4e,0x00,0x00}, //5 {0x00,0x20,0xfe,0x24,0x28,0x30,0x00,0x00}, //4 {0x00,0x6c,0x92,0x92,0x92,0x44,0x00,0x00}, //3 {0x00,0x9c,0xa2,0xa2,0xa2,0xe4,0x00,0x00}, //2 {0x00,0x00,0x80,0xfe,0x84,0x00,0x00,0x00}, //1 {0x00,0x00,0x3c,0x42,0x42,0x42,0x3c,0x00}, //0 }; unsigned int time; unsigned char a,b; sbit Line=P1^3; sbit Row=P1^1; sbit LeDen=P1^2; sbit duan=P1^0; sbit lcd_en=P1^7; void main(void) { TMOD=0x01; TH0=(65536-3000)/256; TL0=(65536-3000)%256; TR0=1; ET0=1; EA=1; while(1) {;} } void t0(void) interrupt 1 using 0 { TH0=(65536-3000)/256; TL0=(65536-3000)%256; Row=1; P0=tab[a]; Row=0; Line=1; P0=digittab[b][a]; Line=0; a++; if(a==8) { a=0; } time++; if(time==233) { time=0; b++; if(b==12) { b=0; } } }