LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Half digit display

Hi everyone, this is my first topic here and I am a beginner in Labview. Please be soft to me 😄

 

I am working on an interface and I need to display numbers like if I was on a 4.5 LCD display.

Meaning I have 5 digits, but the first one can only be 1 or empty.

 

Example:

200 will be displayed as 200.0

15 will be displayed as 15.000

 

Any idea how I could do it?

 

The best option for me would be to use a INI file with the precision after coma as an input, but I did not find anything like that.

 

Thank you for your kind support

 

0 Kudos
Message 1 of 9
(1,880 Views)

Hi jojo,

 


@jojozekil wrote:

Hi everyone, this is my first topic here and I am a beginner in Labview. Please be soft to me 😄


Welcome to this forum!

 


@jojozekil wrote:

I am working on an interface and I need to display numbers like if I was on a 4.5 LCD display.

Meaning I have 5 digits, but the first one can only be 1 or empty.

 

Example:

200 will be displayed as 200.0

15 will be displayed as 15.000

 

Any idea how I could do it?


Some questions:

  • You write "the first digit can only be 1 or empty", but you provide an example of "200.0" - where the first digit is "2"!?
  • You write "I have 5 digits", but you provide an example of "200.0" with just 4 digits (but 5 chars) or "15.000" with 5 digits (but 6 chars)!?

Can you provide examples which don't conflict with your requirement description?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(1,864 Views)

Hi GerdW and thank you for your reply.

 

Sorry, I am figuring out that my message was not clear.

 

I try to emulate the same behavior as a 4.5 digits 7 segment LCD screen. My screen is like that:

Y.X.X.X.X.

I can choose to light on the dot anywhere I want.

Y can only take the value of 1 or be turned off (2 segment piece)

X can take any value between 0 and 9

 

If I have a value of 1.5 to display I can display 1.5000, ie I can use all my spots to display my number.

 

If I have a value of 20 to display I can display 20.00, ie I cannot use the left spot, only the 4 next spot to display my number.

 

My application is basically a voltmeter. I have to set the maximum voltage of the application, but it can change depending who will use it. So I need to change the maximum value and representation in my VI before I compile it. I would prefer to use one INI file with the parameters.

 

Basically, I would like Labview to display on 5 digits in total if the first number is 1 and only on 4 digits if the first number is different of 1.

I could set it manually in my INI file to avoid him to make long complicated operations. For example:

[CONFIG]

Voltage = 5.02

VoltageAccuracy = 3

 

And it will display up to 5.020

 

What do you think about it?

 

0 Kudos
Message 3 of 9
(1,853 Views)

Hi jojo,

 


@jojozekil wrote:

I could set it manually in my INI file to avoid him to make long complicated operations. For example:

[CONFIG]

Voltage = 5.02

VoltageAccuracy = 3

 

And it will display up to 5.020


I don't know what that INI keys should do without knowing your whole project…

 


@jojozekil wrote:

I try to emulate the same behavior as a 4.5 digits 7 segment LCD screen. My screen is like that:

Y.X.X.X.X.

I can choose to light on the dot anywhere I want.

Y can only take the value of 1 or be turned off (2 segment piece)

X can take any value between 0 and 9

 

If I have a value of 1.5 to display I can display 1.5000, ie I can use all my spots to display my number.

 

If I have a value of 20 to display I can display 20.00, ie I cannot use the left spot, only the 4 next spot to display my number.


So you have a float value input and you need a string consisting of 4 or 5 digits and (maybe) a dot.

One solution would be:

  • Format your numeric value into a string using %.4e to get a string like 1.2340e+0 for an input of 1.234.
  • Now you can test the first digit to be "1" or different (aka "<>1") to decide to display 4 or 5 digits.
  • You can also test the exponent to decide where to place the dot in your display (and to check for allowed display range).
  • Do some more string manipulation to get your desired resulting string…

Put all this into a subVI to encapsulate the algorithm…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(1,842 Views)

Thank you @GerdW

It can be very complicated to make such simple things in Labview if they did not implemented the function...

0 Kudos
Message 5 of 9
(1,829 Views)

Hi jojo,

 


@jojozekil wrote:

It can be very complicated to make such simple things in Labview if they did not implemented the function...


That's not "complicated, it's called "programming"!

 

Why should NI implement such a specific functionality? Who needs 4.5 digit displays on a modern GUI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 9
(1,815 Views)

You are right, but I was not talking of this very specific need.

I was talking about setting the precision of a numeric as an external parameter.

A=1.1

B=2

if I want to display A with 2 digits after coma (1.10), I need to set it on the GUI before compilation or use a complex mechanism. I cannot just ask to Labview to display A with B digits, where A and B are parameters in an external INI file.

 

But hey, I am just beginning on Labview, so it is more easy to focus on what is not like I am used to use as I do not feel comfortable yet 😄

Looks like it is very powerful. I am eager to discover what incredible projects I could achieve with!

 

Anyway, thank you for your kind support @GerdW, greatly appreciated!

0 Kudos
Message 7 of 9
(1,805 Views)

Hi jojo,

 


@jojozekil wrote:

if I want to display A with 2 digits after coma (1.10), I need to set it on the GUI before compilation or use a complex mechanism. I cannot just ask to Labview to display A with B digits, where A and B are parameters in an external INI file.


You can change the display format of a numeric indicator also at runtime of your VI!

Just use some property node:

You can also use an "external" INI file, when you implement the ConfigFile functions to read the keys from such a file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(1,798 Views)

Thank you very much! This exactly what I was looking for!

0 Kudos
Message 9 of 9
(1,791 Views)