LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading multiple circular buffers

I have developed a vi that uses a PXI 6602 for position measurement. Two of the counters (0 and 1) are allocated for "buffered position measurement" and a third counter (2) is allocated for "pulse train generation". Counters 0 & 1 measure the rotational position of two 36,000 line quadrature encoders. Counter 2 generates a pulse train which is used as the selected gate signal for the buffer. Thus a large volume of data points is stored as an array which is a record of the encoders movement. As both circular buffers use the same selected gate signal the position measurements are made synchronously. In addition all three counters are hardware triggered so that they start simultaneously.

The goal is to have a 2D array of all the
buffered measurements for each encoder which should have the same number of data points in each, where each cell has a corresponding cell in the other array who's value was recorded at the same time.

Although the buffers record data synchronously they are not being read in a synchronous manner. Data seems to be recorded to the buffers prior to the counters being triggered (hence you can get a row or two of zero's), having stopped the acquisition the amount of data points is not always equal, and often the first values in the arrays start on a different row.

How can I make the read buffer statements work in a synchronous manner similarly to the way in which data is recorded to the buffer?
0 Kudos
Message 1 of 2
(2,684 Views)
I have had a quick look at your VI and I think the problem comes from - you cannot guarantee in what order subVIs and functions are run in the same loop or at the same level.

An answer to the problem might be to use the Rendezvous VIs (Functions->Advanced->Synchronization->Rendezvous) with each buffer read in it own seperate while loop. Use the Rendezvous VIs to ensure that all of the loops wait until ALL are at that point before continuing.

I hope that's not too confusing.

Rob
Message 2 of 2
(2,684 Views)