MODBUS RTV PROTOCAL DESCRIPTION 3- 3
3.3.2 ASCII Framing
In ASCII mode, which is not incorporated in Phoenix
AC drives, messages start with a colon (: character
(ASCII 3A hex), and end with a carriage return-line
feed (CRLF) pair (ASCII 0D and 0A hex).
The allowable characters transmitted for all other
fields are hexadecimal 0… 9, A… F. Networked
devices monitor the network bus continuously for the
colon character. When one is received, each device
decodes the next field (the address field) to find out if
it is the addressed device.
Intervals of up to one second can elapse between
characters within the message. If a greater interval
occurs, the receiving device assumes an error has
occurred. A typical message frame is shown below.
START
SLAVE
ADDRESS
FUNCTION DATA
LRC
CHECK
END
1
CHAR
:
2
CHARS
2
CHARS
N
CHARS
2
CHARS
2
CHARS
CRLF
3.3.3 How the Address Field is Handled
The address field of a message frame contains eight
bits (RTU). Valid slave device addresses are in the
range of 0…247 decimal. The individual slave devices
are assigned addresses in the range of 1…247. A
master addresses a slave by placing the slave address
in the address field of the message. When the slave
sends its response, it places its own address in this
address field of the response to let the master know
which slave is responding.
Address 0 is used for the broadcast address, which all
slave devices recognize. When Modbus protocol is
used on higher level networks, broadcasts may not be
allowed or may be replaced by other methods. For
example, Modbus Plus uses a shared global database
that can be updated with each token rotation.
3.3.4 How the Function Field is
Handled
The function code field of a message frame contains
eight bits (RTU). Valid codes are in the range of
1…255 decimal. Of these, some codes are applicable
to all Modicon controllers, while some codes apply only
to certain models, and others are reserved for future
use.
When a message is sent from a master to a slave
device the function code field tells the slave what kind
of action to perform. Examples are to read the
ON/OFF states of a group of discrete coils or inputs; to
read the data contents of a group of registers; to read
the diagnostic status of the slave; to write to
designated coils or registers; or to allow loading,
recording, or verifying the program within the slave.
When the slave responds to the master, it uses the
function code field to indicate either a normal (error-
free) response or that some kind of error occurred
(called an exception response). For a normal
response, the slave simply echoes the original function
code. For an exception response, the slave returns a
code that is equivalent to the original function code
with its most significant bit set to a logic 1.
For example, a message from master to slave to read
a group of holding registers would have the following
function code.
0000 0011 (Hexadecimal 03)
If the slave device takes the requested action without
error, it returns the same code in its response. If an
exception occurs, it returns:
1000 0011 (Hexadecimal 83)
In addition to its modification of the function code for
an exception response, the slave places a unique code
into the data field of the response message. This tells
the master what kind of error occurred, or the reason
for the exception.
The master device’s application program has the
responsibility of handling exception responses. Typical
processes are to post subsequent retries of the
message, to try diagnostic messages to the slave, and
to notify operators.
3.3.5 Contents of the Data Field
The data field is constructed using sets of two
hexadecimal digits, in the range of 00 to FF
hexadecimal. These can be made from one RTU
character.
The data field of messages sent from a master to
slave devices contains additional information, which
the slave must use to take the action defined by the
function code. This can include items like discrete and
register addresses, the quantity of items to be
handled, and the count of actual data bytes in the
field.
For example, if the master requests a slave to read a
group of holding registers (function code 03), the data
field specifies the starting register and how many