LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to receive Floating Point real numbers in Labview Serially

Hello,

My hardware is sending floating piont values on serial port.

I want to present these values to the Labview.

The values are like 24.35 30.1 etc

each value to be plotted on the display seperately.

Regards

0 Kudos
Message 1 of 6
(3,648 Views)

How do you expect you get help if you do not give enough info? What is your hardware? A vacuum cleaner? A mass spectroscope? A multimeter?

Specify the name/model of your hardware, it is easily possible too that it has LabVIEW drivers. If not, you should search for its manual to see what it uses for communication (SCPI)?

0 Kudos
Message 2 of 6
(3,644 Views)

And how does it send those values? Most measurement instruments send values in ASCII Text which is pretty trivial to parse! LabVIEW has in its string palette ready made functions to do that for most non-execotic string formats.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 6
(3,608 Views)

Thanks alot to all for replying.

I am getting numbers from the arduino board. So its not in the ascii format.

Regards

0 Kudos
Message 4 of 6
(3,584 Views)

That's still very unclear. The Arduino board sends whatever your firmware (sketch) has been programmed to send. That could be a binary floating point number, or a binary integer that you have to scale to floating point yourself on the LabVIEW side, or really a string anyways despite you claiming it is not in ASCII. Show us what you have done so far and what your VI has been receiving.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 6
(3,576 Views)

"Floating Point real numbers" exist in a variety of formats, with a variety of byte orderings.  LabVIEW has at least three "native" Float representations -- Single (32 bits/4 bytes), Double (64 bits/8 bytes), and Extended (in Windows, 128 bits/16 bytes).  If your device is using one of these formats and you know the number of bytes and their order (sometimes called the "Endian-ness", as in Big-Endian and Little-Endian), you can accumulate the bytes (as U8s) into an appropriately-sized Array of Bytes and then use LabVIEW's TypeCast function to convert this Array of Bytes into a Float.

 

If your device outputs data in a slightly different "flavor" of Float, you may need to convert it to the IEEE format (which is that I think LabVIEW uses).  For example, I used to get data from a PDP-11, whose floating point was (as I recall) byte-reversed from IEEE and used a different "rule" for the exponent that resulted in a "factor of 4" difference on conversion.  As I recall, I chose to convert then do the factor-of-4 adjustment (rather than adding/subtracting 2 to the exponent part of the representation).

 

Bob Schor

0 Kudos
Message 6 of 6
(3,550 Views)