Jump to content

1 Screenshot

About This File

Description
 
This package contains functions for maintaining a circular buffer.  
 
Create the Circular Buffer using the Initialize Circular Buffer function.  This makes a DVR, and the data type of the DVR changes based on the data type specified for the circular buffer.  The data type can be any type as long as it is not an array.  It must be a scalar.  The size of the buffer is specified on initialization but can be changed using the Change Circular Buffer Size function.
 
Add data to the circular buffer using the Write Circular Buffer function.  Scalar values can be added, or a 1D array of data can be added.  The data type of the values to be written is the data type defined in the initialize function.
 
Read the data back out of the circular buffer using the Read Circular Buffer function.  The data type of the read values will be the data type defined in the initialize function.
 
Cleanup the program by destroying the DVR on exit.  An example VI Circular Buffer Demo shows how a Circular Buffer can be used.
 
XNode Disclaimer
 
The Initialize, Read, Write, Get Status, and Change Size functions are implemented as XNodes.  NI does not provide support XNode development.
 
For an introduction to XNodes read Adam Rofer's "XNodes - A Crash Course" presentation (http://lavag.org/files/file/56-xnodes-a-crash-course-powerpoint).
 
Dependencies
 
LAVA Palette-1.0.0.1
 
How It Works
 
The source is all open and the template VIs for each XNode is what is executed when the XNode is generated.  This means you are welcome to try to further optimize these XNodes by editing the templates.  A new instance of the XNode will need to be placed which will force the new code to be used.  If anyone finds performance improvements for these functions please feel free to post in the support topic.  
 
Because the size of the buffer is practically unbounded, I wanted to avoid unnecessary data copies, which is why it is designed around DVRs.  There exists 3 things in the DVR, the buffer size, a pointer to the current write location in that buffer, and the array of scalar values, whos data type is defined during the initialization.

 


What's New in Version 1.0.1.13   See changelog

Released

  • - Read Circular Buffer now has optional inputs of Offset and Length, which default to 0 and -1 (all).
  • - Improved Read to not perform a 1D array shift if it isn't needed based on the offset and length to be read.
  • - If a 1D array shift was needed for a Read, then new shifted data is written back, so that the next read won't need to shift data again.
  • - Added code to handle mutation from version 1.0.0



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.