From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing how long for a value to change

Hi, I want to write a small routine that reads an analogue value when a button is pressed and when the value drops by a set amount the time taken is calculated and displayed and the loop (or whatever) is stopped.

I seem to have a mind block today because I am sure I have done a similar thing using shift registers before.

Anyway, if you can help I would be most grateful. Using Labview 5.1 or 6

Thanks

Allan
0 Kudos
Message 1 of 3
(2,353 Views)
You are right.
You can use a shiftregister for this problem. In a while wait until the key is pressed then go into another while and measure your signal, compare the measured value with the previous value and decide whether or not to stop. The previous value can be read from a shiftregister that is filled in the while.
Depending on the measurement speed you can use single reads or blockreads. You can look this up in the DAQ examples.
Timing is best measured with the tick counts (ms) function. Just before you enter the measuring while and just behind the measuring while. Use a single sequence frame before and after the while to be sure that the tick count is measured at the correct moment
greetings from the Netherlands
Message 2 of 3
(2,353 Views)
To see a absolute change no shift register is necessary.
Only read the value before executing the second while loop
and compare this value to the value read inside the second while
loop to stop when the difference is greater than wanted.

albert geven wrote:
>
> You are right.
> You can use a shiftregister for this problem. In a while wait until
> the key is pressed then go into another while and measure your signal,
> compare the measured value with the previous value and decide whether
> or not to stop. The previous value can be read from a shiftregister
> that is filled in the while.
> Depending on the measurement speed you can use single reads or
> blockreads. You can look this up in the DAQ examples.
> Timing is best measured with the tick counts (
ms) function. Just
> before you enter the measuring while and just behind the measuring
> while. Use a single sequence frame before and after the while to be
> sure that the tick count is measured at the correct moment

--
Stephan Heising
0 Kudos
Message 3 of 3
(2,353 Views)