- 6
- 0
- 约小于1千字
- 约 3页
- 2023-05-12 发布于上海
- 举报
STC89C52RC 外部中断测试程序
#includereg52.h//为复杂类型定义别名typedef data unsigned char uchar
#includereg52.h
//为复杂类型定义别名
typedef data unsigned char uchar;
typedef data unsigned int uint;
typedef xdata unsigned char xuchar;
typedef xdata unsigned int xuint;
//定义几个测试用 led 的管脚
sbit
test_led1
=
P2
^
0;
sbit
test_led2
=
P2
^
1;
sbit
test_led3
=
P2
^
2;
sbit
test_led4
=
P2
^
3;
//两个按钮sbit but1 = P1 ^ 6;sbit but2 = P1 ^ 7;//延时void
//两个按钮
sbit but1 = P1 ^ 6;
sbit but2 = P1 ^ 7;
//延时
void Delay(xuint i)
{
while
while (i--);
}
//中断服务子程序void
//中断服务子程序
void exit0() interrupt 0 //外部中断
{
EA = 0; //关中断test_led4 = 0; //点
原创力文档

文档评论(0)