Modbus Operation; Read Coils (Modbus Function Code 01 (0X01)) - 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.2b
the browser will prompt the user for the password. If the XML request is sent from another application and not a
browser, the html request will need to contain the password encoded using the base 64 encoding scheme. The html
request header without the password looks like this:
GET /state.xml?noReply=1 HTTP/1.1 (Ends with two \r\n)
The html request header with the password looks like this:
GET /state.xml?relay2State=1&noReply=1 HTTP/1.1 (Ends with two \r\n)
Authorization: Basic bm9uZTp3ZWJyZWxheQ== (Ends with two \r\n)
where bm9uZTp3ZWJyZWxheQ== is the base 64 encoded version of the username and password
none:webrelay
A utility is provided at http://www.ControlByWeb.com/encoder that can be used to encode the password. The utility
is used by simply typing the string username:password into the website and pressing encode.

3.3 Modbus Operation

WebRelay-Quad
can be controlled (and read) using Modbus/TCP protocol. This provides a standard means of
TM
using WebRelay-Quad
in conjunction with devices and software from other manufacturers. This section contains
TM
the information necessary to communicate with WebRelay-Quad
Modbus and it is assumed that reader is already familiar with Modbus. Detailed Modbus information can be found at
http://www.modbus.org.
It is important to note that when the control password in WebRelay-Quad
are disabled. This is because Modbus/TCP does not provide a mechanism for password protection. Make sure the
control password is disabled (default) before using Modbus with WebRelay-Quad
WebRelay-Quad
functions as a Modbus server. Client devices open a connection with WebRelay-Quad
TM
502 (unless another modbus port is selected) and sends commands or requests to to read the state of a relay, or
change a relay. When WebRelay-Quad
response. The following commands are available:
Read Coils (Modbus function 01) - read the status of the relay (and/or the input).
Write Single Coil (Modbus function 05) - change the relay state
Write Multiple Coils (Modbus Function Code 15) – change multiple relays at the same time
Write Multiple Registers (Modbus function 16) - pulse the relay or multiple relays.
Multiple commands may be sent without closing and re-opening the connection but if no data is transferred for about
50 seconds the connection will time out. To keep the connection open, a read request can be sent periodically.

3.3.1 Read Coils (Modbus Function Code 01 (0x01))

This function returns the state of the relay coil(s).
Relay 1 is at address 0x0000, relay 2 is at address 0x0001, relay 3 is at address 0x0002, and relay 4
is at address 0x0003. Multiple relays may be read at the same time by specifying the correct
starting address and quantity of coils. When address 0x0000 is used, the quantities of coils can be
0x0001, 0x0002, 0x0003 or 0x0004. When address 0x0003 is used, the only valid quantity of coils
is 0x0001. This means that relays 1 and 4 cannot be read without reading relays 2 & 3.
Request
Modbus/TCP:
Transaction identifier (2 Bytes): 0x0001
Xytronix Research & Design, Inc.
TM
receives a command, it will perform the desired function and return a
TM
WebRelay-Quad
using Modbus/TCP. This is not a tutorial on
is enabled, Modbus/TCP communications
TM
.
TM
Users Manual
TM
on port
TM
page 27

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

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

Table of Contents