LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering at the end of a digital pulse train?

Stumped here, i have a digital pulse train it's (4) pulses per revolution and A and B phase for direction.  I'm not really interested in the number of pulses I just want to trigger the data capture to start once the pulse train ends.  Is there a simple way to do this?  

 

I currently am using the IMPLIES function to detect when the signal goes from High to Low depending on the situation, I just can't think of a way to use this for the whole batch of pulses.  The only other thing i can think of is to throw a delay in there because i know the pulse train lasts for (15) seconds.  Would not be the best fix however the encoder is based on motion, if the velocity is changed the time will change.

 

Any thoughts on this or direction would be appreciated.  I'm using a cDAQ 9174 with an NI 9423 DI card.  Works great for single pulses.

0 Kudos
Message 1 of 3
(1,879 Views)

First thing that comes to my mind is some kind of time out.

 

If a pulse is not received before the timeout expires 

Then trigger

Else reset timeout and wait for next pulse

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 3
(1,875 Views)

Finding the start of a signal is easy, finding the end is a lot trickier and more ambiguous (how do you define "the end"?).  However, if you are talking about a Digital Pulse Train, you have a reasonable possiblity -- count the pulses.  Note that you don't need to know how many pulses there will be in the Train at the beginning of the Train, you only need to know the count before the end of the Train, i.e. before the last Pulse.

 

Here's how it works:

  • You are ready to deliver a finite Pulse Train of unknown length.  Set the Pulse Index to 0 (# of pulses so far), and set the Last Pulse to -1 (or some Very Big Integer).
  • Start generating pulses and counting them.  If Pulse Index >= Last Pulse, stop.
  • While this is going on, you are doing code in the background that can decide when to stop, i.e. can compute Last Pulse.  Go ahead and set it whenever you can.  Note that even it you set it "too late", it will still stop the Pulse Train.

I used this scheme to capture an AVI from a video camera, starting the Video one second before a Start Event (defined by monitoring an analog signal) and ending a second after an End Event (monitoring the same analog signal).  In this case, I was counting Video Frames -- my initial End Frame was set to -1, and as soon as the End Event occurred, I added 1 second's worth of Frames to the current Frame and set that as the End Frame.  Worked like a charm.

 

Bob Schor

0 Kudos
Message 3 of 3
(1,846 Views)