You are on page 1of 54

Modular PLC

XN-PLC-CANopen
B
e
d
i
e
n
u
n
g
s
h
a
n
d
b
u
c
h
Moeller GmbH
Industrieautomation
Hein-Moeller-Strae 711
D-53115 Bonn
E-Mail: info@moeller.net
Internet: www.moeller.net
2002 by Moeller GmbH
nderungen vorbehalten
AWB2724-1566D xx/xx/Ki 03/05
Printed in the Federal Republic of Germany (0x/02)
Article No.: xxxxxx
Hardware, Engineering and
Functional Description
02/05 AWB 2724-1566GB
A
A A
Think future. Switch to green. Think future. Switch to green.
All brand and product names are trademarks or registered
trademarks of the owner concerned.
1
st
published 2005, edition date 02/05
Moeller GmbH, 53105 Bonn
Authors: Peter Roersch
Editor: Thomas Kracht
Translator: Dominik Kreuzer
All rights reserved, including those of the translation.
No part of this manual may be reproduced in any form
(printed, photocopy, microfilm or any other process) or processed,
duplicated or distributed by means of electronic systems without
written permission of Moeller GmbH, Bonn.
Subject to alteration without notice.
1
Before commencing the installation
Disconnect the power supply of the device.
Ensure that devices cannot be accidentally restarted.
Verify isolation from the supply.
Earth and short circuit.
Cover or enclose neighbouring units that are live.
Follow the engineering instructions (AWA) of the
device concerned.
Only suitably qualified personnel in accordance with
EN 50110-1/-2 (VDE 0105 Part 100) may work on
this device/system.
Before installation and before touching the device ensure
that you are free of electrostatic charge.
The functional earth (FE) must be connected to the protective
earth (PE) or to the potential equalisation. The system installer
is responsible for implementing this connection.
Connecting cables and signal lines should be installed so
that inductive or capacitive interference does not impair the
automation functions.
Install automation devices and related operating elements in
such a way that they are well protected against unintentional
operation.
Suitable safety hardware and software measures should be
implemented for the I/O interface so that a line or wire
breakage on the signal side does not result in undefined
states in the automation devices.
Ensure a reliable electrical isolation of the low voltage for the
24 volt supply. Only use power supply units complying with
IEC 60364-4-41 (VDE 0100 Part 410) or HD 384.4.41 S2.
Deviations of the mains voltage from the rated value must
not exceed the tolerance limits given in the specifications,
otherwise this may cause malfunction and dangerous
operation.
Emergency stop devices complying with IEC/EN 60204-1 must
be effective in all operating modes of the automation devices.
Unlatching the emergency-stop devices must not cause restart.
Devices that are designed for mounting in housings or control
cabinets must only be operated and controlled after they have
been installed with the housing closed. Desktop or portable
units must only be operated and controlled in enclosed
housings.
Measures should be taken to ensure the proper restart of
programs interrupted after a voltage dip or failure. This should
not cause dangerous operating states even for a short time.
If necessary, emergency-stop devices should be implemented.
Wherever faults in the automation system may cause
damage to persons or property, external measures must be
implemented to ensure a safe operating state in the event of
a fault or malfunction (for example, by means of separate limit
switches, mechanical interlocks etc.).
M
o
e
l
l
e
r
G
m
b
H
S
a
f
e
t
y

i
n
s
t
r
u
c
t
i
o
n
s
Warning!
Dangerous electrical voltage!
2
02/05 AWB2724-1566GB
1
About this manual 5
Device application 5
Abbreviations and symbols 5
Additional documentation 5
1 Layout of the XN-PLC 7
System and field voltage 7
XI/ON I/O module 7
CPU functions 7
Operating mode switch 7
SET button 8
APPLICATION switch 8
LED status indicator 1 8
LED status indicator 2 9
Real-time clock 9
Battery 9
Limit values for memory usage 9
Service (programming) interface 10
CANopen fieldbus interface 11
2 Mounting 13
Mounting the XN-PLC 13
Mounting the XI/ON modules 13
3 Engineering 15
Control panel layout 15
Ventilation 15
Layout of units 15
Preventing interference 15
Suppressor circuitry for interference sources 15
Shielding 15
Lighting protection 16
Connecting system and field voltage 16
4 Using the XN-PLC 17
Switch-on behaviour 17
CPU status indicator 17
Configuring the start-up behaviour with XSoft 17
Program start 18
Program start (STOP l RUN) 18
Behaviour after power off or power interruption 18
Program stop (RUN l STOP) 18
Program processing and system time 18
Monitoring cycle time 18
Reset 19
Warm reset 19
Cold reset 19
Full reset 19
Contents
Contents
02/05 AWB2724-1566GB
2
Test and commissioning 19
Breakpoint/single-step mode 19
Single-cycle mode 19
Forcing variables and I/Os 19
XSoft status indication 20
System events 20
Timer interrupt 20
Creating and transferring boot project 21
Downloading/updating the operating system 22
Diagnostics 24
User program source code 24
5 Browser commands 25
Calling browser commands 25
Using and evaluating browser commands 26
reflect 26
mem 26
memc 26
memd 26
pinf 26
ppt 26
dpt 27
pid 27
cycle 27
canload 27
GetNodeId 27
SetNodeId 28
metrics 28
reload 28
remove 28
getswitchpos 29
getrtc 29
setrtc 29
6 Libraries, function blocks and functions 31
Using libraries 31
Installing additional system libraries 31
XN-PLC-specific functions 32
Library XN_PLC_Util.lib 32
Function CAN_BUSLOAD 32
Function GETAPPLICATIONSWITCH 32
7 Establishing a PC XN-PLC connection 33
Communication settings of the PC 33
Communication settings (baud rate) of the CPU 33
8 Creating a sample project 35
Function 35
Setting up a target system 35
Configuring the PLC 36
Writing a program 37
02/05 AWB2724-1566GB
Contents
3
9 Programming through CANopen network (routing) 39
Prerequisites 39
Notes 40
Addressing 40
Procedure 40
PLC combinations for routing 42
Number of communication channels 42
10 RS 232 interface in transparent mode 43
Appendix 45
Dimensions 45
Technical data 46
Stichwortverzeichnis 49
02/05 AWB2724-1566D
4
02/05 AWB2724-1566GB
5
About this manual
Device application
The XN-PLC-CANopen, referred to as XN-PLC below, is intended
for use in machine and plant control systems. The PLC has an
RS 232 programming device (service) and a built-in CANopen field
bus interface conforming to CIA specification DS301 V4.0. You
can use the PLC as CAN master or as a slave in a CAN network.
Abbreviations and symbols
The symbols used in this manual have the following meanings:
XIndicates instructions for user actions.
Menu items, window titles, button labels and field names are
printed bold. File names, user input and function names are
shown in italics.
To improve legibility, the title of the current section is given at the
top of each left-hand page and the current subsection at the top
of each right-hand page (except on blank pages and the first page
of each section).
Additional documentation
In some places this manual contains references to more detailed
descriptions in other manuals, which are described with their title
and documentation number (e.g. AWB2786-1452GB).
For specific information about selecting, installing, configuring
and using the XI/ON modules, see the documents listed below:
Power supply modules and digital I/O modules
(AWB h1533g.pdf)
XI/ON station general
Integration in CANopen.
XI/ON gateway for CANopen (AWB2725-1530GB)
Product description
Communication
Interfacing with automation products.
Product description XI/ON XN-1RS232 (h1494g.pdf)
Product description XI/ON XN-1RS485/422 (h1495g.pdf)
Product description XI/ON XN-1SSI (h1496g.pdf).
All manuals are available in PDF format. If you cannot find a
particular manual on the product CD, you can download it as a
PDF file from our website: Go to http://www.moeller.net/support
and enter the document number in the Quick Search field.
h
Indicates useful advice and additional information.
Important
Indicates a risk of material damage.
Caution!
Indicates a risk of serious material damage or slight injury.
Warning!
Indicates a risk of serious material damage or serious or
fatal injury.
02/05 AWB2724-1566GB
6
02/05 AWB2724-1566GB
7
1 Layout of the XN-PLC
The PLC has a compact design and can be expanded centrally with
XI/ON modules and/or remotely through the CANopen bus.
System and field voltage
The system voltage supplies the CPU functional span and
through the module bus the XI/ON modules logic circuitry. The
system voltage is monitored for power failure. If the voltage drops
off, a data backup is run.
The field voltage supplies the load connected to the XI/ON
modules.
For further information achapter Engineering on page 15.
XI/ON I/O module
You can expand the XN-PLC centrally with the available XI/ON
modules.
For further information a XI/ON Digital I/O Modules manual
(AWB2725-1533GB).
CPU functions
Operating mode switch
With the operating mode switch, you can set the functions shown
in table 1.
Table 1: Operating mode switch functions
For further information achapter Using the XN-PLC from
page 17.
Figure 1: Layout of the XN-PLC-CANopen
a SET button
b LED display 1
c I/O module
d End plate
e LED display 2
f CANopen
g System and field voltage
h Operating mode switch
(0 = Stop, 1 = RUN, 7 = Mode, 8 = Factory, 9 = Reset)
i APPLICATION switch
j Service/programming interface
b
j
f
a
i
g
e
h
SERVICE
SET
APPLICATION
U
S
y
s
G
N
D
S
y
s
U
L
G
N
D
L
PLC
CANopen
GW
SF
IOs
RUN
STP
Err BUS
11 21
12 22
13 23
c d
Figure 2: Operating mode switch for RUN, STOP, etc.
Switch
position
Function
0 STOP
1 RUN; to put the CPU in the RUN condition,
from operating system Version 1.0.1 upwards, after
setting the switch the SET button must be pushed.
2 STOP
3 STOP
4 STOP
5 STOP
6 STOP
7 STOP
8 STOP; when you press the SET button for at least three
seconds, the default values are read.
9 STOP; when you press the SET button for at least three
seconds, a Reset is performed.
0
9
8
7
65
4
3
2
1
Layout of the XN-PLC
02/05 AWB2724-1566GB
8
SET button
The SET button is enabled only in connection with setting 8 and 9
of the operating mode switch. When you press the SET button,
setting 8 or 9 becomes active (atable 1).
APPLICATION switch
You can query the number set with this switch in the user program
with the GetApplicationSwitch function. You can find this function
in the XN_PLC_UTIL.lib library.
LED status indicator 1
Table 2: LED status indicator 1
Figure 3: SET button
Figure 4: APPLICATION switch
Figure 5: LED status indicator 1
SERVICE
SET
APPLICATION
0
9
8
7
65
4
3
2
1
PLC
CANopen
GW
SF
IOs
RUN
STP
LED Meaning
GW
Green Rated field voltage U
L
is in valid range
Green, flashing at
1 Hz
Rated field voltage not available or < 15 V DC
Green, flashing at
5 Hz
Rated field voltage > 35 V DC
I/Os
Green Configured constellation of module bus
station corresponds with the actual selection;
communication running
Green, flashing at
1 Hz
Station is in Force mode
Red and
GW LED off
PLC not ready for operation or operating
voltage not in the required range
Red Module bus not ready for operation
Red, flashing at
1 Hz
Non-adaptable change of actual constellation
of module bus stations
Red/green,
flashing at 1 Hz
Adaptable change of actual constellation of
module bus stations
Red flashing No communication through the module bus
SF + RUN/STP
Red + Off System test being run (up to 6 seconds after
start; after 6 seconds no user program present)
Red + green System update in progress
Both flashing System test found a fault
Red + green
flashing
User program loaded, PLC in STOP state
Off + green User program loaded, PLC in RUN state
Red + green
flashing
Group error/diagnosis message issued,
apage 24
Red (dependent on
group error Off/On)
+ green (flashing
quickly during
Reset)
Reset through operating mode switch
(switch position 9)
02/05 AWB2724-1566GB
CPU functions
9
LED status indicator 2
Table 3: LED status indicator 2
Real-time clock
The XN-PLC features a real-time clock, which can be referenced in
the user program using the functions in the SysLibRTC library, for
example to read or set the time.
The functions are described in the online help and in the
SysLibRtc.pdf file. This file is located in the
XSoft\Dok\English\XSoftSysLibs folder.
Battery
The battery is permanently installed and can not be replaced by the
user. It supplies the built-in real-time clock (RTC) with power when
the XN-PLC is switched off.
The backup time is normally about 10 years.
Limit values for memory usage
The XN-PLCs memory is segmented. The segment sizes are shown
in figure 7. The number of segments available to global data can
be specified to suit the size of the loaded program.
To view the specified segment size for a PLC type, select the
Resources tab in the object organizer and double-click Target
Settings. In the dialog select the Memory Layout tab:
To allow optimized, efficient usage of the memory range available
for global data, set the number of global data segments to 12
when you create a new project. The default value is one. The next
section contains a description of how to change the number of
allocated segments.
Figure 6: LED status indicator 2
LED Meaning
Err
Off Error-free communication between XN-PLC and other
CANopen stations
Red Faulty or interrupted communication between XN-PLC
and other CANopen stations
Check whether:
the field bus is terminated with a terminating resistor if
the XN-PLC is the last station in the bus topology;
the CANopen bus connector or the direct connection is
secure and whether all connections are correct;
the CANopen cable is correctly connected or shows
signs of damage;
the correct bit rate is set;
the CAN communication is still working correctly.
Bus
Off Field bus not in operation
Wait until the Firmware download is completed. If the LED
remains red, there is a hardware fault. Replace the PLC in
that case.
Red CAN device status of the XN-PLC is Stopped
Orang
e
CAN device status of the XN-PLC is Pre-operational
Green CAN device status of the XN-PLC is Operational
Err BUS
h
The XN-PLC does not support functions
SysRtcCheckBattery and SysRtcGetHourMode!
Figure 7: Segment size of the XN-PLC
Layout of the XN-PLC
02/05 AWB2724-1566GB
10
Changing segment allocation
X Select PLC type XN-PLC-CANopen. Select menu Project l
Options to open the Options dialog. In the Category field
select Build and enter a 12 in the Number of data
segments field.
Service (programming) interface
You can use this interface:
as a programming interface or
for transparent mode/SUCOM-A protocol.
Through the RS 232 programming interface, communications
between the XN-PLC and the programming device takes place.
The handshake lines of the RS 232 interface can not be used.
You can also switch the RS 232 interface to transparent mode
(achapter RS 232 interface in transparent mode on page 43).
The interface port is a PS/2 socket. It is not electrically isolated.
Programming cable
Use programming cable XN-PS/2-CABLE to connect the PC with
the XN-PLC.
Figure 8: Memory management: changing the number of data
segments
h
Important
You can not use commercial standard PS/2 cables.
Figure 9: Assignment of programming cable
XN-PS/2-CABLE
XN-PLC
PS/2 socket
(front view)
PC
9-pin RS 232 socket
2 GND 5 GND
4 TxD 2 RxD
6 RxD 3 TxD
1
2
3
4
5
6
5
9 8 7 6
4 3 2 1
02/05 AWB2724-1566GB
CPU functions
11
CANopen fieldbus interface
The XN-PLC can be connected to the CANopen bus through the
isolated ISO 11898 interface. The device can be operated as CAN
master or CAN device.
Power supply for CAN network stations
You can connect the power supply for the individual CAN stations
in any order.
Bus termination resistors
The ends of the network link must be terminated with 120 O bus
termination resistors:
Properties of the CANopen cable
Use only cable approved for CANopen applications and with the
following characteristics:
Characteristic impedance 100 to 120 O
Capacitance < 60 pF/m
The demands placed on the cable, connectors and bus termination
resistors are specified in ISO 11898. Listed below are a few
requirements and rules for CANopen networks.
table 4 lists default parameters for CANopen networks with fewer
than 64 CANopen stations.
Table 4: Standard parameters for CANopen network cable according to
ISO 11898
Figure 10:Pin assignment, CANopen
CAN H Non-inverted data signal (dominant high)
Shield Fieldbus screen connection
CAN L Inverted data signal (dominant low)
GND Chassis (optional for the CAN data signals)
Figure 11: Possible configuration of a CANopen bus with bus
termination resistors
a Screen
CAN H
SHIELD
CAN L
GND
CAN H
120 O
CAN L
CAN H
120 O
CAN L
GND GND
a a
B
u
s

l
e
n
g
t
h
L
o
o
p

r
e
s
i
s
t
a
n
c
e
C
o
n
d
u
c
t
o
r

c
r
o
s
s
-
s
e
c
t
i
o
n
B
u
s

t
e
r
m
i
n
a
t
i
o
n

r
e
s
i
s
t
o
r
T
r
a
n
s
f
e
r

r
a
t
e

a
t

c
a
b
l
e

l
e
n
g
t
h
[m] [mO/m] [mm
2
] [O] [kbit/s]
0 40 70 0.25 0.34 124 1000 at 40 m
40 300 < 60 0.34 0.6 150 300 > 500 at 100 m
300 600 < 40 0.5 0.6 150 300 > 100 at 500 m
600 1000 < 26 0.75 0.8 150 300 > 50 at 1000 m
02/05 AWB2724-1566GB
12
02/05 AWB2724-1566GB
13
2 Mounting
Mounting the XN-PLC
X Hook the XN-PLC onto the mounting rail from below.
X Pull the locking slider upwards.
X Press the top of the XN-PLC against the mounting rail.
X Push the locking slider down again.
Mounting the XI/ON modules
The XI/ON modules consist of a base module and an electronics
module.
X Connect the systems base module with the PLC from the right-
hand side.
X Secure the XN-PLC and the base modules on a 35 mm mounting
rail.
Yo can connect up to 74 I/O modules in slice design. Engaging
base modules XN-P3x-SBB and XN-P3x-SBBC immediately next to
the XN-PLC is not possible for mechanical reasons.
X Clip any electronics modules onto the base modules.
During commissioning or for maintenance, you can connect and
disconnect the electronics modules without affecting the wiring.
The base modules are wired through tension spring or screw
connectors.
h
Important
Make sure that the XN-PLC is securely attached to the
top-hat rail.
Figure 12:Mounting the XN-PLC
1
2
3
02/05 AWB2724-1566GB
14
02/05 AWB2724-1566GB
15
3 Engineering
Control panel layout
The layout of the components inside the control panel is a major
factor for achieving interference-free functioning of the plant or
machinery. During the project planning and design phase, as well
as its implementation, care must be taken that the power and
control sections are kept physically separated from each other. The
power section includes:
Contactors
Coupling/interfacing components
Transformers
Frequency inverters
Converters
To effectively exclude any electromagnetic contamination, it is a
good idea to divide the system into sections, according to their
power and interference levels. In small control panels it is often
enough to provided a sheet steel dividing wall, to reduce
interference factors.
Ventilation
A clear space of at least 50 mm must be kept between passive
components, to ensure adequate ventilation. If the neighbouring
components are active elements, such as power supplies or
transformers, then the minimum spacing should be 75 mm. The
values given in the technical specifications must be observed.
Layout of units
Mount the PLC horizontally in a control panel:
Preventing interference
Cable routing and wiring
Cables are divided into the following categories:
Power cables (e.g. cables that carry high currents, or cables to
converters, contactors or solenoids)
Control and signal cables (e.g. for digital inputs)
Measurement and signal cables (e.g. for fieldbus connections)
Take care to implement proper cable routing both inside and
outside the control panel, to keep interference as low as possible:
X Avoid parallel routing of cable sections in different power
categories.
X Always keep AC cables and DC separated.
X Keep to the following minimum spacing:
at least 10 cm between power cables and signal cables;
at least 30 cm between power cables and data or analog
cables.
When routing cables, make sure that the outgoing and return
leads of a circuit pair are routed together: The opposing
currents and therefore the generated electromagnetic
fields cancel each other out.
Suppressor circuitry for interference sources
X Connect all suppressor circuits as close to the source of
interference (contactors, relays, solenoids) as possible.
Shielding
X Use shielded cables for the connections to the data interfaces.
The general rule is: the lower the coupling impedance, the
better the shielding effect.
Figure 13: Control panel layout
a Spacing > 50 mm
b Spacing > 75 mm to active elements
c Cable duct
c
b a
b a
b
a
b
a
h
Always route power cables and control cables as far apart
as possible This avoid capacitive and inductive coupling.
If the cables cannot be routed separately, shield the cable
causing interference.
h
Switched inductors should always have suppressor
circuitry fitted.
Engineering
02/05 AWB2724-1566GB
16
Lighting protection
External lightning protection
All cables routed outside buildings must be shielded. Metal
conduit is best for this purpose. Fit signal cables with overvoltage
protection, such as varistors or other surge voltage protectors.
Where possible, protective elements should be fitted at the point
of entry of the cable into the building, but no further away than
the control panel.
Internal lightning protection
Internal lightning protection covers all measures to reduce the
effects of a lightning strike and the resulting electrical and
magnetic fields on metallic installations and electrical plants.
These measures are:
Equipotential bonding/earthing
Shielding
Using overvoltage protection devices
Please consult the following manuals for advice on cable routing
and shielding measures:
AWB27-1287 EMC Engineering Guidelines for Automation
Systems.
TB27-001-GB Electromagnetic Compatibility (EMC) for
Automation systems.
TB02-022-GB Electromagnetic Compatibility (EMC) for
Machinery and Plant.
Connecting system and field voltage
Connect the system voltage at terminals U
Sys
and GND
Sys
, and the
field voltage at terminals U
L
and GND
L
. Use separate power supply
cabling for the system and field voltage.
You do not need a separate power source for the system and field
supply.
Table 5: Rated values for the XN-PLCs system and field voltage
You can connect up to 74 XI/ON modules in slice design to the XN-
PLC. The power consumption of all modules must be less than the
supply current supplied by the XN-PLC. If current consumption is
higher, you can use additional modules for power supply, for
example a bus refreshing module or a power feeding module.
Bus refreshing modules supply the built-in module bus with
5 V DC and the XI/ON modules with 24 V DC.
Power feeding modules supply the XI/ON modules with the field
voltage of 24 V DC. A further module type provides 120/230 V AC.
You can use these modules create groups of different potentials
within the PLC. The 120/230 V AC modules can be arranged
immediately to the right of the XN-PLC.
For configuring the PLC, please refer to manuals XI/ON: Digital I/
O Modules and Supply Modules (AWB2725-1533GB) and XI/
ON Gateways for CANopen (AWB2725-1530GB).
Figure 14:Terminals for system and field voltage
U
Sys
GND
Sys
U
L
GND
L
Rated system
voltage
24 V DC 0 V DC
Rated field
voltage
24 V DC 0 V DC
U
S
y
s
G
N
D
S
y
s
U
L
G
N
D
L
Figure 15:Rating of XI/ON module supply
XN-PLC
XI/ON module bus 1.5 A/5 V DC
XI/ON field voltage 10 A/24 V DC
U
Sys
24 V DC
U
L
24 V DC
02/05 AWB2724-1566GB
17
4 Using the XN-PLC
Switch-on behaviour
After switching on the supply voltage, the PLC checks whether a
boot project is loaded in flash memory. If it is, and the operating
mode switch is in the RUN position, the boot project is written to
the PLCs SRAM and is started. If the flash memory contains no
boot project, the PLC remains in NOT READY state.
CPU status indicator
The NOT READY state is signalled by LEDs RUN/STP and SF. The
PLC goes into this state when an error has occurred during the
start. The CPU remains in STOP state. Once the fault has been
rectified, you can restart the CPU.
Configuring the start-up behaviour with XSoft
The start-up behaviour settings define mainly the handling of the
retentive variables. Changed settings take effect only when the
power supply is switched on.
You can change the settings under PLC Configuration: On the
Other Parameters tab, select one of the following options in the
Start Behaviour field:
HALT
COLDSTART
WARMSTART
HALT
The user program is not started, regardless of the position of the
operating mode switch.
COLDSTART
Precondition: The operating mode switch is in RUN position.
The variables are initialized before the PLC is started. asection
Program start.
WARMSTART
Precondition: The operating mode switch is in RUN position.
The variables are initialized before the PLC is started. asection
Program start.
CPU status RUN/STP-LED SF-LED
RUN On (green) Off
STOP Flashing (green) Off
NOT READY Off On (red)
Figure 16:Configuring the start-up behaviour
Using the XN-PLC
02/05 AWB2724-1566GB
18
Program start
When a program starts, the XN-PLC checks whether the
configured inputs and outputs match the physically present ones.
It also checks whether the actual module corresponds with the
parameterized module type. If the wrong module type is identified,
the CPU changes to NOT READY state. If no module is connected,
the start-up procedure continues.
Program start (STOP l RUN)
You can start the program in one of two ways:
In online operation, issue the START command, for example
after loading a program. The CPU must be in STOP state and the
operating mode switch in the RUN position.
Set the operating mode switch to its RUN position.
Behaviour after power off or power interruption
If you switch off or interrupt the CPU power while a program is
running, the program cycle or the task is interrupted immediately,
so that data integrity is no longer given. All outputs are set to 0 or
switched off.
table 6 on page 18 shows the behaviour of retentive variables.
The remaining program cycle will not be completed when power is
reconnected!
If inconsistent data is not acceptable in your application, you can,
for example, use an uninterruptible power supply (UPS).
The PLC restarts as defined by the settings in the PLC
Configuration window, afigure 16.
Program stop (RUN l STOP)
When you set the operating mode switch to STOP, the CPU
changes to STOP state, as soon as the program cycle is completed.
The outputs are set to 0.
You can stop the program in one of two ways:
In online operation, issue the STOP command.
Set the operating mode switch to its STOP position.
Table 6: Behaviour of the variables at PLC start
Program processing and system time
The user program is processed cyclically. The states of the inputs
are read before the start of each program cycle, and the output
states are written to the outputs at the end of the cycle.
The run-time systems software architecture can cause timing jitter
between individual processing cycles.
You can also program application routines that are started by the
occurrence of system events; asection System events on
page 20.
Monitoring cycle time
A hardware timer monitors the cycles of the user program and the
individual event tasks. If the cycle time exceeds a user-defined
value, the PLC goes into STOP state and the outputs are switched
off.
You can specify the timeout value on the Other Parameters tab
in the PLC Configuration window between 20 ms (default value)
and 1000 ms.
Start-up condition Variable type
Non-retentive Retentive
COLDSTART Initial values are loaded
WARMSTART Initial values are
loaded
Values
remain in
memory
Program loaded and started in
online operation
Initial values are loaded
Start/Stop/Start... Values remain in memory
h
You can not declare physical operands, such as I, Q and
M, as retentive variables.
02/05 AWB2724-1566GB
Reset
19
Reset
There are three different Reset commands:
Warm reset
Cold reset
Full reset
table 7 shows the commands to use for initializing a retentive
variable range. The commands also affect the CPUs state:
Warm reset
This Reset command has the following effect:
The program is stopped.
The variables are initialized.
The program can be restarted.
Cold reset
The program is stopped.
The variables are initialized.
The program can be restarted.
Full reset
This Reset command has the following effect:
The program in the PLC and the boot project are deleted.
The variables are initialized.
The PLC is set into the NOT READY state.
Table 7: Behaviour of the variables after a Reset
Test and commissioning
The PLC supports the following test and commissioning features:
Breakpoint/single-step mode
Single-cycle mode
Forcing
Online modification
Status indication (power flow).
Breakpoint/single-step mode
You can set breakpoints within the user program. If an instruction
has an associated breakpoint, the program will halt at this point.
The following program instructions can be executed in single-step
mode. Cycle-time monitoring is disabled.
Single-cycle mode
In single-cycle operation, one program cycle is performed in real
time. The outputs are enabled during the cycle. At the end of the
cycle, the output states are cancelled and the outputs are switched
off. Cycle-time monitoring is active.
Forcing variables and I/Os
All variables of a user program can be forced into fixed values.
Forced outputs of the XI/ON modules are only switched through to
the I/O in the RUN state.
Variable type
Reset Non-retentive Retain
Warm reset Initial values are loaded Values remain in
memory
Cold reset Initial values are loaded
Full reset
1)
Initial values are loaded
1) After a full reset, the program must be reloaded. In online operation,
you can then restart the PLC.
i
Caution!
Any outputs already set when the program reaches the
breakpoint remain set!
h
Use breakpoint/single-step mode and single-cycle mode
only in the applications actual main program. Do not use
them in den event routines, for example for start, stop and
interrupt events, as this can cause problems in the control
sequence.
XSoft does not prevent the use of breakpoints in the event
routines.
h
The I/O connected through the CANopen field bus can not
be forced.
Using the XN-PLC
02/05 AWB2724-1566GB
20
XSoft status indication
The signal states of the physical, Boolean inputs are displayed
in both the CPUs RUN state and in STOP.
The signal states of the physical, Boolean outputs are displayed
only in RUN state.
Low signals are displayed as FALSE with a black background.
High signals are displayed as TRUE with a blue background.
All other variables are shown with their current value only in the
RUN state.
System events
You can respond to PLC system events with a user application
routine that runs once when a particular event occurs. Its
execution is time-monitored. The time base is the configured
longest permissible cycle time.
Possible events include:
STOP: User program stop (does not apply to cycle time timeout
or hardware watchdogs)
START: User program start (cold and warm start)
COLDSTART: User program cold start
WARMSTART: User program warmstart
TIMER-INTERRUPT: A timer interrupt channel is available.
Timer interrupt
The timer interrupt is triggered after an adjustable delay of 500 to
2500000 microseconds. It interrupts the user program and
executes a user-defined application routine.
To program the delay time, include the TimerInterruptEnable
function from library XN_PLC_UTIL.lib in your user program.
At input dwTimerTickUS enter the delay time.
The value is accepted with the start of the timer and can not be
modified for the run time. If the time falls below 500 or exceeds
2500000, the function returns FALSE and is not executed.
If, for example, a delay of 2 seconds is to be started by external
input I0.0, add the following line to the user program:
TimerInterruptEnable(%IX0.0,2000000)
Creating application routine time_Int:
X In the object organizer, select the Resources tab and double-
click the Task configuration resource.
The System events tab appears.
Figure 17:System events
h
Single step mode can not be used for system event
program blocks.
Figure 18:The TimerInterruptEnable function
Figure 19:Programming a function
TIMERINTERRUPTENABLE
BOOL xEnable TimerInterruptEnable BOOL
DWORD dwTimerTickUS
02/05 AWB2724-1566GB
Creating and transferring boot
project
21
X Click the Timer Interrupt checkbox to activate the timer
interrupt.
X In the field in the called POU column, enter the name
time_Int for the application routine.
X Click the name Timer Interrupt again to enable the Create
POU button and display the name of the POU.
X Click this button to add the POU to the list in the object
organizers POU tab.
X Open the POU and write your user program.
The interrupt can be interrupted by higher-priority system
interrupts. Cycle time monitoring is active during execution of the
timer interrupt.
If timer and I/O interrupts occur too frequently, they can lead to the
user-defined program cycle time being exceeded. In this case the
XN-PLC changes from RUN to STOP state.
The Timer interrupt can be inhibited and enabled from the user
program. Functions DisableInterrupt and EnableInterrupt in library
XN_PLC_UTIL.lib are available for this purpose.
Creating and transferring boot project
Boot projects are created by loaded user projects (programs) and
written to flash memory. A power failure will clear the user project
from memory. The PLC then continues to work with a copy of the
boot project.
To create a boot project, carry out the following steps:
Precondition: a user program is loaded.
X From the Online menu, select Login.
X Select the Generate boot project command.
The following prompt appears:
X Click Yes.
The following dialog appears briefly:
The boot project has been created when this dialog disappears
again. You can now restart the PLC.
Figure 20:Timer interrupt
Figure 21:Writing an application routine
Figure 22:Create boot project, PLC in Stop
Figure 23:Creating a boot project
Using the XN-PLC
02/05 AWB2724-1566GB
22
Downloading/updating the operating system
You can replace the XN-PLCs operating system (OS) with a current
version, which is always available for download at the Moeller
website (http://www.moeller.net/support). It is also included on
each XSoft Service Pack CD.
To download the OS, you have to log in first.
Procedure:
X Log in to the PLC. In the object organizers Resources tab
double-click PLC Configuration and select the Other
Parameters tab.
X Click the Start... button.
The Download operating system dialog opens.
The system reports that the COM port is not initialized.
X Click the OS-File button and select the required operating
system file (*.hex).
The target type and file version are displayed.
X Click Transfer OS to MMC.
The transfer begins. Programming of the flash EPROMs takes
about 10 to 20 seconds.
h
Important
When you download the OS, all files saved on the PLC are
deleted (the existing operating system as well as the user
program).
Figure 24:Starting OS update
Figure 25:Download operating system
h
From the drop-down list, you can select the most recently
opened files.
Figure 26:Operating system file selection
h
While the warning symbol appears in the Status field
next to the text Programming Flash, do not switch off
the supply voltage!
02/05 AWB2724-1566GB
Downloading/updating the
operating system
23
Wait for the following dialog.
X Click Exit.
Because the PLC is rebooted after every OS download, the
message Communication interrupted may appear after the OS
has been downloaded to the PLC. You must log in again after each
reboot.
As soon as you have logged on, the following message appears:
No program on the PLC! Should the new program be loaded?
Click Yes to load the program.You can now create the boot
project.
Figure 27:Warning during download
Figure 28:OS successfully transferred to the PLC
Using the XN-PLC
02/05 AWB2724-1566GB
24
Diagnostics
You can run diagnostics with the help of the diagnostics function
block. The following possibilities are available:
User program source code
The user program source code can not be saved to the XN-PLCs
flash memory.
Type of diagnostics Function block Library Documentation
Checking the XI/ON modules:
Agreement of configured hardware with actual hardware:
performed once when the PLC is switched on or after the program
has been loaded or started.
Module function check: performed continuously.
XDiag_SystemDiag xSysDiagLib AWB2786-1456GB
Module-specific data, such as short circuits, are displayed. XDiag_ModuleDiag XSysDiagLib AWB2786-1456GB
02/05 AWB2724-1566GB
25
5 Browser commands
You can directly access the states and events of the XN-PLC with
the browser commands.
For a description of the available commands, select the XSoft
object organizers Resources tab and double-click PLC Browser.
Place a ? before the selected browser command, followed by a
space, and press the Enter key. Detailed information about the
browser command is then shown.
Calling browser commands
The browser commands can be used only in connection with XSoft.
To run these commands:
X Under Resources in the object organizer, double-click PLC
Browser.
A new window, PLC-Browser appears in the workspace.
X Click .
The selection field lists the available browser commands.
X Double-click the required command to select it.
The selected command now appears in the PLC Browser window.
X To view the result of the browser command, press the Enter key.
Figure 29:Running a browser command
Browser commands
02/05 AWB2724-1566GB
26
Using and evaluating browser commands
reflect
Reflects the command line, for testing communications between
browser and PLC.
'reflect ?' is not transferred to the PLC!
Example:
mem
Shows a memory range.
Syntax:
You can enter addresses as decimal, hexadecimal (prefixed 16#) or
as a macro.
Example:
memc
As mem, but addresses are added to the start address of the code
range.
Example:
memd
As mem, but addresses are added to the start address of the data
range.
Example:
pinf
Shows project information.
Example:
ppt
Displays the program block pointer table.
Example:
Figure 30:Browser command reflect
mem<SPACE><start address><SPACE or -><end address>
Figure 31:Browser command mem
Figure 32:Browser command memc
Figure 33:Browser command memd
Figure 34:Browser command pinf
Figure 35:Browser command ppt
02/05 AWB2724-1566GB
Using and evaluating browser
commands
27
dpt
Displays the data pointer table.
Example:
pid
Displays the project ID.
Example:
cycle
Displays the cycle time.
Example:
canload
Displays the utilization of the CANopen field bus.
Example:
This browser command returns, for example, the following
information:
CAN busload = 0 Percent
Baud rate 125 Kbit/s
Integration Time: 510 ms.
GetNodeId
Displays the node ID of the CANopen field bus.
Example:
Figure 36:Browser command dpt
Figure 37:Browser command pid
Figure 38:Browser command cycle
Figure 39:Browser command canload
h
In addition to the browser command, function block
CAN_BUSLOAD can be used to determine the CAN bus
utilization from the user program.asection Function
CAN_BUSLOADpage 32
h
Important
With a bus utilization of 75 percent or higher, the warning
ATTENTION: HIGH BUSLOAD also appears. Overload of
the local CAN bus in conjunction with further short term
load peaks can lead to CAN data loss.
Figure 40:Browser command GetNodeId
Browser commands
02/05 AWB2724-1566GB
28
SetNodeId
Changes the node ID of the CANopen field bus.
Example:
metrics
Displays specific XN-PLC information.
Example:
reload
Loads the boot project from flash memory to the user memory.
Example:
If you run the reload command again after the XN-PLC is in STOP
state, the following information is displayed:
remove
Deletes the boot project in the flash memory of the XI/ON-PLC.
Example:
Figure 41:Browser command SetNodeId
Figure 42:Browser command metrics
Figure 43:Browser command reload
Figure 44:Browser command reload ok
Figure 45:Browser command remove
02/05 AWB2724-1566GB
Using and evaluating browser
commands
29
getswitchpos
Returns the operating mode switch position.
Example:
getrtc
Shows the currently stored date and time.
Example:
setrtc
Sets or changes the PLC date and/or time.
Syntax:
Example:
Figure 46:Browser command getswitchpos
Figure 47:Browser command getrtc
<setrtc_YY:MM:DD:DW_HH:MM:SS>
Legend:
_ Space
YY The last two digits of the year (00 F YY F 99)
MM Month (01 F YY F 12)
DD Day (01 F DD F 31)
DW Weekday (01 F DW F 07; 01 = Monday, 07 = Sunday)
HH Hour (00 F HH F 23)
MM Minute (00 F MM F 59)
SS Second (00 F SS F 59)
Figure 48:Browser command setrtc
02/05 AWB2724-1566GB
30
02/05 AWB2724-1566GB
31
6 Libraries, function blocks and functions
The libraries contain IEC function blocks and functions that you
can use, for example, for the following tasks:
Data exchange through the CANopen bus
Controlling the real-time clock
Determining bus load of the CANopen bus
Triggering interrupts
Sending/receiving data through the interfaces
The libraries are located in the following folders:
Lib_Common for all PLCs
Lib_CPUxxx for PLCs XC100 and XC200
Lib_XN_PLC_CANopen for PLC XN-PLC.
Using libraries
When you open a project, libraries Standard.lib and
SYSLIBCALLBACK.lib are copied in to the Library Manager. If you
need further libraries for your application, you have to install these
manually.
The libraries in the Library Manager are assigned to the project
after saving. When you open the project, the libraries are then
automatically called up as well.
The following overview lists the documents in which the function
blocks and functions are described.
Installing additional system libraries
You can install libraries manually as follows:
X In your project, click the Resources tab in the object organizer.
X Double-click the Library Manager element.
From the Insert menu, select Additional Library....
The Open dialog appears.
X Select the library to install and click Open.
The library now appears in the Library Manager.
Document Library
AWB 2700-1437 Standard.lib
Util.lib
AWB 2724-1453 XC100_Util. Lib
AWB 2724-1491 XC200_Util. Lib
AWB 2724-1566 XN_PLC_Util. Lib
Online help or PDF
files in folder
XSoft\Dok\English\XSo
ftSysLibs
SysLib . lib
AWB 2786-1456 XS40_MoellerFB. Lib/ Visu. Lib/
AN2700K20 3S_CANopenDevice. Lib
3S_CANopenManager. Lib
AN2700K19 3S_CANopenNetVar. Lib
AN2700K27 XC._SysLibCan. Lib
XN_PLC_SysLibCan. Lib
AWB 2786-1554 CANUserLib. Lib
CANUser_Master. Lib
Figure 49:Libraries, installing manually
Figure 50:Selecting a library
Libraries, function blocks and
functions
02/05 AWB2724-1566GB
32
XN-PLC-specific functions
Library XN_PLC_Util.lib
This library contains the functions shown in the illustration below:
Function CAN_BUSLOAD
This function can be called cyclically in a user program. If a read
cycle has been completed successfully, the function returns TRUE
and writes the determined integration time and the bus utilization
values to the passed addresses.
If the bus load calculation is not yet completed or the CAN
controller has not yet been initialized, the function returns FALSE.
Each read cycle has a duration of 500 ms.
For information about evaluating the returned value, see canload
on page 27.
The function call in the user program is as follows:
Function GETAPPLICATIONSWITCH
With this function you can query the position of the application
switch. After an H signal at input xEnable, the number to which
the switch is set is displayed. This allows an external program
selection.
Figure 51:Functions of library XN_PLC_Util.lib
h
The Timer functions are described in section Timer
interrupt on page 20.
Figure 52:Function CAN_BUSLOAD
CAN_BUSLOAD
POINTER TO DWORD p_dwIntegrationTime CAN_BUSLOAD BOOL
POINTER TO BYTE p_bBusload
Figure 53:Function GETAPPLICATIONSWITCH
GETAPPLICATIONSWITCH
BOOL xEnable GetApplicationSwitch USINT
02/05 AWB2724-1566GB
33
7 Establishing a PC XN-PLC connection
To establish a connection between PC and XN-PLC, the two
devices communication parameters must be the same.
To match them, first adjust the PCs communication settings to the
CPUs settings. Use the CPUs default parameters, transferring
them as shown in figure 54.
You can then change the CPUs parameters (afigure 55),
always making sure that you have the same settings on the PC.
Communication settings of the PC
Using XSoft, specify the PCs communication settings. You can use
either the COM1 or the COM2 port of the PC.
X In the Online menu of XSoft, select Communication
Parameters....
X Specify the port (COM1 or COM2), asection Changing
settings
X Use the remaining settings as shown in figure 54.
X Confirm the settings with OK.
X Log on to the PLC.
Changing settings
To change settings such as the baud rate or the port, do the
following:
X Double-click the displayed value, for example 38400. The field
becomes grey.
X Enter the desired value.
You can double-click the field again to select the required baud
rate, e.g. 57600 bit/s.
Communication settings (baud rate) of the CPU
X In the Resources tab, select PLC Configuration.
X In the PLC Configuration dialog, click the Other Parameters
tab.
X In the Baudrate listfield, select the baud rate (for
example 57600 bit/s as shown in figure 55).
X Log on to the PLC.
The following prompt appears:
X Click Yes.
The program is loaded. After a short while, a communication error
message appears, since the baud rate settings of PC and CPU are
no longer the same:
X Acknowledge the message with OK.
To reestablish communications, change the PCs baud rate again.
h
If you get an error message, the CPUs default settings
have already been changed. In that case try a baud rate of
57600.
Figure 54:Defining the PCs communication settings
Figure 55:Specifying the CPUs communication settings
Figure 56:Program change prompt
Figure 57:Communications fault
02/05 AWB2724-1566GB
34
02/05 AWB2724-1566GB
35
8 Creating a sample project
The following example aims to help you learn how to use the XSoft
software. We will create a project consisting of a configuration
and a program, which you can then load and test.
Our configuration assumes the following hardware layout:
Function
Establish an AND link between inputs IX0.0 and IX1.1. The result
of this logical operation will be output at Q2.1.
Setting up a target system
After starting XSoft, create a new file:
X From the File menu, select New.
The possible target settings are listed.
X From the pull-down list field, select your target system (in our
example XN-PLC-CANopen) and double-click it.
Figure 58:Hardware layout for the sample project
%IX0.0 %IX1.1 %QX2.1
SERVICE
RESET RS232
APPLICATION
U
S
y
s
G
N
D
S
y
s
U
L
G
N
D
L
PLC
CANopen
GW
SF
IOs
RUN
STP
Err BUS
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
11 21
12 22
13 23
X
N
-
2
D
I
-
2
4
V
D
C
-
P
X
N
-
2
D
I
-
2
4
V
D
C
-
P
X
N
-
2
D
0
-
2
4
V
D
C
-
0
.
5
A
-
P
X
N
-
2
D
0
-
2
4
V
D
C
-
0
.
5
A
-
P
X
N
-
2
D
0
-
2
4
V
D
C
-
0
.
5
A
-
P
X
N
-
2
A
I
-
U
(
-
1
0
/
0
.
.
.

+

1
0
V
D
C
)
X
N
-
2
A
I
-
U
(
-
1
0
/
0
.
.
.

+

1
0
V
D
C
)
X
N
-
2
A
I
-
U
(
-
1
0
/
0
.
.
.

+

1
0
V
D
C
)
X
N
-
2
A
I
-
U
(
-
1
0
/
0
.
.
.

+

1
0
V
D
C
)
X
N
-
2
A
I
-
U
(
-
1
0
/
0
.
.
.

+

1
0
V
D
C
)
X
N
-
2
A
I
-
U
(
-
1
0
/
0
.
.
.

+

1
0
V
D
C
)
Figure 59:Selecting the target system
Creating a sample project
02/05 AWB2724-1566GB
36
The dialog with the target system settings appears. In this example
we are using the XN-PLC in stand-alone operation so that you do
not have to change the default settings.
X Click OK to confirm.
The New POU dialog appears.
X Select the POU type Program and programming language IL:
Confirm your selection with OK and save the project under the
name Example-1.
The following window opens.
The object organizer, on the left of the XSoft window, contains
four tabs: POUs, Data types, Visualizations and Resources. In
the illustration, the POUs tab is selected. The upper section of the
POU window in the main workspace contains the variable
declarations, and the lower section is the program editor.
Configuring the PLC
X To configure the PLC, select the Resources tab in the object
organizer and double-click the PLC Configuration resource.
The PLC Configuration editor that opens in the workspace
shows the PLCs configuration in the tree view and further settings
in the tabs to the right.
Click the plus symbol next to Configuration XN-PLC-CANopen. A
further control element, XN-PLC-CANopen [SLOT] is displayed.
Click this element. The right editor section now contains three
tabs. Select the Input/Output tab.
One at a time, select the modules listed in figure 62:
X In the left field, select, for example, input module 2DI-24VDC-P
and click Select to move it to the Selected Modules field
on the right.
X In the tree view, click the plus symbol of each module to view
its I/O addresses.
For input module 2DI-24VDC-P, with two inputs, 8 addresses are
displayed. The modules inputs can be addressed through
addresses IX0.0 and IX0.1. Addresses IX0.2 to IX0.7 can not be
used.
Figure 60:Selecting a POU
Figure 61:Main project window
Figure 62:Selecting the I/O modules
02/05 AWB2724-1566GB
Writing a program
37
Writing a program
In the object organizer, select the POUs tab and double-click the
PLC_PRG(PRG) resource. Create the variables declaration and the
program as shown in figure 64.
Compile the project:
X From the Project menu, select Rebuild all.
A message with the number of errors or a warning appear.
Log on to the PLC:
X From the Online menu, select Login.
The project is transferred. You can now test the program.
Figure 63:Viewing the addresses
Figure 64:Program with declaration
02/05 AWB2724-1566GB
38
02/05 AWB2724-1566GB
39
9 Programming through CANopen network (routing)
Routing means to establish an online connection from a
programming device (PC) to any (routing-capable) PLC in a CAN
network without having to directly connect the programming
device to the target PLC. The target can instead be connected to
any other PLC in the network. All actions that are available
through a direct PCPLC connection can also be implemented
through the routing connection:
Program download
Online modifications
Program test (Debugging)
Generation of boot projects
Writing files in the PLC
Reading files from the PLC
Routing has the advantage that a PLC connected to the
programming PC can access all routing capable PLCs on the CAN
bus. The selected project determines the PLC to communicate
with. This provides an easy way of controlling remote PLCs.
However, the data transfer from routing connections is
significantly slower than with direct (serial or TCP/IP) connections.
This results, for example, in slower display refresh rates of
variables and longer download times.
Prerequisites
The following prerequisites must be fulfilled to use routing:
The routing PLC and the target PLC must both support routing.
Both PLCs must be connected via the CAN bus.
The PLCs must both have the same active CAN baud rate.
The valid routing node ID must be set on both PLCs.
Routing through XC200
To perform a program transfer or routing using TCP/IP through a
connection between XC200 and PC, you must first set the block
size for the transferred data. The packet size (4 Kbyte or
128 Kbyte) depends on the transfer type (program transfer or
routing) and the operating system, atable 8.
Table 8: Block size for data transfer
Routing with the XC200 is possible from BTS version 1.03.02.
The block size can be changed only directly in the Windows
Registry.
Changing the block size
X Close all XSoft applications.
X Close the CoDeSys gateway server.
X Change the block size to the required value.
The XSoft installation folder contains the following *.reg files for
entering the block size in the Windows Registry:
Alternatively, you can use the BlockSizeEditor application to
change the block size.
The download block size is defined in the following Registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\3S-Smart Software Solutions
GmbH\Gateway Server\Drivers\Standard\Settings\Tcp/Ip (Level 2
Route)]
"Blocksize"=dword:00020000
The default block size is 20000
hex
(=128 Kbyte), the block size for
routing is 1000
hex
(= 4 Kbyte).
Program/file transfer Routing
BTS
< V1.03.02
BTS
f V1.03.02
BTS
< V1.03.02
BTS
f V1.03.02
Block size
Default:
128 Kbyte
128 Kbyte 128/4 Kbyte Routing
not possible
4 Kbyte
h
Important
The program download with a block size of 4 Kbyte to a
PLC with an operating system version earlier than 1.03.02
will cause faulty behaviour!
If a program download is performed, the progress bar on
the programming device monitor will only change
erratically (about every 10 seconds).
h
You can change this setting only if you have administrator
rights on your PC.
Figure 65:Closing the CoDeSys gateway server
BlockSizeDefault.reg Enters a block size of 20000
hex
=128 Kbyte
(default value) in the Registry.
BlockSizeRout.reg Enters a block size of 1000
hex
= 4 Kbyte
in the Registry.
Programming through
CANopen network (routing)
02/05 AWB2724-1566GB
40
Notes
If large files are written to the target PLC or read from the PLC,
it is possible that the online connection will be interrupted after
the transfer process has been completed. Renewed connection
is possible.
If a program with a modified routing node ID is loaded into the
target PLC, the target PLC accepts the modified routing node ID;
however, the communication connection will be interrupted.
Reconnection with a corrected routing node ID is possible.
If a PLC receives a program without valid routing parameters
(baud rate/node ID), this PLC cannot be connected via a routing
connection.
The routing is independent of the configuration (master/slave):
a target PLC that has not been configured as a master or as a
slave can be accessed. It must only receive the basic parameters
such as node ID and baud rate, as well as a simple program.
Addressing
PLCs on the CANopen bus can be configured as a master or as a
slave. The PLCs are assigned with a node ID/node number
(address) in order to uniquely identify them. To use the routing
function to access a target PLC, you must assign a further node ID
to the PLC.
Procedure
X Connect the PC to a PLC.
X Select the target PLC with which you want to communicate for
the project.
X Determine the communication settings for the PC and the PLC
connected to the PC.
X Enter the target PLCs target ID (target ID = node ID!) as shown
in the example and log on.
You can run the following functions:
Program download
Online modification
Program test (Debugging)
Create bootable project
Filing source code.
Note for project creation:
The node ID/node number and the baud rate of the target PLC to
the routing function can be defined in the Additional
parameters tab in the PLC Configuration window:
Enter the baud rate on the CANopen bus and the Node-ID/node
number in the RS232 l CAN routing settings field.
This field appears with the XC200, after you have confirmed it in
the Activate field. This activation is necessary to ensure that the
PLC can communicate via the CANopen bus.
Node ID and baud rate are transferred with the project download.
The following illustrations indicate independently of the routing
settings where the baud rate and the node ID of the PLCs which
have been configured as masters or devices are to be entered. The
settings are to made in the master PLC in the CAN Parameters
tab or with the device PLC in the CAN Settings tab.
Figure 66:XC100/200, XN-PLC on the CANopen bus, routing
principle
1) The following applies for the node ID of the device function and the
routing function:
XC100 with operating system < V2.0 or XC200:
The routing node ID must be not equal to the device node ID.
XC100 with operating system f V2.0 or XN-PLC:
The routing node ID must be equal to the device node ID.
PC
Routing PLC XC100/
200/XN-PLC
(master/device)
Node ID 1
Target PLC
XC100/200/XN-PLC
(device)
Routing node ID n
1)
Node ID n
1)
CANopen
h
To guarantee a fast data transfer, the routing should be
performed only with a CANopen baud rate of at least
125 Kbit/s.
Figure 67:CANopen routing settings
02/05 AWB2724-1566GB
Procedure
41
Example
The example below illustrates the procedure for accessing a PLC
program.
You have connected the PC to the PLC with node ID 2 and want
to access the target PLC with node ID 3.
X Open the project of the target PLC (node ID 3) whose program
you wish to edit or test.
X First configure the parameters for the hardware connection PC
n PLC (node ID 2).
X From the Online menu select Communication
Parameters....
X Click the New button under local channels.
The New Channel dialog appears.
X Select the channel in the Device field.
XC200: Serial [RS232] [Level 2 Route] Tcp or
Ip [Level 2 Route].
X In the Name field you can assign a new name, e.g.
Rout_232.
X Confirm with OK and return to the original window.
You have now determined the parameters for the hardware
connection between the PC and the PLC (node ID 2).
Figure 68:CAN master parameters
Figure 69:CAN device parameters
Figure 70: Diagnostics possibilities
a XC100 with node ID 1
b XC200 with node ID 2
c XN-PLC with node ID 3
Figure 71:Channel parameter setting
a b c
CANopen
X
I
/
O
N
Programming through
CANopen network (routing)
02/05 AWB2724-1566GB
42
X From the Online menu select Communication Parameters...
again and select the PLC you want to program or test.
X Enter the number 3 as the target ID in the example. The target
ID is identical to the node ID!
Click in the field on the Value column on the right beside the
target ID term to enter the target ID. Enter the figure 3 and
confirm with OK.
X Log on and carry out the action.
PLC combinations for routing
The following PLC support routing:
Number of communication channels
Several communication channels can be opened, e.g. PC n PLC
2, PC n PLC 3 depending on the PLC (communication channel)
connected to the PC. The status indicator of PLC 2 and 3 can be
implemented simultaneously.
Table 9: Type and number of communication channels depending on
the PLC
From P XC100 XC200 HPT100 XN-PLC-CANopen
To O
XC100 x x x x
XC200 x x x x
HPT100 x x
XN-PLC-
CANopen
x x x
Communications
channel
PLC Max. channel
count
TCP/IP Level2Route XC200 5
Serial RS 232 Level2Route XC100/XC200/
XN-PLC
1
02/05 AWB2724-1566GB
43
10 RS 232 interface in transparent mode
In transparent mode, the data transferred between the XN-PLC
and the data terminals (e.g. terminals, printers, PCs and
measuring instruments) is not interpreted. Switch the RS 232 serial
interface of the XN-PLC (COM1) into transparent mode with the
user program.
For the XN-PLC, this functionality is provided by the
XN_PLC_SysLibCom.lib or SysLibCom.lib library. The library must
therefore be included in the Library Manager.
The library contains functions for opening and closing the
interface, for sending and receiving the data and for setting the
interface parameters.
If transparent mode is active, no communication is possible with
the XSoft programming system. Transparent mode must first be
disabled. When transparent mode is closed, the original
communication parameters are re-initialized. The transparent
mode is forcibly deactivated when the PLC changes to the STOP
mode.
The functions are described in manual Function Blocks for XSoft
(AWB2786-1452GB).
h
If the CPUs RS 232 interface is in transparent mode,
programming through this interface is not possible.
h
Because the interfaces control lines are not active, you
can not use the SysComReadControl and
SysComWriteControl functions.
Figure 72:Function summary
02/05 AWB2724-1566GB
44
02/05 AWB2724-1566GB
45
Appendix
Dimensions
1
1
3
.
2
5
1
1
4
.
7
5
50.6 74.4
Appendix
02/05 AWB2724-1566GB
46
Technical data
XION-PLC-CANopen
General
Standards and regulations IEC/EN 61131-2
EN 50178
Ambient temperature C 0 to +55
Storage C 25 to +85
Mounting position Horizontal
Relative humidity, no condensation (IEC/EN 60068-2-30) % 10 to 95
Air pressure (in operation) hPa 795 to 1080
Vibration resistance 10 to 57 Hz g0.075 mm
57 to 150 Hz g1.0 g
Mechanical shock resistance 15 g/11 ms
Overvoltage category II
Pollution degree 2
Enclosure protection IP 20
Rated insulation voltage V 500
Interference emission EN 50081-2, Class A
Interference immunity EN 50082-2
Battery lifetime Normally 10 years
Weight kg 0.15
Dimensions (W x H x D) mm 50 x 112 x 75
Connecting terminals Plug-in terminal block
Conductor cross-section
Screw terminals
Stranded with ferrule mm
2
0.5 to 1.5
Solid core mm
2
0.5 to 2.5
Electromagnetic Compatibility (EMC)
Electrostatic discharge IEC/EN 61000-4-2, Level 3, ESD)
Contact discharge kV 4
Radiated (IEC/EN 61 000-4-3, RFI) V/m 10
Burst Impulse (IEC/EN 61000-4-4, Level 3)
Supply cables kV 2
Signal cables kV 1
Surge (IEC/EN 61 000-4-5) kV 0.5
Conducted (IEC/EN 61 000-4-6) V 10
02/05 AWB2724-1566GB
Technical data
47
Supply voltage for the CPU (24 V/0 V)
Mains failure bridging
Dropout duration ms 10
Repeat rate s 1
Input voltage V DC 24
Permissible range V DC 20.4 to 28.8
Power consumption W Up to 26
Residual hum and ripple % F 5
Maximum power dissipated (without local I/O) Pv W 6
Overvoltage protection Yes
Polarity protection Yes
Switch-on current surge x In Not limited, (limiting only by a supply-side 24 V DC
PSU)
Output voltage for the signal modules
Nominal value V DC 5
Output current A 3.2
Off-load stability Yes
Short-circuit proof Yes
Electrically isolated from supply voltage No
CPU
Microprocessor Infineon C164
Memory
Program code Kbyte 128
Program data Kbyte 128
Marker and/or retain data Kbyte 4/8/16
Cycle time for 1 k instructions (bit, byte) ms 0.5
Interfaces
Serial interface (RS 232) without handshake line
Data transmission rate kbit/s 38.4 or 57.6
Connection by PS/2 socket
Potential isolation No
In transparent mode:
Data transfer rates 300, 600, 1200, 2400, 4800, 9600, 19200, 38400,
57600 bit/s
Character formats 8E1, 8O1, 8N1, 8N2, 7E2, 7O2, 7N2, 7E1
Number of send bytes in a block 190 bytes
Number of received bytes in a block 190 bytes
XION-PLC-CANopen
Appendix
02/05 AWB2724-1566GB
48
CANopen
Maximum data transmission rate bit/s 10 Kbit/s to 1 Mbit/s
Electrical isolation Yes
Device profile To DS301V4
PDO type Asyn., cyc., acyc.
Connection Terminal block, 5-pin
Bus termination resistors External
Stations No. Up to 126
Watchdog Yes
RTC (real-time clock) Yes
XION-PLC-CANopen
02/05 AWB2724-1566GB
49
Index
A Addressing, PLC on CANopen fieldbus . . . . . . . . . . . . . 40
Application routine . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
APPLICATION switch . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
B Battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Baud rate, specifying/changing . . . . . . . . . . . . . . . . . . 33
Block size for data transfer . . . . . . . . . . . . . . . . . . . . . 39
Boot project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Breakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Browser commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Bus length, CANopen . . . . . . . . . . . . . . . . . . . . . . . . . 11
Bus load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Bus refreshing module . . . . . . . . . . . . . . . . . . . . . . . . . 16
Bus termination resistors . . . . . . . . . . . . . . . . . . . . . . . 11
Bus utilization, CANopen fieldbus . . . . . . . . . . . . . . . . 32
C Cabinet layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Cable
CANopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Cable routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
CAN device parameters . . . . . . . . . . . . . . . . . . . . . . . . 41
CAN master parameters . . . . . . . . . . . . . . . . . . . . . . . . 41
CANopen cable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CANopen fieldbus interface . . . . . . . . . . . . . . . . . . . . . 11
CANopen routing settings . . . . . . . . . . . . . . . . . . . . . . 40
Channel parameter setting . . . . . . . . . . . . . . . . . . . . . . 41
CoDeSys gateway server . . . . . . . . . . . . . . . . . . . . . . . 39
Cold start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
COLDSTART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Communication channels, number . . . . . . . . . . . . . . . . 42
Communication parameters . . . . . . . . . . . . . . . . . . . . . 33
Configuration, creating . . . . . . . . . . . . . . . . . . . . . . . . 36
Connecting terminals . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Connection, PC XN-PLC . . . . . . . . . . . . . . . . . . . . . . 33
CPU status indicator . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Cycle time, display function . . . . . . . . . . . . . . . . . . . . . 27
Cycle time, monitoring . . . . . . . . . . . . . . . . . . . . . . . . . 18
D Data pointer table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Date, display/edit function . . . . . . . . . . . . . . . . . . . . . . 29
Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Diagnostics possibilities . . . . . . . . . . . . . . . . . . . . . . . . 41
Download, operating system . . . . . . . . . . . . . . . . . . . . 22
E Electromagnetic contamination . . . . . . . . . . . . . . . . . . 15
Electronics modules, XI/ON . . . . . . . . . . . . . . . . . . . . . 13
Elements, XN-PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
F Field voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7, 16
Forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Forcing, variables and I/Os . . . . . . . . . . . . . . . . . . . . . . 19
Function blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
H Halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Handshake lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
I Inductors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Interface (communication) defining . . . . . . . . . . . . . . . 33
Interfaces
CANopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Service (programming) interface . . . . . . . . . . . . . . 10
Interference factors . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Interruption of power supply . . . . . . . . . . . . . . . . . . . . 18
L Layout of units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Layout, XN-PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
LED status indicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Libraries
XN_PLC_Util.lib . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Libraries, installing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Lightning protection . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Logging in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
M Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Memory range, display function . . . . . . . . . . . . . . . . . . 26
Memory usage, limit values . . . . . . . . . . . . . . . . . . . . . . 9
Mounting
XI/ON modules . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
XN-PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Mounting position . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
N Node ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27, 40
Node number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
O Operating mode switch . . . . . . . . . . . . . . . . . . . . . . . . . 7
Operating mode switch, position display function . . . . 29
Operating system, download/update . . . . . . . . . . . . . . 22
P Port, defining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Power feeding module . . . . . . . . . . . . . . . . . . . . . . . . . 16
Power supply
CAN network stations . . . . . . . . . . . . . . . . . . . . . . 11
System and field supply . . . . . . . . . . . . . . . . . . . 7, 16
Power supply interruption . . . . . . . . . . . . . . . . . . . . . . 18
Program processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Program start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Index
02/05 AWB2724-1566GB
50
Program stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
Program, creating . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Programming cable . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Programming interface . . . . . . . . . . . . . . . . . . . . . . . . .10
Project ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
R Rated voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
Real-time clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
S Sample project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Select POU type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Service interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
SET button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
Setting up a target system, example . . . . . . . . . . . . . . .35
Shielding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
Single-cycle mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Single-step mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
Start-up behaviour, configuring . . . . . . . . . . . . . . . . . .17
Status indication, LED . . . . . . . . . . . . . . . . . . . . . . . . . . .8
Status indication, XSoft . . . . . . . . . . . . . . . . . . . . . . . . .20
Supply voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
Suppressor circuitry for interference sources . . . . . . . . .15
Switch-on behaviour . . . . . . . . . . . . . . . . . . . . . . . . . . .17
System events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
System voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7, 16
T Target ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
TCP/IP connection (for routing) . . . . . . . . . . . . . . . . . . .39
Test and commissioning . . . . . . . . . . . . . . . . . . . . . . . .19
Time, display/edit function . . . . . . . . . . . . . . . . . . . . . .29
Timer interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
Transfer rate, CANopen . . . . . . . . . . . . . . . . . . . . . . . .11
Transparent mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
U Utilization, CANopen fieldbus . . . . . . . . . . . . . . . . . . . .27
V Ventilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
Voltage source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
W WARMSTART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15

You might also like