Exploded ASCII Coding

J

Thread Starter

Jim Cai

Hello everyone,

There is a communication protocol who uses so-called exploded ASCII coding.

Can anyone help to find what exactly it is ?

Thanks
 
G

Greg Goodman

The term may refer to an ASCII string containing the human-readable hex representation of an ASCII text string.

That is, the ASCII string "HELLO" has the hexadecimal representation

0x48 0x45 0x4C 0x4C 0x4F

which is rendered as the ASCII string "48454C4C4F".

This as the representation used by the Modbus ASCII serial protocol, and may be what you're looking for.
 
R

Rob Hulsebos

For those who are not up-to-date with the ASCII table, the difference is unclear. So below is the story as I always explain it.

Modbus ASCII "explodes" the hex-string to double its size. Each nibble is encoded as another ASCII-character. So, hex "48" (1 byte) becomes ASCII-string "48" (2 bytes), which becomes hex 34 38 (2 bytes), because the ASCII-value for "4" is (hex) 34, and for "8" it is (hex) 38, and so on. The complete "HELLO" (5 bytes) is in hex "48454C4C4F"
which becomes 34 38 34 35 34 63 34 63 34 66 (10 bytes), which shows why Modbus/ASCII is so inefficient...

Rob Hulsebos
 
B
Why does Modbus do this? Doesn't that make it's strings non-printable. Actually it seems they would print the hex values instead of the human readable values.

Bill
 
Top