Industrial Communications

cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

How to convert a hexadecimal 1D array to Packed ASCII in HART Communication protocol with LabVIEW

¡Resuelto!
Ir a solución

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_

0 kudos
Mensaje 1 de 9
2.116 Vistas

@velaravind07 wrote:

Attaching the VI for reference.

There is no VI attached.

0 kudos
Mensaje 2 de 9
2.112 Vistas

Sorry again. Please ignore the previous attachment and check this one.

0 kudos
Mensaje 4 de 9
2.104 Vistas

(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)

Mensaje 5 de 9
2.056 Vistas
Solución
Aceptado por velaravind07

I am sure you figured it out by now, but here's a simple implementation.

 

altenbach_0-1727287725470.png

 

Mensaje 6 de 9
2.039 Vistas

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:

 

altenbach_1-1727465327376.png

 

 

Mensaje 7 de 9
1.997 Vistas

Thanks everyone for the support. I'm now able to convert the hexadecimal 1D array to Packed ASCII 

0 kudos
Mensaje 8 de 9
1.957 Vistas

@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.

0 kudos
Mensaje 9 de 9
1.847 Vistas