5 supported function codes – GE Industrial Solutions Entellisys Integrator’s Guide User Manual

Page 10

Advertising
background image

Integrator’s Guide

10

1.1.5 Supported function codes

Modbus officially defines function codes from 1 to 127 though only a small subset is generally
needed. The CPU supports some of these functions, as summarized in the following table.
Subsequent sections describe each function code in detail.

1.1.5.1 Function Code 03H/04H – Read Actual Values or Settings

This function code allows the master to read one or more consecutive data registers (actual
values or settings) from a relay. Data registers are always 16 bit (two byte) values transmitted
with high order byte first. The maximum number of registers that can be read in a single packet
is 125. See the MODBUS MEMORY MAP table on page 17 for exact details on the data registers.
Since some PLC implementations of Modbus only support one of function codes 03h and 04h,
the CPU interpretation allows either function code to be used for reading one or more
consecutive data registers. The data starting address will determine the type of data being read.
Function codes 03h and 04h are therefore identical. The following table shows the format of the
master and slave packets. The example shows a master device requesting 3 register values
starting at address 4050h from slave device 11h (17 decimal); the slave device responds with the
values 40, 300, and 0 from registers 4050h, 4051h, and 4052h, respectively.

Master and Slave Device Packet Transmission Example

FUNCTION CODE

MODBUS DEFINITION

CPU DEFINITION

HEX

DEC

03

3

Read Holding Registers

Read Actual Values or Settings

04

4

Read Holding Registers

Read Actual Values or Settings

05

5

Force Single Coil

Execute Operation

06

6

Preset Single Register

Store Single Setting

10

16

Preset Multiple Registers

Store Multiple Settings

MASTER TRANSMISSION

PACKET FORMAT

EXAMPLE (HEX)

SLAVE ADDRESS

11

FUNCTION CODE

04

DATA STARTING ADDR - hi

40

DATA STARTING ADDR - lo

50

NUMBER OF REGISTERS - hi

00

NUMBER OF REGISTERS - lo

03

CRC - lo A7 DATA #2 - lo

A7

CRC - hi 4A DATA #3 - hi

4A

Advertising