11-21-2008 08:06 AM
I have a Daqmx program that is counting time between two edges. My problem is that my second edge doesn't always happen so I am getting error messages that the first edge happened twice or it just times out. My program works perfectly in a bench test where the edge is always there. Is there a way that I can make my program ignore the drop outs?
I need the program to count time between the two edges when they occur but if the edge on input 0 occurs without a following edge on input 1, i need the program to start over and look again without sending an error. Any ideas? My Vi is very similar to the 201188.vi example at ni.com.
Any tips would be appreciated.
Thanks.
11-21-2008 12:14 PM
11-21-2008 12:27 PM
Andre
Thanks. I was wondering about the min and max times. I didn't know what it would do when it hit the max. If it doesn't throw and error than that will work for me. I'll give it a try and let you know.
As for the second thing you said:
"Or when receiving a second edge on input 0 and no edge on input 1 in the mean time, restart the measurement with the latest edge detected on input 0"
How do you do that? I haven't seen a mechanism for that.
This program counts fast moving events that occur at around 160 hz. I have six counters running at once so solutions have to be something that can run without input from me and happen quickly.
Thanks
11-21-2008 12:38 PM
Use a shift register for each channel. When an edge (0) is detected put a boolean True in the shift register. When edge (1) is detected reset the boolean to False. If an edge (0) is detected when the boolean is True or and edge (1) when it is False, you have an error and need to restart the measurement. You may need to look at the initialization if you actually watch for both edges simultaneously.
Comparisons and shift registers are very fast so you should not have a speed problem.
Lynn
11-24-2008 10:22 AM
I'm not sure how to separate the two channels since both edges are going into one channel. I have attached a vi that is a sample of one of my counters. I have six total in ths program that can be turned on or off. I have been doing Labview for a year but the Daq MX stuff is a new thing for me.
Thanks
11-25-2008 01:52 PM
RZTC,
I'd recommend you look at some of the LabVIEW shipping examples on this topic. In the LabVIEW example finder (Help » Find Examples) browse to the Two Edge Separation examples: Hardware Input and Output » DAQmx » Counter Measurements » Two-Signal Edge Separation. These examples show the basic architecture of a Two Edge Separation program.
To ignore the missing pulses, I'd recommend modifying the Continuous example to suit your needs, and adding a "Clear Errors" VI in the while loop to ignore the timeout error.
11-26-2008 07:59 AM
Thanks for the feedback. As a relative nube, I always look at examples first on about everything I do. I put the clear errors vi in the loop and I also set the timeout to look once and move on. I know that will throw the error but the clear errors should make it ignore that. Hopefully it will run smoothly and only give me data upon the event.
We should run today. I'll post my progress.
Thanks