LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two Edge Separation with inconsistent second edge

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.

0 Kudos
Message 1 of 7
(4,242 Views)
If you have a time constraint on the time difference. I mean a maximum allowable time. You can wait until that time has past and start over. 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.
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 7
(4,232 Views)

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

0 Kudos
Message 3 of 7
(4,227 Views)

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 

0 Kudos
Message 4 of 7
(4,225 Views)

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

0 Kudos
Message 5 of 7
(4,205 Views)

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.

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 6 of 7
(4,190 Views)

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

0 Kudos
Message 7 of 7
(4,180 Views)