https://static.assets-stash.eet-china.com/album/old-resources/2009/5/14/b173a32b-9120-48cf-9766-e4e752a36002.rar #include <reg51.h>
unsigned char code tab[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
unsigned char code digittab[13][8]={0xff,0xff,0xc1,0xbe,0xbe,0xc1,0xff,0xff, //0
0xff,0xff,0xff,0xff,0xde,0x80,0xfe,0xff, //1
0xff,0xff,0xd8,0xba,0xba,0xba,0xc6,0xff, //2
0xff,0xff,0xdd,0xb6,0xb6,0xb6,0xc9,0xff, //3
0xff,0xff,0xf3,0xeb,0xdb,0x80,0xfb,0xff, //4
0xff,0xff,0x8d,0xae,0xae,0xae,0xb1,0xff, //5
0xff,0xff,0xc1,0xb6,0xb6,0xb6,0xd9,0xff, //6
0xff,0xff,0xbf,0xbf,0xbf,0xb0,0x8f,0xff, //7
0xff,0xff,0xc9,0xb6,0xb6,0xb6,0xc9,0xff, //8
0xff,0xff,0xcd,0xb6,0xb6,0xb6,0xc1,0xff,
0xcf,0xb7,0xbb,0xdd,0xbb,0xb7,0xcf,0xff ,
0xed,0xeb,0xc3,0xb7,0xc3,0xeb,0xed,0xff,
0xff,0xff,0xc7,0xbb,0xbb,0xbb,0xc7,0xff //9
};
unsigned int timecount;
unsigned char cnta;
unsigned char sec;
void main(void)
{
TMOD="0x02";
TH0=0x06;
TL0=0x06;
TR0=1;
ET0=1;
EA="1";
while(1)
{;
}
}
void t0(void) interrupt 1 using 0
{
P2=tab[cnta];
P1=digittab[sec/10][cnta];
P3=tab[cnta];
P0=digittab[sec%10][cnta];
cnta++;
if(cnta==8)
{
cnta="0";
}
timecount++;
if(timecount==4000)
{
timecount="0";
sec++;
if(sec==100)
{
sec="0";
}
}
}
文章评论(0条评论)
登录后参与讨论