- 打卡等级:偶尔看看II
- 打卡总天数:28
- 最近打卡:2025-02-17 13:26:32
已绑定手机
中级会员
- 积分
- 213
|
第一集:I/O口模式设置,传统外部中断
#include "AI8051U.h"
#include "io_int.h"
#include "set_io.h"
void main(void)
{
EAXFR = 1;
WTST = 0;
CKCON = 0;
P40 = 0;
set_io_mode(pp_mode, Pin02, Pin04, Pin07, Pin40, Pin_End);
set_io_mode(pdr_mode, Pin00, Pin01, Pin_End);
set_io_mode(pur_mode, Pin34, Pin_End);
set_ioint_mode(down_edge_mode, Pin34, Pin_End);
set_ioint_mode(en_int, Pin34, Pin_End);
EA = 1;
P0 = 0x00;
while (1)
{
if (get_ioint_satae(Pin34))
{
P0 = ~P0;
}
}
}
|
|