10-12-2022 07:25 AM
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)
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.
Solved! Go to Solution.
10-12-2022 07:35 AM
Hi Vinny. Unfortunately you cannot display a single number in chunks of characters.
10-12-2022 09:24 AM
@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)
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.
10-12-2022 09:47 AM
@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.
10-12-2022 09:59 AM
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…
10-12-2022 10:18 AM
@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.
10-12-2022 10:27 AM
@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.
10-12-2022 10:34 AM - edited 10-12-2022 10:35 AM
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.
10-12-2022 11:38 AM
@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 ?
10-12-2022 11:57 AM
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.
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.