4 - 7 4 - 7
MELSEC-Q
4 MODBUS
R
STANDARD FUNCTIONS
4.3.2 Read discrete inputs (FC: 02)
Reads the statuses (ON/OFF) of one or more inputs.
Number of accessible devices with one message
1 to 2000 points
(1) Request message format (Master Slave)
Head input number
Data
Read points
(H)
(L)
(H)
(L)
Function code
Function code
(0000
H
to FFFF
H
)
(02
H
)
(0001
H
to 07D0
H
)
(2) Response message format (Slave Master)
(When completed normally)
Data
Function code
Function code
Device data
1
Device data
n
(Number of read bytes n)
(Device data 1 to n)
Device data 1
b0
b1
b2
b3
b4
b5
b6
b7
Device data n
0 : OFF
1 : ON
The read input statuses are stored in order from low-order to high-order bits.
When the number of read points is not a multiple of 8, the excess bits turn to 0.
Bit device storage
order
(02
H
)
Number of
read bytes
n
(When completed with an error)
Data
Function code
Function code
(82
H
)
Exception
code*
: When completed with an error, the exception code and error code are stored
into the buffer memory.
Refer to Section 11.3 for the storage location, confirmation method and more
details.