beautypg.com

Read digital outputs (function 1) – BECKHOFF BK7300 User Manual

Page 24

background image

MODBUS

20

BK7300


Read Digital Outputs (Function 1)

READ COIL STATUS

Function 1 can be used to read the settings of the digital outputs.

In this example the first 10 digital outputs of slave number 11 are read. The
start address is zero. If an offset is to be entered, this is done in the "Start
address" field.


Query

Byte Name

Example

RTU

ASCII

Start frame

„:“

0x3A

Slave address 11

0x0B

„0B“

0x30, 0x42

Function code 1

0x01

„01“

0x30, 0x31

Start address high 0

0x00

„00“

0x30, 0x30

Start address low 0

0x00

„00“

0x30, 0x30

Count high 0

0x00

„00“

0x30, 0x30

Count low 10

0x0A

„10“

0x31, 0x30

Error Check

LRC / CRC

0xBC
0xA7

„E4“

0x45, 0x34


End of frame

t1-t2-t3

CRLF

0xD, 0xA


Response

The coupler answers with byte count 2, i.e. 2 bytes of data are returned.
The request was for 10 bits, and these are now distributed over 2 bytes.
The third bit in the output process image of the BK7300 is set, and the
coupler returns a "4" in the first data byte.

Byte Name

Example

RTU

ASCII

Start frame

„:“

0x3A

Slave address 11

0x0B

„0B“

0x30, 0x42

Function code 1

0x01

„01“

0x30, 0x31

Byte Count 2

0x02

„02“

0x30, 0x32

Data bits 0..7 4

0x04

„04“

0x30, 0x34

Data bits 8..15 0

0x00

„00“

0x30, 0x30

Error Check

LRC / CRC

0x23
0x3D

„EE“

0x45, 0x45


End of frame

t1-t2-t3

CRLF

0xD, 0xA