04-26-2021 09:04 PM
Hi all,
I have a set-up that is generating a time array and inserting it into the next column of the data. I made this originally for 2 channel continuous acquisition but I now need to apply it to both 1 and 2 channel, continuous and finite sampling.
When I perform a similar thing for the finite sampling mode, it gets stuck in the innermost for loop until I stop the outer loop. I'm looking for suggestions on why it does this in the finite sampling and not in the continuous also. This is my first semester with Labview so I am still learning alot -- feel free to offer suggestions on anything else you see that could be wrong.
I know another method for creating time arrays is taking the waveform components (Y and dt) and multiplying dt*i in a similar loop but I think that would cause the same issue. I did try this method but my time array was changing based on sampling rate rather than giving the total duration and I did not like that.
I will include screenshots of the areas in focus because this is still a very messy and complicated state machine (10 states) and I am only looking for assistance in one of them.
Multi-Channel Continuous
Single Channel Finite Sampling
Recommendations on how to solve the time array issue within finite sampling would be greatly appreciated. I have the cont. sampling figured out but at a loss for the finite.
Much appreciated and best regards,
04-27-2021 01:36 AM
Hi rashelton,
@rashelton42 wrote:
When I perform a similar thing for the finite sampling mode, it gets stuck in the innermost for loop until I stop the outer loop. I'm looking for suggestions on why it does this in the finite sampling and not in the continuous also.
THINK DATAFLOW! (This is the very basic principle of LabVIEW and you need to repeat those words every day, every hour, every minute when you are still earning LabVIEW!)
Due to DATAFLOW the inner loop keeps processing the same inputs again and again - until you press that "stop" button…
@rashelton42 wrote:
Recommendations on how to solve the time array issue within finite sampling would be greatly appreciated. I have the cont. sampling figured out but at a loss for the finite.
There is a function in the waveform functions palette which will give you an array of timestamps from your waveform…
04-28-2021 09:33 PM
When GerdW says "Think Data-Flow", an important aspect of this (with respect to the "Continuous" vs "Finite" acquisition) is that a While Loop doesn't repeat until everything inside has a chance to run. Suppose you sample 1000 points at 1 kHz, and pass the data to a Chart to display it. You have a DAQmx Read connected to a Chart inside the While Loop. Let's also assume you want to record for 10 seconds.
With Finite Acquisition, the "Read" takes 1 second, at which time the data are passed to the Chart to display. Assume this takes 10 milliseconds. Then the While Loop repeats, does another Read + Chart Display, but now you've "missed" acquiring 10 ms of data!
Contrast this with Continuous Acquisition. It starts exactly the same way. The Read takes 1 second, and the 1000 points are passed to the Chart. But now the Read is set to Continuous, so it immediately starts acquiring the next 1000 points. Meanwhile, the Chart plots the 1000 points, which takes the same 10 milliseconds. So after 1.010 seconds, the While Loop repeats. On the second loop, after 0.99 seconds, the remaining 990 points have been acquired (the first 10 were acquired at the end of the first loop while simultaneously plotting the Chart data) and passed to the Chart, so the second Loop runs slightly faster, taking exactly 1.000 seconds. All further loops take the same 1.000 seconds, losing 0 data points.
Bob Schor