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
Can somebody please help me !!!
Solved! Go to Solution.
somebody please remove this post ,I posted another one by mistake ,sorry
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.
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
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 .
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.
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.
He has only one 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.