六. microchip sam d51 MCU key EIC -->evsys-->led tog

按键按下EIC中断,在中断处理函数中进行控制LED TOG.

那么是否有更好或者其他的方式呢?

按键按下,EIC输出到ev sys,ev sys直接进行控制LED TOG,不需要CPU参与。

当然也可以实现按键按下,产生EIC中断输出,在中断处理函数中进行控制LED TOG.

也同时可以EIC事件输出,ev sys直接进行控制LED TOG,不需要CPU参与。

https://www.microchip.com/forums/m1173949.aspx

4.0 总的控制逻辑

The Source: in this case it is EIC (External Interrupt Controller) channel 13.
The Channel: It is Channel0 which is sourced from the EIC_EXTINT_13 and shown in the attach jpeg. The other end of this channel0 is the user which is PORT_EV_0 (part of the P24 register).
The User: The user is setup as P24 and its action is toggling the pin to control the LED.

As part of this setup, the designer must also setup the pins in pin configuration section of the Harmony3 setup.

I am attaching the four jpegs which might help explain the setup.

4.1 PORT PIN EIC使能输出设置

六. microchip sam d51 MCU key EIC -->evsys-->led tog_第1张图片

根据pin table ,对应的EIC是EIC_EXTINT_13

4.2 EVSYS 使能设置

触发源是EIC_EXTINT_13

六. microchip sam d51 MCU key EIC -->evsys-->led tog_第2张图片

4.3 EVENT SYSTEM MANGER设置

需要对USER CONFIGURATION配置,这里配置了 port_ev_0,即配置了端口事件0
六. microchip sam d51 MCU key EIC -->evsys-->led tog_第3张图片

4.4 LED PA24 输出IO配置

六. microchip sam d51 MCU key EIC -->evsys-->led tog_第4张图片

4.5 PORTA的event system配置

收到端口事件0,则对应的响应是PA24 TOG,也就是LED TOG
六. microchip sam d51 MCU key EIC -->evsys-->led tog_第5张图片

你可能感兴趣的:(#,microchip,mcu,单片机,嵌入式硬件)