Read Coil Status (Function 1)

The Read Coil Status function can be used to read the digital outputs that have been set.

The first 10 digital outputs are read in this example. The start address is zero. An offset can be entered in the Start address field

Query

Byte Name

Modbus RTU

Modbus ASCII

Start - Frame

":"

0x3A

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

0x10

"10"

0x31, 0x30

Error Check, LRC/CRC

 

0xBC, 0xA7 

"E4"

0x45, 0x34

End - Frame

 

t1-t2-t3

CRLF

0x0D, 0x0A

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

Response

Byte Name

Modbus RTU

Modbus ASCII

Start - Frame

":"

0x3A

Address

11

0x0B

"0B"

0x30, 0x42

Function code

1

0x01

"01"

0x30, 0x31

Byte Count

2

0x02

"02"

0x30, 0x32

Data Bit 0...7

4

0x04

"04"

0x30, 0x34

Data Bit 8...18

0

0x00

"00"

0x30, 0x30

Error Check, LRC/CRC

 

0x23, 0x3D 

"EE"

0x45, 0x45

End -Frame

 

t1-t2-t3

CRLF

0x0D, 0x0A