📄 int0.c
字号:
//QQ群:33495724 单片机 ARM FPGA 团队全力打造技术联盟
//实验课题:外部中断0测试实验
//编写人:lc
//时间:2006.11.25.
#include <reg51.h>
unsigned char code tab[10]={0xfc/*0*/,0x60/*1*/,0xda/*2*/,0xf2/*3*/,0x66/*4*/,
0xb6/*5*/,0xbe/*6*/,0xe0/*7*/,0xfe/*8*/,0xf6/*9*/};//段码查表
//
#define uint unsigned int
#define uchar unsigned char
uchar temp=0;//记录中断
void delay(uint num)//函数延迟程序包,可以通用;
{
uint i,j;
for(i=num;i>0;i--)
for(j=0;j<200;j++);
}
void INT0_Show() interrupt 0 using 0//INTO中断
{
P1=0x01;
P0=tab[temp];
temp++;
if(temp>9)temp=0;
}
void main()
{
TCON=0x01;
EA=1;
EX0=1;
IP=0X01;
while(1)
{
if(P3^2==0)
{
delay(3000);//延时去抖;
while(P3^2==0)
{
if(P3^2==1)break;}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -