Table Of Contents

Synchronizing an Asynchronous Custom Device with the Primary Control Loop

Last Modified: November 16, 2020

Configure an asynchronous custom device to run synchronously with VeriStand by configuring the custom device to use the same timing source as the Primary Control Loop (PCL).

Before you begin, you should understand asynchronous custom devices and the VeriStand Engine.

VeriStand can use a DAQ device as the timing source for the PCL. You can configure the RT Driver VI of your asynchronous custom device to use the same timing source.

When you synchronize your custom device to the PCL, your custom device will not delay PCL if it finishes late.

  1. Set up an asynchronous custom device.
  2. Modify the following code to add and configure the Set Loop Type VI in the Initialization VI.

    You can add and configure the Set Loop Type VI in any VI for configuring the custom device, such as a page VI. For example, if you want a user to be able to specify whether or not to synchronize the custom device to the PCL, you could add and configure the Set Loop Type VI in the Main Page VI of the custom device.

    Loop type—Specifies that the custom device will use a Timed Loop.
    Set Loop Type VI—When Use Device Clock (Timed Loops only) input is True, VeriStand passes the timing source from the PCL to the Device Clock control in the RT Driver VI.
  3. Modify the following code to configure the RT Driver VI to use the PCL Timing Source. Before configuring your asynchronous RT Driver VI you must change the device's Data Loop from the default While Loop to a Timed Loop. You can do this by right-clicking the While Loop and selecting Replace with Timed Loop.

    Device Clock—Specifies the name of a timing source that is ticked for every iteration of the PCL after the Custom Device FIFOs have been updated. VeriStand passes this timing source to the custom device. By wiring Device Clock to Source Name, the Timed Loop will run according to the same timing source as the PCL.

    Get Custom Device Decimation VI—Returns the decimation factor of the custom device, or how many iterations of the PCL occur between calls to the custom device. This decimation factor serves as the Period of the Data Loop Timed Loop. The default value, 1, specifies no decimation, meaning the PCL will call the custom device on every iteration.

    This configuration allows you to use the Set Custom Device Decimation VI in one of the VIs for configuring your custom device, such as Initialization VI or a page VI, to specify a decimation.

    For asynchronous custom devices, the decimation only affects when the Primary Control Loop reads and writes the FIFOs it uses to communicate with the custom device.

    Get Asynchronous Driver VI Timed Loop Name VI—Returns the System Explorer path to the custom device as a string. This string serves as the unique Structure Name of the Data Loop Timed Loop, ensuring the VeriStand Engine synchronizes the start of this Timed Loop with the start of the PCL.

    Get Timed Loop Priority VI—Outputs the priority of the Timed Loop. The priority can be low, medium, or high.

    Convert Timed Loop Priority VI—Converts this enumeration value to a numeric value that the Priority terminal of the Timed Loop input node accepts.

Recently Viewed Topics