在线时间101 小时
UID3617445
注册时间2020-2-7
NXP金币217

TA的每日心情 | 开心 2025-7-10 13:07 |
---|
签到天数: 43 天 连续签到: 1 天 [LV.5]常住居民I
版主
  
- 积分
- 1528

- 最后登录
- 2025-7-23
|
LPC55S69之外部中断
外部中断用官方的例子就可以了。
一、引脚。
二、代码。
- <font face="微软雅黑" size="3">#include "fsl_debug_console.h"
- #include "board.h"
- #include "fsl_pint.h"
- #include "fsl_common.h"
- #include "pin_mux.h"
- #include "fsl_inputmux.h"
-
- void pint_intr_callback(pint_pin_int_t pintr, uint32_t pmatch_status) {
- PRINTF("\r\nPINT Pin Interrupt %d event detected.", pintr);
- }
-
- int main(void) {
- CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
- BOARD_InitPins();
- BOARD_BootClockPLL150M();
- BOARD_InitDebugConsole();
-
- INPUTMUX_Init(INPUTMUX);
- INPUTMUX_AttachSignal(INPUTMUX, kPINT_PinInt2, kINPUTMUX_GpioPort1Pin9ToPintsel); // PIO1_9
- INPUTMUX_Deinit(INPUTMUX);
-
- PINT_Init(PINT);
- PINT_PinInterruptConfig(PINT, kPINT_PinInt2, kPINT_PinIntEnableFallEdge, pint_intr_callback);
- PINT_EnableCallbackByIndex(PINT, kPINT_PinInt2);
-
- PRINTF("\r\nPINT Pin Interrupt events are configured\r\n");
- while (1) {
- __WFI();
- }
- }</font>
复制代码 三、说明。
按下开发板中的S3,也就是USER键,可以在控制台上看到有打印信息。
这里的外部中断,一共可以设置10个引脚,其中8个是普通引脚,2个是安全引脚。
文章出处:点击
|
|