Modbus Dokumentation Franka Panda
Modbus Dokumentation Franka Panda
MODBUS
Release Version: 15th of October 2019
Modbus introduction
Modbus TCP/IP is a Client – server protocol and is used to exchange process data between different controllers over Ether-
net. It provides a high degree of flexibility for decentralized control architectures. In a Modbus network each participant can
be both a server as well as a client. To exchange data the client sends a data request to the server. Depending on the request
the server will respond to the request with just a success message or the requested data. If a communication should be esta-
blished with a Modbus server the client needs to know the IP-Address and the Modbus port of the server (which is in most of
the cases 502). Modbus differentiates between the following four datatypes:
A server holds the data and provides the information to a client on a request. The important
data within a request are:
The Modbus function code is the identifier for the server to select the correct data and
return it if a Read function is called and to Write the received data to the correct range if a
Write function is called. Common Modbus functions are:
Network
Network preparation
A regular Ethernet cable can be used to enable Modbus communication between controllers. It is important to use the Ether-
net port at the robot’s Controller, as it shown in the picture below. The controllers can be connected directly (like in the
picture below), or over a switch.
Network configuration
You will not need to edit the settings at “Robot network” as the communication should be established over the Shop Floor
network. Please enter a valid IP-Address and apply your settings. Panda’s Control and your modbus module must be configu-
red to appear on the same network. Simplest way to achieve that is to use static IP addresses. If this is not a valid option for
you, please contact your administrator. An example for a valid network configuration would be:
The information how to configure the IP-Address of the other Modbus controllers in the network should be available in their
respective manual.
Modbus configuration
The modbus service on the robot is a modbus client and needs to know the configuration of the server it should communica-
te with. The format of the configuration file is “json”. If there are any difficutlies with this file format, further information can
be found here: http://www.json.org/
Let‘s have a look at the Modbus Service itself before we start to explain the configuration syntax in detail.
The modbus service (as a client) is able to communicate with multiple servers in the network. They are called “Modules” in
the configuration. For each of the servers multiple input and output setting can be defined. These input and output settings
can also be called “Cards”. Once the configuration file is uploaded it will be checked and then the service will try to connect
to the server and start to poll the information from each server. The following table gives an overview of each setting in the
configuration file:
Name Description
frequency The frequency the service polls the connected modules (default: 10
Hz, must be smaller then 250 Hz)
modules An array of the modules which should be connected
ip The IP-Address of the module
port The port of the module the service should connect to (Default: 502)
inputs An array of input configurations
outputs An array of output configurations
read address Read address of inputs / outputs on the module (If not configured
for output configurations, the write address is used)
write address Write address of the output (only applies to output configuration)
count The number of signals which should be configured
type The type of the input / output configuration. Can either be “coil” or
“register”
The configuration snippet shown above fits a Phoenix Contact BK ETH 2688459 at IP-Address 192.168.1.10 with 16
Inputs (DI 16/4 2688022) and 16 Outputs (DO 16/3 2688048) connected to it. In this configuration we can observe that
modules, inputs and outputs are defined as Arrays which also allows definition of multiple objects.
For each Module an IP-Address and a Port have to be set. Different input and output settings can be defined. Each input or
output setting must include a number of inputs or outputs and the type of those. Types can be either “coil” or “register”. Input
configuration must contain a read address. Output configurations must contain a write address and can have an optional
read address if this address is different from the write address. Once your configuration file is ready, please go to Settings
(which can be found on the top right corner of Desk) and then select “Modbus TCP”. From the you will be able to upload the
configuration file.
Depending on the configuration different Modbus functions are used by the client on the robot controller to read/write data
to/from the module:
In the upper example the modbus function 0x04 will be used to read the inputs at server address 8000. Modbus function 0x03
will be used to read the outputs at server address 9001 and modbus function 0x06 will be used to write the output registers at
address 9001.
Add the key “pin_names” with the pin numbers and the corresponding names for the pins to the JSON-file. An example
configuration could look like the following snippet:
The result will be visible in the Modbus Apps’ configuration panel, as shown in the following screenshot:
Add the key “pin_config” with your desired pin configuration to the JSON-file. Then, provide a name for the configura-
tion and give each required pin (“id”) a value (true or false). It is possible to implement more than one configuration. An
example configuration could look like the following snippet:
The result will be visible in the Modbus Apps’ configuration panel, as shown in the following screenshot. If the configuration is
set correctly, a drop-down menu will appear and enable you to pick one of the configurations.
After selecting the desired configuration, the configured pin-set will appear.
Testing
Once a correct configuration file is uploaded, some lines will appear in the section “Modbus
TCP” of Settings, under “Current Modbus TCP Values and Diagnostics”.
To test if the configuration file enables successful communication, go back to Desk and create a Task named e.g. “Output Test”.
Drag the app “Modbus Out” in the timeline and select the Module, Card and ID of the connected server. Moving the toggle
to “ON” and starting the Task should switch on the connected server.
Troubleshooting
In such case please check the syntax for errors and fix them. The message also gives you a hint at which character position in the
configuration file the parsing of the json file failed including a parsing error message.