This document provides a high-level overview of a system that uses Twido PLCs and other Schneider Electric devices communicating over Modbus RTU. It describes the typical hardware components, software, communication protocols, and applications for small to mid-sized industrial control systems. Examples of source code are available to download for configuring and programming the various devices. Common industrial applications that could benefit from this type of system include small machines, packaging lines, and process control.
This document provides a high-level overview of a system that uses Twido PLCs and other Schneider Electric devices communicating over Modbus RTU. It describes the typical hardware components, software, communication protocols, and applications for small to mid-sized industrial control systems. Examples of source code are available to download for configuring and programming the various devices. Common industrial applications that could benefit from this type of system include small machines, packaging lines, and process control.
This document provides a high-level overview of a system that uses Twido PLCs and other Schneider Electric devices communicating over Modbus RTU. It describes the typical hardware components, software, communication protocols, and applications for small to mid-sized industrial control systems. Examples of source code are available to download for configuring and programming the various devices. Common industrial applications that could benefit from this type of system include small machines, packaging lines, and process control.
This document provides a high-level overview of a system that uses Twido PLCs and other Schneider Electric devices communicating over Modbus RTU. It describes the typical hardware components, software, communication protocols, and applications for small to mid-sized industrial control systems. Examples of source code are available to download for configuring and programming the various devices. Common industrial applications that could benefit from this type of system include small machines, packaging lines, and process control.
Introduction This document is intended to provi de a quick introduction to the described System. It is not intended to replace any specific product documentati on. On the contrary, it offers additional information to the product documentation, for installing, configuring and starting up the system.
A detailed functional description or the speci fication for a specific user application is not part of this document. Nevertheless, the document outlines some typical applications where the system might be implemented.
Twido_Modbus_EN.doc
Schneider Electric
2
Abbreviations
Word / Expression Significati on AC Alternating Current Advantys SE product name for a family of I/O modul es Altivar (ATV) SE product name for a family of VSDs CANopen Name for a communications machi ne bus system CB Circuit Breaker CoDeSys Hardware-i ndependent IEC 61131-3 programming software ConneXium SE product name for a Family of Transparent Factory devices DC Direct Current EDS Electronic Data Sheet E-OFF, E-STOP Emergency Off switch Harmony SE product name for a family of switches and indicators HMI Human Machi ne Interface I/O Input/Output IclA (ICLA) SE product name for a compact dri ve Lexium/Lexium05/LXM SE product name for a family of servo-dri ves Magelis SE product name for a family of HMI-Devices MB - SL SE name for a serial Modbus communications protocol Micro SE product name for a mi ddle range family of PLCs NIM SE product name for a Net work Interface Module Osi switch SE product name for a family of position switches PC Personal Computer PDO Process Data Object (CANopen) Phaseo SE product name for a family of power supplies PLC Programmable Logic Computer Powersuite An SE software product for confi guring dri ves Premium SE product name for a mi ddle range family of PLCs Preventa SE product name for a family of safety devices PS1131 (CoDeSys) SE Product name for PLC programming soft ware with CoDeSys PS Power Supply RPDO Recei ve Process Data Obj ect (CANopen) SE Schneider Electric SDO Service Data Object Sycon SE product name of a Fiel d bus programmi ng software
Twido_Modbus_EN.doc
Schneider Electric
3
Word / Expression Significati on Telefast SE product name for a series of distributed I/O devices TeSys U SE product name for a decentralized I/O System TPDO Transmit Process Data Obj ect (CANopen) Twido SE product name of a middle range family of PLCs TwidoSoft SE product name for a PLC programming software TwidoSuite SE product name for a PLC programming software Unity (Pro) SE product name for a PLC programming software Vijeo Designer An SE software product for programming Magelis HMI devices VSD Variable Speed Dri ve WxHxD Dimensions : Width, Height and Depth XBT-L1000 An SE software product for programming Magelis HMI devices Zelio SE product name for a l ow range PLC family ZelioSoft SE product name for a PLC programming software
Twido_Modbus_EN.doc
Schneider Electric
4
Application Source Code
Introduction Examples of the source code used to attain the system function as described in this document can be downloaded from our website under thi s li nk.
The example source code is in the form of confi guration, application and import files. Use the appropriate software tool to either open or import the files.
Extension File Type Software Tool Required AIW Confi guration file Advantys CNF Confi guration File Sycon CO CANopen definitions file Sycon CSV Comma Separat ed Values, Spreadsheet Twidosoft CTX Unity DCF Device Configuration File Advantys DIB Device Independent Bitmap Sycon DOC Document file Microsoft Word DOP Project File Magelis XBTL EDS Electronic Data Sheet Device Definiti on Industrial standard FEF Export file PL7 GSD EDS file (Geraete Stamm Datei) Profi bus ISL Island file, project file Advantys PB Profi bus definitions file Sycon PDF Portabl e Document Format - document Adobe Acrobat PRO Project file PS1131 - CoDeSys PS2 Export file Powersuite RTF Rich Text File - document Microsoft Word SPA Schneider Product Archi ve TwidoSuite STU Project file Unity Pro STX Project file PL7 TLX Project file Twinli ne control tool TWD Project file TwidoSoft VDZ Project file Vijeo Designer XEF Export file Unity Pro XPR Project file TwidoSuite ZM2 Project file Zeliosoft
Twido_Modbus_EN.doc
Schneider Electric
5
Typical Applications
Introduction Modicon developed the Modbus protocol in 1979 as a master/slave (client/server) system. Due to its open bus structure, devices from di fferent manufacturers can communicate di rectly with one another and exchange data. This has led it to become a global standard for industrial bus systems and (according to estimates) being used in conjunction with more than 10 million nodes.
In 1980, the development of Ethernet using coaxial cables led to the establishment of yet another bus standard which was, at first, concei ved for office use only.
Modbus TCP was created by combining these two systems. This document provides a description of the Modbus RTU (Remote Terminal Unit) with 2-wire cabling; a bus system that is both inexpensi ve and easy to configure. For this reason, it is used in small and mid-scal e systems, where high speeds and real-time functions are not the main concern. ( www.modbus.org )
Below is a list of the typical applications and the market segments where this system or subsystem can be applied:
Industry Small machine or pl ant components that must be controlled and monitored. Decentralized automation systems
Buildings/Services Conveyor belt with turnt able Irrigation systems for greenhouses
Infrastructure Water suppli es Air-conditioni ng/ ventilation for tunnel systems
Food & Beverage/Pharmaceuticals Cont rol of pumps and val ves Modul ar bakery machi nes
Application Description Image Decentralized automati on systems
Plant components such as cooling systems, washing filters, etc., are controll ed by a PLC using a bus system and are checked for errors. This data is also read and archi ved by the production control technology.
Water suppli es
This type of application frequently features several pump stations distributed around a site. A bus system is used so that the PLC can monitor these stations. Air conditioni ng/ ventilation
This invol ves the ventilation of systems and working areas. Sensors, val ves, fans and filters are connected to the PLC, which controls the process, vi a a bus system.
Twido_Modbus_EN.doc
Schneider Electric
6
System
Introduction The system chapter describes the architecture, the dimensions, the quantities and different types of components used withi n this system.
Architecture
General The Modbus RTU is a serial communication bus that is based on the master/slave principl e, with one master and up to 31 slaves. Each slave can be assigned an address bet ween 1 and 247.
In terms of the bus design, both RS232 and RS485 versions are avail abl e. The RS485 version can be used to cover a distance of up to 1. 2 km.
To illustrate a few typical applications where Modbus RTU is used, we shall be considering a Compact Twido PLC, a Magelis XBT-R HMI operator terminal, an Alti var 31 vari able speed dri ve and a TeSysU mot or starter.
An additional Lexium 05 servo is implemented in the case of Option 1, and an additi onal modul ar Twido PLC in that case of Option 2.
The HMI acts as the master. Because of its two interfaces, the PLC therefore acts as both a slave on the HMI line and as a master for a second bus line that connects it to other nodes.
The communication distributors take the form of Modbus hubs. This allows areas of the plant to be separated on the basis of functions and increases the level of fault tolerance. In the exampl es that follow, the default values (9,600 bauds; 8, E, 1) are used as communication parameters.
Twido_Modbus_EN.doc
Schneider Electric
7
Layout
Components Hardware:
Magelis XBT-R411 HMI panel (operator terminal acts as master) Twido PLC (compact design, acts as both master and slave) with TWD-NAC485T (RS485 interface for Modbus) Twido (modular desi gn, acts as slave) with TWD-NOZ485T (RS485 int erface modul e for Modbus) Altivar ATV31 variable speed dri ve with integrated Modbus interface Lexium 05 servo dri ve with integrat ed Modbus interface TeSys U LUCM1XBL motor circuit breaker with LULC031 Modbus interface TeSys LU9GC3 8-way Modbus hub
Quantities of Components For a compl ete and det ailed list of components, the quantities required and the order numbers, please refer to the components list at the rear of this document.
Degree of Protection Not all the components in this configuration are designed to withstand the same envi ronmental conditions. Some components may need additi onal protection, in the form of housings, dependi ng on the envi ronment in which you intend to use them. For envi ronmental details of the indi vi dual components please refer to the list in the appendix of this document and the appropriate user manual.
Twido_Modbus_EN.doc
Schneider Electric
8
Mains voltage 240V AC Power requi rement ~ 1 kW Dri ve power rating 0,18 kW Motor brake none Connection 3x 1,0mm (L1, N, PE) Technical Data Safety Level Cat. 1, Cat 3 (optional)
Safety Notice The standard and level of safety you apply to your application is determi ned by your system design and the overall extent to which your system may be a hazard to people and machinery.
Whether or not the above safety category shoul d be appli ed to your system should be ascertained with a proper risk analysis.
This document is not comprehensi ve for any systems using the gi ven archit ecture and does not absol ve users of thei r duty to uphold the safety requi rements with respect to the equi pment used in thei r systems or of compliance with eit her national or int ernational safety laws and regul ations
Dimensions The dimensions of the indi vi dual devices used; PLC, Dri ve, Power supply, etc. require a housing cabinet size of at least 800x600x300mm (WxHxD).
The HMI displ ay, illuminated indicators such as SYSTEM ON, SYSTEM OFF or ACKNOWLEDGE EMERGENCY OFF as well as the emergency off switch itself, can be built into the door of the housing.
Twido_Modbus_EN.doc
Schneider Electric
9
Installation
Introduction This chapter describes the steps necessary to set up the hardware and configure the software required to fulfil the described function of the application.
Assembly
Magelis XBT-R
Phaseo Power Supply
Vario
Twido SPS modul ar und Compact
TeSys LU9GC3 Modbus-Hub
TeSys U
Altivar ATV31 Lexium LXM05 This image shows a typical test setup, which can be used to test the communication between the devices at the configuration stage.
Twido_Modbus_EN.doc
Schneider Electric
10
Hardware
General Modbus hubs (distributors) are used in the following exampl es so that standard Modbus cables with RJ45 connectors can be accommodated. This means that the di fferences in voltage between the various interfaces have no repercussions. According to the specifications, the bus must be terminated using termi nating resistors. Short cables are a feature of the system layout so that testing can be carried out wit hout resistors.
XBT-R 411 HMI
Modbus master to PLC
RS232/485 interface
Depending on how a proj ect is configured when it is created using the XBT-L1000 software, the terminal can be used as both a master and a slave.
TeSys LU9GC3 Modbus hub Passive RS485 distribut or for eight bus nodes
Only 1 master may be connected at any one time
between the HMI and PLC
and between
the PLC and the devices
Twido Compact PLC
Modbus master to other slaves
COM1 HMI slave + programming interface
With optional COM2 RS485 interface Modbus master
Twido Modular PLC
Acts as a Modbus slave (here, slave 5)
COM1 programming
With optional COM2 RS485 interface Modbus master
Twido_Modbus_EN.doc
Schneider Electric
11
TeSys U motor starter
Power base LUB12
With LUCM1XBL display
LUL-C031(032) Modbus communication modul e
The Modbus interface is located on the underside of the Modbus module.
Altivar ATV31
variabl e speed dri ve
With Modbus interface
The Modbus interface is located behind the front cover
Lexium 05
servo dri ve cont roller
With Modbus interface
The Modbus interface is located behind the front cover
Phaseo power supply unit
ABL7RE2403
Twido_Modbus_EN.doc
Schneider Electric
12
Software
General The Twi doSoft programmi ng tool is used for programmi ng the PLC.
The HMI application on the Magelis XBT-R411 operator terminal is configured using XBT- L1000 software.
Although Alti var 31 vari able speed dri ves and the Lexi um 05 servo dri ve cont roller can be parameterized via the front panel, the PowerSuite soft ware is a more user-friendly option. As well as providing a convenient means of setting dri ve paramet ers, this software also enables data to be saved and archi ved. These functions are extremely useful as they mean that parameters can be restored rapidly whenever service tasks need to be performed. The software can also hel p you to optimize the parameters online.
One of the following versions of the Windows operating system must be installed on your PC:
Windows 2000 or Windows XP
To use the software packages, your PC must have the appropriate Microsoft Windows operating system installed:
Manuals The manual below provides furt her details on Modbus and how to program communication.
Twido_Modbus_EN.doc
Schneider Electric
13
Communication
General A Modbus seri al link is used for communication between indi vi dual devices.
Various pre-assembl ed cabl es should be used for programmi ng or configuring the devices or the communication between them.
Before you can start up the Modbus, both the node addresses (node numbers) and transmission parameters must be set. Depending on the device, this can be carri ed out using soft ware or hardware.
The following table provides an overvi ew of the cable connections and Modbus function codes that shoul d be used.
Usage Cable Type
PLC programmi ng
TSXPCX3030 (USB)
Modbus communication PLC <-> Modbus hub TWDX-CAR-J030 with RJ45
HMI programming
XBT-Z915 Modbus communication HMI <-> Modbus hub XBT-Z938 with RJ45
Altivar 31 parameterization
PowerSuite adapter W8 with RJ45 or USB-485040 adapter with Modbus cabl e with RJ45 Modbus communication Altivar 31 <-> Modbus hub
VW3A8306R10 Modbus cabl e with RJ45
Lexium 05 confi guration
PowerSuite adapter W8 with RJ45 or USB-485040 adapter with RJ45 Modbus cable Modbus communication Lexium 05 <-> Modbus hub
VW3A8306R10 Modbus cabl e with RJ45
TeSys U configuration
PowerSuite adapter W8 with RJ45 or USB-485040 adapter with Modbus cabl e with RJ45 Modbus communication TeSys U <-> Modbus hub
VW3A8306R10 Modbus cabl e with RJ45
8-way Modbus hub
Modbus distributor (passi ve)
Twido_Modbus_EN.doc
Schneider Electric
14
Modbus Specifying bus parameters PLC programmi ng The bus address (node number) for the Twido PLC is set using the port parameters in the Twi doSoft programming software and is written to the PLC (see relevant chapter). HMI programming The bus address (node number) for the XBT-R411 operator terminal is set in the XBT-L1000 programming software and is written to the PLC (see relevant chapter). Altivar 31 and Lexium 05 parameterization The bus address (node number) for the vari abl e speed dri ve and the servos is set vi a the front display. Alternati vely, this can be carri ed out using the PowerSuite software (see relevant chapter). TeSys U parameterization The bus address (node number) for the TeSys U LUB12 motor starter is set using the DIP switches located on the underside of the LUL-C031 Modbus modul e (see relevant chapter).
Possible Modbus function codes
Read
Write
The following devices support the following codes:
No further information is provided in terms of detailed error analysis: only a group error is gi ven consideration.
Twido_Modbus_EN.doc
Schneider Electric
15
Implementation
Introduction The impl ementation chapter describes all the steps necessary to initialise, to configure, to program and start-up the system to achieve the application functions as listed bel ow.
Function
Instructions for switchi ng on and functional description
1. Switch on all fuses and motor circuit breakers. 2. Acknowledge emergency off signals. 3. Switch on the master switch. 4. The data rel ating to the vari ous bus nodes is shown on the HMI display.
Data relating to the various devices such as the PLC, variable speed dri ve, servo dri ve and motor starter, should be displayed on the HMI. The devices communicate using a Modbus network. The Modbus RTU (Remote Terminal Unit) is a serial 2-wire bus (RS485) that is based on the master/slave principl e, with one master and up to 31 slaves.
In the system layout shown bel ow, the HMI operat or termi nal is the master for communication with the first PLC. In turn, this PLC acts as a master for the devices that are connected via a second COM interface. These devices are all slaves.
This layout has a number of advantages:
Shoul d the HMI fail, communication with the devices on the network will continue as normal. Consequently, a production plant will not come to a standstill, since the automatic mode that is controlled by the master PLC can continue to run.
Shoul d the PLC or one of the slaves fail, but there are no probl ems affecting the HMI, then the relevant alarm messages can be displayed on the HMI.
Where bus connections via the Modbus hub are concerned, differences in voltage between the various interfaces will not have any repercussions.
Twido_Modbus_EN.doc
Schneider Electric
16
Functional Layout
Twido_Modbus_EN.doc
Schneider Electric
17
Communication
Introduction This chapter describes the data passed vi a the communications bus (e.g. Modbus Plus or TCP/IP) that is not bound di rectly with digital or anal og hardware.
The list contains:
The device links Direction of data flow symbolic name and Bus address of the device concerned.
Device Links The Modbus bus system is used in this application. This connects the various devices (PLC, HMI, VSD, servo, motor starter) with one another and enabl es data exchange.
Modbus hubs (distributors) are used in the following exampl es so that standard Modbus cables with RJ45 connectors can be accommodated. This means that differences in voltage between the various interfaces will not have any repercussions.
Modbus Topology A number of different layouts are possible as far as the Modbus structure is concerned.
As a basic principle, Modbus al ways takes the form of a master/slave system, i.e., there is only one master, which controls and monitors communication and requests data from/sends data to the slaves. There is no di rect communication bet ween the slaves.
If data is to be transferred from one slave to another, it must first be read by the master and then sent to the other slave. With this kind of transfer, data can only be sent consecuti vely.
The termi nating resistors are responsibl e for guaranteeing a defined voltage level on the cables used for communication. If the test structure invol ves the use of short cables, testing can also be carried out without termi nating resistors.
In the system structure, testing can be carried out wit hout termi nating resistors.
Twido_Modbus_EN.doc
Schneider Electric
18
Example 1:
Example 2:
The LU9GC3 Modbus hub is a passi ve bus distributor, and should therefore be used as a bus line.
Only one master is permitted on a Modbus hub at any one time.
Twido_Modbus_EN.doc
Schneider Electric
19
Each Twido COM interface can be both a master and a slave.
The optional COM2 interface in terminal or mi ni-DIN versions
Twido_Modbus_EN.doc
Schneider Electric
20
Various hardware addresses, as well as fl ags and memory words, are used wit hin the PLC example program. From the point of vi ew of controlling communicati on, it is important to use a seri es of consecuti ve addresses, since the communicati on commands assign a speci fic sequence to the memory words (see PLC Programmi ng). To ensure clarity, absolute addresses (e.g., %MW2) are used in the PLC program. Type Address Comment memory words %MW0 to %MWx In this program, only 16-bit words (2 bytes) are used as memory words. Flags %M0 to %Mx Flags are Boolean variabl es, which can only assume state 0 or 1. Special memory words %SW63 %SW64 Error codes are executed in this kind of flag word when communication errors occur on the Twi do COM1/COM2 interface. EXCHx Exchange instruction EXCH %MW0:30 Instruction to send/recei ve messages (data exchange), e.g., the next 30 bytes following %MW0 (= 15 memory words). MSGx Exchange control function block %MSG1.D %MSG2.D Cont rol bit for coordi nating communication and monitori ng communication errors for COM1 and COM2. General Addressing and Commands
Twido_Modbus_EN.doc
Schneider Electric
21
PowerSuite Software
Introduction
Multi-point Serial Modbus PowerSuite software can be used to directly address and parameterize indi vi dual slaves connected via a Modbus hub. The advantage of this is that the cables between the slaves and the Modbus hub do not have to be disconnected; an additi onal communication cable running to the PC simply needs to be connected.
A typical layout: Within a single system, several devices are connected via a hub.
1 Connect USB 485040 (TSX C USB 485) cabl e adapter to the PCs USB port. Connect the cabl e adapter to the Modbus hub using a Modbus cable with RJ45 connectors. The PC is now the Modbus master.
2 The Modbus master net work (HMI or PLC) cable must be removed from the Modbus hub; otherwise, communication errors can occur.
3 Start PowerSuite software.
4 Expand Connections i n the Project Browser.
Twido_Modbus_EN.doc
Schneider Electric
22
5 Double-click Serial multidrop:
6 Set the communication parameters and the slave address, and click Enter to confi rm.
7
Right -click Serial multidrop and select Connect.
8 The search automatically accepts the connection to slave 2 and the paramet ers are read. These can also be changed online.
Communication is established and avail abl e online.
Twido_Modbus_EN.doc
Schneider Electric
23
HMI
Introduction This application features a Magelis XBT-R411 HMI, which communicates with the PLC vi a the Modbus RTU protocol. XBT-L 1000 software is used to program and confi gure the terminal.
The HMI is defined as the Modbus master and is connected to the COM1 interface of the Twido Compact PLC via the Modbus hub.
The steps to be taken in order to create and downl oad a program are described on the following pages.
The HMI is set up as foll ows:
Define master or slave Edit the application page Transfer project
Master or Slave When creating a new proj ect, you need to decide whet her the terminal is to be a master or slave.
1 The termi nal type is confi gured when a new proj ect is created using the XBT-L1000 software.
The following default parameters are set for all devices:
Speed: 9,600 bauds Parity: Even Stop Bits: 1 Data Bits: 8 (fixed)
Click OK to continue.
Twido_Modbus_EN.doc
Schneider Electric
24
3
In the application creation assistant:
Use Browse to save the proj ect in the relevant directory under any name, before clicking on Next>.
4 At least one slave must be specified in the Li st of current equipment.
Click Modify the list to open the Configure Equipment Symbol s dialog box.
5 Here, you can modify names and slave addresses.
Click OK to exit.
6 You can now configure the language.
Click Next> to finish creating the application.
7 Click Finish to open the first application page.
Twido_Modbus_EN.doc
Schneider Electric
25
Editing the Application Page 1 You can edit the application page.
2 Insert any text you like.
3 Edit Insert field
Read dat a from PLC Slave01
Double-click the location where the variable is to be inserted. - Click Modify - Select the equi pment - Variable type and address to be read (%MW7).
Then click OK.
4 The variable is inserted on the screen. During operation, the current val ue is displayed here.
5 The HMI start screen foll owi ng the addition of more fi elds to the application page.
Twido_Modbus_EN.doc
Schneider Electric
26
Transfer Project to HMI or Export it 1
2
Unpl ug the XBT programming cable and connect the communication cable.
3
HMI display:
Displayed opposite are the current val ues of the fi rst six data registers (from %MW7 to %MW12) as read from the Twido PLC (only when the PLC has been programmed and communi - cation is active).
Twido_Modbus_EN.doc
Schneider Electric
27
PLC
Introduction This chapter describes how to initialize, parameterize and load the Twi doSoft program to the Twi do PLC in order to implement the functional descripti on described above.
Preconditions Communication via the Modbus master requires parameterization and a PLC program that controls and monitors dat a transfer via the COM int erfaces. For the slaves, it is only necessary to set the paramet ers. There is no need for communication programmi ng here. Programmi ng is displayed i n both Ladder Language and Instruction List.
Before carrying out the steps described below, you must ensure that: The Twi doSoft programmi ng tool is installed on your PC The Modbus seri al dri ver, Version 1.6 (Buil d 28) is installed on the PC. The Twi do PLC is switched on and supplied with power The PLC and the PC are linked to one anot her via the PC <> Twi do programming cable (TSXPCX1031 or TSXPCX3030).
Setting up the PLC is done as foll ows: Create a new proj ect Define interfaces Write programming i n Ladder Language Alternati vely, write programming in Instruction List
Communication between the Twido PLC (master) and the Twido PLC (slave) Creating a New Project
1 To create a new project, select:
File->New
Twido_Modbus_EN.doc
Schneider Electric
28
2 A window offeri ng additional settings opens.
For the purpose of this application, the default settings will suffice.
Confi rm with OK.
Defining Interfaces 1 In the application navigator, right-click Hardware and select Add option
2 Select the 2nd COM interface, TWDNOZ485T, and click Add to confirm.
3 Right -click Port 1 and select:
Edit Controller Comm Setup
to call up the Controller Communications Setup dialog box.
Twido_Modbus_EN.doc
Schneider Electric
29
4 Select Modbus protocol. The parameters can now be edited.
The COM interfaces can be either master or slave. The PLC program decides which is which.
Address "1" is always selected. (This is not relevant for the master int erface. For the slave interface, it is the slave address.)
The PLC default val ues have been used in all of the examples:
Baudrate: 9,600 Data Bits: 8 Parity: Even Stop Bits: 1
Click OK to confi rm the values.
5 Do the same for Port 2.
PLC Program in LD
Reading N Words From Slave (Code 03) 1 From the point of vi ew of controlling communicati on, it is important to use a seri es of consecuti ve addresses, since a specific flag word sequence is required for the communication commands. To ensure clarity, absolute addresses (e.g., %MW0, %MW100) are used in the PLC program.
Twido_Modbus_EN.doc
Schneider Electric
30
2 Bus initialization and reading data from slave 1
Here, the dat a %MW120 to %MW134 is read from slave 1, a Twido PLC.
Data words %MW0 to %MW2 are used to initialize the slave concerned and to define which and how much data should be transmitted.
%MW0 and %MW1 contain default values.
Function Code 03 (Read) and 01 for the slave address are entered in %MW2.
%MW3 contains the slaves start address (the data will be read from this address onwards).
The number of memory words to be read is specified in %MW4.
Values from the recei ve tabl e are read in %MW5 and %MW6.
The data read from the slave is displayed in %MW7 onwards.
Note: The data from the slave is displayed from the 7 th memory word onwards (here, %MW7) + number (the 15 memory words in %MW4) = %MW21, and can then be transferred to the appropri ate areas of the PLC program. In the example below, the data from addresses %MW120 to %MW134 (15 memory words) is read from the slave and written to the area of the master that ranges from %MW7 to %MW21. Parameter Assignment
Modbus Function 03 READ 3
4 Controlling communication.
Communication with the slaves must be controlled in the master. This ensures that commands are not executed simultaneously, thereby preventing communication errors.
5 Checking the send bit. The send commands are initialized by means of the EXCH2 function (for COM2). Following sending, bit %MSG2.D is set to 1 and the recei ve mode is triggered.
Twido_Modbus_EN.doc
Schneider Electric
31
6 Controlling the slaves
In this exampl e, bit %MSG2.D causes an i ncremental count to occur in a %MW999 data word. At the end of each send cycle, the val ue increases by 1. The value is compared so that other initial values can be transferred to the COM interface one by one, meaning that each of the slaves is scanned in turn. The sequence in which this is performed is arbit rary. Dependi ng on the system, some slaves may be scanned several times, or hardly ever. Important: At least 2 send cycles are necessary per slave to guarantee secure communication.
7 Control with counter reset once all slaves have been scanned. In the exampl e below, the PLC master scans the data of 5 slaves (MW0, MW100, MW200, MW300, MW400), one after the other. This prevents different slaves from being scanned simultaneously somethi ng that coul d cause communication errors.
Twido_Modbus_EN.doc
Schneider Electric
32
8 Example: Mapping the user data of slave 1
9 Monitoring the bus communication for errors
Here, data word %SW64, which is responsibl e for identifying communication errors on COM2, is scanned and the number of errors counted.
To obtai n a detail ed error analysis, the error code i n %SW64 must be evaluated. (where COM1 = %SW63) Error Codes 10
Twido_Modbus_EN.doc
Schneider Electric
33
11 Under PLC and Connect in TwidoSoft, load the program into the PLC, select Start Program and connect the communication cabl es from the two Twido PLCs to the Modbus hub. The slave data is then visible in the master.
12 Connect cable and test:
PLC programming TSXPCX3030 or TSXPCX1031
Modbus communication PLC <-> Modbus hub TWDX-CAR-J030 with RJ45
PLC Program in LD
1 Writing n words to slave, Modbus function (Code 16 (=10hex))
From the point of vi ew of controlling communicati on, it is important to use a seri es of consecuti ve addresses, since a specific flag word sequence is required for the communication commands. To ensure clarity, absolute addresses (e.g., %MW0, %MW5) are used in the PLC program.
Twido_Modbus_EN.doc
Schneider Electric
34
2 Bus initialization and writing data to slave 2.
The data from %MW6 to %MW10 is to be written to a Twido PLC (slave 2) from a Twido PLC (Modbus master).
Data words %MW0 to %MW5, are used to define the send request, i.e., the amount of data that is to be sent to which slave.
%MW0 (16#01..) contai ns default values; (..12) is the send length = 8+2*(5) number of words to be sent
%MW1 contains default values for sendi ng
%MW2 (16#02..) contai ns the slave address; (..10) is the default val ue for Code 16
%MW3, (..00) refers to %MW0 = the target address in the slave
%MW4 contains the number of words to be written
%MW5 (16#00..) contai ns default values; (..0A) = 10 decimal = 2*(5) number of bytes to be sent
%MW6 onwards contai n n number of data words to be sent to the slave.
Note: In the example below, various factors cause an increment al count to occur in data words %MW6 to %MW10. This is only used for the purpose of an i nternal slave check.
Twido_Modbus_EN.doc
Schneider Electric
35
Parameter Assignment
Writing Modbus Function 16 3
4 Controlling communication Communication with the slaves must be controlled in the master: this ensures that commands are not executed simultaneously, thereby preventing communication errors.
5 Checking the send bit. The send commands are initialized by means of the EXCH2 function (for COM2). Bit % MSG2.D is used to ensure that a send request is complete before the next one is sent. This is not the quickest method, but it is secure.
6 Monitoring send errors Bit %MSG2.E is used to check whether any send errors are pending. The error code from COM2 is displayed in system word %SW64.
Twido_Modbus_EN.doc
Schneider Electric
36
Error Codes 7
8 Loading program
Under PLC and Connect in TwidoSoft, load the program into the PLC, select Start Program and connect the communication cabl es from the two Twido PLCs to the Modbus hub. The slave data is then visible in the master.
9 Connect and test:
PLC programming TSXPCX3030 or TSXPCX1031
Modbus communication PLC <-> Modbus hub TWDX-CAR-J030 with RJ45
Twido_Modbus_EN.doc
Schneider Electric
37
Communication between the Twido PLC (master) and the Twido PLC (slave)
Program in IL 1 From the point of vi ew of controlling communicati on in the master, it is important to use a series of consecuti ve addresses, since a specific flag word sequence is required for the communicati on commands. To ensure clarity, absolute addresses (e.g., %MW0, %MW100) are used in the PLC program.
2 Bus initialization and reading data from slave 1
Here, the dat a %MW120 to %MW134 is read from slave 1, a Twido PLC.
Data words %MW0 to %MW2 are used to initialize the slave in question, and to defi ne which and how much data should be transmitted.
%MW0 and %MW1 contain default values. Function Code 03 (Read) and 01 for the slave address are entered in %MW2. %MW3 contains the slaves start address (the data will be read from this address onwards). The number of memory words to be read is specified in %MW4. Initial values from the recei ve table are read in %MW5 and %MW6. The data read from the slave is displayed in %MW7 onwards.
Note: The data from the slave is displayed from the 7 th flag word onwards (here, %MW7) + number (15 from %MW4) = %MW21, and can then be transferred to the appropriate areas of the PLC program. In the exampl e bel ow, the data from addresses %MW120 to %MW134 (15 memory words) is read from the slave and written int o the area of the master rangi ng from %MW7 to %MW21. Parameter Assignment
Modbus Function 03 READ 3
Twido_Modbus_EN.doc
Schneider Electric
38
4 Controlling communication Communication with the slaves must be controlled: this ensures that commands are not executed simultaneously, thereby preventing communication errors.
5 Checking the send bit. The send commands are initialized by means of the EXCH2 function (for COM2). Following sending, bit %MSG2.D is set to 1 and the recei ve mode is triggered.
6 Controlling the slaves
In this exampl e, bit %MSG2.D causes an i ncremental count to occur in a %MW999 data word. At the end of each send cycle, the value increases by 1. The val ue is compared so that other initial values can be transferred to the COM i nterface one by one, meaning that each of the slaves is scanned in turn. The sequence in which this is performed is arbitrary. Depending on the system, some slaves may be scanned several times, or hardly ever. Important: At least 2 send cycles are necessary per slave to guarantee secure communication.
7 PLC
In the exampl e below, 5 slaves (MW0, MW100, MW200, MW300, MW400) are scanned for their data one after the other This prevents different slaves from being scanned simultaneously something that could cause communication errors.
8 Resetting the counter once all slaves have been scanned.
Twido_Modbus_EN.doc
Schneider Electric
39
9 Example: Mapping the user data of slave 1
10 Monitoring the bus communication for errors
Here, data word %SW64, which is responsibl e for identifying communication errors on COM2, is scanned and the number of errors counted.
To obtai n a detail ed error analysis, the error code i n %SW64 must be evaluated. (where COM1 = %SW63) Error Codes
11 Loading program
Under PLC and Connect in TwidoSoft, load the program into the PLC, select Start Program and connect the communication cabl es from the two Twido PLCs to the Modbus hub. The slave data is then visible in the master.
12 Connect and test:
PLC programming TSXPCX3030
Modbus communication PLC <-> Modbus hub TWDX-CAR-J030 with RJ45
Twido_Modbus_EN.doc
Schneider Electric
40
PLC Program in IL
1 Writing n words to slave, Modbus function (Code 16)
From the point of vi ew of controlling communicati on, it is important to use a seri es of consecuti ve addresses, since a specific flag word sequence is required for the communication commands. To ensure clarity, absolute addresses (e.g., %MW0, %MW5) are used in the PLC program.
2 Bus initialization and writing data to slave 2
The data from %MW6 to %MW10 is to be written to a Twido PLC (slave 2) from a Twido PLC (Modbus master).
Data words %MW0 to %MW5, are used to define the send request, i.e., the amount of data that is to be sent to which slave.
%MW0 (16#01..) contai ns default values; (..12) is the send length = 8+2*(5) number of words to be sent %MW1 contains default values for sendi ng %MW2 (16#02..) contai ns the slave address; (..10) is the default val ue for Code 16 In %MW3, (..00) refers to %MW0 = the target address in the slave %MW4 contains the number of words to be written %MW5 (16#00..) contai ns default values; (..0A) = 10 decimal = 2*(5) number of bytes to be sent
%MW6 onwards contai n n number of data words to be sent to the slave. Note: In the example below, various factors cause an increment al count to occur in data words %MW6 to %MW10. This is only used for the purpose of an i nternal slave check.
Twido_Modbus_EN.doc
Schneider Electric
41
Parameter Assignment
Writing Modbus Function 16 (=10hex) 3
4 Controlling communication Communication with the slaves must be controlled in the master: this ensures that commands are not executed simultaneously, thereby preventing communication errors.
5 Checking the send bit The send commands are initialized by means of the EXCH2 function (for COM2). Bit % MSG2.D is used to ensure that a send request is complete before the next one is sent. This is not the quickest method, but it is secure.
6 Monitoring send errors Bit %MSG2.E is used to check whether any send errors are pending. The error code from COM2 is displayed in system word %SW64.
Twido_Modbus_EN.doc
Schneider Electric
42
Error Codes 7
8 Loading program
Under PLC and Connect in TwidoSoft, load the program into the PLC, select Start Program and connect the communication cabl es from the two Twido PLCs to the Modbus hub. The slave data is then visible in the master.
9 Connect and test:
PLC programming TSXPCX3030 or TSXPCX1031
Modbus communication PLC <-> Modbus hub TWDX-CAR-J030 with RJ45
Twido_Modbus_EN.doc
Schneider Electric
43
Devices
Introduction This chapter describes the steps requi red to initialise and configure the devices to attain the described system function.
General In a large number of applications, other devices are connected to the Twi do PLC via a Modbus network, such as Altivar 31 variabl e speed dri ves (ATV31), servo dri ves (Lexium 05) and motor start ers (TeSys U). In the following examples, the Twido PLC, acting as the master, reads data from these slaves.
The ATV31 and Lexium 05 parameters are ent ered or modi fied via the front panel. The PowerSuite soft ware can also be used for configuration. This offers a number of advantages:
You can save the data on your PC and copy it as you wish You can print out the documentation You can optimize parameters online.
With the TeSys U motor starter, the slave address on the LUL-C032(031) Modbus communication modules must be set using the DIP switch. The module recognizes the communication parameters automatically.
Communication Between the PLC (Master) and Altivar 31 (Slave) The master PLC is connected to the Modbus hub vi a the COM2 interface. From here, it is connected to the Alti var 31 (slave).
The menu is structured as shown below.
Twido_Modbus_EN.doc
Schneider Electric
44
Setting the Altivar ATV31 Slave Address on the Display 1 To view this screen, you must select Modbus communication the fi rst time the device is started up (see manual).
Press ENT.
2 SET = Set
Press ENT.
3 Keep pressing the down arrow until COn (Communication) appears.
Press ENT.
4 Add = Address
5 Press ENT and set the slave address using the arrow keys.
Modbus slave address = 9
Press ENT to confi rm. The displ ay flashes briefly.
Twido_Modbus_EN.doc
Schneider Electric
45
6 Press ESC and press the down arrow until
tbr
(baud rate) appears.
Press ENT.
7 Use the arrow keys to set the baud rat e.
9.6 for 9,600 bauds
Press ENT to confi rm. The displ ay flashes briefly.
8 Press ESC and press the down arrow until
tF0
(Control Bits) appears.
Press ENT.
9 Use the arrow keys to select 8E1.
8E1 stands for 8 data bits. Parity = even; 1 stop bit
Press ENT to confi rm. The displ ay flashes briefly.
Press ESC 3 times to return to the first screen.
Activating Parameters 10 To activate the communication parameters, the ATV31 must be switched off and back on again.
Twido_Modbus_EN.doc
Schneider Electric
46
Altivar 31 Addresses
11
The addresses can be found in the ATV31_Communication_Vari ables manual. In the exampl e below, the dri ve rating and the dri ve voltage of the VSD are read.
PLC Program in LD
12 For scanni ng data from the Alti var 31
In this case, initialization begins with %MW400. Starting with ATV31 Modbus address 3011, two words are read out from slave 9. (Function 03) The user dat a is displayed from %MW407.
Twido_Modbus_EN.doc
Schneider Electric
47
13 Connect and test:
VSD programming PowerSuite adapter W8 with RJ45 or USB-485040 adapter with Modbus cable with RJ45
Modbus communication Altivar 31 <-> Modbus hub VW3A8306R10 Modbus cable with RJ45
14 To see the values on the HMI, read out addresses %MW407 and %MW408 from slave 1 (PLC) on the HMI.
Twido_Modbus_EN.doc
Schneider Electric
48
Communication Between the PLC (Master) and TeSysU (Slave)
The master PLC is connected to the Modbus hub vi a the COM2 interface. From here, it is connected to the TeSys U (slave).
Setting the TeSys U Slave Address 1 First, remove the power supply to the device. Then dismantle it and pull out the Modbus LULC032 modul e.
2 Set the TeSys U slave address on the underside of Modbus module LULC032.
Twido_Modbus_EN.doc
Schneider Electric
49
DIP Settings
3
1 = 2^0 2 = 2^1 3 = 2^2 4 = 2^3 5 = 2^4
The decimal address is binary-coded. It can be easily converted using the Windows Calculator.
4
Binary conversion using the Windows Calculator:
5
Enter the decimal value and click Bin.
6
The module detects communication parameters, such as baud rate, dat a bits and stop bits automatically whenever the master submits a request. This means that it is only necessary to set the slave address.
7
The communication parameters are acti vated when the device is switched on.
Twido_Modbus_EN.doc
Schneider Electric
50
Reading Addresses From TeSys U
1 The addresses can be found in the LULCO31 (Modbus modul e) manual (DE_174323403a55. pdf ). In the exampl e bel ow, the switch setting is read.
2
PLC program component for scanning data from the TeSys U
In this case, initialization begins with %MW300. Starting with TeSys U address 457, one word is read out from slave 2. The user data is displayed from %MW307.
3 Cabli ng:
4 Connect and test
5 To see the values on the HMI, read out address %MW307 from slave 1 (PLC) on the HMI.
Twido_Modbus_EN.doc
Schneider Electric
51
Option 1
Communication Between the Twido PLC (Master) and the Lexium 05 (Slave)
The master PLC is connected to the Modbus hub vi a the COM2 interface. From here, it is connected to the Lexium 05 (slave).
Menu Structure
Setting the Lexium 05 Slave Address on the Display 1 To view this screen, you must select Modbus communication the fi rst time the device is started up (see manual).
Twido_Modbus_EN.doc
Schneider Electric
52
2 SET = Set
Press ENT.
3 CoN = Communication
Press down arrow until..
4
Press ENT.
5 MbAd = Modbus address
Press down arrow until..
6 Example: Slave 11
Press ENT and set the slave address using the arrow keys.
Press ENT to confi rm. The displ ay flashes briefly.
Twido_Modbus_EN.doc
Schneider Electric
53
7 Mbbd = Modbus baud rate
Press ESC and press the down arrow until..
Press ENT.
8 9.6 = 9,600 bauds
Use the arrow keys to select 9,600 bauds.
Press ENT to confi rm. The displ ay flashes briefly.
9 MbFo = Paramet ers
Press ESC and press the down arrow until..
Press ENT.
10 8E1 stands for 8 data bits. Parity = even; 1 stop bit
Use the arrow keys to select 8E1. Press ENT to confi rm. The displ ay flashes briefly.
Press ESC 3 times to return to the first screen.
Activating Parameters 11
To activate the communication parameters, the Lexium 05 must be switched off and back on again.
Twido_Modbus_EN.doc
Schneider Electric
54
Lexium 05 Addresses
12
The addresses can be found in the manual: LXM05A_manual _V104_TE_DE.pdf In the exampl e below, the motor type is read.
PLC Program Component For Scanning Data From the Lexium 05
13 In this case, initialization begins with %MW500. Starting with Lexium address 3332, two words are read out from slave 11. The user data is displayed from %MW507.
Cabling 14
Servo programming
PowerSuite adapter W8 with RJ45 or USB-485040 adapter with Modbus cable with RJ45
Modbus communication Servo <-> Modbus hub VW3A8306R10 Modbus cable with RJ45
15 Connect and test
16 To see the values on the HMI, read out address %MW507 from slave 1 (PLC) on the HMI.
Twido_Modbus_EN.doc
Schneider Electric
55
Option 2
Communication Between the Twido PLC (Master) and the Twido PLC (Slave)
The Twi do PLC (master) is connected to the Modbus hub vi a the COM2 interface. From here, it is connected to the Twi do PLC (slave).
Parameterization
As described in chapter PLC, but the communication parameters for the COM interface are set in the PLC project of the slave PLC.
Programming
There is no need to program the communicati on in the slave PLC. It is important to ensure that the memory words that are to be read or written by the master are avail abl e in the slave program.
Performance
Scan and Cycle Time Modbus (Modbus RTU) is a serial bus used in automation technology for communication bet ween (up to 31) different devices. This bus system requires a master, which initializes the control of the communication protocols, and slaves, which wait for the master to scan (read) or send (write) data. Data cannot be exchanged di rectly between the slaves. Instead, this must always be carried out vi a the master (which reads the data from slave x and writes it to slave y).
The length of time taken to transmit data depends on the bus load (amount of data), the number of slaves connected, the baud rate and the cycle time of the Modbus master PLC. Most devices support baud rates 4,800, 9,600 and 19,200. Baud rates 600, 1,200, 2,400 and 38,400 are only supported by some devices. This must be taken into consideration during configuration.
It is therefore advisable to group flags into memory words, to avoid an unnecessarily large number of indi vidual instructions. In the same way, consecuti ve addresses shoul d be used where there are several memory words. These will then be written or read in blocks (max. 120 MW per instruction).
The speed of dat a transmission, and therefore response times, may slow down depending on the amount of data and the system layout. The times may increase from <1 s (only 1 slave) to 5 10 seconds (more than 5 10 slaves).
Behavior during errors: If one of the slaves fails (due to a cabl e break, power fail ure, etc.), the master repeatedly attempts to establish communication with the slave in accordance with how it has been confi gured. Duri ng this time, no dat a is exchanged with the other slaves, resulting i n a del ay.
Comprehensi ve details can be found in the rel evant reference manuals or on the Internet at www.modbus.org.
Twido_Modbus_EN.doc
Schneider Electric
56
Appendix
Detailed Component List
Pos. Amt. Description Part Number Rev./ Vers. Hardware Components 1.1 1 Vario master switch VCF02GE 1.2 1 Harmony emergency off switch housing XALK178G 1.3 1 Phaseo 230 V AC/24 V DC power supply unit ABL7 RP2403 1.4 1 Magelis XBT-R411 HMI XBT-R411 1.5 1 Modbus TeSys hub LU9GC3 1.6 1 Twido Compact PLC TWDLCAA-24DRF 1.7 1 RS485 communication adapter TWDNAC485D 1.8 1 Altivar 31 variable speed dri ve ATV31H018M2 1.9 1 TeSys U motor starter LUCM1XBL LUCM1XBL
Pos. Amt. Description Part Number Rev./ Vers. Hardware Components
3.0 1 Lexium 05 servo dri ve controll er LXM05AD10M2
Option 2
Pos. Amt. Description Part Number Rev./ Vers. Hardware- Bauteile
4.0 1 Twido Modular PLC TWDLMDA20RT
Twido_Modbus_EN.doc
Schneider Electric
57
Component Protection Classes
Posi tioning Cabinet
Component In Feld, On Site Front Inside Protection class
IP54 IP65 IP67 IP55 IP65 IP20 Vario master and maintenance switch X Harmony emergency off switch housing X Phaseo 230 V AC/24 V DC power supply unit X Magelis XBT-R411 HMI X Modbus TeSys hub LU9GC3 X Twido PLC X Altivar 31 variable speed dri ve X Lexium 05 servo dri ve controll er X TeSys U motor starter LUCM1XBL X
Twido_Modbus_EN.doc
Schneider Electric
58
Component Features
Components Vario master switch VCF02GE
690 V AC 12 A
3-pi n
2 auxiliary contacts possible
Strong housing
Harmony emergency off switch XAL K178G
2 N/C contacts, 1 N/O contact
240 V AC 3 A
2 safety-oriented switchi ng contacts
1 signal contact
Trigger action
Phaseo power supply unit: ABL7RP2403
100 240 V AC/24 V DC
3A secondary
Slimline design
Parall el connection possible
Short-circuit protected
Twido_Modbus_EN.doc
Schneider Electric
59
Components Magelis XBT-R411 operator terminal
Can be programmed usi ng XBT-L1000 software
Modbus master or slave, RS232/RS485 interface
Display color: Green, orange or red
12 freely configurabl e function keys
200 application pages
250 al arm pages
4 x 20 display (72 x 20 mm)
Keys can be custom-labeled
TeSys Modbus hub LU9GC3
8 RJ45 Modbus distributors for RS485 connections
Input and output socket
Passive: no power supply
RJ45 bus terminating resistors (optional)
Twido PLC
Compact or modular design
Compact: 6 I + 4 O up to 24 I + 16 O
Modul ar: 12 I + 8 O up to 248 I + 240 O
24 V DC/ 240 V AC
Can be programmed in IL and LD
Modbus: master/slave
Optional: CANopen bus/AS interface/Profibus
Twido_Modbus_EN.doc
Schneider Electric
60
Components Altivar 31 variable speed drive
Single-phase and 3-phase
240 V AC singl e-phase: 0.18 2.2 kW
400 V AC 3-phase: 0.37 15 kW
600 V AC 3-phase: 0.75 15 kW Built-in class B EMC filter
Temperat ure range: - 10 to +50 C
Speed range from 1 to 20 (0 to 200 Hz)
Speed control with fl ow vector check
Modbus/RS485 CANopen i nterface
Parameterization of inputs/outputs possible
Protection of dri ve and motor
Compact design, side-by-side installation also possible on a top-hat rail using bracket VW3A11852 VW3A11851 for 230 V devices 1~
Lexium 05 servo
Servo amplifi er for a single axis
115 V AC , 0.4 kW to 1.4 kW
240 V AC , 0.75 kW to 3.2 kW
400 V AC, 1.4 kW to 6.0 kW
4 kHz/8 kHz frequencies
Built-in line filter
Temperat ure duri ng operation: 0 + 50C
Modbus, RS485 CANopen
Twido_Modbus_EN.doc
Schneider Electric
61
Components TeSys U motor starter
Single-phase and 3-phase starter
440 V AC, 0.15 32 A
1 and 2 directions of rotation (reversing mode)
For motors from 0.09 to 15 kW
Safety-ori ented switchi ng contacts
Modul ar system
Modbus RS485 (optional with communication module)
Schneider Electric GmbH Steinheimer Strasse 117 D - 63500 Seligenstadt Germany
Twido_Modbus_EN. doc
As standards, specifications and designs change from time to time, please ask for confirmation of the information gi ven in this publication.
62
Contact
Author Telephone E-Mail Schneider Electric GmbH Machines and Process Architectures +49 6182 81 2555 [email protected]