DAQ_VScale Function Equivalent in LabWindows™/CVI DAQmx

Updated Apr 20, 2018

Reported In

Hardware

  • Legacy DAQ (Legacy)

Software

  • LabWindows/CVI

Driver

  • Traditional NI-DAQ
  • NI-DAQmx

Programming Language

  • C

Issue Details

I have old code that I am transferring over from Traditional DAQ to DAQmx. I need to read the data in using the DAQmxReadBinaryU16 function to get the raw data, and in the old DAQ software, the DAQ_VScale function was used to convert the data to volts based on the board setup. Is there a comparable function in DAQmx to the DAQ_VScale function?

Solution

The solution depends on what type of data in the end: raw or voltage. By default, DAQmx will return values in the appropriate units given the different task that you configure. For example, if you are configuring for an analog input task and pick a function such as DAQmxCreateAIVoltageChan, the output will be given to you in volts. Should you want to revert back to raw data, you will have to configure a custom scale with the correct scaling coefficients to backtrack to original data.

You may also keep your code in Traditional DAQ. This option pushes to get raw data using the voltage calculation equation in the NI-DAQ Function Reference Manual for PC Compatibles, which is an outdated manual for Traditional DAQ. Look specifically for the "Voltage Calculation" section and the following equation will be shown --


The table referenced is immediately below the equation. This equation is easily used should you have Traditional DAQ in your program and do not want to restructure your code to DAQmx. Your raw data can be saved in one part of the code while the calculation is made in another function, so that you retain both raw and scaled information. 

NOTE: As Traditional DAQ is being phased out, National Instruments strongly recommends the switch to DAQmx, as most users will be more interested in the end scaled values. Products that support Traditional DAQ will also be phased out soon and the upgrade will be easier with DAQmx.

WAS THIS ARTICLE HELPFUL?

Not Helpful