Revision 3.1
WebRelay
TM
Users Manual
Character String:
char read_inputs_mb_request[] ={0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0xff, 0x02, 0x00, 0x00, 0x00,
0x01 };
Response
Modbus/TCP:
Transaction identifier (2 Bytes): 0x0001
Protocol identifier (2 Bytes): 0x0000
Length (2 Bytes): 0x0004
Unit identifier (1 Byte): 0xff
Modbus:
Function code (1 Byte): 0x01 (Read coils)
Byte count (1 Byte): 0x01
Input status: 0x00 (input off), 0x01 (input on)
Modbus Error:
Function code (1 Byte): 0x82
Exception code (1 Byte): 0x01 or 0x02
Exception codes:
0x01 - Function code not supported
0x02 - Incorrect starting address / quantity of outputs combination
Character String:
char read_coils_mb_response[] = {0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0xff, 0x01, 0x01, 0x01 };
3.4.3 Write Single Coil (Modbus Function Code 05 (0x05))
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
Output value (1 Byte): 0xff - turn relay on, 0x00 - turn relay off
Padding (1 Byte): 0x00
char write_coil_mb_request[] = {0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0xff, 0x05, 0x00, 0x00, 0xff, 0x00};
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)
Output address (2 Bytes): 0x0000
Output value (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
Xytronix Research & Design, Inc.
page 47