LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert from buffer to float

Hi,

the buffer reads my measurements and I want to convert the data to floats.

I only get integers, but I need more precise measurements.

I attached my VI.

Thanks!

0 Kudos
Message 1 of 7
(2,519 Views)

You should have used the phrase "serial port" buffer.  I had no clue what you meant by just "buffer" until I opened your VI.

 

First, don't constantly reconfigure the Serial port in every iteration of the loop.  The configure subVI should be before the while loop.

 

Next, you have to show us what the data looks like that you receive from the serial port.  Is it raw binary bytes?  Is it human readable, ASCII formatted characters?

 

You have two things in there, a fractional string to number and an octal string to number.  Only the octal string to number is providing you an integer, and the use of octal strings is very, very rare.  I doubt your device is providing something like that.

 

Attach a VI, that has been run, shows the data in the string indicator, stopped, Save Values as Default.  Save the VI.  Attach to your message.

0 Kudos
Message 2 of 7
(2,506 Views)

thank you for your time.

the data from the serial port are decimal numbers (e.g. 0,15).

I just want to convert what Im reading in the serial port buffer into a float number.

Currently the box "Zahl" provides me only the natural number (e.g. 0 instead of 0,15).

Im trying to change the representation of "Zahl" but Im not getting what I need.

0 Kudos
Message 3 of 7
(2,499 Views)

Hi acouch,

 

why don't you read the LabVIEW help on string format codes when you use non-English locale/regional settings?

check.png

 

Btw. which weird device is sending numeric values over the serial port using "German" settings (comma as decimal separator)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,493 Views)

I don't understand what is wierd ?

 

0 Kudos
Message 5 of 7
(2,451 Views)

Hi achouch,

 

I don't understand what is wierd ?

It's weird to have an external device sending data in ASCII, but NOT using the typical point as decimal separator.

I had only one (1) device in the last 20 years that worked this way: it's manufacturer assured me "because a main customer had requested that behavior"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(2,447 Views)

@GerdW wrote:

Hi achouch,

 

I don't understand what is wierd ?

It's weird to have an external device sending data in ASCII, but NOT using the typical point as decimal separator.

I had only one (1) device in the last 20 years that worked this way: it's manufacturer assured me "because a main customer had requested that behavior"…


Several Keysight devices and some Rhode Schwarz gear have an option available for localizing numeric parameters.  Seldom mentioned in English manuals but, discoverable from reverse engineering some drivers.

 

I never could figure out why Germany went use a dot radix point.  But hey, I use feet and inches and confuse then with minutes and seconds of angle.',"


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(2,434 Views)