beautypg.com

1 01h read coil, 2 05h write single coils – NORD Drivesystems BU0050 User Manual

Page 63

background image

2.5 Modbus RTU: Function codes

BU 0050 GB-3111

Subject to technical amendments

63

2.5.1

01h Read Coil

This function enables the readout of inverter bits. The addresses of the bits are listed in the "Coil List".

Master

Slave

Slave

Master

Function Code

1 Byte

0x01

Function Code

1 Byte

0x01

Start address

2 Byte

0x0000 to 0x000F

Number of bytes

1 Byte

1 to 2

Number of bits

2 Byte

1 to 16

Status of bits

n Byte

Example:

4 bits are queries from the address 0x0008 (Bus OUT bits 1 to 4). The bus OUT bits 1 and 2 are High and the
other two bits are Low.

Query (Master

Slave)

Response (Slave

Master)

Address

0x08

Address

0x08

Function Code

0x01

Function Code

0x01

Start address High

0x00

Number of bytes

0x01

Start address Low

0x08

Status of Coils

0x03

Number of High Coils

0x00

CRC High

0x12

Number of Low Coils

0x04

CRC Low

0x15

CRC High

0xBC

CRC Low

0x92

2.5.2

05h Write Single Coils

Writes a single 1Bit value The addresses of the bits are listed in the Coil List.

The value 0x0000 is written if a bit is to be deleted. 0xFF00 is written if the bit is to be set.

Master

Slave

Slave

Master

Function Code

1 Byte

0x05

Function Code

1 Byte

0x05

Address

2 Byte

0x0000 to 0x0007

Address

2 Byte

0x0000 to 0x0007

Coil value

2 Byte

0x0000 or 0xFF00

Coil value

2 Byte

0x0000 or 0xFF00

Example:

Bus IN Bit 2 is set to the address 0x0001.

Query (Master

Slave)

Response (Slave

Master)

Address

0x08

Address

0x08

Function Code

0x05

Function Code

0x05

Address High

0x00

Address High

0x00

Address Low

0x01

Address Low

0x01

Coil value High

0xFF

Coil value High

0xFF

Coil value Low

0x00

Coil value Low

0x00

CRC High

0xDD

CRC High

0xDD

CRC Low

0x63

CRC Low

0x63