#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
char Duan_Code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
uchar Count=0;
void SEG7_Static_Display(uchar);
void Ex0_Initial(void);
void Display(void);
int main()
{
Ex0_Initial();
while(1)
{
Display();
}
}
void SEG7_Static_Display(uchar Num)
{
P0=Duan_Code[Num];
}
void Ex0_Initial(void)
{
IT0=1;
EA=1;
EX0=1;
}
void Display(void)
{
SEG7_Static_Display(Count);
if(Count==10)
{
Count=0;
}
}
void EX0_Int() interrupt 0
{
Count++;
}
|