Modbus is a protocol that is used for data transmission. There are different communication paths. We use Modbus TCP with horstFX. The data is sent via the TCP protocol. A master-slave concept applies to Modbus.
1. Introduction
The data is divided into 4 different registers (Coil (Bit Read/Write), Discrete Input (Readonly Bit), Holding Register (Read/Write Word), Input Register (Readonly Word)).
A coil or discrete input register consists of one bit and can therefore have the value 0 or 1.
Holding or input registers consist of a word (16-bit). In our implementation, 2 registers are often used to represent a 32-bit data type.
1.1 Advantages
- Very simple protocol
- Modbus client (master) implementations are available in virtually every programming language. Also on common programmable logic controllers (PLC).
- Asynchronous data transmission (no permanent connection necessary)
- No extra hardware required (as communication runs via TCP).
- Existing network installation (including WLAN) can be used for data transmission.
1.2 Disadvantages
- Robot status must be actively queried.
- One register is limited to 16 bits (variables usually have a space requirement of 32 bits).
Info:
When storing 32-bit data types, two registers are used.
1.3 Advantages over XML-RPC
- Runs on PLC
1.4 Disadvantages compared to XML-RPC
- No direct return values to a function to be executed.
- Client programming is often significantly more complex.
1.5 Advantages compared to Profinet
- No additional hardware.
1.6 Disadvantages compared to Profinet
- Not real-time capable.
- Programming the PLC is significantly more complex.
2. Configure CONTROL
The HORST robot has a Modbus-TCP interface in its horstFX control software. The following explains how this interface can be activated.
Minimum requirements:
- horstFX version 2020.10 or higher
2.1 "Control" Settings
To activate the Modbus interface, a configuration within the CONTROL unit of the robot is required. You will need a keyboard connected to the CONTROL unit in order to perform the configuration.
Here is a step-by-step guide on how to activate the interface. Make sure to follow these steps in the correct order.
- Start the robot via CONTROL.
- Exit the horstFX software (do not shut down CONTROL)
- Adjust the configuration:
In the file /home/fruitcore/fruitcore/config/config.properties, the entry modbus.configuration.isEnabled=true must be added, or its value must be set to true if the entry already exists.
This can be done as follows, for example:- Press ALT+F3
- Enter Mousepad in the search field and start
- Press the key combination CTRL+O (CTRL + O) and then CTRL+L (CTRL + L). Enter /home/fruitcore/fruitcore/config/config.properties in the pre-selected address bar and confirm with Enter.
- At the end, add a line with the content modbus.configuration.isEnabled=true
- Click on Robot-UI to restart horstFX
Info
If the entry modbus.configuration.isEnabled already exists, please update its value to true.
3. Establish connection
First, the IP address must be assigned; you can use the following article to help you with this: Change IP address
The robot enclosure control accepts a Modbus connection on the Modbus standard port 502 or on port 8502. Connect to the Modbus client of your choice.
4. Data types
16-Bit Integer
Memory requirement : 16Bit
Number of Modbus registers = 1 (holding register or input register)
Value range: -32768 to 32767
32-Bit Integer
Memory requirement : 32Bit
Number of Modbus registers = 2 (holding register or input register)
Value range: -2147483648 to 2147483647
Floating point number
Memory requirement : 32Bit
Number of Modbus registers = 2 (holding register or input register)
Raw
Memory requirement : 16 Bit
Number of Modbus registers = 1 (holding register or input register)
Value does not represent a number. Is used when individual bits are to be set.
Bool
Memory requirement : 1Bit
Number of Modbus registers = 1 (Coil or Discrete Input)
Value 0: false
Value 1: true
String
A string consists of utf-8 characters terminated with the string end character '\0'. A Modbus holding or input register always contains two characters
5. Coil (Bit Read/Write)
5.1 Mapping
Any undefined elements are reserved.
Each register entry corresponds to the data type Bool.
5.2 Details
Outputs:
Returns the value of outputs 1-14 or switches them to the desired value.
0 = Low, 1 = High
Initialization:
For more detailed information on the initialization process, please refer to: Robot Initialization.
Program Calls:
To execute program calls, horstFX must be in the "Programming" menu and the robot must be in automatic operating mode. The action is triggered by writing a 1 into the respective register.
Bool Register:
Bool registers are freely available in horstFX. By default, all registers are initialized with 0.
The registers can be accessed read or write from horstFX and via any external interface.
The textual horstFX commands are as follows (more details here Read / Write):
- getBoolRegister(n) | read
- setBoolRegister(n, x) | write
n = Register Index
x = Value
Info
Accessing the Bool register in horstFX, located at Modbus-Coil Address 1000 (Bool-Register 0), can be done in Text-Based Programming using the methods getBoolRegister(0) and setBoolRegister(0, x).
Safety Calls:
When a value of 1 is set, the corresponding command is executed.
PopUp:
6. Discrete Input (Readonly Bit)
Discrete inputs from a client can only be read. They have a value of either 0 (false) or 1 (true).
6.1 Mapping
Each register entry corresponds to the data type Bool.
6.2 Inputs
6.3 Initialization Status
For more detailed information on the initialization process, please refer to the section on initializing the robot.
6.4 Programm-Status
This results in the following statuses: