77
6 Useful Functions
77
Useful Functions
Chapter
6
02 (0x02) Read Discrete Inputs
The ON/OFF status of discrete input is read.
Broadcast cannot be specified.
The start address of the input and the number of inputs is specified.
* N = Number of inputs/8, N = N+1 if division is not possible.
Example) Reading the status from HI LIM (address 10001) to SP3 (address 10008).
Note that the relative address is 0x00 when reading the HI LIM value.
The F701
+ settings for this example are as follows.
The LSB of the first data is the status of the initial address.
11101000 (0xE8) represented in binary digits.
* The status can also be read by function code 04 (0x04) Read Input Registers.
In function code 04, the status can be read along with the weight value.
[Request]
Function 1 byte 0x02
Start address 2 bytes 0x0000 to 0xFFFF
Number of inputs 2 bytes 1 to 2000 (0x0
7D0)
[Response]
Function 1 byte 0x02
Data bytes 1 byte N *
Input status n bytes N or N+1
[Error response]
Error code 1 byte 0x82 (Function +0x80)
Exception code 1 byte 01 or 02 or 03
[Request]
Function 02
[Response]
Function 02
Start address (HI) 00 Data bytes 01
Start address (LO) 00 HI LIM to SP3 E8
Number of inputs (HI) 00
Number of inputs (LO) 08
HI LIM OFF (0)
LO LIM OFF (0)
HI OFF (0)
GO ON (1)
LO OFF (0)
SP1 ON (1)
SP2 ON (1)
SP3 ON (1)