Arduino Interrupt should only trigger Function Call Subsystem
5 次查看(过去 30 天)
显示 更早的评论
I would like to realise a simple hardware interrupt for Arduino in Simulink. For this I use the block "External Interrupt" which activates a function call subsystem.
Within the function call subsystem there is only one constant with the value “1”, which is routed externally to the digital output.
If I then activate the interrupt externally by pressing a button, the LED lights up permanently. Is there a way to deactivate the Function Call Subsystem again until the next interrupt? Of course, I would like a 0 to be fed to the digital output so that the LED goes out again.

Here the inner content of the function call subsystem:

I'm pretty sure that this can be done more elegantly, because I don't have a condition in there that if the interrupt is not there, a 0 is sent to the digital output.
I have also tried to set the trigger type of the function call to Rising, but then the model is no longer compiled.
Kindest regards
0 个评论
回答(1 个)
Satwik
2025-7-22
I understand that you want to model the 'External Interrupt' block which activates the Function Call Subsystem, in such a way that it allows for deactivation of the subsystem output until the next interrupt.
To do this, I recommend adding an Input port to the 'External Interrupt' and incorporating input logic to control the interrupt accordingly. You can achieve this by checking the 'Add simulation input port' option in Block Parameters of the 'External Interrupt' block. This will enable the 'SimIRQ' block input. In simulation, the block triggers the downstream function-call subsystem only if 'SimIRQ' is True.
Please refer to the following MathWorks example, which demonstrates a similar approach: https://www.mathworks.com/help/simulink/supportpkg/arduino_ref/trigger-downstream-function-call-subsystem-using-arduino-external-interrupt-block.html
I hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Schedule Model Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!