Writing a digital output (function 5) – BECKHOFF BK7300 User Manual

Page 28

Advertising
background image

MODBUS

24

BK7300


Writing a Digital Output (Function 5)

FORCE SINGLE COIL

Function 5 can be used to write a digital output. In this example the third
digital output of slave number 11 is written. The digital outputs begin at
offset 0x0000 (hex). The digital value is located in the high byte of the data.
To switch the output on, "Data high" must contain 0xFF (hex), while 0x00
(hex) is used to switch the output off again. "Data low" must contain 0x00
(hex).


Query

Byte Name

Example

RTU

ASCII

Start frame

„:“

0x3A

Slave address 11

0x0B

„0B“

0x30, 0x42

Function code 5

0x05

„05“

0x30, 0x35

Start address high 0

0x00

„00“

0x30, 0x30

Start address low 2

0x02

„02“

0x30, 0x32

Data high 255

0xFF

„FF“

0x46, 0x46

Data low 0

0x00

„00“

0x30, 0x32

Error Check

LRC / CRC

0x2D
0x50

„EF“

0x45, 0x46


End of frame

t1-t2-t3

CRLF

0xD, 0xA


Response

The coupler answers with the same telegram.

Byte Name

Example

RTU

ASCII

Start frame

„:“

0x3A

Slave address 11

0x0B

„0B“

0x30, 0x42

Function code 5

0x05

„05“

0x30, 0x35

Start address high 0

0x00

„00“

0x30, 0x30

Start address low 2

0x02

„02“

0x30, 0x32

Data high 255

0xFF

„FF“

0x46, 0x46

Data low 0

0x00

„00“

0x30, 0x32

Error Check

LRC / CRC

0x2D
0x50

„EF“

0x45, 0x46


End of frame

t1-t2-t3

CRLF

0xD, 0xA

Advertising