单片机中利用中断程序做出按键按下显示数字,逐次加一,从一到九
1个回答
展开全部
#include<reg51.h>
#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 t1isr() interrupt 0
{
dat++;
dat%=10;
P0=distab[dat];
}
main()
{
IT0=1;
EX0=1;
EA=1;
while(1);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询