LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure different rates and how to write different data for diffrent channles using NI-6723 card.

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
0 Kudos
Message 1 of 2
(2,876 Views)

Hello krishna,

You are getting that error because you cannot use two separate analog output tasks on the same device.  Why do you need to have different rates for the two channels?  Perhaps you can form your waveforms for both channels with a rate that will work for both of them so that you can put them in the same task?

Regards,

Laura

0 Kudos
Message 2 of 2
(2,858 Views)