程序如下:
#include
unsigned char code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,};
unsigned char n; //按键计数
void main()
{
EX0=1;
IT0=1; //这是IT0=1,是下降沿中断
EA=1;
n=0;
while(1)
{
P1=tab[n];
}
}
void int0() interrupt 0 //中断子程序
{
n++;
if(n>9)n=0;
}
下图是仿真结果