LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I stop a timed loop in the middle of its cycle?

Hello all,

I'm creating VI that will gather data from a series of thermocouples and outputing that data to a graph as well as to a spreadsheet file.

The sampling rate for each channel needs to be independent and variable. That is, they want to increase the sampling rate to 1/sec during temperature transitions, and then 1/10minutes (for example) when saturated.

I was going to use a menu ring for the user to select the sampling rate (1 second to 15 minutes, with 7 different rates in between) and then, using a case statement, select the value of how long the 'wait (ms)' should wait in each loop.

This kind of works with one major problem. If the user currently has the sampling rate set to 15 minutes, th
en wants to switch it to 1 second, it can take up to 14:59 for the 'wait(ms)' to finish waiting on the 15 minute wait before it switches to the faster sampling rate.

Is there a way to stop a 'wait(ms)' in the middle of its wait cycle? Or is there a better way of doing this?

Thanks in advance for your help.

Dave Neumann
d.neumann@astronautics.com
0 Kudos
Message 1 of 3
(2,994 Views)
"Neumannium" wrote in message
news:506500000008000000E17C0000-1042324653000@exchange.ni.com...
> Hello all,
>
> I'm creating VI that will gather data from a series of thermocouples
> and outputing that data to a graph as well as to a spreadsheet file.
>
> The sampling rate for each channel needs to be independent and
> variable. That is, they want to increase the sampling rate to 1/sec
> during temperature transitions, and then 1/10minutes (for example)
> when saturated.
>
> I was going to use a menu ring for the user to select the sampling
> rate (1 second to 15 minutes, with 7 different rates in between) and
> then, using a case statement, select the value of how long the 'wait
> (ms)' should wait in each loop.
>
> This kind of works with one maj
or problem. If the user currently has
> the sampling rate set to 15 minutes, then wants to switch it to 1
> second, it can take up to 14:59 for the 'wait(ms)' to finish waiting
> on the 15 minute wait before it switches to the faster sampling rate.
>
> Is there a way to stop a 'wait(ms)' in the middle of its wait cycle?
> Or is there a better way of doing this?

Instead of using the wait ms.vi you could use 'tick count' at the beginning
of the loop and then have an inner loop that keeps checking the 'tick count'
until time minus time > time to wait.

You will need to figure out how to handle the case where the millisecond
timer wraps from 2^32-1 to zero. That should not be too difficult.
0 Kudos
Message 2 of 3
(2,994 Views)
hi,

I got this vi from somewhere within this site sometime ago. It might be able to help you in one way or another.

Cheers!
ian
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 3 of 3
(2,994 Views)