MODBUS commands

Top  Previous  Next

This is an overview of the MODBUS commands that are used by the RTCU device in master mode and accepted by the device in slave mode.

 

 

Master

The MODBUS commands that the RTCU device uses to read and write I/O in remote devices.

 

Command

Name

Description

02 (0x02)

Reads discrete inputs.

This is used to read the digital inputs from the devices.

04 (0x04)

Reads input registers.

This is used to read the analog inputs from the devices.

15 (0x0F)

Writes multiple coils.

This is used to set the digital outputs for the devices.

16 (0x10)

Writes multiple holding registers.

This is used to set the analog outputs for the devices.

 

 

Slave

The MODBUS commands that the RTCU device accepts in slave mode.

The RTCU device will return an error message with exception code 01 (0x01) if it receives a MODBUS command not listed here.

 

Please note that memory registers in the RTCU device are 32 bits long and are read and written lower half first and then upper half.

Register channel 0x1000 will therefore contain RTCU memory position 1 Byte 1 + 2 and channel 0x1001 will contain position 1 Byte 3 + 4.

 

The command tables follow this convention:

Field #

Name

Byte count

Value / Comments

 

01 (0x01) Read coils

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x01.

02 - 03

Starting channel

2 bytes

0x0000 - 0x003F for DO onboard RTCU.

0x0040 - 0x023F for DO in extension modules.

04 - 05

Number of channels

2 bytes

0x0001 - 0x0240.

 

Error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x81.

02

Exception code

1 byte

0x03 for number of channels too high.

0x02 for when one or more of the channels are not present.

 

 

02 (0x02) Read discrete inputs

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x02.

02 - 03

Starting channel

2 bytes

0x0000 - 0x003F for DI onboard RTCU.

0x0040 - 0x023F for DI in extension modules.

04 - 05

Number of channels

2 bytes

0x0001 - 0x0240.

 

Error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x82.

02

Exception code

1 byte

0x03 for number of channels too high.

0x02 for when one or more of the channels are not present.

 

 

03 (0x03) Read holding registers

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x03.

02 - 03

Starting channel

2 bytes

0x0000 - 0x003F for AO onboard RTCU.

0x0040 - 0x013F for AO in extension modules.

0x1000 - 0x17FF for RTCU memory registers.

04 - 05

Number of channels

2 bytes

0x0001 - 0x007D.

 

Error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x83.

02

Exception code

1 byte

0x03 for number of channels too high.

0x02 for when one or more of the channels are not present.

 

 

04 (0x04) Read input registers

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x04.

02 - 03

Starting channel

2 bytes

0x0000 - 0x003F for AI onboard RTCU.

0x0040 - 0x013F for AI in extension modules.

0x1000 - 0x17FF for RTCU memory registers.

04 - 05

Number of channels

2 bytes

0x0001 - 0x007D.

 

error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x84.

02

Exception code

1 byte

0x03 for number of channels too high.

0x02 for when one or more of the channels are not present.

 

 

05 (0x05) Write single coil

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x05.

02 - 03

Channel

2 bytes

0x0000 - 0x003F for DO onboard RTCU.

0x0040 - 0x013F for DO in extension modules.

04 - 05

Value

2 bytes

0x0000 or 0xFF00.

 

error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x85.

02

Exception code

1 byte

0x03 for invalid value.

0x02 for invalid channel.

 

 

06 (0x06) Write single holding register

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x06.

02 - 03

Channel

2 bytes

0x0000 - 0x003F for AO onboard RTCU.

0x0040 - 0x013F for AO in extension modules.

0x1000 - 0x17FF for RTCU memory registers.

04 - 05

Value

2 bytes

0x0000 - 0x03FF for AO onboard RTCU.

0x0000 - 0xFFFF for all other channels.

 

Error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x83.

02

Exception code

1 byte

0x02 for invalid channel.

 

 

15 (0x0F) Write multiple coils

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x0F.

02 - 03

Starting channel

2 bytes

0x0000 - 0x003F for DO onboard RTCU.

0x0040 - 0x023F for DO in extension modules.

04 - 05

Number of channels

2 bytes

0x0001 - 0x0240.

06

Byte count

1 byte

N.

07 -

Output values

N * 1 byte

Value.

 

error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x8F.

02

Exception code

1 byte

0x03 for number of channels too high or with invalid byte count

0x02 for when one or more of the channels are not present.

 

 

16 (0x10) Write multiple holding registers

 

Request

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x10.

02 - 03

Starting channel

2 bytes

0x0000 - 0x003F for AO onboard RTCU.

0x0040 - 0x013F for AO in extension modules.

0x1000 - 0x17FF for RTCU memory registers.

04 - 05

Number of channels

2 bytes

0x0001 - 0x007B.

06

Byte count

1 byte

2 * N.

07 -

Values

N * 2 bytes

Value.

 

Error response

00

Address

1 byte

1 - 247.

01

Function code

1 byte

0x90.

02

Exception code

1 byte

0x03 for number of channels too high of invalid byte count

0x02 for when one or more of the channels are not present