EM58 – HS58 - HM58 MODBUS TCP/IP
9 Programming examples
Hereafter are some examples of both reading and writing parameters. All values
are expressed in hexadecimal notation. For any information on the MODBUS
TCP/IP ADU (MBAP Header + PDU) refer to the “6.3 MODBUS on TCP/IP
Application Data Unit” section on page 35.
9.1 Using the 03 Read Holding Registers function code
EXAMPLE 1
registers (address 104-105).
MBAP Request PDU
(in hexadecimal notation)
[00][01][00][00][00][06][00][03][00][68][00][02]
where:
[00][01] = Transaction Identifier
[00][00] = Protocol Identifier
[00][06] = Length
[00] = Unit Identifier
[03] =
function code
[00][68] = starting address (
105)
[00][02] = number of requested registers
MBAP Response PDU
(in hexadecimal notation)
[00][01][00][00][00][07][00][03][04][00][00][05][DC]
where:
[00][01] = Transaction Identifier
[00][00] = Protocol Identifier
[00][07] = Length
[00] = Unit Identifier
[03] =
function code
[04] = number of bytes (2 bytes for each register)
[00][00] = value of register 105, 00 00 hex = 0 dec
[05][DC] = value of register 106, 05 DC hex = 1500 dec
registers (address 104-105) contain the value 00
00 hex and 05 DC hex, i.e. 1500 in decimal notation; in other words the value
set in the
registers is 1500 dec.
MAN EM58_HS58_HM58 MT E 1.1.odt
Programming examples
95 of 104
Содержание EMC58 MT
Страница 101: ...This page intentionally left blank ...
Страница 102: ...This page intentionally left blank ...
Страница 103: ...This page intentionally left blank ...