External Interrupt
Trigger the downstream function-call subsystem from an Interrupt Service Routine
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
Libraries:
Simulink Support Package for Arduino Hardware /
Common
Description
The External Interrupt block configures Simulink® to treat the downstream Function-Call Subsystem, connected to the output port of the block, as an Interrupt Service Routine (ISR). ISR is a section of code that the CPU triggers when the selected interrupt occurs at the selected pin of the hardware.
During simulations, you can provide an input to the block by connecting a Source block from the Simulink library to the input port of the block. If the input provided to the block is boolean true, the block triggers the downstream function-call subsystem. If no input is provided, the block triggers the downstream function-call subsystem until the simulation continues to run. During code generation, any simulation block that is connected to the input port of the block is ignored and has no effect on the generated code.
Note
We recommend that you use the External Interrupt block only in the parent model of a model hierarchy. For more information, refer to Model References.
The External Interrupt block does not support the Arduino® Nano 33 BLE Sense board currently.
Ports
Input
Output
Parameters
Tips
Using serial blocks inside the function subsystem is not recommended. Interrupts triggered by the serial blocks to transfer data inside the ISR result in nested interrupts, which in turn may cause data loss to occur.
Using the same Arduino board to provide an input to the External Interrupt block may result in a racing condition between the input signal and the ISR. Use another Arduino board instead.
Version History
Introduced in R2019a