09-24-2024 01:27 AM
I'm working on HART communication protocol with LabVIEW for my project. Here, I have to convert a hexadecimal 1D array to packed ascii to represent it as a readable format. I'm able to convert the hex 1D array to a string with Byte array to string function. But to convert it to Packed ASCII is where I got stuck. Attaching the VI for reference. The string I received after conversion is ”PTÔ MMH7»(. But the Packed ASCII I need to get with the hex 1 D array is HARTTESTFRAMEALYST 7.2_
Solved! Go to Solution.
09-24-2024 01:36 AM
09-24-2024 01:39 AM
Sorry. Missed somehow. Attaching it again
09-24-2024 01:44 AM
Sorry again. Please ignore the previous attachment and check this one.
09-24-2024 10:05 AM
(Please do not maximize the diagram and front panel to the screen, nobody likes to stare at 95% whitespace).
The algorithm for "packed ASCII" is quite simple. What have you tried?
(There is also this discussion, but the code is horrible and does not give the right result)
09-25-2024 01:09 PM
09-27-2024 02:30 PM
Typically, it is more efficient to operate bitwise (8x less memory compared to boolean arrays!), so here is one possibility. The result is the same:
10-01-2024 03:51 AM
Thanks everyone for the support. I'm now able to convert the hexadecimal 1D array to Packed ASCII
10-09-2024 10:07 AM - edited 10-09-2024 10:09 AM
@velaravind07 wrote:
Thanks everyone for the support. I'm now able to convert the hexadecimal 1D array to Packed ASCII
Just to be clear about the semantics. The input array is packed ASCII (as byte array) while the output is just a plain string,
The shown code does NOT convert to "packed ASCII" but goes the other way (unpacking!). Of course it would be equally simple to implement the reverse operation if needed.