Page 1

System Manual
SmartController
CR2500
CoDeSys® V2.3
Target V05
7390675 / 00 10 / 2009
Page 2

Contents
ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
1 About this manual 7
1.1 What do the symbols and formats mean?.........................................................................7
1.2 How is this manual structured? .........................................................................................8
2 Safety instructions 9
2.1 General..............................................................................................................................9
2.2 What previous knowledge is required? ...........................................................................10
3 System description 11
3.1 Information concerning the device ..................................................................................11
3.2 Information concerning the software ...............................................................................11
3.3 PLC configuration............................................................................................................12
4 Configurations 13
4.1 Set up programming system ...........................................................................................14
4.1.1 Set up programming system manually..........................................................14
4.1.2 Set up programming system via templates...................................................16
4.1.3 ifm demo programs .......................................................................................25
4.2 Function configuration of the inputs and outputs ............................................................29
4.2.1 Configure inputs ............................................................................................29
4.2.2 Configure outputs..........................................................................................33
4.3 Hints to wiring diagrams ..................................................................................................34
5 Operating states and operating system 35
5.1 Operating states ..............................................................................................................35
5.1.1 Reset.............................................................................................................35
5.1.2 Run state.......................................................................................................35
5.1.3 Stop state ......................................................................................................35
5.1.4 Fatal error......................................................................................................35
5.1.5 No operating system .....................................................................................36
5.2 Status LED ......................................................................................................................36
5.3 Load the operating system..............................................................................................37
5.4 Operating modes.............................................................................................................37
5.4.1 TEST mode ...................................................................................................38
5.4.2 SERIAL_MODE.............................................................................................38
5.4.3 DEBUG mode ...............................................................................................38
6 Error codes and diagnostic information 39
6.1 Response to the system error .........................................................................................40
6.1.1 Notes on devices with monitoring relay ........................................................40
6.1.2 Example process for response to a system error .........................................41
2
Page 3

ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
7 Programming and system resources 42
7.1 Above-average stress .....................................................................................................42
7.2 Limits of the SmartController...........................................................................................43
7.3 Watchdog behaviour .......................................................................................................44
7.4 Available memory............................................................................................................44
7.5 Program creation and download in the PLC ...................................................................45
8 CAN in the ecomatmobile controller 47
8.1 General about CAN .........................................................................................................47
8.1.1 Topology .......................................................................................................47
8.1.2 CAN interfaces..............................................................................................48
8.1.3 System configuration.....................................................................................48
8.2 Exchange of CAN data....................................................................................................49
8.2.1 CAN-ID..........................................................................................................49
8.2.2 Data reception...............................................................................................50
8.2.3 Data transmission .........................................................................................50
8.3 Physical connection of CAN ............................................................................................51
8.3.1 Network structure ..........................................................................................51
8.3.2 Bus level........................................................................................................52
8.3.3 Bus cable length............................................................................................53
8.3.4 Wire cross-sections.......................................................................................54
8.4 Software for CAN and CANopen.....................................................................................55
8.5 CAN errors and error handling ........................................................................................55
8.5.1 Error message...............................................................................................55
8.5.2 Error counter .................................................................................................56
8.5.3 Participant, error active .................................................................................56
8.5.4 Participant, error passive ..............................................................................56
8.5.5 Participant, bus off ........................................................................................57
8.6 Description of the CAN functions ....................................................................................58
8.6.1 Function CAN1_BAUDRATE ........................................................................59
8.6.2 Function CAN1_DOWNLOADID...................................................................61
8.6.3 Function CAN1_EXT.....................................................................................63
8.6.4 Function CAN1_EXT_TRANSMIT ................................................................65
8.6.5 Function CAN1_EXT_RECEIVE...................................................................67
8.6.6 Function CAN1_EXT_ERRORHANDLER ....................................................69
8.6.7 Function CAN2..............................................................................................70
8.6.8 Function CANx_TRANSMIT .........................................................................72
8.6.9 Function CANx_RECEIVE ............................................................................74
8.6.10 Function CANx_RECEIVE_RANGE .............................................................76
8.6.11 Function CANx_EXT_RECEIVE_ALL...........................................................79
8.6.12 Function CANx_ERRORHANDLER..............................................................81
8.7 ifm CANopen library ........................................................................................................83
8.7.1 CANopen support by CoDeSys ....................................................................83
8.7.2 CANopen master...........................................................................................85
8.7.3 Start-up of the network without [Automatic startup] ......................................96
8.7.4 CAN device ................................................................................................ 100
8.7.5 CAN network variables............................................................................... 108
8.7.6 Information on the EMCY and error codes ................................................ 113
8.7.7 Library for the CANopen master ................................................................ 117
8.7.8 Library for the CANopen slave................................................................... 129
8.7.9 Further ifm libraries for CANopen .............................................................. 139
8.8 Summary CAN / CANopen........................................................................................... 144
8.9 Use of the CAN interfaces to SAE J1939..................................................................... 145
8.9.1 Function J1939_x....................................................................................... 148
8.9.2 Function J1939_x_RECEIVE..................................................................... 150
3
Page 4

ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
8.9.3 Function J1939_x_TRANSMIT .................................................................. 152
8.9.4 Function J1939_x_RESPONSE................................................................. 154
8.9.5 Function J1939_x_SPECIFIC_REQUEST................................................. 156
8.9.6 Function J1939_x_GLOBAL_REQUEST................................................... 158
9 PWM in the ecomatmobile controller 160
9.1 PWM signal processing................................................................................................ 161
9.1.1 PWM functions and their parameters (general) ......................................... 161
9.1.2 Function PWM............................................................................................ 166
9.1.3 Function PWM100...................................................................................... 168
9.1.4 Function PWM1000.................................................................................... 170
9.2 Current control with PWM ............................................................................................ 172
9.2.1 Current measurement with PWM channels ............................................... 172
9.2.2 Function OUTPUT_CURRENT_CONTROL .............................................. 173
9.2.3 Function OCC_TASK................................................................................. 175
9.2.4 Function OUTPUT_CURRENT.................................................................. 177
9.3 Hydraulic control in PWM ............................................................................................. 178
9.3.1 The purpose of this library? – An introduction ........................................... 178
9.3.2 What does a PWM output do? ................................................................... 179
9.3.3 What is the dither? ..................................................................................... 180
9.3.4 Functions of the library "ifm_HYDRAULIC_16bitOS05_Vxxyyzz.Lib" ....... 182
9.3.5 Function CONTROL_OCC......................................................................... 183
9.3.6 Function JOYSTICK_0............................................................................... 186
9.3.7 Function JOYSTICK_1............................................................................... 190
9.3.8 Function JOYSTICK_2............................................................................... 194
9.3.9 Function NORM_HYDRAULIC .................................................................. 197
10 More functions in the ecomatmobile controller 200
10.1 Counter functions for frequency and period measurement.......................................... 200
10.1.1 Applications................................................................................................ 201
10.1.2 Use as digital inputs................................................................................... 201
10.1.3 Function FREQUENCY.............................................................................. 202
10.1.4 Function PERIOD....................................................................................... 204
10.1.5 Function PERIOD_RATIO ......................................................................... 206
10.1.6 Function PHASE ........................................................................................ 208
10.1.7 Function INC_ENCODER .......................................................................... 210
10.1.8 Function FAST_COUNT ............................................................................ 213
10.2 Software reset .............................................................................................................. 215
10.2.1 Function SOFTRESET............................................................................... 215
10.3 Saving, reading and converting data in the memory.................................................... 216
10.3.1 Automatic data backup............................................................................... 216
10.3.2 Manual data storage .................................................................................. 216
10.3.3 Function MEMCPY..................................................................................... 217
10.3.4 Function FLASHWRITE ............................................................................. 218
10.3.5 Function FLASHREAD............................................................................... 220
10.3.6 Function E2WRITE .................................................................................... 221
10.3.7 Function E2READ ...................................................................................... 222
10.4 Data access and data check ........................................................................................ 223
10.4.1 Function SET_DEBUG............................................................................... 223
10.4.2 Function SET_IDENTITY........................................................................... 224
10.4.3 Function GET_IDENTITY........................................................................... 226
10.4.4 Function SET_PASSWORD ...................................................................... 228
10.4.5 Function CHECK_DATA ............................................................................ 230
10.5 Processing interrupts.................................................................................................... 232
10.5.1 Function SET_INTERRUPT_XMS............................................................. 233
10.5.2 Function SET_INTERRUPT_I.................................................................... 236
4
Page 5

ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
10.6 Use of the serial interface............................................................................................. 239
10.6.1 Function SERIAL_SETUP ......................................................................... 240
10.6.2 Function SERIAL_TX................................................................................. 242
10.6.3 Function SERIAL_RX................................................................................. 243
10.6.4 Function SERIAL_PENDING ..................................................................... 245
10.7 Reading the system time.............................................................................................. 246
10.7.1 Function TIMER_READ ............................................................................. 246
10.7.2 Function TIMER_READ_US ...................................................................... 247
10.8 Processing analogue input values................................................................................ 248
10.8.1 Function INPUT_ANALOG......................................................................... 249
10.8.2 Function INPUT_VOLTAGE ...................................................................... 251
10.8.3 Function INPUT_CURRENT...................................................................... 252
10.9 Adapting analogue values............................................................................................ 253
10.9.1 Function NORM ......................................................................................... 254
11 Controller functions in the ecomatmobile controller 256
11.1 General......................................................................................................................... 256
11.1.1 Self-regulating process .............................................................................. 256
11.1.2 Controlled system without inherent regulation........................................... 257
11.1.3 Controlled system with delay ..................................................................... 257
11.2 Setting rule for a controller ........................................................................................... 258
11.2.1 Setting control ............................................................................................ 258
11.2.2 Damping of overshoot................................................................................ 258
11.3 Functions for controllers ............................................................................................... 259
11.3.1 Function DELAY......................................................................................... 260
11.3.2 Function PT1.............................................................................................. 262
11.3.3 Function PID1 ............................................................................................ 264
11.3.4 Function PID2 ............................................................................................ 266
11.3.5 Function GLR ............................................................................................. 269
12 Annex 271
12.1 Address assignment and I/O operating modes............................................................ 272
12.1.1 Addresses / variables of the I/Os ............................................................... 272
12.1.2 Address assignment inputs / outputs ......................................................... 272
12.1.3 Possible operating modes inputs / outputs ................................................ 273
12.2 System flags................................................................................................................. 274
12.3 Overview of the files and libraries used ....................................................................... 275
12.3.1 General overview ....................................................................................... 275
12.3.2 What are the individual files and libraries used for? .................................. 277
13 Glossary of Terms 281
14 Index 293
5
Page 6
Page 7

ifm System Manual ecomatmobile SmartController (CR2500) V05
About this manual What do the symbols and formats mean?
1 About this manual
What do the symbols and formats mean?...................................................................................7
In this chapter you will find an overview of the following points:
• What do the symbols and formats stand for?
• How is this manual structured?
In the additional "Programming Manual for CoDeSys
of the programming system "CoDeSys for Automation
free of charge from ifm's website:
→ www.ifm.com
→ ifm-CD "Software, tools and documentation"
Nobody is perfect. Send us your suggestions for improvements to this manual and you will receive a
little gift from us to thank you.
© All rights reserved by ifm electronic gmbh. No part of this manual may be reproduced and used
without the consent of ifm electronic gmbh.
How is this manual structured? ...................................................................................................8
®
V2.3" you will obtain more details about the use
Alliance™". This manual can be downloaded
> Select country/language > [Service] > [Download] > [Control systems]
All product names, pictures, companies or other brands used on our pages are the property of the
respective rights owners.
1.1 What do the symbols and formats mean?
The following symbols or pictograms depict different kinds of remarks in our manuals:
DANGER
Death or serious irreversible injuries are to be expected.
WARNING
Death or serious irreversible injuries are possible.
CAUTION
Slight reversible injuries are possible.
NOTICE
Property damage is to be expected or possible.
NOTE
Important notes to faults and errors.
7