Revision 2.6
WebRelay-Quad™
Users Manual
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): 0x0f (write coil)
Starting address (2 Bytes): 0x0000
Quantity of outputs (2 Bytes): 0x0000 - 0x0004
Modbus Error:
Function code (1 Byte): 0x8f
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[] =
{ 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00};
3.3.4 Write Multiple Registers (Modbus Function Code 16 (0x10))
This is used to pulse the relay(s) for a specified time. When WebRelay-Quad™
receives this
command, it immediately turns the appropriate relay coil(s) on (if not on already on) and starts the
pulse timer. The relay(s) are selected by writing the pulse time to the register(s) associated with
the appropriate relay(s). The pulse time is specified in the register value field and can range from
0.1 seconds to 86400 seconds (1 day). When the pulse time expires, the relay coil will be turned
off. If a pulse time command is sent with a value greater than 86400, the pulse timer will be set to
86400. If a pulse time command is sent with a value less than 0.1, the pulse timer will be set to
0.1. If any commands are sent to WebRelay-Quad™
(commands may be modbus, xml or html)
before the pulse timer has expired, the pulse timer will be canceled immediately and the new
command will be executed.
The pulse time is provided in IEEE 754 floating point format. The four data bytes are treated as
two individual big endian 16-bit words but the least significant word is sent first. In other words,
the 32-byte floating point number represented as ABCD is sent as CDAB. In the example shown
below, the relay will pulse for 10 seconds. Ten seconds is represented using a floating point
number of 41200000. It is transferred as 00004120.
Request
Modbus/TCP:
Transaction identifier (2 bytes): 0x0001
Protocol identifier (2 bytes): 0x0000
Length (2 bytes): 0x000b
Unit identifier (1 byte): 0xff
Modbus:
Function code (1 Byte): 0x10 (Write Multiple Registers)
Starting address (2 Bytes): 0x0010 (0x0010 relay1, 0x0012 relay 2, 0x0014 relay 3,
0x0016 relay 4)
Number of registers (2 Bytes): 0x0002 (2 registers for each relay to be pulsed)
Byte count (1 Byte): 0x04 (2 times the number of registers)
Register value (4 Bytes for each relay to be pulsed): 00 00 41 20 (10 second pulse time)
Xytronix Research & Design, Inc.
page 36