LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate multiple analog outputs simultaneously using PCI 6723

Hi Jordan,

Thanks for the reply.  I have another question that somebody may be able to help with.  How which C functions do I use to emulate the Labview DAQmx Write (Analog 1D Wfm NChan NSamp) VI? 


For example, If I have a 50kHz Sample Rate, and I want to generate output on two channels, 60Hz and 60.1Hz.  From the Simulate Signal VI, I get a waveform with 50000 samples and 46589 samples respectively.

Will this sequence do the trick??

Rate = 50000

Create signal 1 (50000 samples)

Create signal 2 (46589 samples)

Concatenate signal 1 and signal 2 into a Data array of size 96589

DAQmxCreateTask("",taskHandle);

DAQmxCreateAOVoltageChan(*taskHandle,"Dev1/ao0 Dev1/ao1","",min,max,DAQmx_Val_Volts,NULL);

DAQmxCfgSampClkTiming(*taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps, 50000);

DAQmxCfgSampClkTiming(*taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps, 46589);

DAQmxWriteAnalogF64(taskHandle,bufferSize,0,10.0,DAQmx_Val_GroupByChannel,data,&written,NULL);

DAQmxStartTask(taskHandle);

DAQmxIsTaskDone(taskHandle,done);

Thanks in Advance,

Francis

0 Kudos
Message 11 of 14
(1,632 Views)

Hi Francis,

There are a few things that I noticed in your code that might cause you trouble during implementation. It was my understanding that you were trying to generate two signals and then output each of them to their own analog output channel. In the pseudo-code that you wrote out, you mentioned concatenating the signals. If you are in fact concatenating them, then you will only have one signal to output. On the other hand, if you are trying to build a multidimensional array with two different sized arrays as inputs you will run into trouble.

I have a few questions that might help clear things up:
Are you trying to set up a single analog output task?
How many channels are you trying to output to?
If you are planning on having two different analog outputs, each with their own signal of different lengths, what do you want to be sent out on the analog output of the shorter signal while the longer signal is finishing its generation?

You also might want to take a look at the following Knowledgebase article.

AE KB 3STFMI46: Simultaneous Analog Output Tasks on the Same Device

Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 12 of 14
(1,609 Views)
Hi Jordon,

To answer your questions,


Right now, i'm hoping to get at least 4 channels of SineWaves with real time variable control  of amp,freq,phase,offset...

I initialy have it setup for single analog output task.  It seemed to work okay in Labview.  I've attached the block diagram of the labview diagram i want to emulate.

All of the signals will be set to regenerate. Is it possible for analog output of the shorter signal to regerate it's own buffer while the longer signal is finishing its generation of the longer buffer?

Thanks again for your help.

Francis
0 Kudos
Message 13 of 14
(1,595 Views)

Hi Francis,

In order to be able to change your values on the fly, and have them outputted, you will need to use a non-regenerative analog output. If you look in the Example Finder for LabVIEW (Help » Find Examples) under Hardware Input and Output » DAQmx » Analog Generation » Voltage » Cont Gen Voltage Wfm-Int Clk-Non Regeneration. Using non-regeneration will prevent the buffer from using the same data over and over again and will instead pull in new data from your signal generator. If you follow the same steps in your text based application you should see the same results.

Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 14 of 14
(1,582 Views)