Overview
This example VI enables the user to use a queue as a FIFO and store only the N most recently acquired points.
Description
Some data acquisition applications require storing only the N most recently acquired points. While it may be acceptable to store all the points in array and pull the final N points off the array after acquisition, this becomes impractical if the application is to run for a long time due to wasteful memory usage. This example code leverages the LabVIEW Queue as a FIFO to keep only the N most recently acquired points. This implementation is much faster than using an array due to the constant element shifting required in the array implementation.
- This VI initializes a queue and sets the max queue size and element type.
- Then the VI dequeues an element if the queue is full.
- Takes the data from the DAQmx Read.vi and adds it to the queue.
- The represented data is taken from the queue and put into an array.
Requirements to Run
Software
- LabVIEW 2009 or compatible
- DAQmx 8.9.5 or compatible
Hardware
Steps to Implement or Execute Code
- Download the VI
- Wire your data acquisition initialization and configuration code to the currently unwired DAQmx Start Task VI on the left
- You may need to change the polymorphic type of the DAQmx Read which will require changing the queue type
- After you have made the necessary changes run the VI
Additional Information or References
Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**