I have a rather large application based on the NI-DAQmx C++ API that works on M-Series (E-Series and S-Series too) devices, but fails on a CompactDAQ device (NI 9205).
The failure is that a call to DAQmxGetAnlgEdgeStartTrigSrc() returns the -50150 error:
DAQmx Error: The software has entered an unknown state - usually as a result of a cascade failure induced by an unexpected series of state inputs. The operation could not be completed as specified and you should immediately terminate all further transactions if you are able to do so.
Device: cDAQ1Mod1
Task Name: _unnamedTask<0>
Status Code: -50150
Using the standard shipped example
C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Int Clk
I've narrowed the problem down to calling 3 calls. The full program is attached, and here are the 3 lines added to ContAcq-IntClk.c:
DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(taskHandle, physicalChannel, DAQmx_Val_RisingSlope, 0.10));
DAQmxErrChk (DAQmxGetStartTrigType(taskHandle, &intData) );
DAQmxErrChk (DAQmxDisableStartTrig(taskHandle));
The value of physicalChannel is set above in the line
char *physicalChannel = "cDAQ1Mod1/ai0"; // cDAQ device (NI 9205)
When I comment out that line and uncomment this line:
//char *physicalChannel = "Dev1/ai0"; // M-series device (PCI-6259)
the program runs fine.
If I comment out any one of those 3 lines the failure does not occur.
The call to DAQmxCfgAnlgEdgeStartTrig does not return any error code, which leads me to believe that it is setting the Start Trigger to the values I've specified.
Adding this line before those 3
DAQmxErrChk (DAQmxGetAnlgEdgeStartTrigSrc (taskHandle, cacheTriggerSource, sizeof(cacheTriggerSource)));
shows that by default the Analog Edge Start Trigger Souce is APFI0. But this is odd because the help specifically states that:
The NI 9205 has no APFI 0 or APFI 1 terminal. Analog input tasks using the NI
9205 can trigger off one of the analog input channels being sampled by the NI
9205.
So one would thinking that using the physical channel "cDAQ1Mod1/ai0" should work.
The questions I have are:
1. Why should calling the sequence of DAQmxCfgAnlgEdgeStartTrig(), DAQmxGetStartTrigType(), DAQmxDisableStartTrig() cause a subsequent call to DAQmxGetAnlgEdgeStartTrigSrc() to fail with -50150?
2. Why does calling DAQmxDisableStartTrig() not reset all of the values to their original, good state?
3. How to I set the Analog Edge Start Trigger withough getting a -50150?
I've read http://digital.ni.com/public.nsf/allkb/21017DE39A3F17F28625727C0081FA99 which talks about Analog Reference Trigger (not Start Trigger) but since I'm only adding 1 channel don't see that this is the same problem.
Thanks in advance,
Sherryl Radbil
Sherryl Radbil
Data Acquisition Engineer
The MathWorks