LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Single pulse digital output triggered externally

 

What is the easiest way to output a single pulse on a digital line (using PCIe 6363) triggered externally so that the pulse width of the digital output is the same as the pulse width of the external trigger?

Thanks in advance !

0 Kudos
Message 1 of 11
(3,837 Views)

connecting external signal to dig input and write its value to desired dig output

bp
0 Kudos
Message 2 of 11
(3,824 Views)

Thank you for the quick reply. The thing I had forgotten to mention is that the trigger is a pulse train and the digital output is only one pulse.

0 Kudos
Message 3 of 11
(3,821 Views)

I didn't get --pulse width of the trigger should equal pulse width of output

and "single output pulse"

do you mean overall on/off time of pulse train reflect as single output pulse? or what

bp
0 Kudos
Message 4 of 11
(3,812 Views)

maybe this image helps understand

0 Kudos
Message 5 of 11
(3,803 Views)

digital output with time delay may work depending on how frequent you want to repeat this, or you should go with counter output

bp
0 Kudos
Message 6 of 11
(3,780 Views)

I'll have to check when I have a PC in front of me but,. A DO task with a pause trigger and inverted output should work.


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(3,756 Views)

@JÞB wrote:

I'll have to check when I have a PC in front of me but,. A DO task with a pause trigger and inverted output should work.


I was close.Capture.pngCapture1.png

 

You may need to play with sample rate and # samples to get the resolution you need.  On Simulated HW I can't really mess with the required trigger input

 


"Should be" isn't "Is" -Jay
Message 8 of 11
(3,742 Views)

Hmmmmmm.  Some other responses came in while I was queuing up mine.  My answer is quite a bit more complex, but I think the complexity is necessary to accomplish what I *think* you're looking for.  Let me define what I *think* you're looking for:

 

Q: Given an incoming pulse train with unknown pulse width, make a program that will produce a single output pulse that coincides with the 1st input pulse very precisely (same pulse width, no delay).

 

A: My solution outline below will produce the same pulse width and a minimal, hardware-deterministic sub-microsec delay.  The output pulse will coincide with the 1st input pulse if the program starts before the input pulse train.  It will coincide with either the 1st or 2nd *full* input pulse if the input pulse train is free running before the program starts, depending on the phase of the input when the tasks start.

 

Ok, on with my original post...

--------------------------------------------------------------------------

 

A high-speed & accurate solution is gonna be trickier than you'd expect, mainly because most DAQ hardware-timing capabilities are only sensitive to 1 kind of edge at a time, either rising or falling but not both.  The main exception I know of is digital change detection.   Here's an outline of what you'll need to do:

 

1. Create a DO task, start it, write a low state to your output pin, then stop and clear the task.  This sets the initial state of your output pin low in case the power-up state had been high.

2. Configure a DI task where DAQmx Timing is configured to use change detection.  You can make it work with either Continuous or Finite Sampling, I'd probably opt for Continuous.

3. Configure the DI task to be sensitive to both rising and falling edges of the incoming pulse train.

4. Create a new DO task for your output pin.  Configure DAQmx Timing for Finite Sampling and # samples = 2.

5. For your DO task, define the Sample Clock 'source' input to DAQmx Timing to be something similar to "/Dev1/ChangeDetectEvent".

6. Use DAQmx Write to write 2 DO samples to the buffer -- a high then a low.

7. Start the DO task.

8. Start the DI task.

9. Wait for the (finite) DO task to complete

10. Stop and Clear both DO and DI tasks.

 

Once the DI task has started, every observed transition on the configured input pin will result in a "change detection event".  The DO task uses these as a sample clock.  The first transition (presumably rising edge of an input pulse) causes a high output, the second one causes a low output.  The DO task is now done as it was configured for 2-sample Finite Sampling.

 

Believe it or not, that was actually a *minimal* best-case set of instructions which will work for the specific case that you can start your program at a time when you know the input pulse train is idle.  If the pulse train can be already present when you start your program, you'll need to add the following:

 

11. Configure a trigger for your DO task.  Set it to trigger off the trailing edge (probably 'falling') of the signal named something similar to "/Dev1/ChangeDetectEvent". 

12. Configure the DO task's sample clock to be active on the leading edge (probably 'rising') of the same signal.

 

This makes sure that whatever state the input pulse train is in when you start your program, you don't trigger the DO task to start until seeing the *end* of the 1st change detection pulse and you don't generate any output samples until you see the beginning of the *next* change detection pulse.

 

 

-Kevin P

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 9 of 11
(3,736 Views)

I appreciate the answers of all!

 


Kevin_Price wrote:

Q: Given an incoming pulse train with unknown pulse width, make a program that will produce a single output pulse that coincides with the 1st input pulse very precisely (same pulse width, no delay).



I could not have said it better !

 

I will have a go on your road plan and hope to provide feedback prior to sinking in further work.

0 Kudos
Message 10 of 11
(3,725 Views)