09-13-2019 08:49 AM
Hello there,
I am using a cDAQ 9189 with a NI 9263 outputting analog voltage waveforms (sine waves). The software we are using is self-written in C++ using the DAQmx C library.
The user of the software is supposed to change some parameters of the sine wave. The update of that should be as fast as possible. But with the way, I implemented it needs several seconds to take the new values over. I am using the following code to initialize and write to the AO port:
//Init DAQmxCreateTask("OscillationTask",&oscillationTask); DAQmxCreateAOVoltageChan(oscillationTask,NIDaqAdress[0].toLocal8Bit().constData(),"",-10.0,10.0,DAQmx_Val_Volts,NULL); DAQmxCfgSampClkTiming(oscillationTask,"",numSamples*f,DAQmx_Val_Rising,DAQmx_Val_ContSamps, numSamples); DAQmxRegisterDoneEvent(oscillationTask,0,DoneCallback,NULL); //Create data int numSamples = 1000; int phaseN = 0; int i = phaseN; QVector<float64> dataRef = QVector<float64> (numSamples); int PI =3.1415926535; double offset = 0.; for(;i<(numSamples+phaseN);i++){ dataRef[i-phaseN] = amp*sin((double)i*2.*PI/numSamples)+offset; } //Write data float64 data[100000]; memcpy(data, dataRef.constData(), numSamples*sizeof(float64)); DAQmxWriteAnalogF64(oscillationTask,numSamples,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL); //When I want to change something I use again: DAQmxWriteAnalogF64(oscillationTask,numSamples,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL) //It is executed super fast but takes several seconds to see a change at the output
The last function is used for changing the waveform during runtime. It is working fine but needs several seconds to see a change at the analog output. Do somebody maybe have an idea how to optimize this?
Best
Florian
09-18-2019 09:16 AM
Hi florian.vollrath,
I know this post has been open for a little while. You may have more success reposting this in the Multifunction DAQ forums, as this is forum is for Real-Time systems like cRIO and LabVIEW FPGA.
09-18-2019 09:18 AM
Thanks for the hint, I just did 🙂