#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 Ex1_Initial(void);
void Display(void);
int main()
{
Ex1_Initial();
while(1)
{
Display();
}
}
void SEG7_Static_Display(uchar Num)
{
P0=Duan_Code[Num];
}
void Ex1_Initial(void)
{
IT1=1;
EA=1;
EX1=1;
}
void Display(void)
{
SEG7_Static_Display(Count);
if(Count==10)
{
Count=0;
}
}
void EX1_Int() interrupt 2
{
Count++;
}
|