LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Syncing digital output and counter output with external trigger

Solved!
Go to solution

I am new to LabVIEW. I am trying to send  two independent  finite trigger pulses signal that have a delay with each other, that should be in sync with an external oscillator. 

I am using an m series board. What will be the best way to implement this.

The external oscillator gives out 400KHz. I tried a simple approach using the error lines but the delay is not constant between the two signal. 

I need the digital signal to start 100micro second before the counter output which should start few millisecond after the external trigger input(oscillator)

Thanks in advance 

0 Kudos
Message 1 of 17
(1,534 Views)

Please attach your code. We cannot debug an image.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 17
(1,522 Views)

I am attaching the code for reference

0 Kudos
Message 3 of 17
(1,466 Views)

Sure, attaching code for refernce.

Thanks

0 Kudos
Message 4 of 17
(1,465 Views)

I'm generally a big proponent of counter/timers, but they're kinda different from the other kinds of data acq tasks (AI, AO, DI, DO).  So as someone coming in new to this stuff, you might want to just generate both pulse outputs using 2 distinct DO lines in a single DO task.

 

The main potential benefit of using a counter/timer would be more precise timing resolution.  The DO task can only create pulse timing with integer multiples of the sample period, but that may very well be sufficient.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 5 of 17
(1,439 Views)

Thank you for taking your time to answer. I want to generate n pulse of 500~1000ns, I am using the counter for this. The digital out is for the camera trigger(100 micro second). I am using an M series, and hence can't use two counters together as there are only 2 counters and we require two for generation of n pulses. 

I am having a hard time starting the two processes together. 

This must be in sync with the pulse from the oscillator - 400KHz 

Thanks

0 Kudos
Message 6 of 17
(1,433 Views)

The sync problem you have in your code right now is that the two tasks are free to start on *different* cycles of the external 400 kHz clock.  You need them both to start on the *same* cycle.  Here's how:

 

Configure the DO task to use one edge of the 400 kHz signal as the sample clock (as you already do) and to use the *other* edge as a start trigger.  Configure the CO task to be triggered off the internal timing signal "/digitizer/do/StartTrigger".   Then set up your task start sequencing differently so that the CO task is started *before* the DO task.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 7 of 17
(1,427 Views)

Thank you for the guidance. I tried following it, but I encountered an "Error -200452 occurred at DAQmx Start Trigger (Digital Edge).vi:3930001 -

Possible reason(s):Specified property is not supported by the device or is not applicable to the task.". I am also attching a screenshot for reference. 

For reference, I am using PCIe - 6251.

Thank you again for the help.

0 Kudos
Message 8 of 17
(1,389 Views)

I double-checked with a simulated device and I guess my memory's getting rusty about M-series details...

 

It's ok, we can still get there from here.  We'll just have to use a dummy AO task as a helper.  The AO task will support the triggering and routing we need.

 

So NOW, configure an AO task to use the 400 kHz signal as a falling edge start trigger.  You will start this task LAST.   Don't configure DAQmx Timing for the AO task at all -- that'll let you fire up this dummy task without generating any new AO output signal.

    Because of what I see about signal routing in MAX for a simulated M-series device, I'm going to further recommend that you use DAQmx Export Signal to route the AO task's start trigger to a PFI or RTSI line.  RTSI is less likely to interfere with anything else you're doing.

 

Then configure both DO and CO to use the AO task's exported start trigger signal as their own respective start triggers.  Also configure DO to use the rising edge of the 400 kHz signal as a sample clock.  Start both of them FIRST.   They will be synced when you later start the AO task that triggers them at the same time, off the same specific edge of the 400 kHz clock.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 9 of 17
(1,384 Views)

Thanks once again for the guidance. I tried implementing the same. Unfortunately, encountered an error - "Error -200452 occurred at DAQmx Start Trigger (Digital Edge).vi:3930004. 

Possible reason(s): Specified property is not supported by the device or is not applicable to the task.

Property: Start.TrigType"

This happened when I implement start trigger on digital line. 

I went through the data sheet and did not see start trigger in external digital trigger for DO

https://www.ni.com/docs/en-US/bundle/pci-pcie-pxi-pxie-usb-6251-specs/page/specs.html#GUID-5BB1ED0F-...

I am attching the code and error message for your reference.

Thanks again.

0 Kudos
Message 10 of 17
(1,376 Views)