beautypg.com

B&B Electronics MODSCAN32 - Manual User Manual

Page 18

background image

18

READ INPUT STATUS (FUNCTION CODE 02)


This function allows the user to obtain the ON/OFF status of discrete inputs in the addressed slave.
Broadcast mode is not supported. In addition to the slave address and function code fields, this message
requires that the information field contain the initial input address to be read, (Starting Address) and the
number of locations that will be interrogated to obtain the status data.

The following is an example of a message to Read Input Status Coils 10197-10218 from slave device
number 17.

ADDR

FUNC

DATA
START
PT HO

DATA
START
PT LO

DATA #
OF PTS
HO

DATA #
OF PTS
LO

ERROR
CHECK
FIELD

11

02

00

C4

00

16

13


An example response to Read Input Status is shown below. The data is packed one bit for each coil. The
response includes the slave address, function code, quantity of data characters, and error checking. Data
will be packed with one bit with one bit for each coil, (1 = ON, 0 = OFF). The low order bit of the first
character contains the addressed coil, and the remainder follow. For coil quantities that are not even
multiples of eight, the last characters will be filled in with zeroes at the high end. The quantity of data
characters is always specified as the quantity of RTU characters, i.e., the number is the same whether RTU
or ASCII is used.

ADDR

FUNC

BYTE
COUNT

DATA
DISCRETE
INPUT
10197-10204

DATA
DISCRETE
INPUT
10205-10212

DATA
DISCRETE
INPUT
10213-10218

ERROR
CHECK
FIELD

11

02

03

AC

DB

35

2E

LRC


The status of inputs 10197-10204 is shown as AC (HEX) = 1010 1100 (Binary). Reading left to right, this
shows that inputs 10204, 10202, 10200 and 10099 are all on. The other input data bytes are decoded
similarly.