#include <AT89X52.H>
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code digittab[4][8]={{0x00,0x00,0x00,0x42,0x7E,0x42,0x00,0x00},
{0x00,0x70,0x78,0x3C,0x1E,0x3C,0x78,0x70},{0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44},{0x00,0x00,0x00,0x06,0x02,0x7E,0x00,0x00},
};
unsigned int timecount;
unsigned char cnta;
unsigned char cntb;
/***************************************/
/* 主程序 */
/***************************************/
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;
P2=tab[cnta];
P0=digittab[cntb][cnta];
cnta++;
if(cnta==8)
{
cnta=0;
}
timecount++;
if(timecount==333)
{
timecount=0;
cntb++;
if(cntb==4)
{
cntb=0;
}
}
}
具体如何运行的啊
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code digittab[4][8]={{0x00,0x00,0x00,0x42,0x7E,0x42,0x00,0x00},
{0x00,0x70,0x78,0x3C,0x1E,0x3C,0x78,0x70},{0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44},{0x00,0x00,0x00,0x06,0x02,0x7E,0x00,0x00},
};
unsigned int timecount;
unsigned char cnta;
unsigned char cntb;
/***************************************/
/* 主程序 */
/***************************************/
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;
P2=tab[cnta];
P0=digittab[cntb][cnta];
cnta++;
if(cnta==8)
{
cnta=0;
}
timecount++;
if(timecount==333)
{
timecount=0;
cntb++;
if(cntb==4)
{
cntb=0;
}
}
}
具体如何运行的啊