WEG plc500 Modbus Rtu Slave Applications Guides 10010165520 en

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Motors | Automation | Energy | Transmission & Distribution | Coatings

Modbus/RTU - Network Slave


PLC500

Application Note
Modbus/RTU Slave - Application Note

Series: PLC500
Language: English
Document: 10010165520 / 00

Publication Date: 10/2022


Summary of Revisions

The information below describes the reviews made in this manual.

Version Revision Description


- R00 First edition
Contents

Contents

1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1 MODBUS/RTU NETWORK COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 RS485 INTERFACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 NETWORK ARCHITECTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 SLAVE MODBUS/RTU SETTINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7


2.1 CREATING A PROJECT IN CODESYS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 MODBUS/RTU SETTINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1 NETWORK SETTINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 I/O SETTINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 TERMINATION RESISTORS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4 MONITORING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.1 COMMUNICATION ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 RS485 SERIAL INDICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
INTRODUCTION

1 INTRODUCTION

This application manual describes how to operate the PLC500 in a Modbus/RTU network. Here, we will show
the settings for network slave. For the PLC500 product settings, follow the steps described in this document
to configure Modbus/RTU network properly.

ATTENTION!

! This application manual is intended for professionals trained in industrial networks. The devices
must be installed and configured according to manufacturer’s manual.

1.1 MODBUS/RTU NETWORK COMPONENTS

For the passive components of the network - cables, connectors, termination resistors, power supply - it is
recommended to use only components certified for industrial applications. See the product documentation for
information on the proper installation of the RS485 network.
For a more detailed description of the Modbus/RTU network operation and its settings, visit Codesys webpage
at: https://help.codesys.com/.

1.2 RS485 INTERFACE

As shown in Figure 1.1, the RS485 connector is used for Modbus/RTU communication. Table 1.1 contains a
description of each pin.

Figure 1.1: RS485 connector.

Pin Name Function


1 COM RS485 common
2 B+ B+ communication signal
3 A- A- communication signal
4 NC Not Connected
5 SH Cable Shield
Table 1.1: RS485 interface description.

1.3 NETWORK ARCHITECTURE

Figure 1.2 shows the devices connected to the computer and among themselves through the RS485 interface.
In this example, the PLC300 is the Modbus/RTU network master, and the PLC500 is the slave.

PLC500 | 5
INTRODUCTION

Programming Tool: Programming Tool:


- WPS - CODESYS

PLC300:
PLC500: Modbus/RTU
Modbus/RTU
Slave
Master Termination

Termination
Figure 1.2: Network components.


NOTE!
This application manual is intended for the PLC500 and the Codesys programming tool, we
recommend using the Codesys V3.5 SP18 or higher. If you need more information about the
Modbus/RTU communication protocol, see its manuals.

PLC500 | 6
SLAVE MODBUS/RTU SETTINGS

2 SLAVE MODBUS/RTU SETTINGS

2.1 CREATING A PROJECT IN CODESYS

For a Modbus/RTU network settings and definitions, first create the project and include the PLC500 programmable
controller. In the Codesys software, create a new project, and choose the directory and name for the application.
Then, select the PLC500-WEG device and the desired programming language, as shown in Figure 2.1.

Figure 2.1: Project configuration in Codesys.


NOTE!
In case the device PLC500 is not available in the Codesys options yet, you must download and
install the configuration file. See the Product Manual for the necessary steps and settings.

With the PLC500 device selected, you will have a project with the available network interfaces already preset,
as shown in Figure 2.2.

Figure 2.2: PLC500 Interfaces.

In the RS485 interface available in the project, you must add the Modbus Serial Device, as shown in Fig. 2.3.

PLC500 | 7
SLAVE MODBUS/RTU SETTINGS

Figure 2.3: Slave addition Modbus/RTU.

By this point, the project should contain the Modbus_Serial_Device device under the RS485 interface.

Figure 2.4: RS485 interface as Modbus/RTU slave.

PLC500 | 8
MODBUS/RTU SETTINGS

3 MODBUS/RTU SETTINGS

3.1 NETWORK SETTINGS

The network must be configured on the master to serve the addresses defined on the network slaves. The
parameters and addresses that will be transmitted from the network master must be set. Each slave device
must be configured with a unique address and at the same baud rate; otherwise, the network will experience
problems. In figure 3.1, the master device settings are defined.

Figure 3.1: Slave device initial settings.

ATTENTION!

! Use only ComPort 1 for the PLC500; if you use any other, a communication error will occur.

3.2 I/O SETTINGS

Before declaring the network variables, select the Offset value of the addresses. The addresses can be defined
independently for each function, as you can see in Start Addresses inside the red rectangle in Figure 3.2.

Figure 3.2: Declaration of variables transmitted by the network slave device.

In this step, we declare the memory addresses reserved for the transmission variables, reading a value in the
network slave register and writing in another. Figure 3.3 below shows the Modbus functions for reading and
writing these data to the slave device.
PLC500 | 9
MODBUS/RTU SETTINGS

Channel 0 Channel 0
Write Single Register (Code 06) 100 ms Write Single Register (Code 06)
Offset - 0x4E20 (20000) Offset - 0x4E20 (20000)

Channel 1 Channel 1
Read Holding Registers (Code 03) 100 ms Read Holding Registers (Code 03)
Offset - 0x4E21 (20001) Offset - 0x4E21 (20001)
Figure 3.3: Settings for the transmission addresses.

The number of registers and coils declared in Figure 3.3 will be shown on the page indicated in Figure 3.4. Take
into account the difference between the Registers and Coils—the coils are in separate addresses and must be
enabled with Discrete Bit Areas.

Figure 3.4: Mapping of Modbus variables.

The variables declared in the network can be monitored through two methods: first, to add the variables to the
Codesys program and monitor their values online; second, to enable Always Update Variables at the bottom
of the previous page, as indicated by the red arrow in Figure 3.5.

Figure 3.5: Declaration of addresses transmitted by the network slave device.

PLC500 | 10
MODBUS/RTU SETTINGS

3.3 TERMINATION RESISTORS

Network Modbus/RTU must have resistors installed at its terminations, as they are essential for the correct
operation. The configuration of this item is done only through Codesys. For the PLC500, go to Setup and then
Setup Parameters, where the Termination Resistors fields are, as shown in Fig. 3.6.

Figure 3.6: Declaration of addresses transmitted by the network slave device.

PLC500 | 11
MONITORING

4 MONITORING

4.1 COMMUNICATION ERRORS

The status of the networks can be monitored in Devices, which indicates the state of each communication step
and informs the Status. When encountering connection problems, as shown in Figure 4.1, check that the cables
are properly connected and the settings again.

Figure 4.1: Indication of error in the communication with the slave device.

Connected to the PLC500, access Status tab within the created items indicated in Figure , Codesys will inform
the problem that is hindering the communication.

Figure 4.2: Indication of error in the communication with the slave device.

When the settings are correct and the devices identify each other, we should see all items in green, as shown
in Figure 4.3.

Figure 4.3: Indication of error in the communication with the slave device.

PLC500 | 12
MONITORING

4.2 RS485 SERIAL INDICATION

The PLC500 programmable logic controller has LEDs on the front of the product that are used to indicate the
interfaces. The LED color indication shown in Figure 4.4 is described in Table 4.1.

Figure 4.4: LEDs indicadores do PLC500.

Table 4.1: Operation of the RS485 interface indication LED.


LED SERIAL STATUS DESCRIPTION
OFF No settings. There are no communication set-
tings Modbus/RTU in the application.
GREEN Communication Communication Modbus/RTU con-
Modbus/RTU without fault. figured in the application and all el-
ements running without error/fault.
ORANGE Communication Communication Modbus/RTU con-
Modbus/RTU with par- figured in the application and with
tial fault. some elements with error/fault.
RED Communication Communication Modbus/RTU con-
Modbus/RTU with total figured in the application and all el-
fault. ements with error/fault.

PLC500 | 13
WEG Drives & Controls - Automation LTDA.
Jaraguá do Sul - SC - Brazil
Phone 55 (47) 3276-4000 - Fax 55 (47) 3276-4020
São Paulo - SP - Brazil
Phone 55 (11) 5053-2300 - Fax 55 (11) 5052-4212
[email protected]
www.weg.net

You might also like