05-04-2021 11:34 AM - edited 05-04-2021 11:42 AM
Hi,
Hope you are doing good,
I am trying to convert a decimal value- first to boolean array- break that array into smaller sub-arrays and then convert those sub-arrays into a a HEX value (numeric) (using a case structure I created to convert numeric values to HEX String) and then convert this Hex value into ASCII code.
I managed to get the desired output but I do not think it is the most efficient way to do it. I would appreciate if anyone has any recommendations. (VI attached)
Instructions I followed:
Screenshot for a quick glance: (VI attached)
Solved! Go to Solution.
05-04-2021 12:18 PM - edited 05-04-2021 12:22 PM
What is the desired output for the current diagram constant?
I don't see where you create a numeric. You only create a string.
Shouldn't your input be U16?
(I think what you need to do could fit on a postage stamp. No need for green or pink. Also learn the difference between datatype and cosmetic formatting)
05-04-2021 12:19 PM - edited 05-04-2021 12:20 PM
I'm not even sure you are getting the right results. You are flipping the arrays when I don't think you need to. And I don't think you are supposed to convert into ASCII Hex and then back into an actual value.
Based on the chart you gave, I would do this:
05-04-2021 02:27 PM
@crossrulz wrote:
I'm not even sure you are getting the right results. You are flipping the arrays when I don't think you need to. And I don't think you are supposed to convert into ASCII Hex and then back into an actual value.
Based on the chart you gave, I would do this:
Hi crossrulz,
Thank you for looking into this. I was getting desired result for certain values not all of them. The constant I had in the block diagram were from an actual reading from the device and all the Alpha numeric (A1) values got converted as expected the numeric only (01) values were not.
But your implementation of course works with all types of input values and as expected. Thank you, I learned too many thing form this implementation.
05-04-2021 02:33 PM
@altenbach wrote:
What is the desired output for the current diagram constant?
I don't see where you create a numeric. You only create a string.
Shouldn't your input be U16?
(I think what you need to do could fit on a postage stamp. No need for green or pink. Also learn the difference between datatype and cosmetic formatting)
Desired output was a string value. Yes, input should have been U16. I learned that while playing with the arrays.
I know my VI would have been painful for you to look at but I am trying to learn. So thank you for your input.
05-04-2021 03:56 PM
Seriously thank you!! I learned that everything that I was doing could use split and/or join number functions and no more array conversions on the diagram and is all cleaned up. I did not know I could do this:
I could not take the before screenshot but that's actually healthy for viewers.