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: 

Start a timer with a binary input and stop it with another binary input and define the elapsed time.

Hi,

 

I am trying to implement a very simple timing task, if I press a start button I will initiate a timer to start counting the time elapsed in milliseconds, once I press the stop button the timer stops and I can display the time elapsed between the two button press. Anyone able to give me a hint on what timing block I can use to code such performance?

 

Many thanks

 

 

0 Kudos
Message 1 of 2
(817 Views)

Look in the timing palette. You need a simple state machine. Since you only have two states, you only need one button with switch mechanical action. Press it to start the time and press it again to stop.

Did you do the basic tutorials? Do you know about shift registers and feedback nodes?

The tick count gives you a relative millisecond value, so an elapsed time can be calculated from the difference between two readings. On START, place the current tick count into a shift register, then run the loop at 1ms period, reading a new tick count and subtract the start value to get elapsed time

 

Also search the forum....

 

See how far you get. (I recommend to stay away from express VIs.)

0 Kudos
Message 2 of 2
(780 Views)