LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Packed ASCII conversion

Hi,

 

Can anyone provide any examples or Algorithm to convert 'ASCII' to 'Packed ASCII'

 

Packed ASCII format is used in HART protocol

 

Thanks.

0 Kudos
Message 1 of 5
(10,513 Views)

Hi,

 

Packed ASCII is noting but a data compression technique.

 

HART makes limited use of data compression in the form of Packed ASCII.  Normally, there are 256 possible ASCII characters, so that a full byte is needed to represent a character.  Packed ASCII is a subset of full ASCII and uses only 64 of the 256 possible characters.  These 64 characters are the capitalized alphabet, numbers 0 through 9, and a few punctuation marks.  Many HART parameters need only this limited ASCII set, which means that data can be compressed to 3/4 of normal.  This improves transmission speed, especially if the textual parameter being communicated is a large one.

 

    Since only full bytes can be transmitted, the 3/4 compression is fully realized only when the number of uncompressed bytes is a multiple of 4.  Any fractional part requires a whole byte.  Thus, if U is the number of uncompressed bytes, and T the number of transmitted bytes; find T = (3*U)/4 and increase any fractional part to 1.  As examples, U = 3, 7, 8, and 9 result in T = 3, 6, 6, and 7.

 

    The rule for converting from ASCII to Packed ASCII is just to remove bits 6 and 7 (two most significant).  An example is the character "M".  The full binary code to represent this is 0100,1101.  The packed binary code is 00,1101.  The rules for conversion from packed ASCII back to ASCII are (1) set bit 7 = 0 and (2) set bit 6 = complement of packed ASCII bit 5.

 

    Note that, with some exceptions, HART Slaves don't need to do the compression or know anything about the compression.  They simply store and re-transmit the already compressed data.  Again, this is an instance where the more difficult software is placed in the device (Master) that is more capable of dealing with it.

 

Thanks and Regards

Himanshu Goyal

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 2 of 5
(10,509 Views)

Hi,

 

     I already found this information in this website(Section;Data Compression).

 

If you have more information, please share.

 

Thanks.

0 Kudos
Message 3 of 5
(10,498 Views)

See attached.

Download All
Message 4 of 5
(8,644 Views)

@Jim12345678 wrote:

See attached.


I would recommend you rewrite those in a more sane way. This is just a mess!

 

I am very sure you don't need any local variables or sequence structures! Try it! 😄

0 Kudos
Message 5 of 5
(8,631 Views)