LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I record the time stamps for a series of digital triggers?

I would like labview to hang until it recieves a digital trigger and then execute a section of code, and then hang again.  Seems straight forward, but everything I can find online is about triggering an acquistion with a digital trigger, not a section of code.  The triggers are coming in too fast to restart a triggered analog acquisition everytime.

0 Kudos
Message 1 of 4
(2,818 Views)
How 'bout you say a bit more concerning what you want to do. Timings? Types of inputs? Other constraints?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(2,805 Views)

I'm going to make some assumptions here, which may be totally wrong, but you haven't given us much to go on.  I'm assuming that you have a device with a Digital I/O port that can be read very quickly (i.e. to read the port takes very little time, say a few microseconds).  [Note -- I don't have a specific device in mind, but assume they exist].  I'm also going to assume that a 1KHz "clock" is adequate, i.e. a millisecond "delay" between a digital line transition and your action is acceptable.

 

With these assumptions, here's one way to handle this:

  • Create a "Clock" consisting of a Timed Loop running at 1 KHz that reads your chosen Digital Line.
  • Save the state of the Digital Line in a Shift Register.
  • By comparing the "new" value of the Line with the previous value, detect a Rising Edge.  Use this to fire a Notifier.
  • Have a second loop with a "Wait on Notification".  When the Clock detects the Digital Line going True and fires the Notifier, this second loop will run (once) and do whatever you need to do when the Digital Line goes high.

For this to work, in addition to the previous assumptions, the Digital signals need to stay High long enough to be read by the DIO port, and need to go low long enough to reset the Clock's DIO state.  This means the DIO line needs a high and low state of at least 1 msec, so the fastest you would fire off events would be 500 Hz (or every 2 msec).

 

Now, this is doing all of the work using an ordinary DIO port.  There are also counter/timer devices on many NI DAQ systems that might have modes that work with triggers (rising edges) directly -- you'd need to read the manuals and see if you can come up with something clever.  My method is slightly "brute force", but can certainly work (if the DIO transitions are "slow") ...

 

Bob Schor

 

Message 3 of 4
(2,774 Views)

Thanks for the excellent and very helpful reply!  All of your assumptions were spot on.  The digital "on" has a 1-5% duty cycle and is "on" for 2 ms.

 

After posting the question last night, I fiddled around somemore and this is what I came up with.  It seems similar to your solution, but a little less advanced.  I was unaware of "notifications" and I'll have to look into that.

Download All
0 Kudos
Message 4 of 4
(2,751 Views)