|Download Help (Windows Only)|
The caller VI is the VI you create that contains a Run Statechart function. This function creates and executes an instance of a statechart. Executing a statechart means sending input data to a statechart. You also can use the caller VI to send triggers to a statechart.
The caller VI has a different structure depending on whether the statechart is asynchronous or synchronous. The following sections provide information about these differences.
Executing asynchronous statecharts involves the following two processes:
In this situation, the VI that contains the Run Statechart function is the caller VI. You can send triggers to the external queue from another VI or a parallel loop in the caller VI. The following figure shows a caller VI that both executes an asynchronous statechart and sends triggers to the external queue.
In the previous figure, the Statechart Loop, which is a While Loop, executes the statechart. The Inputs control contains any input data of the types that you defined. The Outputs indicator returns output data from the statechart. The Instance Name constant specifies Statechart 1 as the name of the statechart instance.
The Trigger Loop, which can execute in parallel with the Statechart Loop, contains an Event structure. This Event structure handles events that occur within the VI. In this case, an event occurs when you click the Button front panel control. When you click this control, the Event structure detects this event and the Send External Trigger function sends the Trigger1 trigger to the Statechart 1 statechart instance.
|Note This example uses the caller VI to send triggers to an external queue. However, as long as the caller VI is running and the statechart is in memory, you can use any VI to send triggers to an external queue. This behavior means that you can place the Trigger Loop and Statechart Loop in separate VIs.|
The following figure shows a caller VI that executes a synchronous statechart.
Notice the differences between this caller VI and the asynchronous caller VI. The typical use case for a synchronous statechart is an application that executes at defined time intervals. Therefore, this caller VI uses a Timed Loop with frames to (1) read input data, (2) execute the statechart, and (3) write output data within the specified time. The Read Input Data and Write Output Data subVIs represent LabVIEW block diagram code that communicates with measurement hardware. For example, these VIs can represent NI-DAQmx code that communicates with an NI DAQ device.
|Note Sending triggers to synchronous statecharts is optional. If you do not send triggers, LabVIEW sends the NULL trigger to the statechart. If you do send triggers to a synchronous statechart, you can send these triggers from only the caller VI.|