beautypg.com

Modbus protocol description and set-up, 3 function 03: read holding registers, 4 function 04: read input registers – KROHNE ALTOSONIC V12 EN User Manual

Page 117

background image

MODBUS PROTOCOL DESCRIPTION AND SET-UP

10

117

ALTOSONIC V12

www.krohne.com

04/2013 - 4002643502 - MA ALTOSONIC V12 R02 en

10.5.3 Function 03: READ HOLDING REGISTERS

Function 03 reads the contents of 1 to 125 contiguous holding registers in the slave.
The maximum number of registers at each request is limited to 125 16-bit registers: 125
integers, 62 long integers, 62 floats, 31 doubles or 31 long longs.

Request

The request message specifies the starting register and the quantity of registers to be read.
Registers are addressed starting from zero. Registers 1...16 are addressed as 0...15.

Example

A request to read from slave device 17, registers 40108...40110 (decimal), or starting from 9CAC
(hex):

Response

For each register the first byte contains the high order byte, the second the low order byte.

The contents of register 40108 are shown as the two byte values of 02 2B hex (555 decimal).
The contents of register 40109 is 00 00 hex (0 decimal) and of register 40110 is 00 64 hex (100
decimal).

If the request is not applicable, an exception response will be sent.
For more information, refer to

Exception responses

on page 120.

10.5.4 Function 04: READ INPUT REGISTERS

Function 04 performs a “read” operation, similar to function 03. The difference is that function 04
addresses input registers (which are “read-only”), whereas function 03 addresses holding
registers (which are "read/write").

Header

Slave
address

Function

Starting address

Number of data items Error

check

Trailer

--

11(h)

03(h)

Hi

9C(h)

Low

AB(h)

Hi

00(h)

Low

03(h)

--

--

Table 10-2: Example read holding registers

Header Slave

addres
s

Funct.

Byte
count

Data

Error
check

Trailer

--

11(h)

03(h)

06(h)

(Reg.

40108

Hi)

02(h)

(Reg.

40108

Low)

2B(h)

(Reg.

40109

Hi)

00(h)

(Reg.

40109

Low)

00(h)

(Reg.

40110

Hi)

00(h)

(Reg.

40110

Low)

64(h)

--

--

Table 10-3: Response read holding registers