Lynn's Industrial Automation Protocol Tips
Home > Modbus > Modbus/ASCII Tips >
IP-Enable Blog
White Papers
Modbus
Rockwell
ODVA/CIP
Protocols
XML
Digi Product Tips
Others
Yahoo Group
 
Contact Info

The information on this web page is either Lynn's opinion or something Lynn agrees with. He has complete control over its contents. Nothing contained within this pages is approved by or represents the opinion of Digi International, The Modbus Organization, the Modbus-IDA Group, ODVA, or any other organization Lynn is associated with.

Modbus/ASCII Tips


Question? Is Modbus/ASCII a separate protocol from RTU?

Answer: Not really. It is just a different encoding.

One hears nonsense about how MB/ASCII is slightly different than MB/RTU, but really it is just an RTU messages encoded a bit different. This means you can implement you 'Modbus/RTU' send routine as:

If( msg.form == RTU)

     then send_as_rtu( msg)

     else send_as_ascii( msg)

That's all there is to it. You have a binary message, and it is either sent as MB/RTU or as MB/ASCII. When you receive as MB/RTU or MB/ASCII, you end up with a 256-byte or less binary message. There is no reason to allocate 512 bytes for mythical ASCII messages. Just receive the MB/ASCII message 2 hexadecimal bytes at a time and convert them to a single 8-bit binary value.

return to top

Question? Is Modbus/ASCII limited to 9999 registers?

Answer: No, it can handle many message MB/RTU can.

One hears nonsense about how MB/ASCII is limited to 9999 registers or is one (1) based instead of zero (0) based like MB/RTU. But no, you can send any MB/RTU message as either MB/RTU or MB/ASCII. There is no extra limitation to MB/ASCII.

return to top

Question? Does Modbus/ASCII have a fixed 1 second time out?

Answer: Yes and No. You should make it user settable.

The Modbus specification implies Modbus/ASCII must have a fixed 1 second time out. This may be a good starting default, plus setting it shorter than 1 second can cause problems in the situations where one wants to use MB/ASCII. However, the problem with a fixed 1 second time out is when you start sending the message over a wide-area network (WAN). For example if you bridge a Modbus/ASCII master polling a remote slave as Modbus/TCP. Hard limiting the Modbus/ASCII transaction to 1 second will bite you hard in the posterior when you meet a satellite or other WAN technology that routinely sees 1 or 2 second delays. I'd suggest a minimum user settable range of 1 to 5 seconds, but personally I don't see any problem with giving users the same range as you offer them for MB/RTU.

return to top

Question? Does Modbus/ASCII move any ASCII messages?

Answer: No. MB/ASCII can only move hexadecimal characters.

You may run across a few older products that do bad things like move pure ASCII strings like 'JAN-20-1994' within MB/ASCII. Instead, 'JAN' must be moved as the 6 hexadecimal characters '4A414E'. So I suppose we should really can it Modbus/Hex. All MB/ASCII messages must be directly convertible to/from binary using the same simple two hexadecimal bytes to/from one 8-bit data byte.

return to top