LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop Timing

Hello, I have a VI that logs data from a while loop. I let the user select how many seconds elapse before each sample is taken. It seems to work for 2 second intervals and greater, but when I set the control to 1 or lower, the minimum data interval is 2 seconds in the log file. I used to be able to collect the data in 1 second intervals when the VI was less developed so my theory is that when I added more content, it seems that the while loop cannot execute fast enough each iteration to keep up with the 1 second interval timing demand. Is this possible? Can there be any other reason for this?

 

Please see attached VI.

0 Kudos
Message 1 of 4
(2,462 Views)

I can't open your VI because it's too new of LabVIEW version but...

 

If your instrument can not respond any faster than every 2 seconds that's all the faster it will respond. 

 

I have a bunch of old Yokogawa WT230 power analyzers in our lab. Most of them only have 9600 baud serial communications, but a few have GPIB. The Serial ones can only be polled about once every 2 seconds, the GPIB ones can be polled as fast as the instruments update rate is set to.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(2,460 Views)

@laps682 wrote:

... I used to be able to collect the data in 1 second intervals when the VI was less developed so my theory is that when I added more content,...

 

Please see attached VI.


I like that theory.

 

Producer/Consumer design pattern may allow for you to sample faster and keep the "other" stuff from slowing down how fast you collect data.

 

You may want to look into that approach.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 4
(2,454 Views)

It may be due to the fact that you run VISA Configure Serial Port for every iteration of the While Loop.  Try moving this to the outside (left) of the loop, so you do it once, do many reads, then close when you exit the While.

 

Bob Schor

 

 

0 Kudos
Message 4 of 4
(2,427 Views)