beautypg.com

Address field, Function field, Address field 272 function field 272 – Watlow PPC-2000 User Manual

Page 300

background image

Appendix A: Modbus Protocol

PPC-2000 User’s Guide

272

Watlow Anafaze

Doc.# 30002-00 Rev 2.3

Address Field

The address field of a message frame contains eight bits. 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. Address 0 is reserved for broadcast messages. The PPC
controller currently supports only 32 devices. 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.

Function Field

The function code field of a message frame contains eight bits.
Valid codes are in the range of 1-255 decimal. Not all these
codes are applicable to PPC controllers. Current codes are
described in Function Codes on page 276.

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 block of
digital inputs or outputs; to read the data contents of a block of
registers; to read the diagnostic status of a controller.

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 the master to slave to read a
block 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.