Arduino Interrupt should only trigger Function Call Subsystem

조회 수: 3 (최근 30일)
Hendrik2k1
Hendrik2k1 2025년 7월 15일
답변: Satwik 2025년 7월 22일
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