LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use the LabView time delay in a while loop instead of using the instrument inherent time loop.

Solved!
Go to solution

I have a zes lmg500 that I use. It has the option of continues measuring data, with a user control cycle loop (still using a while loop but the delay is coming from the instrument). The problem is that the loop time is not constant. Can I use a very short time (100ms) as the instrument cycle time but use a longer time delay in the while loop that collect the data?

I know many instrument offer the same abilities, so the question is relevant to all of them.

Thanks for any help

0 Kudos
Message 1 of 13
(4,447 Views)

I'm not sure exactly what you are doing right now.

How does the instruments communicate (serial/VISA, TCP, etc.)?

How are you timing your loop right now?

 

Sounds like maybe you set it up and then the instrument sends data at fixed (or attempted fixed Smiley Wink) time intervals and you have a loop that simply waits on receiving input?

 

 



0 Kudos
Message 2 of 13
(4,440 Views)

 

 

I'm usimg serial Visa. I'm ataching a picture with comment.

Now the loop is timed by the instrument .

I want to use 100ms as the loop time but use a 1 sec delay in the while loop

Zes.PNG

0 Kudos
Message 3 of 13
(4,435 Views)
I don't understand your question. You can put in a delay that is longer than the instrument requires to acquire. That will be your loop time. If you use a shorter wait, the instrument will still be limiting the rate to whatever it requires and the wait function won't do a thing.
0 Kudos
Message 4 of 13
(4,426 Views)

That is exactly my question. Are you sure that if I’ll use a longer delay then the loop time I’m not going to saturate the instrument buffer?

0 Kudos
Message 5 of 13
(4,418 Views)

Does that measurement VI have built-in wait functionality and a timeout?

 

If not, then you are simply polling the VI at 1 kHz, but I suspect that this is not the case or your Waveform Chart probably wouldn't look as you expect (getting 0's put in everytime measurement data is not available).

 

 

I expect that if you have the instrument set up to send data at a fixed time interval (i.e. 100 ms), all the data that it is sending you will end up residing in your serial buffer (or the instrument driver will have taken it out and put it in another internal buffer), so if you come back to read it 1 sec later, then you will have 10 data points to go through.  Whether you can read them all at once with the read VI or have to call it a whole bunch of times until empty I can't say.

 

 

What is your objective?



0 Kudos
Message 6 of 13
(4,414 Views)

All i want is to read the data at one secont interval. But I want the one secont to be exact, If I use 1sec as the cycle time the actual loop time is 970ms-1040ms.

 

0 Kudos
Message 7 of 13
(4,406 Views)

All i want is to read the data at one secont interval. But I want the one secont to be exact, If I use 1sec as the cycle time the actual loop time is 970ms-1040ms.

 

0 Kudos
Message 8 of 13
(4,405 Views)

Another problem that might happen is that Ill collect and ‘old’ data – meaning every time I read instead of reading the last data points ill read the first one in the internal buffer

0 Kudos
Message 9 of 13
(4,397 Views)
Solution
Accepted by topic author erezg
You aren't going to be exact with Windows. The time between samples should be what you have programmed the instrument for (i.e. the time between each value in the 1D array) but the iteration rate of a while loop is always going to be subject to some jitter on a non real time os.
0 Kudos
Message 10 of 13
(4,393 Views)