Hardware manual

Chapter2 Connection to a PLC
2-250
FC2 Read discrete inputs
Reading of Input Relay (I) consecutively
(Request)
Byte 7 FC (Function code)=02
Byte 8-9 Reference No.
Byte 10-11 Number of read bits (1 to 2000 bits)
(Normal response)
Byte 7 FC (Function code)=02
Byte 8 Number of bytes for the response ((number of read bits+7)/8)
From Byte 9 Read data
(Abnormal response)
Byte 7 FC (Function code)=82 (HEX)
Byte 8 Exception code 01 or 02
(Example)
Reading of I100001. 1 bit. The read value is 1.
02 00 00 00 01 => 02 01 01
(Data sequence for read value)
The data sequence for the read value is similar to that of FC1 Read Coils.