Fetching Multi-Record Data While an Acquisition Is in Progress Using niHSDIO in LabVIEW

Updated Oct 5, 2026

Reported In

Software

  • LabVIEW

Driver

  • NI-HSDIO

Issue Details

I am using an NI-HSDIO device to acquire data packets relative to an external trigger. I want to capture only the data packets and fetch them while the acquisition is still in progress. I need each data packet to be stored as a separate record, and each record must be acquired relative to a trigger event. I am using the NI-HSDIO Fetch Multi Record (WDT) VI but I am unsure how to configure the acquisition and triggering settings to achieve this behavior.

Solution

To capture discrete packets into separate records relative to a trigger and fetch them while the acquisition is running, follow the configuration steps below:

1. Configure Channels and Sample Clock

Initialize the session, assign the required digital channels, and configure the sample clock rate and source.

2. Configure Multi-Record Acquisition Size

Use the niHSDIO Configure Acquisition Size VI to configure the records:

  • Samples per record: Set this to the size in samples (or bits, for single-channel serial acquisitions) of each individual data packet.
  • Number of records: Set this to the total number of data packets expected during the acquisition session (or an arbitrarily large number if the total packet count is not known in advance).

3. Configure Reference and Advance Triggers

For a multi-record acquisition in which each record is acquired relative to a trigger, it is needed to configure both a reference trigger and an advance trigger. This will require two instances of niHSDIO Configure Trigger  corresponding to the source of the trigger signal, as shown in the image below:

4. Commit and Initiate Acquisition

Finally, commit the settings and initiate the acquisition. 

5. Fetch Records in a While Loop

Use the niHSDIO Fetch Multi Record (WDT) VI inside a loop to retrieve records incrementally as they arrive:

  • In addition to the standard inputs (Instrument Handle, Channel List, Error In), configure the necessary inputs as below:
    • starting record
    • records to fetch

 

The below image shows an example of how fetching records in a loop could look:

This loop will fetch 5 records at a time, then use the number of records previously acquired to set the starting record for the next loop iteration. There are two things to be aware of:

  • If the fetch VI times out before all 5 records are present, the VI will return an error. One way to handle this is to clear the error, as shown, and continue with the next loop iteration. Another option is to increase the timeout of the Fetch VI. The better approach depends on whether the time required to acquire all 5 records is deterministic.
  • The loop can be stopped before all the records specified in number of records have been acquired. This is useful when it is not known in advance how many records will be needed and have set number of records to an arbitrarily large value.

There may be other ways to achieve the same result, but this is one method that differs significantly from the shipping examples.