Modbus

Beta Program

Warning: This interface is currently in the beta phase. This means that not all functions have been tested or completed.

  • Currently, only the TCP/UDP library is available
  • The editor does not display invalid configurations
  • Modbus Slave is not yet available

The Modbus interface can read and write data between devices. The following function codes are supported:

FC Name Description
FC1 Read coils Reading back multiple digital outputs
FC2 Read inputs discrete Reading multiple digital inputs
FC3 Read holding registers Reading multiple analog inputs (and outputs)
FC4 Read input registers Reading multiple analog inputs (and outputs)
FC5 Write coil Writing a single digital output
FC6 Write single register Writing a single analog output
FC15 Force multiple coils Writing multiple digital outputs
FC16 Write multiple registers Writing multiple analog outputs
FC22 Mask write Manipulation of individual bits of a register
FC23 Read/write multiple registers Write-read operation on analog inputs/outputs

Modbus Modes

The Modbus interface operates as a master or slave, but not simultaneously as both. For this purpose, multiple interfaces must be created.

To configure a device as a slave, nothing special needs to be considered. The parameters query cycle, sync, and init are ignored by the slave. However, the unit ID is taken into account. If no unit ID can be set on the master, set it to 0 or possibly to 255.

Import and Export as CSV File

It is possible to export and re-import each device as a CSV file. It is recommended to create an export first so that the structure of the file is known. It is important that the order of the columns is not changed. Additionally, no invalid data should be imported.

Configuration

The configuration of addresses is done in the installation. Here, multiple devices with their registers can be created. Each register defines a table with parameters for an individual unit ID.

Tip: Duplicate the individual registers after commissioning the first device. This speeds up parameterization.

In the right column, you will find the unit ID and the byte as well as bit order if it differs from the hardware used.

Symbol

By clicking on the symbol, multiple registers can be read or written simultaneously. This significantly increases the performance of queries. It should be noted that the number of addresses queried simultaneously must be maintained. These vary depending on the device.

Address

The value defines the Modbus address. This ranges between 0 and 65'535 or 0x0000 and 0xFFFF.

The value can be defined as a decimal value 32'767 or as a hex value 0x7FFF.

Length

The value defines the number of registers in words or bytes. A word corresponds to two bytes. The mode can be changed by clicking on the title Length (Word).

Function

The value defines the function code. This also determines whether the value can be described or not.

Variable

Defines the variable for communication with the Antcas PLC. This can be set individually. If a value of the same variable is to be read and written, the same variable with the same data type can be set for multiple registers.

Tip: Use a / as a separator for many variables to create subfolders in the installation. This enables better overview.

Description

The description comments on the variable.

Calculation

The value for transmission can be calculated with the corresponding trigger. This is defined as follows, for example:

/64+100

This calculates the value by 64 plus 100 and directly returns the result to the PLC.

(v%2)/64

A value can also be defined with v and placed in parentheses. It should be noted that the parentheses must always be closed correctly. Another Modbus address in a format such as $1000 can also be used for calculation. The value 1000 corresponds to the Modbus address 1'000 in the configuration. The reference always relates to the raw value. That is, concatenations are not calculated. Additionally, the address must be used in the editor so that the value is decoded beforehand.

Data Type

Defines the data type for conversion from the Modbus register and communication with the PLC. The calculations are performed after conversion. Therefore, the data type can be specified as real in the Explorer instead of the defined type uint. Here is an example of a temperature:

Location Value Data Type
Modbus Register 215 uint
After Conversion (uint) 215 uint
Value After Calculation 21.5 real
Antcas PLC 21.5 real

To send the temperature, this table is considered from bottom to top.

The data types Float and Double are defined and configured as Real. The query is then configured based on the length of the word.

Query Type Length (Word)
Float 16 1
Float 32 2
Double 4
Invalid Other Lengths

Query Cycle

The query cycle is defined in milliseconds. The value can be defined as a number or with the PLC time specification T#1d1h1m10s500ms.

The time 0 or no value disables the request or writing of the value until it is sent from the PLC to the interface.

The maximum time specification corresponds to T#1d. Otherwise, the modulus cannot be calculated with the timezone offset.

To perform a query at midnight, the timezone can be set accordingly. The query cycle is then set to T#1d. Other times, for example noon, can be queried hourly and the evaluation must then be done in the PLC.

Warning: Time zones with daylight saving time changes may lead to unwanted results when calculating energy data.

Sync

If the checkbox is selected, the value is synchronized with the real-time clock. This is practical if the device is an energy meter.

Init

If the checkbox is selected, the value is read or written when starting the interface or connecting to the slave.

Keyboard Shortcuts

Combination Function
ENTER Next Line
SHIFT+ENTER Previous Line
CTRL+ENTER Insert New Line Below
CTRL+SHIFT+ENTER Insert New Line Above
CTRL+D Duplicate Line
CTRL+DEL Delete Line
ALT+[Up Arrow] Move Line Up
ALT+[Down Arrow] Move Line Down

Monitor

The monitor only shows all changes. It is possible to activate a debug mode in the settings to see all messages cyclically.

Important: However, this mode prevents saving all values to the hard drive. Therefore, the mode must be reset after troubleshooting.