04-08-2009 04:07 AM
Hello,
I am writting an adapter that allows the user to select a number of channels and then write a buffer out to the channels. I do not know how many channels will be used apriori and cannot tell the system, instead just allow them to send the channel string and then send the buffer. Is it possible to poll the system to see how many channels were created?
Here is the example code:
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,Device_,"",(float64)minVolts_,(float64)maxVolts_,DAQmx_Val_Volts,NULL));
DAQmx Get Number of created channels...
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,length/ ( Number of active channels ),0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
Thank you
04-08-2009 07:19 AM
Ok I got it
DAQmxErrChk(DAQmxGetTaskAttribute(taskHandle, DAQmx_Task_NumChans,&numChannels));
Thanks