Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer problem for continuous acquisition from two channels.

Hi

I need a VI where I am acquiring samples from a CTR period measurement channel and an anlog input channel. I want to continually acquire samples from them, and I want the samples I acquire from each channel to be synchronized. The VI I attached shows an example of what I want to do.

In the VI, I am sampling the analog signal at 300 Hz and reading 300 samples in each loop iteration. I also want to know the period measurements over that same time period of 1second. I made a test program that would generate a signal that had periods of 5 ms, so I should read 200 samples from the CTR in each loop iteration.  This way, the samples I am acquiring in each loop is associated with the same timeframe.

Sometimes the program will lag because i am running other things in the background because the OS will devote more processor time to other tasks. I thought this would be okay since the samples would just build up in the buffer and eventually I would be able to catch up by just reading from the buffer. However, I discovered that when the program lags, only the analog buffer seems to build up, while the counter buffer remains at 0. This means that all the CTR samples have been read while some analog samples have not been read, which shouldnt happen if I'm synchronized. II would think that both of the buffers would build up together, (ex: If my program stalls for exactly 1second, then the analog buffer would be 300 and the counter buffer would be 200). Why don't the buffers build up together?

Sorry if I didn't explain this too well.

Thanks for the help.

PS Eventually I'll use queues to send the samples to another loop for processing,
0 Kudos
Message 1 of 2
(2,992 Views)
Sorry Wrong forum. I meant to post in Labview.
0 Kudos
Message 2 of 2
(2,989 Views)