Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronise AI/AO with USB 6212 using triggering

Hi,
 
I am currently using a USB 6212. I am trying to improve the speed of the application that I have written
 
The task of my application is to turn a mirror (analog voltage output) and then measure the intensity of the new location via a photodetector(analog voltage input). I would need to measure multiple points and take multiple samples for a single point.
 
Previously I have programmed the application for the process to proceed sequentially. I am using finite AI sampling in which the acquisition process is started at each cycle(each point the mirror turn to) ie AI Start Task and AI Stop Task is started at each point. The point is taken to be processed. A rough pictorial diagram is shown in the query.jpg. This seem quite slow as the AI Start and Stop seem to consume up lengthy amount of processing time
 
Currently I am exploring ways to improve on this.  I am trying to program it for continuous acquisition and using triggering to obtain the samples at each step and synchronise the movement of mirror at the same time.
 
I have a number of following question that required some help here
1) If I am using continuous acquisition, do I have to use independent parallel loop for the acquisition?
 
2) Is there any internal trigger signal that I could use to start the acquisition/process and how do we go about it? Currently I do not have any external device capable of generating the digital trigger for the USB 6212. Is there any internal signal that is produced after AO is updated?
 
3) Is there any way we could synchronise the starting of both the movement of mirror and acquisition together or  at least 1-2 cycles after the mirror is shifted?
 
4) How do we test for synchronisation and timing? Again is there any internal signal updates that could inform us about the timing cycles?
 
5) Would like to know if there is any similar or somewhat similar vi examples that I could further expand my work on(I am using Labview 7.1)?
 
Thanks for the patience and help!
0 Kudos
Message 1 of 4
(3,604 Views)

Hello Water,

You do not have to use independent parallel loops for your analog output and input tasks. To trigger your analog input tasks, you can use the following internal signals: ai/StartTrigger or any Counter n internal output.  To implement this, just place a DAQmx Trigger VI in your task, select the Start Digital Edge option, and wire a control for the source input. Wire a constant to the edge input of the DAQmx Trigger VI, and you have set up triggering for your acquisition.

 

When you are doing analog output, there is no DAQmx function that generates a flag or signal to indicate when the analog output has been updated. The simple way to test when the analog output updates is to monitor the ao line and the sample clock with an oscilloscope and see how the value of the ao channel changes with the appropriate edge of the sample clock. Also, the only true way to test whether your analog input and output is truly synchronized is to monitor the analog input and output channels, and the sample clocks with an oscilloscope.

 

Lastly, I will refer you to a NI Developer Zone article that discusses synchronization of analog input and output. There is an example VI that you might find useful.  The article is linked below.

 

http://zone.ni.com/devzone/cda/epd/p/id/2352

 

Best wishes,

Wallace F.

National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(3,578 Views)

Thanks!.

I have another question here. Most of the synchronise and triggering example I have seen are mainly one shot acquisition ie some form of changes occur(AO update) and the AI acquisition is started.

However, I would need to made many AO updates and take AI acquisition for each changes. The simplest way seem to me is to simply put everything in a for loop and run it for n times. But this does not seem to be efficient or fast in my point of view.

Some examples that I have seen utilise CO counter pulse so that they can retrigger the AI acquisition(eg Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.vi). Is this the common way to do it? If this is true, i presume that it is possible to use this counter pulse to reset/retrigger both the AI and AO output so that the process can be restarted. Would this be possible?

Thanks once again  

0 Kudos
Message 3 of 4
(3,569 Views)

Hello Water,

It is possible to retrigger your analog input operation.  While I cannot attest to whether or not using the counter output pulse as the trigger for your analog input is the common way to do it, I can verify that it is a valid method.

The Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.vi example uses the counter’s internal output as the sample clock for the analog input operation.  This is not the same thing as using the counter output to trigger the analog input operation.

To use the counter output to retrigger the analog input, you must first create a counter output channel in DAQmx.  Then, place a DAQmx Start Trigger VI in your analog input task sequence, usually after the DAQmx Timing VI. Create controls for the required inputs to the DAQmx Start Trigger VI, and select the counter internal output of your DAQ device as the source input of your DAQmx Start Trigger VI.

Best wishes,

Wallace F.

National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(3,550 Views)