#include
#define uchar unsigned char
uchar distab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00}; //0到f
uchar dat;
void ext0() interrupt 0
{
dat++;
dat%=10;
P1=distab[dat];
}
ext1() interrupt 2
{
if(dat>0)dat--;
P1=disab[dat];
}
main()
{
EX0=1;
EX1=1;
IT0=1;
IT1=1;
EA=1;
while(1);
}
外部中断,proteus 仿真