LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hex conversion problem

Hello wireworkers,

I'm having a bit of a problem converting a number into a Hex string.  

I have a small equation that results in a large number. (Example 4294965695)  I need to convert this number into a Hex string. (FFFFF9BF)  

I can't use the Number to Hex String block in the String pallet because the number is too large.  I've been trying to figure out another way to do this.  But so far I'm stumped.  I know there's a way...I'm just not having any luck finding it.

Any ideas greatly appreciated.  
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 1 of 9
(3,152 Views)
No need to convert. Use the Numeric Text>>Text property for the numeric indicator.

___________________
Try to take over the world!
Message 2 of 9
(3,148 Views)
Sweet!  

I knew there had to be a way. 

Thanks for the quick reply.
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 3 of 9
(3,138 Views)
Just a note:
 
You need to insert a "To U32" bullet before "Number to Hexadecimal String", else it will be coerced to I32 and thus clipped.
If this is really a DBL and you are allowed to exceed the U32 range too, you could use successive divisions as in the attached example (LabVIEW 7.1).
 
Additional Note: LabVIEW 8.0 supports U64, so you don't need anything special up to 16 hexadecimal digits! 😉
 
Additional additional Note: 😉 I would recommend to stay away from the text property method. I don't like code where the outcome depends on cosmetics such as the numeric formatting of an indicator. Even worse, the code will break once you delete the indicator. Property nodes are also relatively expensive in terms of CPU (this is not an issue here unless this happens in a fast, long running loop).

Message Edited by altenbach on 01-04-2006 02:59 PM

Message 4 of 9
(3,136 Views)

Hi pallen,

This is probably overkill, but these solutions are fun to do... Smiley Happy

Building on Altenbach's idea, but without need for a while-loop...

cheers!

Message Edited by Dynamik on 01-04-2006 08:17 PM

Message Edited by Dynamik on 01-04-2006 08:22 PM

When they give imbeciles handicap-parking, I won't have so far to walk!
Message 5 of 9
(3,117 Views)
Dynamik, your "version2" is a bit better than the original attachment, but you still should replace the %7x with a %x to get rid of the leading spaces for small numbers. 🙂
Message 6 of 9
(3,105 Views)

Doh! Smiley Very Happy - you're right! Smiley Wink

(so many edits! i need to figure-out how to use the smilys next to parens...)  

Message Edited by Dynamik on 01-04-2006 09:22 PM

Message Edited by Dynamik on 01-04-2006 09:29 PM

When they give imbeciles handicap-parking, I won't have so far to walk!
Message 7 of 9
(3,100 Views)


@altenbach wrote:
 
Additional additional Note: 😉 I would recommend to stay away from the text property method. I don't like code where the outcome depends on cosmetics such as the numeric formatting of an indicator. Even worse, the code will break once you delete the indicator. Property nodes are also relatively expensive in terms of CPU (this is not an issue here unless this happens in a fast, long running loop).

Obviously, Altenbach is right, and I probably wouldn't have suggested that as a solution, but I had to leave the computer unexpectedly and didn't complete a full answer. Thanks, Alten.

___________________
Try to take over the world!
0 Kudos
Message 8 of 9
(3,084 Views)
Thank you to everyone that replied and put up code.  This is exactly the reason LabView has worked so well for me and I've been able to learn so much in such a short time.

Because the Numeric I'll be using in this case actually represents a distance in mm that is converted and translated to be sent serially to an IAI RoboCylinder controller, it looks like all I need is the U32 conversion before I convert the number to a Hex String.  (See screenshot)  

This seems to do everything I need, and gives me the result I'm looking for.  (It has to be concatenated with the rest of the serial command and run through the Binary Cross Check calculator I built last week...with help from this forum)

Thanks again!   Smiley Very Happy


---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 9 of 9
(3,071 Views)