12-02-2008 01:58 PM
Device: USB-5133
Software: NI-DAQmx ANSI C 8.7.2f1
I have a program working that gets data fine from the analog input using software (immediate) triggering. However, I get an odd error when I try to set it up to use PFI1 as an external trigger:
Measurements: Device identifier is invalid.
Device Specified: dev9
Status Code: -200220
It seems to be telling me that dev9 is invalid (which would be true), expect that I specified dev2 in the function call. In researching other examples, this seems like it should be working. Below is the relevant code I'm using. I would appreciate any insight into what might be going on here.
error = DAQmxCreateTask("", &taskHandle);
if (DAQmxFailed(error))
{
DaqError("Digitizer Error (DAQmxCreateTask)");
return false;
}
error = DAQmxCreateAIVoltageChan(
taskHandle, // Task handle
"dev2/0", // Physical channel name
"", // Virtual channel name, if blank uses physical channel name
DAQmx_Val_Cfg_Default, // Input terminal configuration
-1.0, // Minimum value you expect to measure
1.0, // Maximum value you expect to measure
DAQmx_Val_Volts, // The units of the previous two parameters
NULL); // Custom scale name
if (DAQmxFailed(error))
{
DaqError("Digitizer Error (DAQmxCreateAIVoltageChan)");
return false;
}
error = DAQmxCfgSampClkTiming(
taskHandle, // Task handle
NULL, // Source terminal of the sample clock (use NULL for internal)
pDoc->SampleRateHz, // Sample rate in samples per second
DAQmx_Val_Rising, // Edge of the clock to acquire samples on
DAQmx_Val_FiniteSamps, // Sample mode
pDoc->nCount); // Number of samples per channel to acquire
if (DAQmxFailed(error))
{
DaqError("Digitizer Error (DAQmxCfgSampClkTiming)");
return false;
}
if (m_trig_type == Trig_Serial)
{
error = DAQmxCfgDigEdgeStartTrig(taskHandle, "/dev2/pfi1", DAQmx_Val_Rising);
if (DAQmxFailed(error))
{
DaqError("Digitizer Error (DAQmxCfgDigEdgeStartTrig)");
return false;
}
}
error = DAQmxStartTask(taskHandle);
if (DAQmxFailed(error))
{
DaqError("Digitizer Error (DAQmxStartTask)");
return false;
}
Solved! Go to Solution.
12-03-2008 01:48 PM
Hi Benote,
Welcome to the NI Forums! The USB-5133 is meant to be used with the NI-SCOPE driver as opposed to DAQmx. The likely reason that the code initially functions is that NI-SCOPE is based off of our DAQmx driver. You may be able to run some DAQmx functions, but many of the features of NI-SCOPE are implemented differently (it seems this would include triggering). Since the 5133 is not meant to be used with the DAQmx driver, you could expect to see unusual (or incorrect) error messages such as the one you are receiving.
If you haven't already, I recommend that you install NI-SCOPE (from the above link or from the device drivers CD). The NI-SCOPE examples and documentation can be found at:
Start >> All Programs >> National Instruments >> NI-SCOPE. If you have any questions don't hesitate to ask. Thanks and have a great day!
-John
12-12-2008 01:46 PM
John,
Thank you for the reply! Moving to NI-Scope (and NI-modinst for device enumeration / discovery) has everything working now.