09-20-2012 10:17 AM
I currently have an 8byte array that I typecasted down to 2 32bit-word values since the 8byte array needs to be split in half resulting in 2 4-byte strings. I thought it would be easier to typecast it down to 2Words then convert each word to separate strings. Maybe there's easier way, not sure. Any ideas?
09-20-2012 10:31 AM
Can you give a clear example of how you want the string formated? Please give clear input and output.
Without knowing what you want, you should look at the Byte Array to String function or the Number to Decimal String function.
09-20-2012 10:57 AM
Hi, I've attached an example of what I need to do. I have 2 strings I need to convert to an 8Byte output array, then I need convert the 8Byte array back into the 2 4byte strings. Does this make sense?
09-20-2012 11:02 AM
You do not show what the actual strings are. Are they "binary" strings, or are they "textual" strings? In other words, do you see hex values when the string control is set to normal display, or do you see funny characters? Do you see the hex characters when you set the string to "hex display mode"? Where are the string contents coming from? The exact content of the string matters in terms of what you need to use.
09-20-2012 11:08 AM
What format are your strings? Are they the ASCII representation of a number or are they binary data? What exactly are you doing? Yes, we know you want to convert but what will you be doing with the data? How is it being used? There are several ways to accomplish the conversions and the right way will depend on what you are doing with the data.
The most basic method would be this:
09-20-2012 12:24 PM - edited 09-20-2012 12:25 PM
Here is what I need to accomplish. I have an 8-byte array of data that contains 2 sets of data, bytes 0-3 are Latitude in dd.ddddd (degrees) and 4-7 are Longitude also in dd.ddddd (degrees) format. I need to convert each string containing the Latitude and Longitude and combined them into the 8 byte array with the Latitude placed in bytes 0-3 and Longitude in bytes 4-7. Then I need to be able to get them back out of the 8 byte array and place them back into the strings. Does this make more sense?
Thanks so much...
09-20-2012 01:01 PM
Still not telling us what this string looks like...
Also, what does "bytes 0-3 are Latitude in dd.ddddd (degrees)" mean? Is byte 0 the first 2 d's? Are the 4 bytes a 32-bit number? How do you go from that 32-bit number to "dd.ddddd"?
09-20-2012 01:30 PM
I think I'll just simply things and store the GPS coordinates in 32-bit fixed point representation. That will be alot easier then converting strings with floating points back and forth plus I only have 32bits available for each value anyway. Thanks for you help.
09-20-2012 01:31 PM
Hi,
Look at my solution, is it what you need?
Best Regards,
09-20-2012 01:39 PM
Thanks Luis, this is exactly what I needed 😃 Could you post the VI example for it?
Thank you so much...