Write Single Coil (Modbus Function Code 05 (0X05)) - ControlByWeb WebRelay-Quad X-WR-4R1-5 User Manual

Hide thumbs Also See for WebRelay-Quad X-WR-4R1-5:
Table of Contents

Advertisement

Revision 2.6

3.3.2 Write Single Coil (Modbus Function Code 05 (0x05))

This function is used to change the state of the coil
Request
Modbus/TCP:
Transaction identifier (2 Bytes): 0x0001
Protocol identifier (2 Bytes): 0x0000
Length (2 Bytes): 0x0006
Unit identifier (1 Byte): 0xff
Modbus:
Function code (1 Byte): 0x05 (write coil)
Output address (2 Bytes): 0x0000 – 0x0003 (specifies relay)
Output value (1 Byte): 0xff - turn relay on, 0x00 - turn relay off
Padding (1 Byte): 0x00
Character String Example:
char write_coil_mb_request[] =
Response
Modbus/TCP:
Transaction identifier (2 Bytes): 0x0001
Protocol identifier (2 Bytes): 0x0000
Length(2 Bytes): 0x0006
Unit identifier (1 Byte): 0xff
Modbus:
Function code (1 Byte): 0x05 (write coil)
Reference number (2 Bytes): 0x0000
Data (1 Byte): 0xff - relay on, 0x00 - relay off
Padding (1 Byte): 0x00
Modbus Error:
Function code (1 Byte): 0x85
Exception code (1 Byte): 0x01 or 0x02
Exception codes:
0x01 - Function code not supported
0x02 - Incorrect starting address / quantity of outputs combination
Character String Example:
char write_coil_mb_response[] =
Xytronix Research & Design, Inc.
{0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0xff, 0x05, 0x00, 0x00, 0xff, 0x00 };
{0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0xff, 0x05, 0x00, 0x00, 0xff, 0x00 };
WebRelay-Quad™ Users Manual
page 34

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WebRelay-Quad X-WR-4R1-5 and is the answer not in the manual?

This manual is also suitable for:

Webrelay-quad x-wr-4r1-iWebrelay-quad x-wr-4r1-e

Table of Contents