jaehov Posted February 18, 2009 Report Share Posted February 18, 2009 Hello Code Gurus I would like to convert a labview decimal string, e.g. "242992472391692" into an equivalent HEX String "DD001800000C" Can someone show me how to do this? thanks new kid on the block Quote Link to comment
Mark Yedinak Posted February 18, 2009 Report Share Posted February 18, 2009 Use the same general approach that I used in the example I posted in your other thread but modify the algorithm. In this case you would only be working with a single array and you would need to work with two elements of the array at one time. You would also need to work with nibbles of data. Cycle through the array picking 16 bits of data at a time from the digits and then accumulate the new hex string. In this conversion you would not need to generate the intermediate byte array as you could go directly to the hexadecimal string. Quote Link to comment
LAVA 1.0 Content Posted February 18, 2009 Report Share Posted February 18, 2009 QUOTE (jaehov @ Feb 17 2009, 10:18 PM) I would like to convert a labview decimal string, e.g. "242992472391692" into an equivalent HEX String "DD001800000C" Here are the steps (LabVIEW isn't currently running). Use a string to numeric conversion VI: With a I64 (or U64) as datatype. Now you have two options 1.Use a Number to Hexadecimal string: 2.Display the 'number' and change it's representation to HEX. Ton Quote Link to comment
Mark Yedinak Posted February 18, 2009 Report Share Posted February 18, 2009 QUOTE (Ton @ Feb 17 2009, 03:39 PM) Here are the steps (LabVIEW isn't currently running).Use a string to numeric conversion VI: With a I64 (or U64) as datatype. Now you have two options 1.Use a Number to Hexadecimal string: 2.Display the 'number' and change it's representation to HEX. Ton This will work nicely provided he has 64 bit integers. Based on an earlier post of his he needed to do this on without 64 bit integers for numbers larger than 32 bit integers. That was the reason I was suggesting converting the string to a byte array and processing that. That solution will work for abitrarily large numbers. Quote Link to comment
jaehov Posted February 18, 2009 Author Report Share Posted February 18, 2009 QUOTE (Mark Yedinak @ Feb 17 2009, 04:54 PM) This will work nicely provided he has 64 bit integers. Based on an earlier post of his he needed to do this on without 64 bit integers for numbers larger than 32 bit integers. That was the reason I was suggesting converting the string to a byte array and processing that. That solution will work for abitrarily large numbers. Yes. I am in the labview 7.1 environment. So I am without the use of the Labview U64 capability. Quote Link to comment
lvABC Posted February 18, 2009 Report Share Posted February 18, 2009 QUOTE (jaehov @ Feb 17 2009, 06:22 PM) Yes. I am in the labview 7.1 environment. So I am without the use of the Labview U64 capability. Here is an example, hope this helps! Quote Link to comment
jaehov Posted February 20, 2009 Author Report Share Posted February 20, 2009 QUOTE (lvABC @ Feb 17 2009, 06:59 PM) Here is an example, hope this helps! GREAAAAT! This works like a charm! Thanks for EVERYONE QUOTE (jaehov @ Feb 19 2009, 11:02 AM) GREAAAAT! This works like a charm! Thanks for EVERYONE'S help with this. You all saved me development time. Quote Link to comment
lvABC Posted February 20, 2009 Report Share Posted February 20, 2009 QUOTE (jaehov @ Feb 19 2009, 11:04 AM) GREAAAAT! This works like a charm! Thanks for EVERYONE I guess this is what you were looking for! Just be careful, there is a limitation on conversion. It is not all 64 bits. You can find more info on NI web site about extended precision. Quote Link to comment
Mark Yedinak Posted February 21, 2009 Report Share Posted February 21, 2009 Here is a slightly different version which would solve his original issue of converting a number with greater than 32 bits on an earlier version of LabVIEW that did not have U64 integers. This vi will take an arbitrarily long decimal string and convert it to a hexadecimal string. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.