Discussion:
Hex conversion problem
(too old to reply)
pallen
2006-01-04 22:40:54 UTC
Permalink
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.  


Pos to Hex.vi:
http://forums.ni.com/attachments/ni/170/159283/1/Pos to Hex.vi
altenbach
2006-01-04 23:40:58 UTC
Permalink
This post might be inappropriate. Click to display it.
tst
2006-01-05 07:40:50 UTC
Permalink
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.
Dynamik
2006-01-05 02:40:49 UTC
Permalink
Hi pallen,
This is probably overkill, but these solutions are fun to do... :smileyhappy:
Building on Altenbach's idea, but without need for a while-loop...
cheers!

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


PostoHex2.vi:
http://forums.ni.com/attachments/ni/170/159309/2/PostoHex2.vi
Dynamik
2006-01-05 03:40:55 UTC
Permalink
Doh! :smileyvery-happy: - you're right! :smileywink:
(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 PMMessage Edited by Dynamik on 01-04-2006 09:29 PM
pallen
2006-01-05 14:10:53 UTC
Permalink
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!   :smileyvery-happy:


PostoHex3.jpg:
Loading Image...

Continue reading on narkive:
Loading...