Force Single Coil (Function 5)

The Force Single Coil function can be used to write a digital output. The third digital output is written in this example. The digital outputs start at address 0x0000. The digital value is located in Data high. To switch the output on, Data high must contain the value 0xFF, while 0x00 is used to switch the output off again. Data low must contain the value 0x00.

Query

Byte Name

Modbus RTU

Modbus ASCII

Start - Frame

":"

0x3A

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, 0x30

Error Check, LRC/CRC

 

0x2D, 0x50 

"EF"

0x45, 0x46

End -Frame

 

t1-t2-t3

CRLF

0x0D, 0x0A

The coupler answers with the same telegram.

Response

Byte Name

Modbus RTU

Modbus ASCII

Start - Frame

":"

0x3A

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, 0x30

Error Check, LRC/CRC

 

0x2D, 0x50 

"EF"

0x45, 0x46

End - Frame

 

t1-t2-t3

CRLF

0x0D, 0x0A