How do I configure a GPIO pin as an external interrupt in a Target Support Package?

2 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
The attached model configures GPIO0 as external interrupt to trigger the blinking of LED. The custom code in the System Initialize block assigns GPIO0 as an input to trigger the XINT1 interrupt:
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 0;
EDIS;
XIntruptRegs.XINT1CR.bit.ENABLE = 1;
XIntruptRegs.XINT1CR.bit.POLARITY = 1;
The ISR toggles the LED based on a rising edge of GPIO00. Connect GPIO to 3V and GND in order to blink the LED.

更多回答(0 个)

标签

产品


版本

R2009b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by