From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of binary to numeric data for text output

I tried to use the HS DataLogger.vi (comes free with LabView) to log a two-channel data in binary format. For further analysis of the data, we need to have it in text format. The problem is I can't understand how to change the binary data to numeric (or decimal) data, in the HS DataReader.vi (also free).
I would also like to know if I can acquire the decimal data by multiplying a scaling factor
(voltage range/ 2^( number of bits - 1)?
Thanks a lot for your help!
Download All
0 Kudos
Message 1 of 2
(2,408 Views)
The way the reader scales the data is to read the binary data (as I16s) from the data file. This 2d array drives a FOR loop that executes once for each column of data. (As a side note, if I had written this routine I would have transposed the array to turn the columns into rows and then just let the loop auto-index the array--the logic to me would seem a little clearer. In any case...)

Inside the loop each column is processed slightly differently depending on whether it's the data is unipolar (positive only) or bipolar. The result is that the I16 integer array is turned into a SGL floating-point array.

These values are then multiplied by a "multiplier" value (which could be your "(voltage range/2^(number of bits-1)"--though not necessarily)and added to
an "offset" value--straight-forward Mx + B scaling...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 2
(2,408 Views)