Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Is there a way to return 4 byte floats from DAQmxReadAnalogF64?

I am trying to return a very large array (many samples from several channels) from DAQmxReadAnalogF64 within a Windows 7 32 bit environment and running into memory allocation issues in my C language application (when combined with the other arrays that I derive from it).  I don't require the precision of 8 byte floats (F64) and would prefer to use 4 byte floats, especially since it halves my memory requirements.  Type-casting is not a solution because the F64 array would have to be created initially and then typecast one element at a time.  So, is there something equivalent to, say,  DAQmxReadAnalogF32?  Thank you!

0 Kudos
Message 1 of 6

Hello oevidneg,


I'm checking the Read Functions available in the C API for DAQmx and can't find any other version for the DAQmxReadAnalogF64.


Another option that comes to my mind is trying to get the RAW values from the API and formatting them yourself to the data type you need.


Hope this information helps. The best of luck with your application!

0 Kudos
Message 2 of 6

Thanks for the info, Oscar.  For those interested, I came across a sample C program demonstrating how to perform the polynomial scaling conversion:

It's listed in the attachments on the right side (scaling.cpp)


Can I assume that the NIDAQ driver is performing this exact same conversion in order to return the array of actual voltage values?

0 Kudos
Message 3 of 6

Sounds right oevidneg,


All the DAQ boards have an ADC on board, which does the transformation from 'the real world' to the raw values. I'd assume they way it converts back depends on the board for which specified coefficients should exist. As the example says: depending on the device, are the coefficients you would use. I find this forum related to the handling of Device Coefficients, you might want to give it a try.


All the best!


0 Kudos
Message 4 of 6

My assumption was that the NI software driver uploads the stream of binary codes and performs the same conversion on demand for function DAQmxReadAnalogF64.  I was simply trying to figure out the most efficient way to transfer and convert the data.  Having the NI driver perform the conversion blows up the necessary memory space by 4x (16 bit binary to 64 bit float) right from the get-go.   My plan is to keep it as binary until required for use.  Unfortunately, the polynomial conversion equation (w/ 3 coefficients) is a killer for near-real time applications involving large amounts of data.  Thanks for your help.

0 Kudos
Message 5 of 6

I had the same question and searched a "DAQmxReadAnalogF32" to no avail.


My reason is a different one: I wanted to use hardware accelerated FP32 vector math to calculate faster live results. Also the dataset could be half as long and would have a higher chance of a cache hit once it is loaded to the CPU.


I understand that the 16Bit ADC value has to be converted to world units and rounding errors are not desireable. But single precision with it's 23Bit mantissa (effective 24Bit) should be plenty to store and transmit the result.

0 Kudos
Message 6 of 6