07-17-2021 12:37 AM - edited 07-17-2021 12:44 AM
I am creating a VI to obtain measurements from an LCR meter with a provided driver (BK891).
The VI already outputs the LCR meter readings every 200 ms on FAST mode, or 500 ms on SLOW. All I want to do is have a time vector associated with this, with a new element appearing the same time as the primary and secondary measurements.
What I expect as an output is:
Time, Primary, Secondary
0, p1, s1
0.2, p2, s2
0.4, p3, s3
etc.
Instead I am getting something like this
0, p1, s1
0.2, p1, s1
0.4, p1, s1
... an actual 200 ms has passed
t, p2, s2,
t+0.2, p2, s2
t+0.4, p2, s2
etc.
It seems that the loop keeps going as fast as possible, even though new data is only generated every 200 ms. I would've thought it would only have data output from the BK891 when new data is generated, and therefore wouldn't loop until it does. What is the best way to fix this?
07-17-2021 06:56 AM
Hi frasdoge,
@frasdoge wrote:
It seems that the loop keeps going as fast as possible, even though new data is only generated every 200 ms. I would've thought it would only have data output from the BK891 when new data is generated, and therefore wouldn't loop until it does. What is the best way to fix this?
Place a wait (until next multiple) function in your loop…
Just adding the "time" data in the loop might be accurate enough for your purposes. I guess it's more accurate (but very easy too) to just determine the elapsed time since the loop started…