LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display decimal point for integer variable

Hello

I'm acquiring variables via modbus from a slave device.

This device (temperature probe) transmits data in INT16 

A temperature of 25.3° C is transmitted via modbus as 253

 

When I add the NUMERIC INDICATOR in the user interface VI, the displayed value is always without a comma.

I tried to change the view in DISPLAY FORMAT but I can not find the right combination.
What can I do?

I know that you can convert it to FLOATING POINT variable in block diagram, but I would like to simplify the development
Thank

 

image.png

0 Kudos
Message 1 of 5
(4,982 Views)

Hi gigibindi,

 

A temperature of 25.3° C is transmitted via modbus as 253

What about dividing by 10 and displaying the (float) result?

Best regards,
GerdW


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

Converting the variable to FLOAT format in block diagram works.

But I would like to avoid working in the block diagram because I have about 100 variables to insert! Thanks

image.png

 

0 Kudos
Message 3 of 5
(4,960 Views)

Showing the decimal point won't automatically show it at the 'right' place. So it would show 256.0, not 25.6. In other words, I don't think the decimal point does what you think it does.

 

If you have 100 values like that, manage them in an array (for instance a current value table) and do the division on the array. The code would be exactly the same, no for loop is needed. Let the (your) software do the hard work, that is what it is for.

0 Kudos
Message 4 of 5
(4,955 Views)

@gigibindi wrote:

Converting the variable to FLOAT format in block diagram works.

image.png

 


Don't over-complicate things. You can leave out the "ToDBL" functions because LabVIEW will coerce the result automatically to DBL. Same difference, less code.

I fact you could create a subVI that does the entire scaling and make it the size of a single ToDBL function. 😄 (If you have LabVIEW 2017 or newer, you could even make it a malleable VI so it can take a scalar or array as needed)

 


@gigibindi wrote:

But I would like to avoid working in the block diagram because I have about 100 variables to insert! Thanks 


If you have 100 such "variables", it means you also have 100 controls and indicators and the  complications already start there. As has been mentioned, build the data into 1D- or 2D-arrays as early as possible and use array indicators and divide the array by 10. If it is just for display, format it all into a single table indicator. You can even add the data names into the table header.

 

0 Kudos
Message 5 of 5
(4,903 Views)