Timed Loop Acquisition and Logging of Triggered Values in LabVIEW Real-Time

Updated Nov 3, 2023

Reported In


  • LabVIEW
  • LabVIEW Real-Time Module

Issue Details

I am acquiring data in a timed loop on my Real-Time PXI, CompactRIO(cRIO), or CompactDAQ (cDAQ) controller and I want to log this data into a file when a trigger signal is high.  How can I accomplish this acquisition and logging task without losing any data or logging any of the data incorrectly?


There are a number of ways to approach this acquisition and logging task.  We will be exploring one of the numerous ways.

Below are steps to acquire and log you are using LabVIEW 2016 or later.  A VI Snippet is attached at the bottom showing all the steps:
  1. Create a timed loop for your data acquisition.
  2. Inside the timed loop, create a Real-Time Stream Writer Endpoint.  Connect your trigger (boolean) to the element valid? input terminal.
  3. Create a while loop for data logging.
  4. Inside the while loop, create a Real-Time Stream Reader Endpoint.
  5. Inside the while loop, create a case structure that will only write to the log file if the element valid? output terminal is True.

Note:  this image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the File onto your LabVIEW diagram.