02-09-2012 04:33 AM
Hi everybody,
I am facing a problem for a while and despite all the related information I could pick up on the forum, my program still doesn't work. Can someone help me?
What I would like to do is to generate *clocked* digital signals on 2 lines of my digital port0 (Dev1/port0/line0,Dev1/port0/line1) on my NI USB-6216 using DAQmx and CVI/Labwindows.
I understood that since USB-6216 is a M-serie device, digital i/o cannot be statically addressed, so that I cannot use the DAQmxCfgSampClkTiming with an internal clock.
This is explained in http://digital.ni.com/public.nsf/allkb/51754212AD10BDCE862573BD007BFDD2 that is actually supposed to give a solution to my problem.
But the point is that even if I use the internal counter Dev1/ctr0 as an "external clock", I still get this error message:
"Requested value is not a supporter value for this property. The property value may be invalid because it conflicts with another property.
Property: DAQmx_SampTimingType
Requested Value: DAQmx_Val_SampClk
You Can Select: DAQmx_Val_OnDemand
Task Name: _unnamedTask<1>
Status Code: -200077"
With the following code:
------------------
DAQmxErrChk (DAQmxCreateTask("",&TaskHandle_counter));
DAQmxErrChk (DAQmxCreateTask("",&TaskHandle_temp_rvar));
DAQmxErrChk (DAQmxCreateDOChan(TaskHandle_temp_rvar, "Dev1/port0/line0,Dev1/port0/line1", "", DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxCfgSampClkTiming(TaskHandle_temp_rvar, "", 100, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, steps+1));
DAQmxErrChk (DAQmxCreateCOPulseChanFreq(TaskHandle_counter,"/Dev1/ctr0","",DAQmx_Val_Hz,DAQmx_Val_Low,0.0,100,0.5));
DAQmxErrChk (DAQmxCfgImplicitTiming(TaskHandle_counter,DAQmx_Val_ContSamps,0));
DAQmxErrChk (DAQmxStartTask(TaskHandle_temp_rvar));
DAQmxErrChk (DAQmxStartTask(TaskHandle_counter));
-----------------------------
I really don't understand *why* I get this error, it should work this way, right?
Other things I tried:
Using an ai port as clock reference doesn't work.
I also tried to create the task in a different orders, but it still get the same error.
Using DAQmxSetSampTimingType(TaskHandle_temp_rvar, DAQmx_Val_OnDemand) doesn't help.
I know I could use alternative solutions, such as using timers, but I need the timing to be very accurate and can't use any external signal as a clock.
Any idea about how to solve this?
Thank you very much for your help !
William
02-09-2012 07:21 AM
Oops, the code I gave was obviously wrong. This one fails:
DAQmxErrChk (DAQmxCreateTask("",&TaskHandle_counter));
DAQmxErrChk (DAQmxCreateTask("",&TaskHandle_temp_rvar));
DAQmxErrChk (DAQmxCreateDOChan(TaskHandle_temp_rvar, "Dev1/port0/line0,Dev1/port0/line1", "", DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxCfgSampClkTiming(TaskHandle_temp_rvar, "/Dev1/Ctr0InternalOutput", 100, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, steps+1));
DAQmxErrChk (DAQmxCreateCOPulseChanFreq(TaskHandle_counter,"Dev1/ctr0","",DAQmx_Val_Hz,DAQmx_Val_Low,0.0,100,0.5));
DAQmxErrChk (DAQmxCfgImplicitTiming(TaskHandle_counter,DAQmx_Val_ContSamps,0));
DAQmxErrChk (DAQmxStartTask(TaskHandle_temp_rvar));
DAQmxErrChk (DAQmxStartTask(TaskHandle_counter));