Clear Filters
Clear Filters

Simulink manual switches not propagating outputs consistently

5 views (last 30 days)
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.
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.
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).
The settings for the display block are below.
Please let me know if you have any suggestions for dealing with this issue.

Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!