Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronized Analog Input and Output Finite Samples Different Clock Rates

I understand and have successfully programmed with the AI_AO_rate.vi example a control and feedback system using USB6215 with synchronized clocks where the output and input clock rates are equal.  As the example shows, I wire AO/sampleclock to the input of the DAWmx.timing VI.
 
I am now looking to make the AI clock a multiple of the AO clock (as part of an oversampling algorithm), yet still keep the synchronized outputs.  How can I do this?
0 Kudos
Message 1 of 4
(3,781 Views)

Hello Jmarzouk,

You will find a DAQmx example in the LabVIEW Example Finder called
'Multi-Function-Synch AI-AO.vi'.  This example is already set up to synchronously perform analog input and output at different rates.   The synchronization occurs due to the fact that the analog output is triggered by the start of the analog acquisition and a shared clock is used. 

If you need to continuously update the signal which is being written to the analog output channel (as you suggested by 'control-feedback') you can update the buffer by adding a 'DAQmx Write' inside the acquisition loop.  You could for example read at 10 times the output rate, and then write one output based upon the 10 input values you read.  Depending on the rates you specify there will be a finite delay before the output appears (i.e. the output will display your previous feedback value until you analyze and write your value to the buffer).  You will want to add a DAQmx Write Property Node and set RegenMode to 'do not allow regeneration'.

A second option would be to run both tasks at the same rate and simply duplicate your analog output values to simulate the slower rate.  M Series Synchronization with NI LabVIEW and NI DAQmx provides more information on synchronizing different types of tasks.

Hope this helps,

Jennifer Ormston
Applications Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,755 Views)

Hi,

First of all, thank you Jennifer for your prompt response. 

I had already seen the example (Multifunction synch AI-AO) you specified in your response; unfortunately I do not have an external ai/StartTrigger in my system.  Is there some internal system start trigger I can use?  Also, I'm not clear about what you mean when you write that the analog output start depends on the analog input start - it seems the DAQmx Start Task.vi for the output comes before the DAQmx Start Task.vi for the input.  Maybe I'm misunderstanding this vi....

I do not need to do continuous feedback; just update my output values once a second (after an acceptable processing delay of the input data).

I tried running both clocks at the higher rate; however, the software or the box couldn't keep up with the output of 100x data in addition to the 100x oversampling.

Thanks again for your assistance,

Jerry

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

Hi Jerry,

The example 'Multi-Function-Synch AI-AO.vi' does not require any external trigger.  It works by first setting up the analog output to wait for the analog trigger and writing to the output channel buffer and starting the analog task.  The output task then has all the data it needs, but is waiting for the analog input to start before outputting any values.

Next the analog input channel (which has already been configured) is started.  This throws the aiStartTrigger and begins acquiring samples into the input buffer.  The trigger causes the output buffer to begin writing its samples, hence synchronizing the output to the input without any physical external triggering signals.

If you do not need exact timing you could also do a single point software timed output and simply output one sample in each while loop based upon the samples you have read.  For example you could read in 100 samples with each analog read, determine the desired output and write a single point (software timed) to your analog output channel.  For this you would simply use a Continuous Acquire Voltage example and add the functionality from 'Gen Voltage Update' example.  The analog write would be placed inside your acquisition loop, the Create Channel would come before, and the Clear would follow.

Regards,

Jennifer O.

 

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