Simulink manual switches not propagating outputs consistently
3 views (last 30 days)
Show older comments
Hi, as the title suggests, I'm having several issues with manual switches seemingly not working properly.
I've set up a simple manual switch to toggle between a 0 and 1. The output of this switch goes to a Simulink display block, as well as a digital output on my microcontroller, which happens to be a TI Delfino TMS320F28379D Launchpad.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/548173/image.png)
It seems like the manual switch only works for a "falling-edge". More details below:
- If the switch is set to choose input "1" when the program is downloaded to hardware, then it will initially reflect as a 1 on the display block, as well as a HIGH voltage measurement at the digital output.
- If the switch is then clicked to toggle it to a "0" state, this change will propagate to the display block and the digital output. That is, the display will show a 0 and the output voltage will be LOW.
- However, if I then again toggle the switch to a "1" state, the change does not propagate. The display block remains at "0", as shown in the image below. Furthermore, the output voltage is still LOW.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/548178/image.png)
The settings for the constant blocks are shown below. I've experimented with sample times of inf, -1 (inherited) and 1 with the same results. I've also experimented with output data types of boolean, uint16, uint32, single, and fixdt(1, 16).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/548183/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/548188/image.png)
The settings for the display block are below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/548193/image.png)
Please let me know if you have any suggestions for dealing with this issue.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!