|Download Help (Windows Only)|
The NI Scan Engine is a software component that you can install on supported targets, such as RT Series PXI and CompactRIO targets. Refer to the target I/O driver documentation for information about NI Scan Engine support.
|Note You must install the LabVIEW Real-Time Module to create applications that use the NI Scan Engine. However, if you do not have the Real-Time Module installed on your computer, you can still use the NI Distributed System Manager to monitor and manage scan engine settings on targets with the NI Scan Engine installed.|
The NI Scan Engine enables efficient access to coherent sets of data channels, such as I/O channels, using a scan that stores data in a global memory map and updates all values at a single rate, known as the scan period.
|Note By default, the NI Scan Engine runs in a thread above time-critical priority, although LabVIEW includes the scan thread in the time-critical category when reporting CPU usage statistics. If you plan to use the scan engine, you must synchronize the deterministic sections of the application with the scan period to ensure that the scan thread does not affect the determinism of the application. If you do not plan to use I/O variables on a target, do not install the NI Scan Engine on the target. If the NI Scan Engine is already installed on the target, you can use the NI Measurement & Automation Explorer (MAX) to uninstall the NI Scan Engine.|
Use the Scan Engine page to configure scan engine settings including the scan period, network-publishing rate, and priority level of the NI Scan Engine.
The NI Scan Engine executes at regular intervals determined by the Scan Period you specify on the Scan Engine page. Choose a period long enough to accommodate both the scan itself and the application logic, as shown in the following illustration.
|Note The length of the scan depends on the number and type of I/O items deployed to the target. To maximize scan engine performance, undeploy any I/O items that you do not plan to use in the application.|
|Note Real-time loops generally need one or two warm-up iterations to begin executing deterministically. Before checking to ensure that an application meets timing requirements, you should allow each time-critical loop to execute warm-up iterations.|
By default, the scan engine runs in a thread above time-critical priority. You should synchronize time-critical code to the scan engine to avoid collisions that could affect the determinism of the application.
Use the Synchronize to Scan Engine timing source to synchronize timed structure execution to the scan engine. If you do not want to use a timed structure, you can use the Synchronize to Scan Engine VI to synchronize to the scan engine. Both synchronization methods trigger execution at the time labeled End of Scan in the previous illustration. To use I/O variables as a coherent data set, you should ensure that the synchronized code finishes executing before the next scan iteration. However, you can safely skip scan iterations if the code does not depend on a coherent data set.
|Note If synchronized code does not finish executing before the next scan iteration, the information reported by the error cluster of an I/O variable might lose synchronization with the I/O value.|
|Note When you press the Abort button on a VI that involves synchronization to the NI Scan Engine, the VI does not abort until the current scan iteration completes, so the VI could appear to hang temporarily if the scan period is sufficiently long.|
By default, the NI Scan Engine runs in a thread above time-critical priority. For most applications that use the scan engine, above time-critical is the appropriate priority because reading and writing I/O values is generally the highest-priority task of an application. To prevent jitter, you must synchronize time-critical code, such as control loops, to the scan engine and configure the scan period to accommodate the time-critical code.
For applications in which I/O is not the highest-priority task, you also can configure the priority of the scan engine to fall between time-critical and Timed Structure priority.
|Note Only certain targets and devices use NI Scan Engine modes. CompactRIO targets with local I/O modules do not use NI Scan Engine modes. Refer to the I/O hardware documentation for information about hardware-specific mode behavior.|
LabVIEW distinguishes four NI Scan Engine modes:
|Initialization Mode||Occurs only briefly during startup.|
|Configuration Mode||The required mode when configuring scan engine settings on hardware that uses NI Scan Engine modes.|
|Active Mode||The mode in which the scan engine runs and updates values.|
|Fault Mode||The mode triggered when a major or unrecoverable fault occurs.|
|Note Fault mode behavior varies by target. Refer to the specific target hardware documentation for information about fault mode behavior.|
Use the NI Distributed System Manager to view and configure the scan engine mode. Use the Get Scan Engine Mode VI to read the scan engine mode programmatically. Use the Set Scan Engine Mode VI to set the scan engine mode programmatically.