Example Code

Overlay Most Recent Data Over Older Data on Same Graph

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview
This VI will continually acquire and graph a signal from one channel of a DAQ device, while maintaining previously plotted data in the graph.

 

Description
After each acquisition, it will plot all data acquired, which each data set (waveform) plotted on the same graph. All of the old data will be plotted in blue, and only the newest data, plot 0, will be plotted on top in yellow.

 

If left running for an extremely long amount of time, this VI will go through system memory very quickly. This is because every iteration we are continually adding a waveform to an array which will be stored in system memory. After a while that array will get very large, and take up a significant amount of memory. Eventually this could cause an Out of Memory Error. How long it will take for an error will depend on how many data points you acquire per loop and how quickly data is being acquired, but it should be fine until you have at least several million data points total across all of your waveforms.

 

Requirements
LabVIEW Base Development System (or compatible)

 

Steps to Implement or Execute Code
1. Create an analog input voltage channel.
2. Configure the acquisition.
3. Run the VI.
4. Call the Start VI to start the acquisition.


Additional Information or References
Capture.PNG

**This document has been updated to meet the current required format for the NI Code Exchange.**

Eric S.
AE Specialist | Global Support
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.