Hi!
I ran into what seems a similar problem.
I am programming a 6221-M under Matlab, using the C-libraries. So excuse the strange syntax.
I try to sample AI channels and one counter, using the BNC 2120 device.
I have two tasks at the moment, supposed to run on the same device. Task(h)1 is AI and task(h)ctr is the Counter.
for each analog sample, I want to read out the current counter.
The counter works, I was able to test it in MAX. It is connected to PFI8.
Both tasks should start when an external Trigger on PFI0 occurs.
Here's my code (declarations omitted for clarity - hopefully):
[a,b,taskh1] = calllib('myni','DAQmxCreateTask',taskname1,taskh1);
[a,b,taskhctr] = calllib('myni','DAQmxCreateTask',taskname4,taskhctr)
[a,b,c,d] = calllib('myni','DAQmxCreateAIVoltageChan',uint32(taskh1),taskchans1,'',-1,-10,10,DAQmx_Val_Volts,'');
[a,b,c]=calllib('myni','DAQmxCreateCICountEdgesChan',taskhctr,'Dev1/Ctr0','',DAQmx_Val_Rising , 0,DAQmx_Val_CountUp )
[a,b]=calllib('myni','DAQmxCfgSampClkTiming',taskh1,'',fsample,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,nsample)
[a,b]=calllib('myni','DAQmxCfgSampClkTiming',taskhctr,'/Dev1/ai/SampleClock',fsample,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,nsample)
[a,b]=calllib('myni','DAQmxCfgDigEdgeStartTrig',taskh1,'/Dev1/PFI0',DAQmx_Val_Rising );
[a,b]=calllib('myni','DAQmxCfgDigEdgeStartTrig',taskhctr,'/Dev1/ai/StartTrigger',DAQmx_Val_Rising )
This last line gives me an
-200452 = DAQmxErrorAttributeNotSupportedInTaskContext = Specified property is not supported by the device or is not applicable to the task.
It does not matter which terminal I specify, even 'nonsense' will give the same error.
I haven't tried this duplicate count prevention, because my problem seems to be more basic than duplicate counts - it does not count at all.
Any ideas? Do digital/counter channels need another set-up function?
I had a serious look at the "Finite Counter Input Programming Flowchart" in the C reference, but couldn't make much use of it 😕
Regards
Jens