Xytronix Research & Design WebRelay-10 X-WR-10R12-I User Manual page 66

Table of Contents

Advertisement

Operation
3.4.4 Read Coils - Modbus Function Code 01 (0x01)
This function returns the state of the relay coils. 0 denotes that the coil is not energized, 1 denotes that
the coil is energized.
Request
Valid starting address can fall in the range of 0x0000 and 0x0009. Relay 1 is at address 0x0000, Relay
2 is at address 0x0001, Relay 3 is at address 0x0002, and so forth. Multiple relays may be read at the
same time by specifying the correct starting address and quantity of coils to be read.
Start Address: 0x0000 (coil 1) to 0x0009 (coil 10)
Coil Quantity:
The sum of the start address and coil count cannot exceed the maximum coil count or an error response
will be returned.
Modbus TCP Request Frame Example – Read Coils 2 through 10
Field Name
Transaction Identifier
Protocol Identifier
Message Length
Unit Identifier
Function Code
Data
Tx String: 00 01 00 00 00 06 FF 01 00 01 00 09
Response
The WebRelay-10 will respond to the request with a data field of one or two bytes, each bit representing
the coil status. A '1' indicates the relay is ON. A '0' indicates that the relay is OFF. A single byte is
returned if no more than 8 coils are requested. Two bytes are returned if the status of nine or 10 coils
are requested.
Consequently, the message length will be 0x0004 bytes or 0x0005 bytes, depending on the number of
coils.
Bit zero of the return value will be the state of the coil corresponding to the start address. For example, if
a start address of 0x0006 is used, bit zero will be the status of coil 7. The tables below show two
examples.
Coil status for relays 7-9, start address of 0x0006 and quantity of 3:
Bit 7
6
X
X
Full, 10-bit return value:
Bit 15 14
X
X
page 66
0x0001 (1 coil) to 0x000A (10 coils)
Length
2 bytes
2 bytes
2 bytes
1 byte
1 byte
4 bytes
Single Byte
5
4
3
2
X
X
X
Relay
9
Upper Byte
13
12
11
10
X
X
X
X
Function
Synchronization number.
Zero for Modbus/TCP
Number of bytes in frame (below)
Slave Address (0xff if not used)
Read Coils
Start Address (0x0000-0x0009)
Quantity of coils to read (0x0001-0x000A)
1
Bit 0
Relay
Relay
8
7
9
8
7
Relay
9
8
10
WebRelay-10 Users Manual
Lower Byte
6
5
4
3
7
6
5
4
Xytronix Research & Design, Inc.
Example Data
0x0001
0x0000
0x0006
0xFF
0x01
0x0001
0x0009
2
1
Bit 0
3
2
Relay
1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WebRelay-10 X-WR-10R12-I and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Webrelay-10 plus x-wr-10r12-ip

Table of Contents