11-21-2012 08:21 AM
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 😞
Can somebody please help me !!!
Solved! Go to Solution.
11-21-2012 08:29 AM
somebody please remove this post ,I posted another one by mistake ,sorry
11-21-2012 08:36 AM
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.
11-21-2012
11:58 AM
- last edited on
11-26-2012
09:00 AM
by
MaryH
11-22-2012 02:27 AM
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
11-22-2012 02:28 AM
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
11-22-2012 09:46 AM - edited 11-22-2012 10:05 AM
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.
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
11-22-2012 05:10 PM - edited 11-22-2012 05:24 PM
He has only one digital input.
11-22-2012 06:00 PM - edited 11-22-2012 06:06 PM
Posted in error.
11-22-2012 08:10 PM
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.