05-23-2006 03:24 AM
Hi,
I'm currently using VEE 7.5 and trying to take data using NI's DAQPad 6015. Though I found the post for the PCI-651X under VEE very helpful, I'm still having problems with my code. I'm using the posted "nidaqmx_vee.h" and the "nicaiu.dll." (Re: Accessing PCI-651X under Agilent VEE) I would like to acquire data from a channel until I tell it to stop. Does anyone know how to fix my code to make this work?
Thanks,
Darren
05-23-2006 05:59 PM
Hi Darren,
While I can't look at your code to see why it is not working, could you give us a description of what isn't working? Perhaps there is something wrong with the way the acquisition is setup causing it not to work.
Regards,
Laura
05-25-2006 01:51 AM
Dear Laura,
Here's what is working: I have been able to query the DAQpad 6015 for it's serial number in VEE. To do this, I have selected __stdcall from the NIDAQmx header to create my own header file to use the nicaiu.dll. As a model I'm following the syntax in an example provided by NI for ANSI C development. The example is called, "Cont Acq Samp-Int Clk.c" This example seems to be a good starting point since I would like to acquire data continuously until user interrupted for example. The problem I'm having is that if I call the function "DAQmxCreateAIVoltageChan" I get error #-200088, which is "DAQmxErrorInvalidTask" error. However, I can't figure out which command is causing the error. My stdcall in VEE syntax for DAQmxCreateAIVoltageChan is:
long __stdcall DAQmxCreateAIVoltageChan (long taskhandle, char *physicalChannel, char *nameToAssignToChannel, long terminalConfig,
double minVal, double maxVal, long units, char *customScaleName);
I interpreted this from the NIDAQmx.h as it shows:
int32 __CFUNC DAQmxCreateAIVoltageChan (TaskHandle taskHandle, const char physicalChannel[], const char nameToAssignToChannel[], int32 terminalConfig, float64 minVal, float64 maxVal, int32 units, const char customScaleName[]);
One of these parameters is the causing the error?
physicalChannel: Dev1/ai0
nameToAssignToChannel: mychannel
terminalConfig: DAQmx_Val_Cfg_Default
minVal: -10
maxval: 10
units: ? tried 10348 doesn't work
customScaleName: NULL ? not sure what goes here
After this function call I have to call "DAQmxCfgSampClkTiming"
int32 __CFUNC DAQmxCfgSampClkTiming (TaskHandle taskHandle, const char source[], float64 rate, int32 activeEdge, int32 sampleMode, uInt64 sampsPerChan);
What values should be used for this function call?
If I get this far, then things might become a bit easier.
thanks,
Darren
05-25-2006 05:27 PM
Hi Darren,
Usually, the NI-DAQmx error will tell you the parameter that is set incorrectly, but here it looks like the error doesn't tell us anything, unless the taskhandle is of the wrong type.
If you haven't seen it, you should take a look at the NI-DAQmx C Reference Help that installs at Start >> Programs >> National Instruments >> NI-DAQ.
In the documentation for the function DAQmxCreateAIVoltageChan, you can see that your options for units are DAQmx_Val_Volts and DAQmx_Val_FromCustomScale. When choosing DAQmx_Val_Volts, you must set customScaleName to NULL.
You might also try what UliK suggests in this thread, creating your task statically in Measurement and Automation Explorer and then loading it in your program to use, rather than creating it dynamically in your program.
Hope this helps!
Laura
06-04-2010 03:47 PM