From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display a "spaced" hexadecimal number in a numeric control/indicator

Solved!
Go to solution

Hi,

 

I have some numeric controls/indicator that work better when expressed in hexadecimal (representation is U32 to U64)

For readability, I'd like to be able to space the characters in groups of 4.

Typically what the Windows Calculator does + a "0x2 in frot to be clear (but the latter isn't the problem)

VinnyAstro_1-1665577224185.png

 

With a String Control/indicator, that's no brainer, but with a numeric one, I'm struggling a bit in the "Display Format" ´section, and my number always ends up in one unreadable chunk.

I know how to always fill with 0 before, to add text and other stuff, but not to add characters in between the number. Is that even possible?

Any idea of what I should put in the Display Format field? I couldn't find any answers so far on the forum (only for strings)

 

Thanks,

Vinny.

 

PS: The Radix is set on Hexadecimal of course. 

 

0 Kudos
Message 1 of 10
(1,426 Views)

Hi Vinny. Unfortunately you cannot display a single number in chunks of characters.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 2 of 10
(1,421 Views)
Solution
Accepted by topic author VinnyAstro

@VinnyAstro wrote:

Hi,

 

I have some numeric controls/indicator that work better when expressed in hexadecimal (representation is U32 to U64)

For readability, I'd like to be able to space the characters in groups of 4.

Typically what the Windows Calculator does + a "0x2 in frot to be clear (but the latter isn't the problem)

VinnyAstro_1-1665577224185.png

 

With a String Control/indicator, that's no brainer, but with a numeric one, I'm struggling a bit in the "Display Format" ´section, and my number always ends up in one unreadable chunk.

I know how to always fill with 0 before, to add text and other stuff, but not to add characters in between the number. Is that even possible?

Any idea of what I should put in the Display Format field? I couldn't find any answers so far on the forum (only for strings)

 

Thanks,

Vinny.

 

PS: The Radix is set on Hexadecimal of course. 

 


Not possible, numeric controls/indicators were not designed for this requirement. On the other hand, you can create X-controls to use string control to mimic this behaviour and still take in a numeric wire in your block diagram.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 3 of 10
(1,377 Views)

@santo_13 wrote:

 

Not possible, numeric controls/indicators were not designed for this requirement. On the other hand, you can create X-controls to use string control to mimic this behaviour and still take in a numeric wire in your block diagram.

That's what I was afraid of... I don't really know how to use these and don't really have time to figure it out now. 

It will be an ugly chunk for now 🙂

 

Thanks to the both of you.

Vinny.

Vinny.

0 Kudos
Message 4 of 10
(1,368 Views)

Hi Vinny,

 


@VinnyAstro wrote:
I don't really know how to use these and don't really have time to figure it out now. 

It will be an ugly chunk for now 🙂


It doesn't need to be ugly: create a small (sub)VI to convert your U64 input to a suitable formatted string, then attach a string indicator…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 10
(1,358 Views)

@GerdW wrote:

Hi Vinny,

 


@VinnyAstro wrote:
I don't really know how to use these and don't really have time to figure it out now. 

It will be an ugly chunk for now 🙂


It doesn't need to be ugly: create a small (sub)VI to convert your U64 input to a suitable formatted string, then attach a string indicator…


Just use Flatten To String and then a string indicator set to "Hex" display.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 10
(1,334 Views)

@crossrulz wrote:

@GerdW wrote:

Hi Vinny,

 


@VinnyAstro wrote:
I don't really know how to use these and don't really have time to figure it out now. 

It will be an ugly chunk for now 🙂


It doesn't need to be ugly: create a small (sub)VI to convert your U64 input to a suitable formatted string, then attach a string indicator…


Just use Flatten To String and then a string indicator set to "Hex" display.


I think this is the best solution.  It's just for human-friendly viewing, so converting to a string is quite acceptable.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 10
(1,328 Views)

My issue is that these are not only Indicators, but also controls. I can have multiple of them, either one or the other, but also sometimes both (programatically updating a control based on SW behaviour). and working with numbers is simply much easier.

 

That's why I wanted to have Spaced hex numbers option in the Display Format Tab property.

0 Kudos
Message 8 of 10
(1,325 Views)

@crossrulz wrote:

@GerdW wrote:

Hi Vinny,

 


@VinnyAstro wrote:
I don't really know how to use these and don't really have time to figure it out now. 

It will be an ugly chunk for now 🙂


It doesn't need to be ugly: create a small (sub)VI to convert your U64 input to a suitable formatted string, then attach a string indicator…


Just use Flatten To String and then a string indicator set to "Hex" display.


Nice.

What's best solution for binary, like: 1010 1111 0000 0101 ?

 

George Zou
0 Kudos
Message 9 of 10
(1,267 Views)

You can use an array of U16's and type cast it to a U64. It's not quite as elegant as a single control, but it handles the grouping for you.

 

U16 array.png

 

I bet you could create a custom Numeric control and get rid of the border around each box to make it look like a single control.

 

The obvious issue here is typing in values, since the cursor won't auto-skip to the next field.

 

Also- if you don't want to learn XControls, you could try QControls. I've done several QControls and quite like them. My experience with XControls was both much more confusing and more prone to errors, so I seriously doubt I'll be using them again. There is also YControls, but I haven't tried those yet.

0 Kudos
Message 10 of 10
(1,261 Views)