Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB 6211 - PyDAQmx - Sync Analog Inputs with Analog Outputs

Solved!
Go to solution

Hello,

 

I have a USB-6211 which controls XY galvo stages with its 2 AO channels. As galve stage moves, I need to measure light intensity (photo diode detector) with 6211's AI channels. The detector we are using doesn't support external trigger so it's continuously reads. Galvo scanner returns its position voltage but it's too low to use as a trigger and 6211 doesn't support external trigger. I need to synchronize analog input data I'm reading but I'm not sure how to do this. I tried to set the AI task to use AO sample clock and wait for AO to start but doesn't seem to work. What would be a good way to accomplish this? Any help is really appreciated.6211_ai_sync.JPG

0 Kudos
Message 1 of 6
(3,703 Views)

Opps, I was searching the forum and somehow used one of thread I was reading as my subject. This is misleading - I don't want to do it in Python, rather do it in LabVIEW.

0 Kudos
Message 2 of 6
(3,685 Views)
Solution
Accepted by topic author DKFF

It's right to config the AI task to use "/Dev5/ao/SampleClock", but don't config the AO task the same way.  Though it seems intuitive to do so, it's wrong.  Simply leave the 'source' input of DAQmx Timing unwired for the AO task -- that'll signal DAQmx to do the default thing which is to create a sample clock from its own internal timebase.

 

Following that, you should start the AI task before starting the AO task.  That way it'll be ready for the first AO sample clock signal that it's configured to use.

 

 

-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.
0 Kudos
Message 3 of 6
(3,669 Views)

Hello Kevin,

 

Thank you for your input again. The problem is, AI starts acquisition soon as I start reading. I want to have AI task to wait until AO starts (and hopefully AI and AO are synced). Is it because I'm running in simulated 6211? I can try it on the real 6211 tomorrow but thought simulated DAQ should work the same as real one.

Thanks again.

0 Kudos
Message 4 of 6
(3,664 Views)

On a real device, you can start the AI task long before you start the AO task.  It won't matter.  No AI samples will get taken until there's an AO sample clock signal to cause sampling, and that won't start until you start the AO task.  Note that if you try to Read from your AI task long before you start AO, you may get a timeout error while waiting for the sample clock to show up.

 

Simulated devices are not a perfect simulation of real devices, especially when it comes to data values and timing.   A call to DAQmx Read on a simulated device simply returns simulated data.  It doesn't try to deeply analyze the configuration of timing & triggering signals and the sequencing of other tasks before deciding whether or not to return data.

 

 

-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.
0 Kudos
Message 5 of 6
(3,661 Views)

Thank you for the help. It works as expected with the real 6211.

0 Kudos
Message 6 of 6
(3,645 Views)