Skip to content

Modbus TCP/IP Interface

The Modbus TCP/IP Interface is used to control and interact with the drag&bot program from an external device. Where drag&bot act as a Modbus client (called Client here and after) and the external device as a Modbus Server (called Server here and after).

Currently, the external device can control starting of a program, stopping of a program, pausing of a program, resuming of a program and the robot speed.

The Modbus TCP/IP interface supports setting and getting of different types of values (16-bit Integer, 32-bit Interger, 1-bit Coil, 32-bit Float and 192-bit Pose) using drag&bot function blocks Refer here.

Communication

Info

In the following the notation 16#.... means a value in hexadecimal notation.

Protocol

The drag&bot modbus client communicates with the external device (modbus server) using Big Endian(ABCD), which means the most significant 16 bit of the data is placed in the register with the lowest address and the other 16 bit of data is placed in the next register.

01

Header Registers

Five Modbus registers (Holding registers) are used to communicate the commands with drag&bot. The start address n of the header registers can be selected by the user in the component setup.

Register No. Register address Description
0 n Command execution status Refer here
1 n+1 Commands (program starting, stopping, pausing..etc.) Refer here
2 n+2 drag&bot program status (program is running, stopped, finished, ... etc.) Refer here
3 n+3 Depend on command type Refer here
4 n+4 Depend on command type Refer here

Register-0

Register-0 is used to communicate the command execution and results. This register is set by both the Client and the Server.

The table below shows the meaning of each register value.

Register-0 value hex (decimal) Description Set by
16#0000 (0) Command executed successfully / Idle Client/Server
16#0001 (1) Execute the command Server
16#0064 (100) Error : Command not known Client
16#0065 (101) Error : Program not found Client
16#0066 (102) Error : Program name is invalid Client

Register-1

Register-1 is used to communicate the command type. This register is set by the Server.

Table below show the commands represented by the register values.

Register-1 value hex (decimal) Description
16#0001 (1) Start program with name
16#0002 (2) Reserved for future use
16#0003 (3) Stop the program
16#0004 (4) Pause the program
16#0005 (5) Resume the program
16#0006 (6) Set robot override speed

Register-2

Register-2 is used to communicate the drag&bot program status type. This register is set by the Client.

Table below show the status represented by the register values.

Register-2 value hex (decimal) Description
16#0000 (0) Program is stopped
16#0001 (1) Program is running
16#0002 (2) Program is paused
16#0003 (3) Program finished successfully
16#0004 (4) Error in program execution
16#0005 (5) Unknown

Register-3

Register-3 use is based on the command type (register-1). This register is set by the Server.

Table below show the register value and use for each command type.

Register-1 value hex (decimal) Register-3 value hex (decimal) Description
16#0001 (1) 16#xxxx (x) Address of the first register that contains the program name
16#0006 (6) 16#0001 (1) to 16#0064 (100) Robot override speed in % (1 to 100%)
Other 16#0000 (0) The register value has no effect

Register-4

Register-4 use is based on the command type (register-1). This register is set by the Server.

Table below show the register value and use for each command type.

Register-1 value hex (decimal) Register-4 value hex (deximal) Description
16#0001 (1) 16#xxxx (x) Program name length in registers (1 register = 2 ASCII char)
Other 16#0000 (0) The register value has no effect

Example

Below figure show the header registers values to start a program with name "test".

02

Pose Registers

The Pose is used to describe the robot tool position in the space (x, y, z, rz, ry, rx) using 6 degree of freedom. Where each value (ex. rz) is represented by a 32-bit float number (2 registers) using Big Endian(ABCD) Refer here.

Important

  • Pose values communicated with external systems should use the units METER for position and RAD for orientation values to be consistent with the units used in the drag&bot system.

The table below shows how the registers are structured for a Pose.

Register no. Register address Contains Value
0 n x-coordinate value most significant 16 bit
1 n+1 x-coordinate value least significant 16 bit
2 n+2 y-coordinate value most significant 16 bit
3 n+3 y-coordinate value least significant 16 bit
4 n+4 z-coordinate value most significant 16 bit
5 n+5 z-coordinate value least significant 16 bit
6 n+6 rz rotation around z-axis value most significant 16 bit
7 n+7 rz rotation around z-axis value least significant 16 bit
8 n+8 ry rotation around y-axis value most significant 16 bit
9 n+9 ry rotation around y-axis value least significant 16 bit
10 n+10 rx rotation around x-axis value most significant 16 bit
11 n+11 rx rotation around x-axis value least significant 16 bit

Function Blocks

Set Coil

This function block is used to set one 1-bit coil data to a Modbus server.

Field name Data type Description
Inputs Address Integer The integer address of the Modbus Coil to set the coil value.
Value Boolean The coil value to be set.
Outputs Success Boolean The writing execution success flag.

Set Multiple Coils

This function block is used to set multiple 1-bit coil data to a Modbus server.

Field name Data type Description
Inputs Address Integer The integer address of the first Modbus Coil to set the coil value(s).
Value String The coil value(s) to be set in numeric notation. To set multiple values in consequtive addresses, use commas to separate the values, e.g. '1,0,1'.
Outputs Success Boolean The writing execution success flag.

Get Coil

This function block is used to get the 1-bit Coil data from a Modbus server.

Field name Data type Description
Inputs Address Integer The integer address of the Modbus coil.
Do await value Boolean Activate waiting until the coil value is equal to the given value.
Awaited value Boolean The awaited coil value (false is equals to 0; true is equals to 1).
Timeout Float Timeout in seconds for awaiting the value before a TIMEOUT error is thrown. A value of 0 waits infinitely.
Outputs Value Boolean The read value.

Set 16bit Integer

This function block is used to set one 16-bit integer data (Holding Register) to a Modbus server using Big Endian(AB).

Field name Data type Description
Inputs Address Integer The integer address of the Modbus register to set the 16-bit value.
Value Integer The 16-bit integer value to be set.
Outputs Success Boolean The writing execution success flag.

Set Multiple 16bit Integers

This function block is used set multiple 16-bit integer data (Holding Register) to a Modbus server using Big Endian(AB).

Field name Data type Description
Inputs Address Integer The integer address of the first Modbus register to set the 16-bit value(s).
Value String The 16-bit integer value(s) to be set. To set multiple values in consequtive addresses, use commas to separate the values, e.g. '33,576'.
Outputs Success Boolean The writing execution success flag.

Get 16bit Integer

This function block is used to get the 16-bit integer data (Holding Register) from a Modbus server using Big Endian(AB).

Field name Data type Description
Inputs Address Integer The integer address of the Modbus register, which contains the 16-bit integer value.
Do await value Boolean Activate waiting until the register value is equal to the given value.
Awaited value Integer The awaited 16-bit integer value.
Timeout Float Timeout in seconds for awaiting the value before a TIMEOUT error is thrown. A value of 0 waits infinitely.
Outputs Value Integer The read value.

Set 32bit Integer

This function block is used to set one 32-bit integer data (Holding Register) to a Modbus server using Big Endian(ABCD).

Field name Data type Description
Inputs Address Integer The integer address of the Modbus register to set the 32-bit value.
Value Integer The 32-bit integer value to be set.
Outputs Success Boolean The writing execution success flag.

Set Multiple 32bit Integers

This function block is used to set multiple 32-bit integer data (Holding Register) to a Modbus server using Big Endian(ABCD).

Field name Data type Description
Inputs Address Integer The integer address of the first Modbus register to set the 32-bit value(s).
Value String The 32-bit integer value(s) to be set. To set multiple values in consequitve addresses, use commas to separate the value, e.g. '28545,-534874'.
Outputs Success Boolean The writing execution success flag.

Get 32bit Integer

This function block is used to get the 32-bit integer data (Holding Register) from a Modbus server using Big Endian(ABCD).

Field name Data type Description
Inputs Address Integer The integer address of Modbus register, which contains the 32-bit value.
Do await value Boolean Activate waiting until the register value is equal to the given value.
Awaited value Integer The awaited 32-bit integer value.
Timeout Float Timeout in seconds for awaiting the value before a TIMEOUT error is thrown. A value of 0 waits infinitely.
Outputs Value Integer The read value.

Set 32bit Float

This function block is used to set one 32-bit float data (Holding Register) to a Modbus server using Big Endian(ABCD).

Field name Data type Description
Inputs Address Integer The integer address of the Modbus register to set the 32-bit value.
Value Float The 32-bit float value to be set.
Outputs Success Boolean The writing execution success flag.

Set Multiple 32bit Floats

This function block is used to set multiple 32-bit float data (Holding Register) to a Modbus server using Big Endian(ABCD).

Field name Data type Description
Inputs Address Integer The integer address of the first Modbus register to set the 32-bit value(s).
Value String The 32-bit float value(s) to be set. To set multiple values in consequtive addresses, use commas to separate the values, e.g. '0.2,-5.42'.
Outputs Success Boolean The writing execution success flag.

Get 32bit Float

This function block is used to get the 32-bit float data (Holding Register) from a Modbus server using Big Endian(ABCD).

Field name Data type Description
Inputs Address Integer The integer address of Modbus register, which contains the 32-bit float value.
Do await value Boolean Activate waiting until the register value is equal to the given value.
Awaited value Float The awaited 32-bit integer value.
Tolerance Float The tolerance of the awaited value. A very slight inaccuracy of the received value is usual for floating point values and is caused by system internal conversions.
Timeout Float Timeout in seconds for awaiting the value before a TIMEOUT error is thrown. A value of 0 waits infinitely.
Outputs Value Float The read value.

Set Pose

This function block is used to set the Pose data (Holding Register) to a Modbus server using Big Endian(ABCD).

Important

  • Pose values communicated with external systems should use the units METER for position and RAD for orientation values to be consistent with the units used in the drag&bot system.
Field name Data type Description
Inputs Address Integer The integer address of the first Modbus register to set the Pose data.
Pose Pose The Pose to be set on the Modbus register.
Outputs Success Boolean The writing execution success flag.

Get Pose

This function block is used to get the Pose data (Holding Register) from a Modbus server using Big Endian(ABCD).

Important

  • Pose values communicated with external systems should use the units METER for position and RAD for orientation values to be consistent with the units used in the drag&bot system.
Field name Data type Description
Inputs Address Integer The integer address of the first Modbus register that contains the Pose values.
Outputs Pose Pose The resulting Pose read from the Modbus register.

External Resources

You can search in the Internet for an online tool to encode the ASCII characters (Program name) as Hexadecimal values to use it in your registers Refer here.