Synchronizing an Asynchronous Custom Device with the Primary Control Loop
- Updated2025-10-27
- 3 minute(s) read
Synchronizing an Asynchronous Custom Device with the Primary Control Loop
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).
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.
- Set up an asynchronous custom device.
-
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.

1 Loop type—Specifies that the custom device will use a Timed Loop. 2 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. -
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.

1 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.
2 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.Note 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.3 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.
4 Get Timed Loop Priority VI—Outputs the priority of the Timed Loop. The priority can be low, medium, or high.
5 Convert Timed Loop Priority VI—Converts this enumeration value to a numeric value that the Priority terminal of the Timed Loop input node accepts.
Related Information
- Asynchronous Custom Devices
An asynchronous custom device executes in a parallel loop with the VeriStand Engine's Primary Control Loop (PCL) and uses RT FIFOs to exchange channel data with the rest of VeriStand.
- VeriStand Engine
The VeriStand Engine is the execution mechanism that controls the timing of the entire system and the communication between the target and the host computer.
- Using the Asynchronous Custom Device Driver Template
Use the asynchronous custom device driver template to build the RT Driver VI for a custom device.