| Stateflow User's Guide | ![]() |
Sending Multiple Trigger Events to a Stateflow Chart
In Adding Event Triggers to Transitions, you replace the trigger event event with two trigger events: off_switch and on_switch. Even though you added multiple events, the trigger port in the Simulink test interface for the Controller block has the same appearance as before.
Each event requires a trigger signal to generate its event with a rise or fall in signal. However, Stateflow blocks have only one trigger port for receiving trigger signals. This means that each signal must be indexed into an array of two trigger signals.
Provide two trigger signals to the single trigger port of the Controller Stateflow block with the following steps:
off_switch. The bottom port connects with the trigger event of index 2, on_switch. During simulation, when you toggle the Manual Switch from -1 to 1, you send a rising trigger signal to both signal inputs of the trigger port. Only the on_switch event port reacts by sending an on_switch event to the Controller Stateflow diagram. Likewise, when you toggle the Manual Switch from 1 to -1, you generate an off_switch event.
| Adding Multiple Trigger Events to a Stateflow Chart | Modifying Output Data with Actions | ![]() |
© 1994-2005 The MathWorks, Inc.