LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instrument Data Output Even When No New Data From Serial

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?

 

mycode.png

0 Kudos
Message 1 of 2
(677 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(627 Views)