Read Discrete Inputs (Modbus Function Code 02 (0X02)) - Xytronix Research & Design WebSwitch XRDI-WS3 User Manual

Webswitch
Table of Contents

Advertisement

Revision 1.1
3.4.2 Read Discrete Inputs (Modbus Function Code 02 (0x02)) (Model XRDI-WS3P only)
This function returns the state of the discrete inputs.
Valid Starting Address and Quantity of coils combinations:
Valid starting address can fall in the range of 0x0000 and 0x0001. Valid quantities can fall in the range of
0x0001 and 0x0002. The only restriction is that the sum of the starting address and the quantity of coils
must not be greater than 0x0002. For example, if you want to read 0x0002 bits, both inputs, then the
starting address must be 0x0000. On the other hand, you may want to read the second input only. This
can be achieved by starting at address 0x0001 and using a quantity of 0x0001.
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): 0x02 (read discrete input)
Starting address (2 Bytes): 0x0000 (0x0000 or 0x0001)
Quantity of inputs (2 Bytes): 0x0001 (0x0001 or 0x0002)
Character String Example:
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): 0x02 (Read discrete input)
Byte count (1 Byte): 0x01
Input status: 0x00 (input off), 0x01 (input on)
Data Byte (hex)
0x00
0x01
0x02
0x03
Xytronix Research & Design, Inc.
LS Data Bits (binary)
10000
10001
10010
10011
WebSwitch™ Users Manual
Input 2 State
Low
Low
High
High
Input 1 State
Low
High
Low
High
77

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WebSwitch XRDI-WS3 and is the answer not in the manual?

This manual is also suitable for:

Webswitch xrdi-ws3p

Table of Contents