You are on page 1of 33

Commissioning the 9400 Highline TA CiA402 with EtherCAT

and Beckhoff NC

Contents

1. Preface/aim of the Application Report ......................................................................................................2


2. Introduction......................................................................................................................................................3
2.1. General information on EtherCAT ....................................................................................................3
2.2. General information on CiA 402 .......................................................................................................4
3. Components .....................................................................................................................................................5
4. Configuration notes for Lenze Engineer and 94xx Highline TA CiA 402 ...........................................6
4.1. Creating an Engineer Project..............................................................................................................6
4.2. TA CiA 402 configurations required for the Beckhoff NC ........................................................ 11
4.3. Monitoring responses and telegram failure detection ............................................................ 12
4.4. Diagnostics options ........................................................................................................................... 13
5. Beckhoff IPC and TwinCAT configuration notes................................................................................... 14
5.1. Configuring the Beckhoff NC with Lenze EtherCAT and TA CiA 402..................................... 15
6. Creating a TwinCAT PLC project and assigning variables with the NC........................................... 27
7. Example signal flow chart for the setpoint target position .............................................................. 30
8. Distributed Clocks (DC) EtherCAT synchronisation.............................................................................. 31
9. Wireshark bus analyser with TwinCAT ................................................................................................... 32

Page 1 of 33
Application Report No. 200.4.15
GI-PAS EL

1. Preface/aim of the Application Report

• This Application Report provides commissioning instructions for using a 94xx Highline
servo inverter technology application (TA) CiA 402 with EtherCAT communication along
with a guide to integration into the Beckhoff NC environment.

• It describes the procedures to be followed in the Lenze Engineer and Beckhoff TwinCAT
software programs in order to commission such a system.

• This Application Report contains an example program for the Beckhoff PLC which is
available for download from the Lenze homepage www.lenze.com.

PC with Beckhoff TwinCAT NC and


PLC Control Soft PLC

EtherCat

94xx Highline TA CiA402 with


PC with integrated PCI EtherCAT module
Express Ethernet card

Important note:
The software is supplied to the user as described in this document. All risks resulting from its quality or use
remain the responsibility of the user. Users must take appropriate precautions to protect against
maloperation.
We do not take any liability for direct or indirect damage, e.g. profit loss, order loss or any loss regarding
business.
 2009
No part of this document may be reproduced or distributed to third parties without the express written
permission of Lenze Automation GmbH.
The greatest care has been taken in compiling the information in this documentation and checking it
against the hardware and software described here. Nevertheless, deviations cannot be ruled out
completely. We do not assume any legal responsibility or liability for damage that may arise from its use.
Necessary corrections will be introduced in subsequent editions.
All trade names in this documentation are trademarks belonging to the related owners

Page 2 of 33
Application Report No. 200.4.15
GI-PAS EL

2. Introduction

This report is intended to explain, with the help of an example, how a Lenze 94xx Highline servo
inverter with TA CiA402 can be commissioned or operated in conjunction with EtherCAT and a
Beckhoff TwinCAT NC.
The reports begins with a description of the configuration requirements on the Lenze 94xx to
enable communication with EtherCAT. It then goes on to give a detailed description of how to
carry out the configuration in the Beckhoff System Manager and how to access data, before
concluding with a description of the TwinCAT NC example program.

2.1. General information on EtherCAT

The EtherCAT fieldbus system is standardised by the EtherCAT user organisation (ETG). The driving
force behind this is the company Beckhoff. Due to the advanced Ethernet technology used for
EtherCAT, in future, customers can change from other fieldbus systems to EtherCAT or generally
equip new plant models with EtherCAT. EtherCAT is a closed Ethernet system and uses a ring
topology.

Communication on EtherCAT is based on a master/slave operation. The update cycle between


master and slave depends on the number of EtherCAT slaves and the set update time of the
master. Due to the ring topology, in every bus cycle only one telegram is sent on the bus. The bus
cycle time thus remains exactly the same in every cycle.

The maximum cable length for Ethernet-based fieldbus systems is 100m between two nodes. The
baud rate is 100 Mbit/s.

The EtherCAT E94AYCET communication module supports a baud rate of 100 Mbit/s, is electrically
isolated from EtherCAT and can be externally supplied with 24 V. A maximum of 32 process data
words can be exchanged with the module and the 94xx Highline. In addition, the module is
equipped with an optional parameter channel according to CoE (CAN over EtherCAT) EtherCAT
specification.

Page 3 of 33
Application Report No. 200.4.15
GI-PAS EL

2.2. General information on CiA 402

The CiA402 device profile describes predefined functions and modes of variable-speed drives. The
individual process data for the modes are exactly defined. Standardised indices are used for the
parameter setting of the axis and the bus configuration (PDO mapping). The following illustration
shows the CiA 402 modes supported by the Lenze 94xx axis.

• Homing mode
• Interpolated position mode
• Cyclic synchronous position mode (IEC-61800-7)
with additional speed and torque offset (option)
• Cyclic synchronous velocity mode (IEC-61800-7)
with additional speed offset (option)
• Cyclic synchronous torque mode (IEC-61800-7)
with additional torque offset (option)

Page 4 of 33
Application Report No. 200.4.15
GI-PAS EL
For each mode there is a separate dialog available in the Lenze engineering software.

Overview of all CiA indices

Dialogs of the CiA modes

The following dialogs show the PLC setpoints on the left-hand side and the actual values of the
drive on the right-hand side.

The "Interpolated position mode" and the "Cyclic synchronous position mode" only differ in the
PDO mapping variables available. The functions of the modes are exactly the same.

For more detailed information on TA CiA402, please see the Lenze documentation.

3. Components
Lenze hardware
9400 Highline, FW 07.00 or higher
EtherCAT communication module, FW 2.0 or higher

Lenze software
Lenze Engineer Highlevel version 2.10.2 (SP2) or higher

Beckhoff TwinCAT
TwinCAT V 2.11 (build 1539) and System Manager V 2.11.0 (build 1534)

Page 5 of 33
Application Report No. 200.4.15
GI-PAS EL

4. Configuration notes for Lenze Engineer and 94xx Highline TA CiA 402

4.1. Creating an Engineer Project

No. Action Comment


1 Start the Lenze Engineer. Engineer version
2.10.2.0 has been
used in this guide.

2 Create a new project.

Click Next to confirm.


3 Enter a project name for the project.

Click Next to confirm.

Page 6 of 33
Application Report No. 200.4.15
GI-PAS EL

4 Enter a project name and choose a storage location for the project.

Click Complete.
5 The Start-up wizard: insert component opens automatically. Go to In this case, a 94xx
the Controller tab, select a 94xx Highline and enter a controller Highline with FV
name. 7.0 has been
selected.

The controller
firmware version is
indicated in the
pull-out clip behind
the keypad slot of
the controller.

Click Next to confirm.

Page 7 of 33
Application Report No. 200.4.15
GI-PAS EL

6 You now need to decide which modules are to be inserted into The firmware
which slots. version of the plug-
in modules is
indicated on the
right outside edge.

Click Select to access a selection of all available modules. Select the


EtherCAT communication module with the appropriate firmware.

Click OK to confirm.
7 After inserting the EtherCAT communication module, the following TA CiA 402 requires
dialog appears. at least memory
module MM220.

Memory and safety modules are assigned in the same way. Click
Next to confirm.

Page 8 of 33
Application Report No. 200.4.15
GI-PAS EL

8 Select the technology application (TA) CiA 402. TA Version 1.1.0


has been used in
this example.

The TA can only be


selected for 94xx
FW 7.0 or higher.

Click Next to confirm.


9 In the next window, you can specify which components you wish to
select in the subsequent dialog boxes.

10 If a Lenze motor has been connected, the motor can be selected in


the Motor tab.

Click Next to confirm.

Page 9 of 33
Application Report No. 200.4.15
GI-PAS EL

11 If a gearbox has been connected, the gearbox factor and the


gearbox name can be selected in the Gearbox tab.

Click Complete.
12 The axis entered will now appear as follows in the project tree.

Page 10 of 33
Application Report No. 200.4.15
GI-PAS EL

4.2. TA CiA 402 configurations required for the Beckhoff NC

In the following, the settings to be selected for TA CiA 402 in conjunction with the Beckhoff NC
will be described.
The entire process data mapping (meaning of the individual process data) and the CiA 402 mode
to be used for axis operation is configured in the EtherCAT master!

No. Action Comment


1 Setting the feed constant: * 65536 applies to
The feed constant is configured as scaling factor in the Beckhoff NC. an encoder
For this, set the feed constant under code L-C2524 in the 94xx to resolution of
6.5536*. 16 bits under code
L-C0100.

The Lenze feed


constant L-C2524
can also be set via
the CiA402 index
I-6092/1 by the
EtherCAT master.

2 Beckhoff NC scaling factor: In chapter 6, step


In the example, the motor feed is 150 mm/motor revolution. The 29 you can read
scaling factor for the Beckhoff NC is calculated according to the where to enter the
following formula: scaling factor in the
Beckhoff NC.
150 mm
= 0.00228881835937
Inc
65536
motor revolution
3 Beckhoff NC and EtherCAT cycle: The codes can also
In the 94xx, the TA CiA402 runs in a 1-ms task. If the EtherCAT bus be set via the CiA
cycle or the NC cycle differs from 1ms, this must be set in the codes 402 indices
Ip time units and Ip time index (L-C3637 and L-C3638). The default I-60C2/1 and
settings of these codes lead to a cycle of 1ms. I-60C2/2 by the
EtherCAT master.

Page 11 of 33
Application Report No. 200.4.15
GI-PAS EL

4 Transfer the TA CiA402 to the axis.

4.3. Monitoring responses and telegram failure detection

No. Action Comment


1 The communication monitoring time which starts to expire when 65535 deactivates
leaving the Operational state is set in code L-C13881 or 14881. the monitoring
response.
2 The response after expiry of the communication monitoring time
selected in code 13881 or 14881 can be set in code L-C13880 or
L-C14880.

3 In addition to the monitoring response, you can select in code


L-C13855 / 14855 whether the last valid process data is to be
frozen if an error occurs (default setting = 0) or whether all process
data is to be set to zero (value 1) if an error occurs.
4 Internal communication monitoring between the 94xx and the MX1 = Slot 1
module can be set in code L-C1501 (MX1) and L-C1502 (MX2). MX2 = Slot 2
5 When a telegram failure is detected, the setpoints (position, speed This function is only
and torque) will be extrapolated. Based on the position, a square- available for TA CiA
law extrapolation algorithm will be used. 402!

Page 12 of 33
Application Report No. 200.4.15
GI-PAS EL

6 Telegram failure counter The error counter


The telegram failures occurring during operation are evaluated in can be reset via
the application. The number of individual errors occurred is stored L-C3013.
in L-C3011 and the number of multi-errors occurred (more than 1
telegram failure in succession) is stored in L-C3012.

If the number of telegram failures occurred in succession exceeds


the limit value set in L-C03010 (Lenze setting: 1), the error response
set in L-C05902/2 will be activated (Lenze setting: Information).

4.4. Diagnostics options

The Lenze EtherCAT offers a range of display codes which can be used for diagnostics purposes.
The most important of these are described below.

Code Action Comment


L-C13861 / 14861 Current bus status Display of current bus status
L-C13879 / 14879 Current bus error Bit-coded display of bus error
L-C13850/L-C14850 Display all words to the EtherCAT All process data words
Subcodes 1-32 master (1-32) transmitted from the module to
the master are displayed.
L-C13851/L-C14851 Display of all words from the All process data words
Subcodes 1-32 EtherCAT master (1-32) received by the module are
displayed.
L-C13852/L-C14852 Display all words to the basic All process data words
Subcodes 1-32 drive (1-32) transmitted from the module to
the basic drive (94xx) are displayed.
L-C13853/L-C14853 Display all words from the basic All process data words
Subcodes 1-32 drive (1-32) transmitted from the basic drive
(94xx) to the module are displayed.

Page 13 of 33
Application Report No. 200.4.15
GI-PAS EL

5. Beckhoff IPC and TwinCAT configuration notes

A TwinCAT project consists of two components. The TwinCAT System Manager is used to create a
configuration that represents the structure of the automation system. The configuration is stored
in a configuration file (ending xxx.tsm). The TWIN CAT Control software is used to programme a
PLC project which can subsequently be imported into the System Manager.

PC with Beckhoff TwinCAT V 2.11.0

EtherCAT

PCI Express Ethernet


card integrated in the PC
94xx Highline with
EtherCAT module

Page 14 of 33
Application Report No. 200.4.15
GI-PAS EL

5.1. Configuring the Beckhoff NC with Lenze EtherCAT and TA CiA 402

No. Action Comment


1 Import the EtherCAT xml device description file The Lenze xml file
'Lenze_E94AYCET_MOTION_20100323.xml' required for the 94xx can be found in the
communication module EtherCAT E94AYCET FW 2.0. Copy the xml download area on
file into the following TwinCAT directory: the Lenze
C:\..\TwinCAT\Io\EtherCAT homepage
www.Lenze.com
2 Start the Beckhoff System Manager In the example, the
version V2.11
build 1534 was
used.

3 Create a new project in Beckhoff System Manager.


Menu => File => New
4 Select I/O Devices and append an EtherCAT master.

5 In the example, the EtherCAT master shall use the on-board Beckhoff only
Ethernet connection of the PC. Therefore, an EtherCAT master in guarantees the real
direct mode has been selected. time of an
EtherCAT master if
an on-board
Ethernet interface
of a motherboard
with Intel chipset is
used.

Click OK to confirm your selection.

Page 15 of 33
Application Report No. 200.4.15
GI-PAS EL

6 Under the Adapter => compatible Devices tab, you can see which
Ethernet interface can be used as EtherCAT master. Select the
EtherCAT interface.

7 Use the menu Actions => Choose Target System or F8 to select the
target system.

8 When the physical EtherCAT connection to the Lenze EtherCAT An online bus scan
module has been established, you can select Scan Boxes to carry is only possible in
out an online bus scan. the Config mode of
the System
Manager! The
Config mode is
selected via the
following icon
in the System
Manager.

9 Of course, it is also possible to configure the EtherCAT node offline Note:


on the EtherCAT master. For this select Append Box. Since EtherCAT
uses a ring
topology, it must
be ensured that the
slaves are arranged
in correct order on
the bus when using
the offline
configuration!

Page 16 of 33
Application Report No. 200.4.15
GI-PAS EL

10 If a CiA 402-conform axis has been found, the following dialog will
appear:

If the dialog is confirmed with Yes, an NC task will be created and


the axis will be appended. As far as possible, variables of the TA CiA
402 axis will be automatically assigned in the NC axis.
11 The found CiA 402 axis appears as drive in the EtherCAT tree and an All information
additional axis is created under the NC configuration. given in the
different tabs of
the Lenze node are
default values from
the xml file!

12 As you can see in screen shot 11, the TA CiA402 axis has been For a detailed list of
loaded with Cyclic Synchronous Position Mode and the the CiA 402 modes
corresponding process variables. The process variables are stored and the
under the index corresponding
I-1602 and I-1A02. This can be changed through the PDO process variables,
Assignment by the user depending on the CiA402 mode you want please see the
to use. document default
PDO Mapping xml
file.pdf

In the PDO List you can find the predesigned PDO configurations.
Each PDO configuration is stored under a different index I-1600 to
I1609 and I-1A00 to I-1A09. You can only select one PDO
configuration for RPDO and TPO!

Page 17 of 33
Application Report No. 200.4.15
GI-PAS EL

13 In the example, the following variables have been assigned to the drive in the NC axis:

TA CiA 402 variable TA CiA 402 index NC variable


Controlword 0x6040 Axis 1_Drive_Out Variable nCtrl1 and
nCtrl2
Target position 0x607A Axis 1_Drive_Out Variable
nOutData1 and nOutData2
Statusword 0x6041 Axis 1_Drive_In Variable nStatus1
and nStatus2
Position actual value (units) 0x6064 Axis 1_Enc _In Variable nInData1 and
nInData2

Process output data EtherCAT master

Process input data EtherCAT master

14 If you check PDO Assignment and PDO Configuration, the complete


PDO mapping will be written to the slave when the EtherCAT
master is started.

In the Startup tab, you can see the whole PDO mapping sent to the
slave when the master is started.

Page 18 of 33
Application Report No. 200.4.15
GI-PAS EL

15 The PDO mapping through the EtherCAT master is indicated in the


following Lenze codes:

Lenze code PDO Index


13231 / 14231 sub 1-32 RPDO-1 I-1600 sub 1-32
13232 / 14232 sub 1-32 RPDO-2 I-1601 sub 1-32
13233 / 14233 sub 1-32 RPDO-3 I-1602 sub 1-32
13234 / 14234 sub 1-32 RPDO-4 I-1603 sub 1-32
13235 / 14235 sub 1-32 RPDO-5 I-1604 sub 1-32
13236 / 14236 sub 1-32 RPDO-6 I-1605 sub 1-32
13237 / 14237 sub 1-32 RPDO-7 I-1606 sub 1-32
13238 / 14238 sub 1-32 RPDO-8 I-1607 sub 1-32
13239 / 14239 sub 1-32 RPDO-9 I-1608 sub 1-32
13238 / 14238 sub 1-32 RPDO-10 I-1609 sub 1-32

Lenze code PDO Index


13531 / 14531 sub 1-32 TPDO-1 I-1A00 sub 1-32
13532 / 14532 sub 1-32 TPDO-2 I-1A01 sub 1-32
13533 / 14533 sub 1-32 TPDO-3 I-1A02 sub 1-32
13534 / 14534 sub 1-32 TPDO-4 I-1A03 sub 1-32
13535 / 14535 sub 1-32 TPDO-5 I-1A04 sub 1-32
13536 / 14536 sub 1-32 TPDO-6 I-1A05 sub 1-32
13537 / 14537 sub 1-32 TPDO-7 I-1A06 sub 1-32
13538 / 14538 sub 1-32 TPDO-8 I-1A07 sub 1-32
13539 / 14539 sub 1-32 TPDO-9 I-1A08 sub 1-32
13538 / 14538 sub 1-32 TPDO-10 I-1A09 sub 1-32
16 Under the Lenze codes 13484 / 14484 (source RPDO) and 13784 / In this case, '2'
14484 (source TPDO) you can see which of the 10 possible PDO stands in L-C 13484
mappings or PDO assignments has been transferred from the and L-C 13784, i.e.
master to the slave and is effective. I-1602 and I-1A02
are active.
17 Under the indices I-1C12/1 and I-1C13/1 you can also see which of In this case, these
the 10 possible PDO mappings is active. are the indices
I-1602 and I-1A02
=>Cyclic Position
Mode

Page 19 of 33
Application Report No. 200.4.15
GI-PAS EL

18 You can also change/adapt the preconfigured PDO mappings from


the xml file. Use the context menu to Delete variables or Insert new
variables.

19 You can insert any CiA 402 variables available.

20 The System Manager does not automatically assign the variables The CiA 402 mode
Mode of Operation and Mode of Operation Display to the NC. is selected via
When using these variables, use the global variables of the PLC Mode of Operation
program and assign the variables manually to the PLC program. and the current CiA
402 mode of the
axis is indicated via
Mode of Operation
Display.
21 For the Lenze CiA402 axis, the mode NEEDS TO BE set via EtherCAT!
This can be done in two different ways: either via the process
variable Mode of Operation or via the CiA 402 index I-6060. The
index can either be set via the CoE parameter channel from the PLC
program or you can insert it in the Startup tab for the EtherCAT
slave.
If the Mode of Operation is set via the index
I-6060, there must be no Mode of Operation process variable
available. Otherwise, this variable would overwrite the value!

Page 20 of 33
Application Report No. 200.4.15
GI-PAS EL
22 In the Startup tab, you can also add additional codes which you The index list in the
want to sent to the slave when the EtherCAT master is started. Click screen shot shows
the right mouse button => context menu => Insert or New to add the PDO mapping
new Startup codes. sent to the slave
when the master is
started.

23 The following dialog contains a list of all CiA 402 indices available
in the Lenze 94xx TA.

24 In the box framed red you can find the Lenze codes.

Page 21 of 33
Application Report No. 200.4.15
GI-PAS EL
25 If you wish to create additional Lenze codes in the Startup dialog,
select the following settings in the Edit CANopen Startup Entry
dialog.
Enter the index using the Lenze formula 24575 – Lenze code and
conversion into hex. Select the subindex and enter the data to be
written in a binary formula into the corresponding data field. In this
case, the value 256 dec (0x00000100) was written to the Lenze
code L-C0011 (24575 – 11 = 24564dex => 0x5FF4).

26 In the CoE tab (CAN over EtherCAT parameter channel), the


standardised indices and their online values are displayed.

27 The current state of the EtherCAT slave is indicated in the Online


tab.

28 As described under step 13, 4 variables have been automatically


assigned to the CiA 402 drive in the NC axis. A CANopen DS402 axis
has been selected as axis type. In the Settings tab of the NC you
can select the measuring unit. In this case mm. In the NC, an axis is
divided into several subaxes. The Axis 1_Enc takes care of the
current actual position value. In the Axis 1_Drive, the position
setpoint and the status and control word are edited and assigned.

Page 22 of 33
Application Report No. 200.4.15
GI-PAS EL

29 Enter the scaling factor 0.00228881835937 from chapter 4.2, step The scaling factor
2 in the Parameter tab of the Axis 1_Enc. contains a point
and no comma!

Click Download to
transfer changes in
the Parameter tab
to the NC!

30 To check whether the selected TwinCAT configurations are correct, In the Free Run
activate the configuration in the Free Run mode. mode, the EtherCAT
master runs
For this, check the configuration , activate the configuration
without PLC
and restart the configuration in the Free RUN mode.
program in the
background.
31 After this, download the configuration to the EtherCAT master and
restart the EtherCAT system through the master.

Page 23 of 33
Application Report No. 200.4.15
GI-PAS EL

32 The Online NC user interfaces will now appear online and you can The actual position
work with them. of the axis is
displayed in the red
window.

33 Before working with the user interfaces, select the Mode of


Operation as described in step 21 and, if necessary, set a home
position for the drive using bit 11 of the Controlword.
34 In the Parameter tab under the NC axis you can select many NC
parameters such as reference velocities, etc.

35 Click Set in the Online NC user interface to enable the axis. Then
click All in the Set Enabling dialog to set all enable bits required.

Page 24 of 33
Application Report No. 200.4.15
GI-PAS EL

36 When the axis has enabled successfully, this will be indicated by To enable the axis,
the bit Ready in the Online dialog. the NC sends the
value 0x31 as
Controlword to the
drive.

In the Engineer, the Cyclic Synchronous Position Mode dialog will


appear as follows after the axis has been enabled.

37 In the Cyclic Synchronous Position Mode, the Controlword is assigned as follows:

Bit Signal Meaning


0 SwitchOn Ready to switch on
1 Enable Voltage Speed follower is enabled
2 Quick Stop Quick stop
3 Enable Operation Controller inhibit
4 Enable Operation Controller inhibit Interpolated Position Mode
5-6 Reserved
7 Fault reset Fault reset
8 Halt
9-10 Reserved
10 Load Home Position Set home position
11 Reset Home Position Reset home position
12-15 Reserved

Page 25 of 33
Application Report No. 200.4.15
GI-PAS EL

38 In the Cyclic Synchronous Position Mode, the Statusword is assigned as follows:

Bit Signal Meaning


0 ReadyTo Switch On Device status: ready to switch on
1 Switch On Device status: switched on
2 Operation Enable Device status: operation
3 Fault Device status: fault
4 Voltage Enable DC-bus voltage is available
5 Quick Stop Quick stop is active
6 Switch on disabled Switch-on inhibit is active
7 Warning Warning is active
8 Following error Following error
9 Remote Drive can accept commands via fieldbus
10 Target Reach Target position reached
11 Reserved
12 Operation Mode active Operating mode is active
13 Reserved
14 Home Position available Home position is available
15 Reserved
39 Use the function keys F1-F4 to traverse the axis in the manual jog
mode of the NC.

40 In the Functions tab, different start modes, e.g. Absolute position, The different start
can be selected for traversing. For this, a target position and a modes are also
target velocity need to be selected. Click Start to start absolute available as Motion
positioning. FB in the Beckhoff
PLC environment.

Page 26 of 33
Application Report No. 200.4.15
GI-PAS EL

41 Each NC axis has a fixed variable structure for being transferred to From the NC to the
the PLC program. These variables are used in the PLC program. The PLC, the structure is
Beckhoff Motion library is available for this. called
Axis_1_To_PLC and
from the PLC to the
NC
Axis_1_FromPLC

6. Creating a TwinCAT PLC project and assigning variables with the NC

These instructions are based on the Beckhoff PLC example TcNcsample PTPmoveV2_01.exe.
The example is available on the Beckhoff homepage.

No. Action Comment


1 Start the Beckhoff TwinCAT PLC Control software and open the In the example, a
example PLC project 94xx_Highline_CiA_402.pro PC target system
has been selected.

2 The PLC project has the following project structure.

3 The following libraries are integrated in the PLC project.

Page 27 of 33
Application Report No. 200.4.15
GI-PAS EL

4 The transfer of the variable with the NC axis in the System


Manager is declared as follows:

5 The structure of the MAIN program is very easy. Go to the Axis


Enable POU.
6 Call the MC_Power POU. This POU enables the axis (Control and The MC_Power
Statusword). The POU requires one enable bit each for Enable, POU corresponds to
Enable_Positive and Enable_Negative. Just like for the Online NC release from the NC
user interface, set the Override value to 100 %. In addition, you Online tab
need the global variable structures NcToPLC and NCFromPLC. described in
chapter 5.1, step
35.

7 The MAIN PRG contains a small program code for traversing the
axis. The axis shall travel forward and backward between 0 and
2000 mm.

Page 28 of 33
Application Report No. 200.4.15
GI-PAS EL

8 Use the MoveAxis POU to traverse the axis. The POU is enabled via
the Execute input and also gets the Target position and Velocity
from this input. Here, the variable structure NcToPlc is needed
again.

9 Save and compile the project and load it into the target system.
10 Go to the System Manager and click the right mouse button to
append a PLC program.

11 After appending the PLC program, the global variables will be


indicated in the TwinCAT System Manager. Click Linked to... to
assign the global variables to the NC variable structure.

Now you can assign the PLC variable structure NcToPLC to the NC
axis. Repeat this for the variable structure NcFromPLC.
12 After this, restart the System Manager configuration.
13 When the system is in the Run mode and the PLC program has been
started, enable the Lenze CiA402 drive via the variable
bLenzeEnable, bLenzeEnablePositive and bLenzeEnableNegative.

Page 29 of 33
Application Report No. 200.4.15
GI-PAS EL

7. Example signal flow chart for the setpoint target position

Beckhoff TwinCAT

PLC Control NC

NcToPLC Axis 1_from_PLC


This variable
connection must Variable Axis 1_Drive_Out
be assigned by the nOutData1 and nOutData2
user himself in the
NC

System Manager Variable Target


Position
Variable Position
xml files

Index 0x607A

Green arrows are automatic


variable assignments through
94xx Highline
TwinCAT EtherCAT
TA CiA402

Index 0x607A

Page 30 of 33
Application Report No. 200.4.15
GI-PAS EL

8. Distributed Clocks (DC) EtherCAT synchronisation

The EtherCAT synchronisation contains 2 functions:

1. With the DC synchronisation, process data acceptance can be synchronised for all slaves.
2. In addition, it is possible to synchronise the controller cycle of the 94xx servo inverter. This is
particularly useful for synchronous operation.

With EtherCAT, the synchronicity between the fieldbus communication and the connected slaves
is not as usual transmitted via the fieldbus, but each slave has its own internal 'clock' for this. One
slave in the network acts as the so-called 'master clock' and the clocks of the other slaves are
adapted to it with the runtimes on the bus being considered. In this way, the internal clock
ensures the synchronous process data acceptance for each slave. The clocks are cyclically re-
adjusted during bus operation.

No. Action Comment


1 The synchronisation can be activated for every single EtherCAT Changes will only
node under the DC tab in the Beckhoff System Manager by become effective
selecting DC for synchronization. after reconfiguring
and restarting the
EtherCAT master!

2 When DC is active for the EtherCAT module,


'1' is indicated under code L-C13883 / 14883.

3 In addition to synchronous process data acceptance on the


EtherCAT module via DC, you can also synchronise the 94xx
controller cycle. For this, set the sync source of the controller, code
L-C1120, to the slot into which the EtherCAT module is plugged.
This setting can also be selected via the application user interface
of the EtherCAT module.

Page 31 of 33
Application Report No. 200.4.15
GI-PAS EL
9. Wireshark bus analyser with TwinCAT

No. Action Comment


1 The Twin CAT System Manager allows you to activate a mode with Etherreal is the
bus analyser for the EtherCAT master. earlier name of the
Wireshark
software!

2 The Wireshark analyser software is free-of-charge available in the


Internet at http://www.wireshark.org/ .
3 When the EtherCAT system is started, the following message
appears because operation with Wireshark is possible.

4 When EtherCAT is running, you can now start the Wireshark


analyser software.
5 Select the EtherCAT interface used under the menu items Capture
=> Interface.
6 In the example, this is the interface with the IP address
169.254.143.191. Click Start to start the analysis.

Page 32 of 33
Application Report No. 200.4.15
GI-PAS EL

7 After completion of the analysis, the recorded telegrams are listed. LWR = Write data
In the example, only the telegrams of the source dell_9F:ab:4c are from master to
of interest. slave
LRD= Read data
from slave to
master

Wireshark can only


be used to record
data. You cannot
send data on the
bus on your own!

6 process data bytes

0x0040 current status word

In the user data, you can see the 6 process data bytes in both
directions.
8 Note:
Exact EtherCAT bus analyses can only be carried out with an additional hardware
component from Beckhoff (ET2000).

Page 33 of 33

You might also like