beautypg.com

2 02 (0216): read discrete input, Read discrete input – KROHNE MFC 010 C Converter User Manual

Page 26

background image


24

MFC010 Interface Manual

6.2

02 (02

16

): Read Discrete Input

This function permits the user to read the state of a number of consecutive Discrete Input registers. (See

Section 7.3, on page 41, for details of the individual registers). The format of the Master request telegram

for this function should be as follows.

Request

Character

Field

For Example

1

Slave Address

01

16

Request to Slave ID 1

2

Function

02

16

“Read Discrete Input”

3

Start Address Hi

03

16

Start Address = 1001

4

Start Address Lo

E8

16

5

No of Points Hi

00

16

No. of Points = 12

( “Inputs” 1001 – 1011 )

6

No of Point Lo

0C

16

7

CRC Lo

F8

16

CRC Checksum

8

CRC Hi

7F

16

The MFC010 will respond to such a request with a telegram formatted as follows.

Response

Character

Field

For Example

1

Slave Address

01

16

Response from Slave ID 1

2

Function

02

16

“Read Discrete Input”

3

Data Bytes in Response

02

16

2 bytes

4

Data Byte 1

CD

16

Data = 11001101

2

5

Data Byte 2

09

16

Data = 00001001

2

6

CRC Lo

2D

16

CRC Checksum

7

CRC Hi

2E

16

The num ber of dat a by tes i n t he r esponse will depend upon the number of Discrete Inputs requested.

The appropriate bit in each of the data bytes received will indicate each Discrete Input state requested.

Therefore, each data by te i n t he r esponse w ill c ontain a m aximum of 8 di screte i nput s tates. F or

example, if 19 Discrete Inputs are requested, then three data characters will be returned, with the first

group of 8 input states encoded in the first data byte, the second group of 8 i nput states coded in the

second data byte, and the last 3 input states coded in the first three bit locations of the last data byte. Bit

0 of the first response data byte will correspond to the “Start Address” Discrete Input register specified by

the request telegram. B it 0 of the second response data byte will correspond to the “Start Address” + 8

Discrete Input register and so on.

In the example above, 12 Discrete Inputs are requested, so two data bytes are required in the response.