LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

32 bit floating point instrument buffer

Solved!
Go to solution

I have an instrument that when I read it I get 32 bit floating point data back from the buffer. There are two pieces of data per measurement point and multiple measurement values returned within the buffer.

How do i convert this IEEE 32 bit buffer data into an array of numeric data using LabView?

I should get an array of values around +8.704706E-009

I have displayed the format and what i get in the attachment.

0 Kudos
Message 1 of 5
(2,928 Views)

A Single is a 32 bit floating point, so you only need to extract the 4 bytes and typecast it.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(2,916 Views)

Use Unflatten from String instead of the Typecast as it allows you to select the Endianess of the binary stream data. Typecast always assumes that the binary data is in the LabVIEW default Endianess which is Big Endian.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 5
(2,900 Views)
Solution
Accepted by topic author stevesteve

@stevesteve wrote:

I have an instrument that when I read it I get 32 bit floating point data back from the buffer. There are two pieces of data per measurement point and multiple measurement values returned within the buffer.

How do i convert this IEEE 32 bit buffer data into an array of numeric data using LabView?

I should get an array of values around +8.704706E-009

I have displayed the format and what i get in the attachment.


This will get you started. You will need to modify the VI in order to correctly read the raw data from your instrument. In this case, the number of Bytes that follows the header is 3208. That's 401 measurements * 2 datasets * 4 bytes (401*2*4=3208).

 

Rolfk's advise to use "Unflatten from String" is spot on. The data is little-endian.

 

The two sets of data are interleaved. Easiest way is to extract each dataset is to use "Decimate 1D array". In my experience, if the second dataset is undefined on the instrument, then it sends back all zeros.

 

fp.PNG

 

bd.png

 

EDIT: the attached VI is ver 2014

Message 4 of 5
(2,875 Views)

Thanks a lot for you help, its just what I needed, saved me lots of time.

 

Cheers

 

0 Kudos
Message 5 of 5
(2,830 Views)