smartDEN
IP-16R-MT
User Manual
7 July 2020
-
40
-
9.1.1. Read Coil Status
This command is used to read the ON/OFF status of the output relays (coils).
Request
The Read Coil Status request specifies the starting address and quantity of relays
to be read:
Start Address: 0x0000 (Relay 1) to 0x000F (Relay 16)
Coil Quantity: 0x0001 (1 Relay) to 0x0010 (16 Relays)
Relays are addressed starting from zero (relays 1
–16 are addressed as 0–15).
Note
: If the sum of the start address and coil quantity exceeds 16, an error
response will be returned.
Request example 1: Read Coil Status: Relays 1..3:
Table 6.
Read Coils Request Example 1
Field
Length
Data
Transaction Identifier
2 Bytes
0x0001
Protocol Identifier
2 Bytes
0x0000
Length
2 Bytes
0x0006
Unit Identifier
1 Byte
0x00
Function Code
1 Byte
0x01
Start Address
2 Bytes
0x0000
Quantity of Coils
2 Bytes
0x0003
Request example 2: Read Coil Status: Relays 4..16:
Table 7.
Read Coils Request Example 2
Field
Length
Data
Transaction Identifier
2 Bytes
0x0001
Protocol Identifier
2 Bytes
0x0000
Length
2 Bytes
0x0006
Unit Identifier
1 Byte
0x00
Function Code
1 Byte
0x01
Start Address
2 Bytes
0x0003
Quantity of Coils
2 Bytes
0x000D
Response
The coils in the response message are packed as one coil per bit of the data field.
Status is indicated as 1 for ON and 0 for OFF. The least significant bit (LSB) of the
first data byte contains the relay addressed in the query. The other relays follow
toward the high order end of this byte, and from low order to high order in
subsequent bytes. If the returned output quantity is not a multiple of eight, the
remaining bits in the final data byte will be padded with zeros. The Byte Count field
specifies the quantity of complete bytes of data.
Response
example 1: Read Coil Status: Relays 1..3: