Hi, I am running a program where I have 4 nidaq cards on a single machine, all connected. I am trying to start a counter and keep getting that error (daqmx error num: -50103 with message: The specified resource is reserved. The operation could not be completed as specified.) in two places in my code. I understand what the error means (you can only have one task of a type per card), but I don't see where that is occuring in my code.
See below for code. I noted the two places where the error is occuring. I am debugging someone else's code, which is part of the problem.
Thanks!
counterTask = 0;
daq_err_check( DAQmxCreateTask( "counter_generation_task",&(counter_generation_task) ));
daq_err_check( DAQmxCreateTask("counter_count_task",&(counter_count_task) ));
char co_chan_name[40];
char ci_chan_name[40];
char ci_trig_chan_name[40];
sprintf( co_chan_name, "%s/ctr0", niDev);
sprintf( ci_chan_name, "%s/ctr1", niDev);
sprintf( ci_trig_chan_name, "/%s/PFI9", niDev);
printf("OK1");fflush(stdout);
daq_err_check( DAQmxCreateCOPulseChanTicks( counter_generation_task,
co_chan_name, "", "ai/SampleClock",
DAQmx_Val_Low, 32,16,16) );
daq_err_check( DAQmxCfgImplicitTiming( counter_generation_task,
DAQmx_Val_ContSamps, 1000) );
daq_err_check( DAQmxCreateCICountEdgesChan( counter_count_task,
ci_chan_name, "",
DAQmx_Val_Rising, 0, DAQmx_Val_CountUp) );
daq_err_check( DAQmxCfgSampClkTiming( counter_count_task,
"Ctr0InternalOutput", 1000.0, DAQmx_Val_Rising,
DAQmx_Val_ContSamps, 1000) );
daq_err_check( DAQmxSetRefClkSrc( counter_generation_task, "OnboardClock") );
daq_err_check( DAQmxSetRefClkSrc( counter_count_task, "OnboardClock") );
printf("abt to start counter_count\n"); fflush(stdout);
daq_err_check ( DAQmxStartTask( counter_count_task ) ); // ERROR OCCURS HERE
printf("abt to start counter_gen\n"); fflush(stdout);
daq_err_check ( DAQmxStartTask( counter_generation_task ) ); // ERROR OCCURS HERE
fflush(stdout);
Thanks again for your patience!