11-16-2009 07:19 PM
Hi;
In my application, I would like to read all buffer content (which is made up of a series of 1D array) all at once and then empty the buffer so that the upcoming data can be written to the buffer in the next step in my code. I am wondering if there is anyone out there who knows how to do this.
Thank you very much.
Serdar
Solved! Go to Solution.
11-17-2009 03:11 PM
Hi Serdar,
You cannot read all of the data at once. With a FIFO, elements are written to and read from the buffer one at a time. One thing you can do is place the RT FIFO Read in a loop. Each time you read from the buffer check the output of the element # terminal to see how many elements are left in the buffer. When that that value reaches zero, exit the loop and continue on to write more data to the buffer.
11-17-2009 05:07 PM
Thank you Olivia for your response. I really appreciate it. I can empty my buffer using a loop as you suggested. However, in my application, values keep being written to the FIFO as the FIFO content is being read in the loop. Therefore, my buffer will never become empty resulting in the loop running forever. ( Unless I read buffer way faster than I write, which is not be the case.) Do you have any suggestings for this problem?
I found the smart buffer example in LabVIEW which does exactly what I want. However, the smart buffer was designed for scalar entries, and as a result, is not applicable to my implementation in which I need to buffer arrays. Do you know how to make that code work with arrays? (I posted this question in another stream but haven't received any answer yet.)
Thank you so much for your help!
Serdar
11-18-2009 05:04 PM
Hi Serdar,
You won't able to use the Smart Buffer example with 1D arrays. The reason for that is the "buffer" created by the functional global is an array and mades use of 1D array properties. Since your elements are arrays, this will not work.
11-19-2009 12:29 PM
Hi Olivia
It is possible! The only thing you need to do is to pack the 1D array in a cluster and add that to a 1D array of clusters in the buffer.
So in practise it is a bit more work bu doable.
step 1 replace the internal 1D array by a 1D array of cluster of 1D array. (sounds difficult, just do it)
step 2 replace the float by a 1D array and as a first step bunde that into a cluster.
step 3 replace the output by a 1D array and retrieve that from the buffer and unbundle immediately before wiring to the indicator.
11-21-2009 11:37 AM