07-07-2016 06:54 PM
I am passing a ASCII string from Test Stand to a VI i wrote and I start out with "04" and my VI get the ASCII "04" normal. I then convert a ASCII string to a Hex string (using a VI solution I found on the web) and instead of it being Hex Display "04", it adds two leading zeros in the Hex Display "0004". I need to remove the two leading zeros so it is just "04". I am sure there is probably a obvious solution (I am rather new at LabVIEW). Thank you
Solved! Go to Solution.
07-07-2016 07:00 PM - edited 07-07-2016 07:01 PM
String palette >> String Subset
Better yet, fix the VI you found on the web that is giving you the extra zeroes.
07-07-2016 07:00 PM
Could you supply the code that you are doing the conversion with? We will likely find your problem there.
07-08-2016 01:54 AM
There is probably much more going on than it "just adding two extra zeroes" that you need to chop off. Find out what's really going on so you don't make the mistake of treating the symptom and not the cause. (I can pretty much guarantee that chopping off the extra zeroes without understanding why will lead to heartache down the road.)
07-08-2016 11:24 AM - edited 07-08-2016 11:24 AM
I think this conversion does what you are looking for.
07-08-2016 12:31 PM
One thing I left out. The VI works fine by it self, when I input a 04 string in Hex Display.
The problem is that I am passing a 04 string from TestStand, it shows up as the Hex value 34 (Hex Display), not the symbol 04 (Hex Display). This is where I added the Hex convert section where is converts to 0004 (Hex Display) but I need it to be 04. The convert program does converts the string 17FF (Normal Display) to 17FF (Hex Display) correctly, it just has a problem a 04 (2 digits) vs17FF (4 digits).
I then pass the concatenated string to a microprocessor.
07-08-2016 12:40 PM - edited 07-08-2016 12:41 PM
Wiring a format statement to a typecast operation just confuses the programer. Don't do that. The value is not important, just the type. (...and if you want a string, you don't even need to wire the type. String is the default!)
What is the representation of the blue zero diagram constant wired to the bottom left of "hex string to munber"? Make sure it is U8.
Please attach the actual VI, many things cannot be determine by a picture alone. Thanks!
07-08-2016 01:28 PM
Changing the 0 from U16 to U8 fixed it.
I can't believe it was that easy - I won't make that mistake again.
I will also look into the programming issue you pointed out.
Thank you, ( Kudos)
Paul
07-08-2016 03:32 PM
Well, this shows you why code images are not useful for troubleshooting.
There is no way to tell what the representation of these constants is! 😄