Articles Download Safety & Security Forum myUR Go to Main Site

Universal Robots A/S
Energivej 51
DK-5260 Odense S

T: +45 8993 8989
sales@universal-robots.com

 
  • Articles
  • Download
  • Safety & Security
  • Forum
  • myUR
  • Go to Main Site
  • Support
  • Articles
  • Modbus Register and Digital I/O - 19252

Modbus Register and Digital I/O - 19252

Utilize Modbus register to read from and write to digital I/Os

Last modified on Sep 30, 2024

Modbus Register and Digital I/O

Example is valid for: All versions                                              

CB3 Software version: 3.1.17779 and above
e-Series Software version: 5.1
Note that older or newer software versions may behave differently.

This is a example for using modbus registers to read from digital inputs and write to digital outputs of the control box.


Introduction

All Universal Robots features an internal Modbus server. This is a guide on how to configure the Modbus client to read and write to the internal registers in the Modbus server.

Modbus Addresses

Digital input and output registers are located on the addresses listed below. The full list of port map 16bit registers are located here Modbus server -16377. 

Address

Pre 3.0

3.0

3.1

R

W

 

0

X

X

X

X

 

Inputs, bits 0-15 [BBBBBBBBTTxxxxxx] x=undef, T=tool, B=box

1

X

X

X

X

X

Outputs, bits 0-15 [BBBBBBBBTTxxxxxx] x=undef, T=tool, B=box

 

Modbus Client IO Setup

Modbus Registers can be accessed by the robot internally using the Modbus client.

1. The Modbus client is located in the installation tab.

2. Internal IP for Modbus server is 127.0.0.1.

3. Input and output registers are added by clicking the “+” button on the right hand side of the GUI

Picture 1

 

 

4. Set Modbus address signal to 0 for register input. Example below show that when digital inputs 4 and 5 are activated, the Modbus register will convert the binary into an integer

 Picture 2

Picture 3 (1)

 

5. Set Modbus address signal to 1 for register output. When integer values are set to the Modbus register, the digital output values are reflected accordingly.

Picture 4

Picture 5

Converting integer to binary list

Data from Modbus server is an integer. Data can be converted to a list of binary with the use of the functions below. After conversion individual IO channel can be accessed.

binary_list_to_integer()

  • Function to convert a list of binary into an integer

integer_to_binary_list()

  • Function to convert an integer into a list of binaries

Example code

Reading input registers and converting to binary

Robot Program

ASSIGN List_A =integer_to_binary(digital_inputs)

ASSIGN Input_4=List_A[4]

ASSIGN Input_5=List_A[5]

Converting a list of binary values and setting the output register.

 Robot Program

ASSIGN List_B =  [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
SET digital_outputs = binary_list_to_integer(List_B)

 

BeforeStartSequence

ASSIGN List_A = [True]

ASSIGN List_B =  [False, True, False, True, True, True]

Robot Program

ASSIGN List_A =integer_to_binary(digital_inputs)

WAIT 0.5

SET digital_outputs = binary_list_to_integer(List_B)

WAIT 0.5

 

Related articles

UR MODBUS Slave Setup - 20579
Modbus Server
Modbus client troubleshooting
Modbus slave addresses - 16369
Modbus TCP Client Setup
Modbus communication - 16357
logo

Product

  • UR3e Robot
  • UR5e Robot
  • UR10e Robot
  • UR16e Robot
  • UR20 Robot
  • UR+ Products

Company

  • About us
  • Contact us
  • Careers We're hiring
  • UR merchandise

Training / Resources

  • Academy
  • Technical Resources
  • Articles
  • FAQ

Insights

  • Blog
  • Case stories
  • Content library
  • News centre
  • Podcast
  • Webinars & Events

Get in touch

  • Ask an Expert
  • Schedule a no-cost assessment
  • Find a distributor
  • Customer support

Connect with us

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube
  • Instagram
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com
  • Copyright @ Universal Robots 2025
  • Cookie policy
  • Privacy policy
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com

Copyright © Universal Robots 2025

Cookie policy
Privacy policy