0% found this document useful (0 votes)
505 views

Modbus Dokumentation Franka Panda

franks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
505 views

Modbus Dokumentation Franka Panda

franks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Modbus

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:

Type Access Size


Input Bits Read 1 Bit
Bits Read / Write 1 Bit
Input Registers Read 16 Bits
Holding Registers Read / Write 16 Bits

A server holds the data and provides the information to a client on a request. The important
data within a request are:

• Address: The address on the server for the requested information


• Function: The modbus function code
• Data: Only necessary if a Write function is called. In that case the information which
should be written is transmitted in data

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:

Function Code Action Description


01 (01 hex) Read Read Discrete Output Coils
02 (02 hex) Read Read Discrete Input Contacts
03 (03 hex) Read Read Output Holding Registers
04 (04 hex) Read Read Input Registers
06 (06 hex) Write Write Output Holding Register
15 (0F hex) Write Write Discrete Output Coils

© Copyright 2019 by Franka Emika


Modbus

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

Once all controllers are connected, valid IP-Addresses need to be assigned.


To configure the robot’s IP-Address please go to Settings (which can be found on the top right corner of Desk) and then
select “Network”.

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:

Control Modbus Module


Address 172.16.1.11 172.16.1.10
Netmask 255.255.255.0 255.255.255.0

The information how to configure the IP-Address of the other Modbus controllers in the network should be available in their
respective manual.

© Copyright 2019 by Franka Emika


Modbus

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”

An example configuration could look like the following snippet:

© Copyright 2019 by Franka Emika


Modbus

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:

Type 0x04 0x02 0x03 0x01 0x06 0x0F


Read input coil x
register x
Read output coil x
register x
Write output coil x
register x

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.

© Copyright 2019 by Franka Emika


If desired, it is possible to name each I/O-pin, by using the key “pin_names” in the JSON -file. Additionally, you can set
up pin configurations by using the key “pin_config”. This is particularly helpful if you want to use a set of pins several
times. The pin names and the pin configurations will be visible as part of the configuration panels of the Modbus Apps,
in Desk.

Example 1: Naming I/O-pins

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:

© Copyright 2019 by Franka Emika


Example 2: Adding a pin configuration

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.

© Copyright 2019 by Franka Emika


Modbus

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.

© Copyright 2019 by Franka Emika


Modbus

Troubleshooting

Uploading the configuration file fails


If there is a syntax error in the json configuration file, the upload will fail with the following message:

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.

Diagnostic Status in Modbus TCP section


Each configured module publishes its current status in the modbus route in the Modbus TCP section.

• No route to host (Host: [address], Port: [port])


There is no ethernet connection to the server which was defined in the configuration. Please check if the network
wiring is ok and that all configured IP-Addresses are in the same range.

• Connection refused (Host: [address], Port: [port])


The server refused the connection of the Modbus Client. Please check if your server
is accepting requests on the configured port.

• Illegal data address (Host: [address], Port: [port])


The client requested data from an illegal data address. Please check the manual of
your Modbus TCP server for the correct addresses.

• Illegal function (Host: [address], Port: [port])


The function sent by the client is not supported by your server. In the section
“Modbus configuration” of this guide, an overview was included to illustrate which Modbus function is used given
the configuration.

© Copyright 2019 by Franka Emika

You might also like