MODBUS communication

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

MODBUS communication

MODBUS communication is supported for the following devices:

Ethernet

Modbus communication is a master/slave protocol where the Modbus line performs the functions of the master.

General PC requirements

The Modbus line can be implemented on the following platforms:

Windows platform

Limitations

Windows 7 or higher

-

Windows XP/Vista

-

Windows CE

No longer supported in PVI V3.0.3 and higher

Ethernet communication

PC requirements:

TCP/IP must be installed.

Using multiple network adapters on one PC:

How can you be sure that PVI uses the correct network card if two or more network adapters are located on the PC?

The subnet mask must be configured properly to ensure that the correct network adapter is used for communication. First an AND operation is executed with the IP address of the Modbus slave and the subnet mask of a network adapter. The network adapter whose IP address matches the result of this operation is used.

Example:

Device parameters: /IF=mbustcp

Station parameters: /DAIP=192.168.100.1

IPAdr NW1: 192.168.100.12 Subnet Mask: 255.255.255.0

IPAdr NW2: 192.168.101.12 Subnet Mask: 255.255.255.0

IPAdr Slave: 192,168,100.1

In this example, the first network adapter is used to communicate with the slave.

Line configuration

The FieldbusDESIGNER can be used to set up a Modbus system with all stations and modules, to configure modules and to specify I/O variables. The configuration file is generated from this project and contains all of the necessary data for the Modbus line. The file name of the generated file is ModbusConfig.xml, and the line searches for it under this name as long as no other configuration file was specified when setting up the line.

Station numbers 1 - 127 are configured with IP addresses operating bus connectors. This means that the bus connectors must be assigned an IP address using the Modbus toolbox. The assigned IP address must also be entered in the FieldbusDESIGNER for the respective bus connector. Station numbers 128 - 239 are for DHCP operation. The respective node number must be set on the bus connector, and the bus connector uses it to generate a host name ("brmb" + node number). This host name must be entered in the FieldbusDESIGNER for the respective bus connector. Changes made to the node number on the bus connector do not take effect until a restart.

Specifying the format of the configuration file

This configuration is optional, however it provides the following advantages:

The device object can list all defined stations. This makes it easy to set up a station as connection description using an entry in this list.

The configuration of the bus controller and the I/O modules can be completed automatically when necessary.

The station object can list all defined variables including data format.

Access to I/O channels is abstracted using a symbolic name (i.e. the user does not have to determine which address is assigned to a channel and changes to the process image resulting from changes to the module structure or module configuration have no effect on the user software.

If the FieldbusDESIGNER and the Modbus line are operated on the same computer, the FieldbusDESIGNER automatically copies this configuration file to the PVI configuration directory after the build. If the line is operated on a different computer, the file must be copied to the correct location manually. If this file is placed either in the PVI binary directory or in the configuration directory of the PVI line, the line loads it automatically. If the file needs to be renamed or placed in a different directory than the two just mentioned, the complete path for the file must be entered in the connection description when setting up the line.

The configuration directory of the PVI line should be taken from PviConfig.xml. The file can be found in the PVI binary directory.

Example: Defining the configuration directory in PviConfig.xml:

The line will run in a non-configured state if this file is not found in either of the two directories. In this mode, the bus connectors and the connected modules are not configured and are operated in the standard function model. Only the generic I/O variables are defined, and all other required I/O variables must be defined separately.