01-06-2012, 11:34 AM
MODBUS
Technical_Modbus.pdf (Size: 145.41 KB / Downloads: 132)
Introduction
MODBUS Protocol is a messaging structure developed by Modicon in 1979, used to
establish master-slave/client-server communication between intelligent devices. It is a de facto
standard, truly open and the most widely used network protocol in the industrial manufacturing
environment. The MODBUS protocol provides an industry standard method that MODBUS
devices use for parsing messages.
Communication between MODBUS devices
MODBUS devices communicate using a master-slave technique in which only one device
(the master) can initiate transactions (called queries). The other devices (slaves) respond by
supplying the requested data to the master, or by taking the action requested in the query. A
slave is any peripheral device (I/O transducer, valve, network drive, or other measuring device),
which processes information and sends its output to the master using MODBUS.
Masters can address individual slaves, or can initiate a broadcast message to all slaves. Slaves
return a response to all queries addressed to them individually, but do not respond to broadcast
queries
MODBUS REGISTER MAP
MODBUS devices usually include a Register Map. MODBUS functions operate on
register map registers to monitor, configure, and control module I/O. You should refer to the
register map for your device to gain a better understanding of its operation.
Serial Transmission Modes of MODBUS networks
The transmission mode defines the bit contents of the message bytes transmitted along
the network, and how the message information is to be packed into the message stream and
decoded.
Standard MODBUS networks employ one of two types of transmission modes:
ASCII Mode
RTU Mode.
The mode of transmission is usually selected along with other serial port communication
parameters (baud rate, parity, etc.) as part of the device configuration.
Technical Tutorial
Introduction to MODBUS
ASCII Transmission Mode
In the ASCII Transmission Mode (American Standard Code for Information Interchange),
each character byte in a message is sent as 2 ASCII characters. This mode allows time intervals
of up to a second between characters during transmission without generating errors.
4.2. RTU (Remote Terminal Unit) Transmission Mode
In RTU (Remote Terminal Unit) Mode, each 8-bit message byte contains two 4-bit
hexadecimal characters, and the message is transmitted in a continuous stream. The greater
effective character density increases throughput over ASCII mode at the same baud rate.
MODBUS MESSAGE FRAMING
A message frame is used to mark the beginning and ending point of a message allowing
the receiving device to determine which device is being addressed and to know when the
message is completed. It also allows partial messages to be detected and errors flagged as a
result.
A MODBUS message is placed in a message frame by the transmitting device. Each
word of this message (including the frame) is also placed in a data frame that appends a start bit,
stop bit, and parity bit.
In ASCII mode, the word size is 7 bits, while in RTU mode; the word size is 8 bits. Thus,
every 8 bits of an RTU message is effectively 11 bits when accounting for the start, stop, and
parity bits of the data frame
Do not confuse the message frame with the data frame of a single byte (RTU Mode) or 7-
bit character (ASCII Mode). The structure of the data frame depends on the transmission mode
(ASCII or RTU). Note that on some other network types and on MODBUS Plus, the network
protocol handles the framing of messages and uses start and end delimiters specific to the
network.
Technical Tutorial
Introduction to MODBUS
ASCII Mode Message Frames
ASCII Mode messages start with a colon character ":" (ASCII 3AH) and end with a
carriage return-line feed pair of characters (CRLF, ASCII 0DH & 0AH). The only allowable
characters for all other fields are hexadecimal 0-9 & A-F. Recall that it only takes 7 significant
bits to represent an ASCII character. Likewise, the MODBUS ASCII Mode data byte’ or
character is only 7 bits long.
For ASCII Mode transmission, each character requires 7 data bits. Thus, each character
is 10 bits when accounting for the start bit, parity bit, and stop bit of the data frame.
In ASCII Mode, all network devices continuously monitor the network for the start of
message’ colon ( character. When it is received, every network device decodes the next field to
determine if it is the addressed device.
RTU Mode Message Frames
RTU mode messages start with a silent interval of at least 3.5 character times
implemented as a multiple of character times at the baud rate being used on the network. The
first field transmitted is the device address. The allowable characters transmitted for all fields are
hexadecimal values 0-9, A-F.
A networked device continuously monitors the network, including the silent intervals, and when
the first field is received (the address) after a silent interval of at least 3.5 character times, the
device decodes it to determine if it is the addressed device. Following the last character
transmitted, a similar silent interval of 3.5 character times marks the end of the message and a
new message can begin after this interval.