Difference between revisions of "Modbus Server"

From Wiki
Line 40: Line 40:
 
= PLC integration =
 
= PLC integration =
  
To be written...
+
Will follow soon...
  
 
= Modbus mapping =
 
= Modbus mapping =

Revision as of 08:03, 23 August 2021

The Modbus protocol can be used for controlling robots among other devices from a central PLC to achieve a combined workflow. A register mapping defines sets of 1-bit and 16-bit registers that can be read for information or written to send parameters, change states or start actions.

The embedded robot control TinyCtrl supports Modbus TCP. This article gives a short overview of the features, a more in-depth explanation can be found in the user manual.

Programming blocks for Siemens S7-1200 and S7-1500 will be provided for easy integration of basic features.


Introduction Video

TitleScreenModbus small.JPG

Video Link: Modbus Interface Video on YouTube

Availability

The Modbus server is implemented in TinyCtrl version V980-12-XXX (to be released in September 2021). Please upgrade your software to the current version.

Using the Modbus server requires a license. More information can be found on our shop.

Without a license the Modbus features can be tested for 30 minutes. Another test duration can be started by restarting the robot.

Setting up the Modbus server

By default the Modbus server is disabled. In order to enable it the project configuration file of the embedded control must be changed. It can either be accessed via CPRog/iRC or an SFTP client:

  • via CPRog/iRC
    • Connect CPRog/iRC to the robot
    • Click File -> Access Remote Configuration
    • Find the project configuration section and click Load
    • After changing the file using a text editor click Write and select the changed file.
  • via a SFTP client
    • Please refer to sections 1 and 2 of this guide: FTP and putty Access
    • Find the file /home/robot/TinyCtrl/Data/Projects/EmbeddedCtrl.prj
    • Edit it with a text editor, then save it and make sure it is written back to the robot control

Once you opened the project file in a text editor find the section <Environment>. In that section try to find a line starting with <ModbusServer. If it does not exist create it as follows. Change the port and connection count if necessary.

<ModbusServer Active="true" Port="502" MaxConnections="5"/>

After changing the configuration file save it, write it back to the robot control and restart it by powering it down and up.

PLC integration

Will follow soon...

Modbus mapping

The Modbus protocol defines 4 access types that generally refer to distinct sets of parameters:

  • Discrete inputs (1 bit, read only)
  • Coils (1 bit, read/write)
  • Input registers (16 bit, read only)
  • Holding registers (16 bit, read/write)

Our mapping uses these depending on what access type is appropriate for what information. Status information can be read from discrete inputs and input registers, states can be changed by writing to coils and holding registers, actions can be startet by writing to coils.

A complete mapping table can be found in the user manual.

To test whether the Modbus connection is successful the input registers on addresses 0-3 can be read: These contain the TinyCtrl version and mapping version, e.g. 980, 12, 20, 1.

Digital inputs and outputs

  • Digital inputs can be read on discrete inputs 300-363 and as bitsets on input registers 207-210.
  • Digital outputs can be read or changed on coils 300-363 and as bitsets on holding registers 207-210.

Program variables and global signals

The Modbus server enables communication with the robot program using global signals, number variables and position variables:

  • Global signals work similar to the digital outputs: They can be read or changed on coils 200-299 or as bit sets on holding registers 200-206.
  • The Modbus server defines 32 number variables (mb_num1 - mb_num32) which can be read or written as 16 bit integers on addresses 480-511
  • 32 position variables (mb_pos1 - mb_pos32) are defined as a combination of 16 registers each on addresses 512-1023. Please refer to the user manual for more information.

Moving robots via Modbus

The Modbus server offers two approaches for moving the robot:

  • Position variables: Write your position as joint angles or cartesian position to a position variable, then use a robot program with a Join-by-Variable or Linear-by-Variable command to move to the position.
  • The mapping provides registers for motion target positions (joint angles or cartesian positions). By writing 1 to a specific coil address a cartesian, joint or relative motion can be started. Please refer to the mapping table in the user manual.