Using Stateflow     Search    Help Desk 

Exporting Events

Stateflow allows a state machine to export events. Exporting events enables external code to trigger events in the state machine. To export an event, first add the event to the data dictionary as a child of the state machine (see "Adding Events to the Data Dictionary"). Then set the new event's Scope property to Exported.

Note
External events can be parented only by a state machine. This means that you must use the Explorer to add external events to the data dictionary. It also means that external events are visible everywhere in a state machine.

When encoding a state machine that parents exported events, the Stateflow code generator generates a function for each exported event. The C prototype for the exported event function has the form

where EVENT is the name of the exported event. External code built into the target containing the state machine can trigger the event by invoking the event function. For example, suppose you define an exported event named switch_on. External code can trigger this event by invoking the generated function external_broadcast_trigger_on. See "Exported Events" for an example of how to trigger an exported event.



[ Previous | Help Desk | Next ]