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

回答(1 个)

Satwik
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.
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Schedule Model Components 的更多信息

标签

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by