Stateflow User's Guide Previous page   Next Page

Importing Events from Stateflow External Code

A Stateflow machine serves as a surrogate parent for imported events defined by external code. Importing an event allows Stateflow to build a custom or Real-Time Workshop (RTW) target, that triggers the imported event in external code.

To import an event, add an event to the Stateflow machine that needs to trigger the event and set its Scope property to Imported.

Stateflow assumes that external code defines each imported event as a function whose prototype is of the form

where EVENT is the Stateflow name of the imported event. For example, suppose that the Stateflow machine imports an external event named switch_on. In this case, Stateflow assumes that external code defines a function named external_broadcast_switch_on that broadcasts the event to external code. Later, when you build a target for the Stateflow machine, the Stateflow code generator encodes actions that signal imported events as calls to the corresponding external broadcast event functions defined by the external code.

See Imported Events for an example of a Stateflow external code event imported into Stateflow.


Previous page  Exporting Events to Stateflow External Code Defining Implicit Events Next page

© 1994-2005 The MathWorks, Inc.