# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## How can I measure the time between each two successive rising edges ,using Digital Input ?

Hello

I'm trying two measure the time in seconds between each two successive rising edges on a digital input .

Till now I have managed to detect the rising edge ,increment a counter with each rising edge ,and snap the time at which the rising edge happenned

all I need now is to subtract the current rising edge time from the previous rising edge time in order to calculate (T) which can be 1/frequency and display it in realtime to the user.

but I don't know how to do this

Message 1 of 11
(2,652 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

somebody please remove this post ,I posted another one by mistake ,sorry

Message 2 of 11
(2,647 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

It would help if you included the sub VI "FP Read" with your example program.

This task can be accomplished by setting up a counter input task as a frequency measurement.

Not sure if you tried this yet, but if you include the missing sub VI, we would be able to help a little easier.

Message 3 of 11
(2,644 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

assuming your device does not have a counter....

Spoiler

Message 4 of 11
(2,631 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

The subvi FP Read is included in the Fieldpoint Device Drivers package ,even if i included the subvi ,you wont be able to use coz u dont have the hardware.

the vi typically outputs a boolean number ,either 0 or 1 ,that's it

Message 5 of 11
(2,610 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

Apok

Thanks a lot for your reply ,and yes my device does not have a counter input ,only the digital input .

I just want to know what the use for the two digital inputs *the boolean controls" ? can you please explain to me .

Regards

Message 6 of 11
(2,608 Views)
Solution
08-27-2015 04:09 PM

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

Woah!

Sorry Apok, but your code is becoming way too complicated/messy. I don't think that all of those shift registers or boolean conversion/operators are needed at all.

If you want to measure the timing between two button presses then this is a different (much less complicated) way. It simply records the timing of the button press into a shift register then compares the two.

Spoiler

Of course this is a very quick and basic solution just to show you that it can be much simpler than you are making it (remember to use the mechanical actions of the buttons to get the behaviour you want).

A better way would be to use an event structure looking at value changes of the buttons to determine the timings between clicks.

-CC

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"

Message 7 of 11
(2,578 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

He has only one digital input.

Message 8 of 11
(2,554 Views)

Posted in error.

Message 9 of 11
(2,544 Views)

## Re: How can I measure the time between each two successive rising edges ,using Digital Input ?

Try this. Substitute the boolean control with your FP Read. Note there will be some measurement error due to the FP Read overhead and non-deterministic OS.

The first rising edge "primes the pump" so ignore the first Elapsed Time and Frequency. This gives timing between adjacent rising edges, e.g., 2 and 3, 3 and 4, 4 and 5, etc.

Message 10 of 11
(2,518 Views)