Using the SendT() function to activate triggers

To activate a local state chart variable trigger, use the pre-defined SendT() function in places where you can insert behavioral (C) code. Typically, behavioral code can be inserted in state and transition behaviors using the Do action.

The format of the SendT() function is:


The following rules apply to the trigger-name:

      It must be defined in the Data Browser tab for the State Chart Block Properties dialog

      It has Local scope

      Its data type is Trigger

The following example uses a local variable named trigger and the SendT() function to control the trigger.

When the simulation starts, the initial state transitions to State1, and the variable a = 2. The trigger is executed if the state is active and remains active for the current simulation step. When the trigger goes high, State1 transitions to the final state. On State1 exit, a = 3. The variable b shows that the transition to final state occurred.

trigger 2 example state chart