You also can use several types of NI-DAQmx timing sources, including frequency, digital edge counter, digital change detection, and signal from task sources, to control timed structures. Use the DAQmx Create Timing Source VI to programmatically select an external timing source. You can create external timing sources for controlling a timed structure with NI-DAQmx Version 7.2 or later. You can use a software-triggered timing source as an RT-compatible event handler or to notify a consumer Timed Loop when new data becomes available in a producer-consumer application. Use the Fire Software-Triggered Timing Source VI to programmatically trigger a Timed Loop controlled by a software-triggered timing source. Use the Create Timing Source VI to create a software-triggered timing source. You can create a software-triggered timing source to trigger a timed structure based on a software-defined event. The period between iterations corresponds to the Scan Period (µS) setting you configure on the NI Scan Engine page. Using this timing source, the timed structure executes at the end of each scan. This synchronizes the timed structure to the NI Scan Engine.
For example, you can configure the Timed Loop to start at a precise time each day.Īn additional internal timing source is the Synchronize to Scan Engine. You also can configure the Timed Loop structure to use either of these built-in timing sources as an absolute time reference to start the structure execution using timestamps.
Targets that support the 1 MHz timing source can schedule a timed structure with microsecond resolution. All LabVIEW platforms that can run a timed structure support the 1 kHz timing source. Using the 1 kHz clock, you can schedule a timed structure with millisecond resolution. You can configure the Timed Loop to use a 1 kHz clock or a 1 MHz clock on a supported real-time (RT) target. The internal timing source uses the nanosecond engine to keep track of time. Timing Sources for the Timed Loop Structure: Built-In Internal Timing Sources, Software-Triggered Sources, and External Sources Internal Timing Sources You can select from three classes of timing sources: internal, software-triggered, or external (Figure 4).įigure 4.
#TIMING WATCH CLOCK CODE#
LabVIEW Timed Loop Structure for Executing Code with Timing ConstraintsĪ timing source controls the execution of a timed structure. With the combination of these attributes and the wide range of timing sources, you can create sophisticated applications regardless of the required timing constraints (Figure 3).įigure 3. Using the Timed Loop, you can specify a variety of timing attributes including the period, priority, deadline, offset, and timeout. In addition to the tight timing characteristics of the Timed Loop, the structure can be used to assign processor affinity for multicore programming. Use the Timed Loop when you want to develop applications that require multirate processing, precise timing and synchronization, feedback on loop execution, timing characteristics that change dynamically, or several levels of execution priority. It has a wide range of timing sources that are described later in this tutorial. The Timed Loop is a looping structure that executes when the configured timing source has an event. Configuration of Time Synchronization Source for Device from MAX
#TIMING WATCH CLOCK SOFTWARE#
You also can configure your device to use the Software 1588 Precision Time Protocol with the NI Measurement & Automation Explorer (MAX) utility (Figure 2).įigure 2. You can configure multiple devices on a network to use the same IEEE 1588 reference clock, allowing multiple platforms to synchronize over a standard Ethernet network. The IEEE Standard 1588 plug-in available with NI-TimeSync 1.1 provides a clock reference that is synchronized with 1 ms resolution. LabVIEW 2010 introduces a new clock available to NI-TimeSync. The LabVIEW nanosecond timing mechanism and NI-TimeSync coordinate to provide a clock for your application.
The nanosecond engine can use a local real-time clock (RTC) or it can be driven by an external reference clock integrated through the NI Time Sync Framework (NI-TimeSync) (Figure 1).įigure 1. There are a variety of functions and structures in LabVIEW that use the nanosecond engine for time keeping, such as the Wait function and the Timed Loop structure. The nanosecond engine runs behind the scenes and interfaces to the OS to manage time. LabVIEW uses a software component called the nanosecond engine to keep track of time within a program. LabVIEW Timing Under the Hood – Nanosecond Engine and NI-TimeSync