Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx: PCI-6722 simultaneous digital and analog output data acquisition for the same card.

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.

0 Kudos
Message 1 of 7
(2,174 Views)

As the first error told you, you need to supply a different name for each task.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(2,171 Views)

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;

    }

0 Kudos
Message 3 of 7
(2,165 Views)

In your first post, you are using _hSamplingTask for both the AO and the DIO.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(2,160 Views)

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.

0 Kudos
Message 5 of 7
(2,155 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(2,135 Views)

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);

0 Kudos
Message 7 of 7
(2,130 Views)