# Help ASCII mode

D
Thread Starter

#### De Volder Marc

Hi,
Can somebody help me to understand the mode ASCII. When you use MODBUS ASCII you have a 8 bit byte with two ASCII characters. Now what I don't get is a ASCII character is at least 7 bits. How can 14 bits fit in a 8 bit byte?

I

#### Ian Halse

When ASCII mode is used each register of PLC data is transmitted as 4 ASCII characters. The ASCII codes for the Hex value are sent.

So if the register contained 1234 dec = 04D2 Hex the ASCII codes for 0 (30 hex) 4 (34 hex) D (44 hex) and 4 (30 hex) are transmitted).

IE an ASCII message is twice as long as an Modbus RTU message.

Hope this helps

R

#### Raymond van der Tas

14 bits do not fit in a 8 bit byte, not even if you squeeze.

The protocol frame of a ASCII Modbus where each <X> represents one byte (8 bits):
<Start><addr1><addr2>><funct1><funct2><data 1>..<data N><LRC1><LRC2><end1><end2>

The protocol frame of a Binary Modbus where each <X> represents one byte (8 bits):
<addr><funct><data 1>..<data N><CRC1><CRC2>

Imagine you try to address a Modbus device with the node number 17 (decimal)

In binary Modbus mode you would ensure that your modbus protocol string contains the address byte with the value 17. This address byte is 8 bits.

In ASCII Modbus mode you would have to fill two (2) bytes in order to address a device. Since 17(dec) is 11 in Hex notation you would send the string "11" (without the quotes).

As you see, the ASCII mode communication requires more than the double amount of bytes in order to address the exact same data. You even have one start character and two end characters extra. Thus 7+7=16

R

#### Rufus

Obviously you're not going to squeeze two 7 bit numbers(characters) into an 8-bit byte.

Are you sure you're not talking about HEX characters, only 0-9,A-F? There are only 16 characters which can be represented by 4 bits, allowing for two HEX characters in 8 bits.

Rufus

Similar threads