|
#include<reg52.h> unsigned char lie[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}; unsigned char hang[3][8]={0x00,0x18,0x24,0x24,0x24,0x24,0x18,0x00, //數(shù)字0 0x00,0x3c,0x20,0x38,0x04,0x24,0x38,0x00, //數(shù)字5 0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00}; //數(shù)字8 int a,i,j; void main() { TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; TR0=1; while(1) { P2=hang[j][i]; P1=lie[i]; i++; if(i==8) { i=0; } if(TF0==1) { TF0=0; a++; if(a==10) { a=0; j++; if(j==3) { j=0; } } } } } |
|