
Modbus Commands
C-11
TIWAY I Gateway User Manual
Code
04 allows you to read the contents of input registers in the attached
PLC. These registers hold the values returned by the I/O devices. The data
field of this command includes the start address of the registers and the
number of registers to be read.
Addressing is sequential up to the maximum memory size for a particular
PLC. The maximum number of registers that can be addressed with one
command is 125. If more are requested, the whole command will be rejected
with an Exception code 03.
[This command is equivalent to issuing a TIW
A
Y I Primitive 20 request with
a TT
-type 09 (W
ord input WX)].
Example:
I000000
Request: 07 04 0008 0001 XXXX
Checksum (XXXX)
Number of registers (0001)
Address of first register (0008)
Function code (04)
Slave address (07)
Figur
e C-11
Read
Input Register Example — Request
This request is for secondary address 7 to read and return the value stored
in input register 0008.
I000000
Response: 07 04 02 0020 XXXX
Checksum (XXXX)
Input register value (0020)
Number of bytes (02)
Function code (04)
Slave address (07)
Figur
e C-12
Read
Input Register Example — Response
The response has returned the number of bytes of data (02) and the value
0020 (32 decimal) from the requested input register (0008).
Code 04 — Read
Input Registers
Kommentare zu diesen Handbüchern