07-22-2009 05:44 AM
07-22-2009 05:50 AM
07-22-2009 06:13 AM
07-22-2009 06:32 AM
Hi Dan,
sorry, it was the wrong picture. I'm not sure what happend there. 🙂
Mike
07-23-2009 06:15 AM
Hi Dan,
I've attached a piece of code that I wrote for a customer a while back. It takes in a Hex String Array and converts it into ASCII. I have attached a picture below but there is a more complete explanation on the community pages linked here
Many thanks,
07-23-2009 08:04 AM
Hi Andrew,
as Application engineer you should provide code for others to learn from!
- Use boolean operations directly on integer numbers
- Q&R avoids type coercions
- ArrayInterleave avoids a FOR loop
- simplify case structures
07-23-2009 08:24 AM
I'd like to nominate Andrew's code for Rube Goldberg status.
As I can't post files/images from here. I present a text description of my equivalent code.
The HEX and NORMAL format arrays are respectively, the auto-index input and output of a FOR loop.
Within the for loop, the string input feeds to string to byte array, the byte array to number to hexadecimal string (length=constant 2), the hex string is the single input of concatenate strings, the concatenated string goes to the auto-index string output.
One for loop, no cases, no boolean algebra, no red dots.
Rod.
07-23-2009 08:46 AM
Hi Rod,
I have tried to recreate your code below and I concede that my code wasn't perhaps the simplest piece of coding in the world. Although as we say on the training courses "These are not the only solutions, you may in fact find better, more efficient ways of doing things". This would definitely be one of these cases.
I can't work out how you got rid of the coercion dots so if you want to post, I shall try and update. I think what I've attached describes what you have done.
Many thanks,
07-23-2009 09:41 AM
Hi Andrew,
Just get rid of the "To I32" and you've got it, ie wire the U8 array directly to the [polymorphic] number to hex string. I'm using rev 8.2
BTW: This is a diversion as Gerd's posted VI answered the original query.
Rod.
07-23-2009 10:29 AM
Gerd,
Nice answer.
Andrew,
Your code scares me. Please consider modifying your post in the communities. Here is a much easier way to do this.