06-05-2008 05:00 AM
06-06-2008 05:50 PM
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.
06-07-2008 04:19 AM
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
06-09-2008 12:28 PM
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.