07-06-2017 04:27 AM
I have a PCI-6722 DAQ card that I am programming with DAQmx.
I want to perform a data acquisition for analog and digital ports in the same time.
I tried to create 2 tasks but i get the error: (0xFFFCF267): Task name specified conflicts with an existing task name.
I tried also to create two channels for the same tasks but i still have problem.
DAQmxCreateAOVoltageChan(_hSamplingTask, "Dev2/a0",NULL , -10.0, 10.0, DAQmx_Val_Volts, NULL);
DAQmxCreateDIChan(_hSamplingTask,"Dev2/port0","",DAQmx_Val_ChanForAllLines);
>>> (0xFFFCF091): Task cannot contain a channel with the specified channel type,
because the task already contains channels with a different channel type.
Is it possible to do this test ?
Thanks.
07-06-2017 04:34 AM
As the first error told you, you need to supply a different name for each task.
07-06-2017 04:46 AM
But both tasks have different names:
result= DAQmxCreateTask("Dev2_PFG",&_hSamplingTask);
if (result<0) {
daqmxLogError(result,"DAQmxCreateTask");
_hSamplingTask= 0;
return false;
}
result= DAQmxCreateTask("DioTask",&_DioTaskHandle);
if (result<0) {
daqmxLogError(result,"DAQmxCreateTask");
_DioTaskHandle= 0;
return false;
}
07-06-2017 04:50 AM
In your first post, you are using _hSamplingTask for both the AO and the DIO.
07-06-2017 05:00 AM
Actually because i tried two solution:
1. The first solution is to create two session, one session for AO and the other for DIO.
I get the error when i create the second task: (0xFFFCF267): Task name specified conflicts with an existing task name.
2. The second solution is to create only one session and to associate it tow channels AO and DO.
DAQmxCreateTask("Dev2_PFG",&_hSamplingTask);
DAQmxCreateAOVoltageChan(_hSamplingTask, "Dev2/a0",NULL , -10.0, 10.0, DAQmx_Val_Volts, NULL);
DAQmxCreateDIChan(_hSamplingTask,"Dev2/port0","",DAQmx_Val_ChanForAllLines);
I get The error : (0xFFFCF091): Task cannot contain a channel with the specified channel type,
because the task already contains channels with a different channel type.
07-06-2017 07:03 AM
C.Assem wrote:
1. The first solution is to create two session, one session for AO and the other for DIO.
I get the error when i create the second task: (0xFFFCF267): Task name specified conflicts with an existing task name.
This tells me you uses the same name for the two task names. Since you did not supply any code, I cannot verify your setup.
The other possibility is that you did not close the tasks and therefore DAQmx still has the tasks open.
07-06-2017 07:41 AM
In fact I did not share the code because it is a large application that contains several modules and that it will take a long time understand it.
Below you will find the DAQmx code:
result= DAQmxCreateTask("Dev2_PFG",&_hSamplingTask);
if (result<0) {
daqmxLogError(result,"DAQmxCreateTask");
_hSamplingTask= 0;
return false;
}
result= DAQmxCreateTask("DioTask",&_DioTaskHandle);
if (result<0) {
daqmxLogError(result,"DAQmxCreateTask");
_DioTaskHandle= 0;
return false;
}
DAQmxCreateAOVoltageChan(_hSamplingTask, "Dev2/ao0:7" ,NULL , -10.0, 10.0, DAQmx_Val_Volts, NULL);
DAQmxCfgSampClkTiming(_hSamplingTask,NULL, 1000, DAQmx_Val_Rising, DAQmx_Val_ContSamps, NUMBER_OF_SAMPLES);
DAQmxWriteAnalogF64(_hSamplingTask, NUMBER_OF_SAMPLES , 0, DAQmx_Val_WaitInfinitely, DAQmx_Val_GroupByChannel, _DAQmxsample, NULL, NULL);
DAQmxCreateDIChan(_DioTaskHandle,"Dev2/port0","",DAQmx_Val_ChanForAllLines);
DAQmxStartTask(_hSamplingTask);
DAQmxStartTask(_DioTaskHandle);
....
....
....
DAQmxWriteAnalogF64(_hSamplingTask, NUMBER_OF_SAMPLES , 0, DAQmx_Val_WaitInfinitely, DAQmx_Val_GroupByChannel, _DAQmxsample, NULL, NULL));
DAQmxReadDigitalU32(_DioTaskHandle,1,10.0,DAQmx_Val_GroupByChannel,&data,1,&read,NULL));
....
....
....
DAQmxStopTask(_hSamplingTask);
DAQmxStopTask(_DioTaskHandle);