smartDEN
IP-16R-XX
User Manual
13 Apr 2021
-
48
-
10.2.1.1. Write Single Coil
This command will turn single relay output to ON or OFF.
Request
The Write Single Coil request specifies the address of the coil to be forced:
Address: 0x0000 (Relay 1) to 0x000F (Relay 16)
A value of 0xFF00 requests the coil to be ON, a value of 0x0000 requests the coil
to be OFF, and a value of 0xFF02 toggles the coil state. All other values are illegal
and will not affect the coil state.
Note:
If the address exceeds 16, an error response will be returned.
Request example: Write Single Coil 2 (Relay 2) to ON:
Table 10.13.
Write Single Coil request
Field
Length
Data
Transaction Identifier
2 Bytes
0x0002
Protocol Identifier
2 Bytes
0x0000
Length
2 Bytes
0x0006
Unit Identifier
1 Byte
0x00
Function Code
1 Byte
0x05
Output Address
2 Bytes
0x0001
Output Value
2 Bytes
0xFF00
Response
The response indicates the new state of the relay.
Response: Write Single Coil 2 (Relay 2) to ON:
Table 10.14.
Write Single Coil reply
Field
Length
Data
Transaction Identifier
2 Bytes
0x0002
Protocol Identifier
2 Bytes
0x0000
Length
2 Bytes
0x0006
Unit Identifier
1 Byte
0x00
Function Code
1 Byte
0x05
Output Address
2 Bytes
0x0001
Output Value
2 Bytes
0xFF00
Error
The possible error responses for function code 0x05 are:
Function Code (1 byte): 0x85 (0x80 + 0x05)
Exception Codes (1 byte):
- 0x01
– Function code not supported
- 0x02
– Incorrect relay address
- 0x03
– Illegal relay value
Error response example:
Содержание smartDEN IP-16R Series
Страница 63: ...smartDEN IP 16R XX User Manual 13 Apr 2021 63 Figure 10 9 Inputs state notifications...
Страница 66: ...smartDEN IP 16R XX User Manual 13 Apr 2021 66 13 Appendix 2 Application reply formats 13 1 XML reply...
Страница 67: ...smartDEN IP 16R XX User Manual 13 Apr 2021 67 13 2 JSON reply...