I would like to configure two channels like below :-
Dev1/ao1 with rate as 80000
Dev1/ao2 with rate as 500000
After Configuring I would like to write different data for the above two channels. How can this be done?
The below snippet shows the way I am configuring two channles with different rates.
Snippet :-
Channel : Dev1/ao:
rate : - 80000
1.DAQmxCreateTask("Dev1/ao1",taskHandle);
2.DAQmxCreateAOVoltageChan(taskHandle,"Dev1/ao","",-10.0,10.0,DAQmx_Val_Volts,NULL);
3.DAQmxCfgSampClkTiming(taskHandle,"",80000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);
5.DAQmxWriteAnalogF64(taskHandle,bufferSize,0,10.0,DAQmx_Val_GroupByChannel,data,&written,NULL);
6.DAQmxStartTask(taskHandle);
Channel : Dev1/ao2:
rate : - 500000
1.DAQmxCreateTask("Dev1/ao2",taskHandle1);
2.DAQmxCreateAOVoltageChan(taskHandle1,"Dev1/ao","",-10.0,10.0,DAQmx_Val_Volts,NULL);
3.DAQmxCfgSampClkTiming(taskHandle1,"",500000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);
5.DAQmxWriteAnalogF64(taskHandle1,bufferSize,0,10.0,DAQmx_Val_GroupByChannel,data,&written,NULL);
6.DAQmxStartTask(taskHandle1);
If I configure the above channels with different task handle, I am getting an error saying that "Task is already reserved, specified operation cannot be performed" and halts execution.
Please reply ASAP
Regards
krishna