Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Traditional DAQ instead of DAQmx with newer boards

I've always been able to read a voltage from my DAQ cards using AI_VRead, one nice simple function, part of "Traditional DAQ" now.
 
Now it appears I have to jump through all sorts of hoops just to get a voltage if I use DAQmx, so I'm trying to avoid that.
 
I have an NI 6229 DAQ board that is not showing up as "Traditional DAQ" in MAX, only as DAQmx. Is there some way I can still use "Traditional DAQ" with my board?
0 Kudos
Message 1 of 7
(3,108 Views)

What version DAQ are you using?

According to this DAQ7.5 only supports DAQmx functions. Unsure about earlier versions.

http://www.ni.com/support/daq/versions_pci_pxi.htm

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 2 of 7
(3,099 Views)
Ah, thanks.
 
Not only does my version of version of NI-DAQ not support traditional, but my DAQ board doesn't.
 
Well I finally wrote AI_VRead using this nutty DAQmx scenario, so at least I don't have to deal with it until I need something really complicated. Then I'm toast.
 
int AI_VRead2 (int nDevice, int nChannel, double *pdVoltage)
{
 char   sWhichChannel[64];
 TaskHandle taskHandle;
 int   error;
 char  errBuff[2048];
 
 sprintf (sWhichChannel, "Dev%d/ai%d", nDevice, nChannel);
 errChk (DAQmxCreateTask("AI_VRead2", &taskHandle));
 errChk (DAQmxCreateAIVoltageChan (taskHandle, "Dev2/ai0", "Voltage",
  DAQmx_Val_RSE, -10, 10, DAQmx_Val_Volts, "")); 
 errChk (DAQmxStartTask(taskHandle));
 errChk (DAQmxReadAnalogScalarF64(taskHandle,10.0, pdVoltage,0));
Error:
 if( DAQmxFailed (error) )
  DAQmxGetExtendedErrorInfo (errBuff, 2048);
 if( taskHandle!=0 ) {
  DAQmxStopTask (taskHandle);
  DAQmxClearTask (taskHandle);
 }
 if( DAQmxFailed (error) )
  gui_InternalError (errBuff);
 return error;
}
 
0 Kudos
Message 3 of 7
(3,092 Views)

Hi bmihura,

 

Not sure if you are familiar with this, but my experience with DAQmx is that the DAQmxCreateTask takes a little while to complete. Therefore, in a time sensitive application it would be best to place that call somewhere outside of your AI_VRead2 function so that you're not constantly waiting on that task to be created each time you just want to read a value.

 

Hope this helps!

0 Kudos
Message 4 of 7
(3,086 Views)
My current app is not time-sensitive, but I'll do that anyway since it seems like better programming-- thanks.
0 Kudos
Message 5 of 7
(3,075 Views)
You said, "Now it appears I have to jump through all sorts of hoops just to get a voltage if I use DAQmx, so I'm trying to avoid that."

That is true; to do very simple things in DAQmx often requires more lines of code than in Traditional DAQ. But as you get into more complex operations I think you will find that DAQmx is better organized, more flexible, easier to use, and faster.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 6 of 7
(3,061 Views)

Good comments John,
I'd also like to point out that there are a bunch of DAQmx ANSI C shipping examples that install by default into this directory: 

C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C

-Alan A

0 Kudos
Message 7 of 7
(3,044 Views)