Hi Mark,
Sorry about the delay.
First;
Is the code you have keeping up with your data stream?
Second;
The deatils of circular buffer are dependent on how you plan to use it.
Suggestions;
You could use a couple of SR's to do the following;
1) Buffer you already have this
2) Write pointer - Use to store the index where new data will be stored. After use, it should be updated by adding the size of the current update OR set back to zero if you close to or at the end of the buffer.
3) Last value - Stores the location of the last valid value. This is used when the Read Pointer (see below) is greater than the write pointer. This will be the condition when the buffer has filled up and writing is starting back at teh begining. Should start being equal to the write pointer. This will be the case until the buffer has filled and the write pointer gets set back to zero. I this case the Last value will stop following the write pointer and stay fixed until the next time the buffer loops back on itself.
4) Read pointer - is updated any time you do a read. Normal reads will fetch data between read pointer and write pointer unless the Read pointer is greater than the write pointer. The will be the case when the oldest data is between the Read pointer and the end of the buffer and the writes are occuring at the start of the buffer.
Like I said in my first post, I can not give away code. I am allowed to answer to my hearts content though.
The whole thing operates sorta like a snake chasing its tail around a ring. It keeps growing at the head end and its tail stays fixed. When ever you read, you grab the whole snake from tail to head. The next write operation starts the snake growing again.
There are all kind of variations on the above that I have used. Some of these are;
a) Dual read pointers - allows screens to be updated pseudo-Real-Time while mainataining a pre-trigger buffer for logging.
b) Auto-loop around - Handles condition where reading from the end of the buffer but new data is available at the start of the buffer.
c) Re-Settable Read Ponters - Allow clients of the buffer to specify how far back in time it want to read.
That is all I can say for now! I have a meeitng coming up to talk about our backlog!
It may be a good idea to re-submit this Q as a new Q on the LabVIEW-General list. You will get more opinions (and help) there and it looks like I will have to be a little busy elsewhere over the next couple of days (weeks).
Ben