07-09-2007 03:09 PM
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
07-10-2007 11:43 PM
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
07-11-2007 04:36 PM
07-12-2007 04:37 PM
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.