Skip to content

xArm Controller RS-485 (Modbus RTU) User Guide

1. Overview

This manual describes the RS-485 communication capabilities of the UFACTORY xArm controller and how to use them under the Modbus RTU protocol.

The controller currently supports:

  • Modbus RTU Master
  • Modbus RTU Slave (Controller AC1310 or later, firmware V2.7.104 or later)

2. Modbus RTU Master

In Master mode, xArm actively communicates with external RS-485 slave devices.

2.1 Interface Definition

TerminalDescriptionNote
M_ARS-485 A / D+Master
M_BRS-485 B / D-Master
GNDSignal Ground

2.2 Communication Parameters

ParameterDefaultRange
Baud Rate20000004800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1000000, 1500000, 2000000, 2500000
Data Bits8
Stop Bits11, 2
ParityNoneNone (N), Odd (O), Even (E)
Timeout50 ms1–9999 ms

2.3 Control Methods

2.3.1 UFACTORY Studio

RS-485 Port: Control Box Protocol: Modbus RTU
alt text CRC will be appended automatically after the input command.

2.3.2 Python SDK

  1. Set controller baud rate
python
arm.set_rs485_baudrate(200000, target='control_box')
  1. Set timeout
python
arm.set_rs485_timeout(1000, target='control_box')
  1. Send data
python
arm.set_rs485_data([0x08, 0x06, 0x01, 0x00, 0x00, 0x01], target='control_box')

3. Modbus RTU Slave

In Slave mode, xArm can be accessed by a PLC or host computer.

3.1 Interface Definition

TerminalDescriptionNote
L_ARS-485 A / D+Slave
L_BRS-485 B / D-Slave
GNDSignal Ground

3.2 Communication Parameters

ParameterDefaultRange
Slave ID11–247
Baud Rate96004800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1000000, 1500000, 2000000; (0-12)
Data Bits8
Stop Bits11, 2
ParityNoneNone (N), Odd (O), Even (E); (0-2)

3.3 Parameter Configuration

Set parameters:

python
arm.set_modbusrtu_params(slave_id=1, baudrate=9600, stopbits=1, parity=0)

Get parameters:

python
arm.get_modbusrtu_params()

Example output:

text
(0, [1, 9600, 1, 0])

3.4 Register Mapping Examples

3.4.1 Function Code

  • Discrete input register
    • 0x02: Read multiple discrete input registers
  • Input register
    • 0x04: Read multiple input registers
  • Coil register
    • 0x01: Read multiple coil registers
    • 0x05: Write single coil register
    • 0x0F: Write multiple coil registers
  • Holding register
    • 0x03: Read multiple holding registers
    • 0x06: Write single holding register
    • 0x10: Write multiple holding registers
    • 0x16: Mask write single holding register
    • 0x17: Read and Write multiple holding registers

3.4.2 Status Registers (Read Only)

Discrete Input Registers (1 bit, READ only)

Address (Dec)Address (Hex)Description
0–310x00–0x1FController digital input IO (16 valid)
32–390x20–0x27Tool digital input IO (2 valid)
40–1270x28–0x7FReserved

Input Registers (16 bit, READ only)

Address(Dec)Address(Hex)Description
0 ~ 10x00 ~ 0x0132 controller Digital Inputs (Now only 16 effective)
20x028 tool Digital Inputs (Now only 2 effective)
3 ~ 60x03 ~ 0x064 controller analog inputs (now only 2 effective), it is 1000 times the real value
7 ~ 100x07 ~ 0x0A4 tool analog inputs (now only 2 effective), it is 1000 times the real value
11 ~ 310x0B ~ 0x1FReserved
320x20Robot Error code
330x21Robot Warning code
34 ~ 350x22 ~ 0x23Counter value (0x22 stores the higher 16-bit, 0x23 stores the lower 16-bit)
36 ~ 630x23 ~ 0x3FReserved
64 ~ 720x40 ~ 0x48Current TCP coordinate of x/y/z/roll/pitch/yaw/rx/ry/rz values, register values are 10 times the real numbers (unit: mm, degree)
73 ~ 760x49 ~ 0x4CTCP payload mass(1000x)/center_x(10x)/center_y(10x)/center_z(10x) (unit: kg, mm)
77 ~ 820x4D ~ 0x52TCP Offset, register values are 10 times the real numbers(unit: mm, degree)
83 ~ 880x53 ~ 0x58User/world coordinate offset, register values are 10 times the real numbers(unit: mm, degree)
89 ~ 950x59 ~ 0x5Fjoint (J1-J7) angles, register values are 10 times the real numbers(unit: degree)
86 ~ 1020x60 ~ 0x66joint (J1-J7) temperature (unit: degree Celsius)
103 ~ 1090x67 ~ 0x6Djoint (J1-J7) speed, register values are 10 times the real numbers(unit: degree/s)
1100x6ERobot TCP linear speed, register values are 10 times the real numbers(unit: mm/s)
111 ~ 1270x6F ~ 0x7FReserved

3.4.3 Control Registers (Read / Write)

Coil Registers (1 bit, READ/WRITE)

Address(Dec)Address(Hex)Description
0 ~ 310x00 ~ 0x1F32 controller Digital Output (Now only 16 effective)
32 ~ 390x20 ~ 0x278 tool Digital Output (Now only 2 effective)
40 ~ 1270x28 ~ 0x7FReserved
128 ~ 1340x80 ~ 0x86joint (J1-J7) brake states
135 ~ 1410x87 ~ 0x8Djoint (J1-J7) enable states
1420x8EReduced mode (0: OFF, 1: ON)
1430x8FDigital Fence (0: OFF, 1: ON)
1440x90isPaused (0: False, 1: True)
1450x91isStopped (0: False, 1: True)
146 ~ 1590x92 ~ 0x9FRobot Mode (14 bits for mode 0-13 respectively, 0: not in this mode, 1: in this mode)
160 ~ 2550xA0 ~ 0xFFReserved
256 ~ 5110x100 ~ 0x1FFGeneral purpose, user defined

Holding Registers (16 bit, READ/WRITE)

Address (Dec)Address (Hex)Description
0-10x00-0x0132 controller Digital Outputs (Now only 16 effective), each bit correspond to one IO in order
20x028 tool Digital Outputs (Now only 2 effective), each bit correspond to one IO in order
3-60x03-0x064 controller analog outputs (now only 2 effective), it is 1000 times the real value
7-100x07-0x0A4 tool analog outputs (currently NOT EFFECTIVE), it is 1000 times the real value
110x0BModbus RTU slave ID
120x0CModbus RTU slave baud rate
130x0DModbus RTU slave stop bit
140x0EModbus RTU slave parity
15-310x0F-0x1FReserved
320x20Robot Mode
330x21Robot State
34-470x22-0x2FReserved
48-630x30-0x3FOffline (Blockly) Task (only effective by writing multiple (max 16) holding registers to address 0x30 via function code 0x10, each register value correspond to one Blockly project with specific naming convention, for example: value 1 for project '00001', 12 for project '00012', projects will be executed automatically in order)
640x40Gcode(Firmware≥2.4.0), trigged the gcode file under modbus_tcp folder.
65-2550x41-0xFFReserved
256-5110x100-0x1FFGeneral purpose, user defined