Ecomat Mobile Series
Ecomat Mobile Series
Ecomat Mobile Series
SmartController
CR2500
CoDeSys® V2.3
Target V05
10 / 2009
7390675 / 00
ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
Contents
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
2
ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
3
ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
4
ifm System Manual ecomatmobile SmartController (CR2500) V05
Contents
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
14 Index 293
5
ifm System Manual ecomatmobile SmartController (CR2500) V05
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
ifm System Manual ecomatmobile SmartController (CR2500) V05
Info
Further hints.
8
ifm System Manual ecomatmobile SmartController (CR2500) V05
2 Safety instructions
General ........................................................................................................................................9
What previous knowledge is required?......................................................................................10
2.1 General
No characteristics are warranted with the information, notes and examples provided in this manual.
The drawings, representations and examples imply no responsibility for the system and no application-
specific particularities.
The manufacturer of the machine/equipment is responsible for the safety of the machine/equipment.
WARNING
Property damage or bodily injury possible when the notes in this manual are not adhered to!
ifm electronic gmbh does not assume any liability in this regard.
► The acting person must have read and understood the safety instructions and the corresponding
chapters of this manual before performing any work on or with this device.
► The acting person must be authorised to work on the machine/equipment.
► Adhere to the technical data of the devices!
You can find the current data sheet on ifm's homepage at:
→ www.ifm.com > Select country/language > [Data sheet direct] > (Article no.) > [Technical data in
PDF format]
► Note the installation and wiring information as well as the functions and features of the devices!
→ supplied installation instructions or on ifm's homepage:
→ www.ifm.com > Select country/language > [Data sheet direct] > (Article no.) > [Operating
instructions]
ATTENTION
The driver module of the serial interface can be damaged!
Disconnecting the serial interface while live can cause undefined states which damage the driver
module.
► Do not disconnect the serial interface while live.
9
ifm System Manual ecomatmobile SmartController (CR2500) V05
10
ifm System Manual ecomatmobile SmartController (CR2500) V05
3 System description
Information concerning the device.............................................................................................11
Information concerning the software .........................................................................................11
PLC configuration ......................................................................................................................12
NOTE:
The software versions suitable for the selected target must always be used:
• of the operating system (CRnnnn_Vxxyyyzz.H86),
• of the PLC configuration (CRnnnn_Vxx.CFG),
• of the device library (CRnnnn_Vxxyyyzz.LIB),
• and the further files (→ chapter Overview of the files and libraries used, → page 275)
CRnnnn device article number
Vxx: 00...99 target version number
yy: 00...99 release number
zz: 00...99 patch number
The basic file name (e.g. "CR0032") and the software version number "xx" (e.g. "02") must always have
the same value! Otherwise the controller goes to the STOP mode.
The values for "yy" (release number) and "zz" (patch number) do not have to match.
11
ifm System Manual ecomatmobile SmartController (CR2500) V05
Also note:
The target for CRnn32 must be > V02, for all other devices > V05.
The user is responsible for the reliable function of the application programs he designed. If necessary,
he must additionally carry out an approval test by corresponding supervisory and test organisations
according to the national regulations.
12
ifm System Manual ecomatmobile SmartController (CR2500) V05
4 Configurations
Set up programming system......................................................................................................14
Function configuration of the inputs and outputs.......................................................................29
Hints to wiring diagrams ............................................................................................................34
The device configurations described in the corresponding installation instructions and in the annex
(→ page 271) to this documentation are used for standard devices (stock items). They fulfil the
requested specifications of most applications.
Depending on the customer requirements for series use it is, however, also possible to use other
device configurations, e.g. with respect to the inputs/outputs and analogue channels.
WARNING
Property damage or bodily injury possible due to malfunctions!
The software functions described in this documentation only apply to the standard configurations. In
case of use of customer-specific devices:
► Note the special hardware versions and additional remarks (additional documentation) on use of
the software.
13
ifm System Manual ecomatmobile SmartController (CR2500) V05
At the same time, all important libraries and the PLC configuration are loaded when selecting the
target. These can be removed by the programmer or complemented by further libraries, if necessary.
NOTE:
The software versions suitable for the selected target must always be used:
• of the operating system (CRnnnn_Vxxyyyzz.H86),
• of the PLC configuration (CRnnnn_Vxx.CFG),
• of the device library (CRnnnn_Vxxyyyzz.LIB),
• and the further files (→ chapter Overview of the files and libraries used, → page 275)
CRnnnn device article number
Vxx: 00...99 target version number
yy: 00...99 release number
zz: 00...99 patch number
The basic file name (e.g. "CR0032") and the software version number "xx" (e.g. "02") must always have
the same value! Otherwise the controller goes to the STOP mode.
The values for "yy" (release number) and "zz" (patch number) do not have to match.
14
ifm System Manual ecomatmobile SmartController (CR2500) V05
Based on the configuration the following is available in the program environment for the user:
• All important system and error flags
Depending on the application and the application program, these flags must be processed and
evaluated. Access is made via their symbolic names.
• The structure of the inputs and outputs
These can be directly symbolically designated (highly recommended!) in the window [PLC
Configuration] (example → figure below) and are available in the whole project as [Global
Variables].
15
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
When installing the ecomatmobile CD "Software, Tools and Documentation", projects with templates
have been stored in the program directory of your PC:
…\ifm electronic\CoDeSys V…\Projects\Template_CDVxxyyzz
► Open the requested template in CoDeSys via:
[File] > [New from template…]
> CoDeSys creates a new project which shows the basic program structure. It is strongly
recommended to follow the shown procedure.
→ chapter Set up programming system via templates (→ page 16)
16
ifm System Manual ecomatmobile SmartController (CR2500) V05
► Find article number of the unit in the list, e.g. CR2500 as CANopen master:
(via the folder structures in Templates → Section About the ifm Templates, → page 18).
► Save the new project with [file] > [Save as...], and define suitable directory and project name.
► Configuration of the CAN network in the project:
Double click the element [PLC configuration] above the tabulator [resources] in the CoDeSys
project.
► Right mouse click in the entry [CR2500, CANopen Master]
► Click in the context menu [Append subelement]:
> A list of all available EDS files appears in the extended context menu.
17
ifm System Manual ecomatmobile SmartController (CR2500) V05
► Select requested element, e.g. "System R360": I/O CompactModule CR2011 (EDS)".
The EDS files are in directory C:\…\CoDeSys V…\Library\PLCConf\.
> The window [PLC configuration] changes as follows:
► Set CAN parameters, PDO mapping and SDOs for the entered slave according to the
requirements. Note: Better deselect [Create all SDOs].
► With further slaves proceed as described above.
► Save the project!
This should be a sufficient description of your project. You want to supplement this project with further
elements and functions?
→ chapter Supplement project with further functions (→ page 23)
18
ifm System Manual ecomatmobile SmartController (CR2500) V05
19
ifm System Manual ecomatmobile SmartController (CR2500) V05
20
ifm System Manual ecomatmobile SmartController (CR2500) V05
21
ifm System Manual ecomatmobile SmartController (CR2500) V05
22
ifm System Manual ecomatmobile SmartController (CR2500) V05
A joystick is connected to the CR2012 which is to trigger a PWM output on the CR2032. How is that
achieved in a fast and simple way?
► Save CoDeSys project!
► In CoDeSys use [Project] > [Copy...] to open the project containing the requested function:
e.g. CR2500Demo_CR2012_02.pro from directory DEMO_PLC_CDV… underC:\...\CoDeSys
V…\Projects\:
23
ifm System Manual ecomatmobile SmartController (CR2500) V05
► Highlight the elements which contain only the requested function, in this case e.g.:
► The comments of the POUs and global variables usually contain information on how the individual
elements have to be configured, included or excluded. This information has to be followed.
► Adapt input and output variables as well as parameters and possible visualisations to your own
conditions.
► [Project] > [Save] and
[Project] > [Rebuild all].
24
ifm System Manual ecomatmobile SmartController (CR2500) V05
► After possibly required corrections and addition of missing libraries (→ Error messages after
rebuild) save the project again.
► Follow this principle to step by step (!) add further functions from other projects and check the
results.
► [Project] > [Save] and
[Project] > [Rebuild all].
25
ifm System Manual ecomatmobile SmartController (CR2500) V05
26
ifm System Manual ecomatmobile SmartController (CR2500) V05
27
ifm System Manual ecomatmobile SmartController (CR2500) V05
28
ifm System Manual ecomatmobile SmartController (CR2500) V05
Digital inputs
Depending on the controller, the digital inputs can be configured differently. In addition to the
protective mechanisms against interference, the digital inputs are internally evaluated via an analogue
stage. This enables diagnosis of the input signals. But in the application software the switching signal
is directly available as bit information. For some of these inputs the potential can be selected.
UB
Figure: Block diagram high/low side input for negative and positive sensor signals
29
ifm System Manual ecomatmobile SmartController (CR2500) V05
UB UB
Sensor
Sensor
GND GND
High side input for negative sensor signal Low side input for positive sensor signal
Fast inputs
In addition, the ecomatmobile controllers have up to 16 fast counter/pulse inputs for an input
frequency up to 50 kHz (→ data sheet). If, for example, mechanical switches are connected to these
inputs, there may be faulty signals in the controller due to contact bouncing. Using the application
software, these "faulty signals" must be filtered if necessary.
Furthermore it has to be noted whether the pulse inputs are designed for frequency measurement
(FRQx) and/or period measurement (CYLx) (→ data sheet).
The following functions, for example, can be used here:
On FRQx inputs:
• Frequency measurement with function FREQUENCY (→ page 201)
• Fast counter with function FAST_COUNT (→ page 212)
On CYLx inputs:
• Period measurement with function PERIOD (→ page 203) or with function PERIOD_RATIO
(→ page 205)
• Phase position of 2 fast inputs compared via the function PHASE (→ page 207)
Info
When using this function, the parameterised inputs and outputs are automatically configured, so the
programmer of the application does not have to do this.
30
ifm System Manual ecomatmobile SmartController (CR2500) V05
Analogue inputs
The analogue inputs can be configured via the application program. The measuring range can be set
as follows:
• current input 0...20 mA
• voltage input 0...10 V
• voltage input 0...30 / 32 V
If in the operating mode "0...30 / 32 V" the supply voltage is read back, the measurement can also be
performed ratiometrically. This means potentiometers or joysticks can be evaluated without additional
reference voltage. A fluctuation of the supply voltage then has no influence on this measured value.
As an alternative, an analogue channel can also be evaluated digitally.
NOTE
In case of ratiometric measurement the connected sensors should be supplied via the same voltage
source as the controller. So, faulty measurements caused by offset voltage are avoided.
In case of digital evaluation the higher input resistance must be taken into account.
UB
Referenz-Spannung
Reference Voltage
Analog
Eingang / Input Input Filter Spannung
Voltage
Strommessung
Current measurement
0...10 / 32 V
Voltage measurement
Spannungsmessung
31
ifm System Manual ecomatmobile SmartController (CR2500) V05
Info
Sensors with diagnostic capabilities to NAMUR can be used on all inputs. In this case, no additional
resistor connection is required.
If the diagnostic function is active, the system variable ANALOG_0...ANALOG_3 with the voltage
values is available for each input channel on the input.
32
ifm System Manual ecomatmobile SmartController (CR2500) V05
WARNING
Property damage or bodily injury due to malfunctions possible!
Outputs which are operated in the PWM mode do not support any diagnostic functions and no ERROR
flags are set. This is due to the structure of the outputs.
The function OUT_OVERLOAD_PROTECTION is not active in this mode!
NOTE
If an output is switched off in case of a fault (e.g. short circuit) via the hardware (by means of a fuse),
the logic state created by the application program does not change.
To set the outputs again after removal of the peripheral fault, the outputs must first be logically reset in
the application program and then set again if required.
33
ifm System Manual ecomatmobile SmartController (CR2500) V05
Examples:
12 GNDA
12 Terminal number
GNDA Terminal designation
30 %IX0.7 BL
30 Terminal number
%IX0.7 IEC address for a binary input
BL Hardware version of the input,
here: Binary Low side
47 %QX0.3 BH/PH
47 Terminal number
%QX0.3 IEC address for a binary output
BH/PH Hardware version of the output,
here: Binary High side or PWMHigh side
34
ifm System Manual ecomatmobile SmartController (CR2500) V05
5.1.1 Reset
This state is passed through after every power on reset:
• The operating system is initialised.
• Various checks are carried out.
• This temporary state is replaced by the Run or Stop state.
> The LED lights orange for a short time.
35
ifm System Manual ecomatmobile SmartController (CR2500) V05
The operating states STOP and RUN can be changed by the programming system.
For this controller the status LED can also be set by the application program. To do so, the following
system variable is used:
LED_MODE flashing frequency from the data structure "LED_MODES"
allowed: LED_2HZ, LED_1HZ, LED_05HZ, LED_0HZ (permanently)
NOTE
If the flashing mode is changed by the application program, the above-mentioned table (default setting)
is no longer valid.
36
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE:
The software versions suitable for the selected target must always be used:
• of the operating system (CRnnnn_Vxxyyyzz.H86),
• of the PLC configuration (CRnnnn_Vxx.CFG),
• of the device library (CRnnnn_Vxxyyyzz.LIB),
• and the further files (→ chapter Overview of the files and libraries used, → page 275)
CRnnnn device article number
Vxx: 00...99 target version number
yy: 00...99 release number
zz: 00...99 patch number
The basic file name (e.g. "CR0032") and the software version number "xx" (e.g. "02") must always have
the same value! Otherwise the controller goes to the STOP mode.
The values for "yy" (release number) and "zz" (patch number) do not have to match.
37
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTICE
Loss of the stored software possible!
In the test mode there is no protection of the stored operating system and application software.
NOTICE
Destruction of the EEPROM possible!
The test input must not be activated permanently because otherwise the allowed write cycles are
exceeded in the EEPROM.
5.4.2 SERIAL_MODE
The serial interface is available for the exchange of data in the application. Debugging the application
software is then only possible via the CAN interface.
For CRnn32: Debugging of the application software is then only possible via all 4 CAN interfaces or
via USB.
This function is switched off as standard (FALSE). Via the flag SERIAL_MODE the state can be
controlled and queried via the application program or the programming system.
→ chapter Use of the serial interface (→ page 239)
38
ifm System Manual ecomatmobile SmartController (CR2500) V05
To ensure maximum operational reliability the operating system checks the ecomatmobile controller
in the start phase (reset phase) and during the program execution by internal error checks.
The following error flags are set in case of an error:
Error Description
CANx_BUSOFF CAN interface x: Interface is not on the bus
CANx_LASTERROR ¹) CAN interface x: Error number of the last CAN transmission:
0= no error
≠0 → CAN specification → LEC
CANx_WARNING CAN interface x: Warning threshold reached (> 96)
ERROR ³) Set ERROR bit / switch off the relay *)
ERROR_MEMORY Memory error
ERROR_POWER Undervoltage/overvoltage error
ERROR_TEMPERATURE Excessive temperature error (> 85 °C)
ERROR_VBBR Terminal voltage error VBBR
CANx stands for the number of the CAN interface (CAN 1...x, depending on the device).
¹) Access to this flags requires detailed knowledge of the CAN controller and is normally not required.
²) Flag NOT available for CR2500, CR0301, CR0302.
³) By setting the ERROR system flag the ERROR output (terminal 13) is set to FALSE. In the "error-
free state" the output ERROR = TRUE (negative logic).
*) Relay NOT available for CR2500 and CR030n.
The following diagnostic messages are only available for devices with periphery terminals:
Diagnostic message Type Description
(only devices with periphery connections)
ERROR_BREAK_Qx *) BYTE Wire break error on the output group x
ERROR_Ix BYTE Peripheral error on the input group x
ERROR_SHORT_Qx *) BYTE Short circuit error on the output group x
x stands for the input/output group x (word 0...x, depending on the device).
*) Flags only available for ClassicController, ExtendedController, SafetyController.
NOTE
In adverse cases the output transistor can already switch off a disturbed output before the operating
system could detect the error. The corresponding error flag is then NOT set.
We recommend that the application programmer (additionally) evaluates the error by reading back the
outputs.
39
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTICE
Premature wear of the relay contacts possible.
► Only use this function for a general switch-off of the outputs in case of an "emergency".
► In normal operation switch off the relays only without load!
To do so, first switch off the outputs via the application program!
40
ifm System Manual ecomatmobile SmartController (CR2500) V05
41
ifm System Manual ecomatmobile SmartController (CR2500) V05
For the programmable devices from the controller family ecomatmobile numerous functions are
available which enable use of the devices in a wide range of applications.
As these functions use more or fewer system resources depending on their complexity it is not always
possible to use all functions at the same time and several times.
NOTICE
Risk that the controller acts too slowly! Cycle time must not become too long!
► When designing the application program the above-mentioned recommendations must be complied
with and tested. If necessary, the cycle time must be optimised by restructuring the software and
the system set-up.
It must also be taken into account which CPU is used in the device.
Controller family Article no. CPU frequency [MHz]
ClassicController (16 bits) CR0020 40
CR0505
ExtendedController (16 bits) CR0200 40
CabinetController CR0301 20
CR0302
CabinetController CR0303 40
SmartController CR2500 20
ClassicController (32 bits) CR0032 150
ExtendedController (32 bits) CR0232 150
SafetyController (16 bits) CR7020, CR7021 40
CR7200, CR7201
CR7505; CR7506
The higher the CPU frequency, the higher the performance when complex functions are used at the
same time.
42
ifm System Manual ecomatmobile SmartController (CR2500) V05
ATTENTION
Risk that the controller works too slowly! Cycle time must not become too long!
► When the application program is designed the above-mentioned recommendations must be
complied with and tested. If necessary, the cycle time must be optimised by restructuring the
software and the system set-up.
43
ifm System Manual ecomatmobile SmartController (CR2500) V05
44
ifm System Manual ecomatmobile SmartController (CR2500) V05
Programming and system resources Program creation and download in the PLC
nein fehlerfrei?
no no errors?
Nur wenn Sicherheits-Software:
Only if safety software:
ja
yes
Applikation testen
R360
R360/ /PDM360 smart
Test application R360
R360 /PDM360
/PDM360
smart
PDM360smart
smart smart
R360 Controller / PDM360
45
ifm System Manual ecomatmobile SmartController (CR2500) V05
Programming and system resources Program creation and download in the PLC
ifm downloader
The ifm downloader serves for easy transfer of the program code from the programming station to the
controller. As a matter of principle each application software can be copied to the controllers using the
ifm downloader. Advantage: A programming system with CoDeSys licence is not required.
Safety-related application software MUST be copied to the controllers using the ifm downloader so as
not to falsify the checksum by which the software has been identified.
NOTE
The ifm downloader cannot be used for the following devices:
- PDM360: CR1050, CR1051, CR1060,
- PDM360 compact: CR1052, CR1053, CR1055, CR1056.
46
ifm System Manual ecomatmobile SmartController (CR2500) V05
8.1.1 Topology
The CAN network is set up in a line structure. A limited number of spurs is allowed. Moreover, a ring
type bus (infotainment area) and a star type bus (central locking) are possible. Compared to the line
type bus both variants have one disadvantage:
In the ring type bus all control devices are connected in series so that the complete bus fails if one
control device fails.
The star type bus is mostly controlled by a central processor as all information must flow through this
processor. Consequently no information can be transferred if the central processor fails. If an
individual control device fails, the bus continues to function.
The linear bus has the advantage that all control devices are in parallel of a central cable. Only if this
fails, the bus no longer functions.
The disadvantage of spurs and star-type bus is that the wave resistance is difficult to determine. In the
worst case the bus no longer functions.
For a high-speed bus (> 125 kbits/s) 2 terminating resistors of 120 Ω (between CAN_HIGH and
CAN_LOW) must additionally be used at the cable ends.
47
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
The CAN download ID of the device must match the CAN download ID set in CoDeSys!
In the CAN network the CAN download IDs must be unique!
48
ifm System Manual ecomatmobile SmartController (CR2500) V05
8.2.1 CAN-ID
Depending of the CAN-ID the following CAN identifiers are free available for the data transfer:
CAN-ID base CAN-ID extended
11 bits 29 bits
2 047 CAN identifiers 536 870 912 CAN identifiers
Motor management (SAE J1939),
Standard applications
Truck & Trailer interface (ISO 11992)
NOTE
In some devices the 29 bits CAN-ID is not available for all CAN interfaces, → datasheet.
49
ifm System Manual ecomatmobile SmartController (CR2500) V05
Legend:
SOF = Start of frame
Edge of recessive to dominant
RTR = Remote transmission request
dominant: This message sends data
recessive: This message requests data
IDE = Identifier extension flag
dominant: After this control bits follows
recessive: After this the second part of the 29 bits identifier follows
SRR = Substitute remote request
recessive: Extended CAN-ID: Replaces the RTR bit at this position
50
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
The line must be terminated at its two ends using a terminating resistor of 120 Ω to prevent corruption
of the signal quality.
The devices of ifm electronic equipped with a CAN interface have no terminating resistors.
Spurs
Ideally no spur should lead to the bus participants (node 1 ... node n) because reflections occur
depending on the total cable length and the time-related processes on the bus. To avoid system
errors, spurs to a bus participant (e.g. I/O module) should not exceed a certain length. 2 m spurs
(referred to 125 kbits/s) are considered to be uncritical. The sum of all spurs in the whole system
should not exceed 30 m. In special cases the cable lengths of the line and spurs must be calculated
exactly.
51
ifm System Manual ecomatmobile SmartController (CR2500) V05
5V
CAN_H
3,5 V
2,5 V
1,5 V
CAN_L
0V
rezessiv dominant rezessiv t
recessive dominant recessive
This differential transmission with common return considerably improves the transmission security.
Noise voltages which interfere with the system externally or shifts of the ground potential influence
both signal cables with the same interference. These influences are therefore not considered when the
difference is formed in the receiver.
52
ifm System Manual ecomatmobile SmartController (CR2500) V05
500
200
100
50
20
10
Bus-Länge
5 Bus length
0 10 50 1000 10000 [m]
Baud rate [kBit/s] Bus length [m] Bit length nominal [µs]
1 000 30 1
800 50 1.25
500 100 2
250 250 4
125 500 8
62.5 1 000 20
20 2 500 50
10 5 000 100
Table: Dependencies bus length / baud rate / bit time
NOTE
These declarations apply to CAN layer 2.
Other CAN protocols (e.g. SAE J1939 or ISO 11992) have other requirements!
53
ifm System Manual ecomatmobile SmartController (CR2500) V05
54
ifm System Manual ecomatmobile SmartController (CR2500) V05
55
ifm System Manual ecomatmobile SmartController (CR2500) V05
56
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
The error CANx_BUSOFF is automatically handled and reset by the operating system. If the error is to
be handled or evaluated more precisely via the application program, the function
CANx_ERRORHANDLER (→ page 80) must be used. The error CANx_BUSOFF must then be reset
explicitly by the application program.
57
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
To use the full capacity of CAN it is absolutely necessary for the programmer to define an exact bus
concept before starting to work:
• How many data objects are needed with what identifiers?
• How is the ecomatmobile controller to react to possible CAN errors?
• How often must data be transmitted? The functions CANx_TRANSMIT and CANx_RECEIVE must
be called accordingly.
→ chapter function CANx_TRANSMIT (→ page 71) and function CANx_RECEIVE (→ page 73)
► Check whether the transmit orders were successfully assigned to CANx_TRANSMIT (FB output
RESULT) or ensure that the received data is read from the data buffer of the queue using
CANx_RECEIVE and processed in the rest of the program immediately.
To be able to set up a communication connection, the same transmission rate (baud rate) must first be
set for all participants of the CAN network. For the controller this is done using the function
CAN1_BAUDRATE (→ page 58) (for the 1st CAN interface) or via the function CAN2 (→ page 69) (for
the 2nd CAN interface).
Irrespective of whether the devices support one or several CAN interfaces the functions related to the
interface are specified by a number in the CAN function (e.g. CAN1_TRANSMIT or CAN2_RECEIVE).
To simplify matters the designation (e.g. CANx_TRANSMIT) is used for all variants in the
documentation.
NOTE
When installing the ecomatmobile CD "Software, Tools and Documentation", projects with templates
have been stored in the program directory of your PC:
…\ifm electronic\CoDeSys V…\Projects\Template_CDVxxyyzz
► Open the requested template in CoDeSys via:
[File] > [New from template…]
> CoDeSys creates a new project which shows the basic program structure. It is strongly
recommended to follow the shown procedure.
→ chapter Set up programming system via templates (→ page 16)
In this example data objects are exchanged with other CAN participants via the identifiers 1 and 2. To
do so, a receive identifier must exist for the transmit identifier (or vice versa) in the other participant.
58
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_BAUDRATE
ENABLE
BAUDRATE
Description
CAN1_BAUDRATE sets the transmission rate for the bus participant.
Using this function, the transmission rate for the controller is set. To do so, the corresponding value in
kbits/s is entered at the function input BAUDRATE. After executing the function the new value is
stored in the device and will even be available after a power failure.
ATTENTION
Please note for CR2500, CR0301, CR0302 and CS0015:
The EEPROM memory module may be destroyed by the permanent use of this function!
► Only carry out the function once during initialisation in the first program cycle!
Afterwards block the function again (ENABLE = "FALSE")!
NOTE
The new baud rate will become effective on RESET (voltage OFF/ON or soft reset).
ExtendedController: In the slave module, the new baud rate will become effective after voltage
OFF/ON.
59
ifm System Manual ecomatmobile SmartController (CR2500) V05
60
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_DOWNLOADID
ENABLE
ID
Description
CAN1_DOWNLOADID sets the download identifier for the first CAN interface.
Using the function the communication identifier for the program download and for debugging can be
set. The new value is entered when the function input ENABLE is set to TRUE. The new download ID
will become effective after voltage OFF/ON or after a soft reset.
ATTENTION
Please note for CR2500, CR0301, CR0302 and CS0015:
The EEPROM memory module may be destroyed by the permanent use of this function!
► Only carry out the function once during initialisation in the first program cycle!
Afterwards block the function again (ENABLE = "FALSE")!
NOTE
Make sure that a different download ID is entered for each controller in the same network!
If the controller is operated in the CANopen network, the download ID must not coincide with any
module ID (node number) of the other participants, either!
ExtendedController: In the slave module the download ID becomes effective after voltage OFF/ON.
61
ifm System Manual ecomatmobile SmartController (CR2500) V05
62
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_EXT
ENABLE
START
EXTENDED_MODE
BAUDRATE
Description
The function CAN1_EXT initialises the first CAN interface for the extended identifier (29 bits).
The function has to be retrieved if the first CAN interface e.g. with the function libraries for SAE J1939
(→ page 145) is to be used.
A change of the baud rate will become effective after voltage OFF/ON. The baud rates of CAN 1 and
CAN 2 can be set differently.
The input START is only set for one cycle during reboot or restart of the interface.
NOTE
The function must be executed before the functions CAN1_EXT_... .
63
ifm System Manual ecomatmobile SmartController (CR2500) V05
64
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_EXT_TRANSMIT
ID RESULT
DLC
DATA
ENABLE
Description
CAN1_EXT_TRANSMIT transfers a CAN data object (message) to the CAN controller for
transmission.
The function is called for each data object in the program cycle; this is done several times in case of
long program cycles. The programmer must ensure by evaluating the function block output RESULT
that his transmit order was accepted. To put it simply, at 125 kbits/s one transmit order can be
executed per 1 ms.
The execution of the function can be temporarily blocked via the input ENABLE (ENABLE = FALSE).
This can, for example, prevent a bus overload.
Several data objects can be transmitted virtually at the same time if a flag is assigned to each data
object and controls the execution of the function via the ENABLE input.
NOTE
If this function is to be used, the 1st CAN interface must first be initialised for the extended ID with the
function CAN1_EXT (→ page 63).
65
ifm System Manual ecomatmobile SmartController (CR2500) V05
66
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_EXT_RECEIVE
CONFIG DATA
CLEAR DLC
ID RTR
AVAILABLE
OVERFLOW
Description
CAN1_EXT_RECEIVE configures a data receive object and reads the receive buffer of the data
object.
The function must be called once for each data object during initialisation to inform the CAN controller
about the identifiers of the data objects.
In the further program cycle CAN1_EXT_RECEIVE is called for reading the corresponding receive
buffer, this is done several times in case of long program cycles The programmer must ensure by
evaluating the byte AVAILABLE that newly received data objects are retrieved from the buffer and
further processed.
Each call of the function decrements the byte AVAILABLE by 1. If the value of AVAILABLE is 0, there
is no data in the buffer.
By evaluating the output OVERFLOW, an overflow of the data buffer can be detected. If
OVERFLOW = TRUE at least 1 data object has been lost.
NOTE
If this function is to be used, the 1st CAN interface must first be initialised for the extended ID with the
function CAN1_EXT (→ page 63).
67
ifm System Manual ecomatmobile SmartController (CR2500) V05
68
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_EXT_ERRORHANDLER
BUSOFF_RECOVER
Description
Error routine for monitoring the first CAN interface.
The function CAN1_EXT_ERRORHANDLER monitors the first CAN interface and evaluates the CAN
errors. If a certain number of transmission errors occurs, the CAN participant becomes error passive. If
the error frequency decreases, the participant becomes error active again (= normal condition).
If a participant already is error passive and still transmission errors occur, it is disconnected from the
bus (= bus off) and the error bit CANx_BUSOFF is set. Returning to the bus is only possible if the "bus
off" condition has been removed (signal BUSOFF_RECOVER).
Afterwards, the error bit CANx_BUSOFF must be reset in the application program.
NOTE
If the automatic bus recover function is to be used (default setting) the function
CAN1_EXT_ERRORHANDLER must not be integrated and instanced in the program!
69
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN2
ENABLE
START
EXTENDED_MODE
BAUDRATE
Description
The function CAN2 initialises the 2nd CAN interface.
The function must be called if the 2nd CAN interface is to be used.
A change of the baud rate will become effective after voltage OFF/ON. The baud rates of CAN 1 and
CAN 2 can be set differently.
The input START is only set for one cycle during reboot or restart of the interface.
For the 2nd CAN interface the function libraries for SAE J1939 (→ page 145), among others, are
available.
NOTE
The function must be executed before the functions CAN2_... .
70
ifm System Manual ecomatmobile SmartController (CR2500) V05
71
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CANx_TRANSMIT
ID RESULT
DLC
DATA
ENABLE
Description
CANx_TRANSMIT transmits a CAN data object (message) to the CAN controller for transmission.
The function is called for each data object in the program cycle, also repeatedly in case of long
program cycles. The programmer must ensure by evaluating the function output RESULT that his
transmit order was accepted. Simplified it can be said that at 125 kbits/s one transmit order can be
executed per ms.
The execution of the function can be temporarily blocked (ENABLE = FALSE) via the input ENABLE.
So, for example a bus overload can be prevented.
Several data objects can be transmitted virtually at the same time if a flag is assigned to each data
object and controls the execution of the function via the ENABLE input.
NOTE
If the function CAN2_TRANSMIT is to be used, the second CAN interface must be initialised first using
the function CAN2 (→ page 69).
72
ifm System Manual ecomatmobile SmartController (CR2500) V05
73
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CANx_RECEIVE
CONFIG DATA
CLEAR DLC
ID RTR
AVAILABLE
OVERFLOW
Description
CANx_RECEIVE configures a data receive object and reads the receive buffer of the data object.
The function must be called once for each data object during initialisation, in order to inform the CAN
controller about the identifiers of the data objects.
In the further program cycle CANx_RECEIVE is called for reading the corresponding receive buffer,
also repeatedly in case of long program cycles. The programmer must ensure by evaluating the byte
AVAILABLE that newly received data objects are retrieved from the buffer and further processed.
Each call of the function decrements the byte AVAILABLE by 1. If the value of AVAILABLE is 0, there
is no data in the buffer.
By evaluating the output OVERFLOW, an overflow of the data buffer can be detected. If
OVERFLOW = TRUE at least 1 data object has been lost.
NOTE
If the function CAN2_RECEIVE is to be used, the second CAN interface must be initialised first using
the function CAN2 (→ page 69).
74
ifm System Manual ecomatmobile SmartController (CR2500) V05
75
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CANx_RECEIVE_RANGE
CONFIG ID
CLEAR DATA
FIRST_ID DLC
LAST_ID AVAILABLE
OVERFLOW
Description
CANx_RECEIVE_RANGE configures a sequence of data receive objects and reads the receive buffer
of the data objects.
For the first CAN interface max. 2048 IDs per bit are possible.
For the second CAN interface max. 256 IDs per 11 OR 29 bits are possible.
The second CAN interface requires a long initialisation time. To ensure that the watchdog does not
react, the process should be distributed to several cycles in the case of bigger ranges. → Example
(→ page 78).
The function must be called once for each sequence of data objects during initialisation to inform the
CAN controller about the identifiers of the data objects.
The function must NOT be mixed with function CANx_RECEIVE (→ page 73) or function
CANx_RECEIVE_RANGE for the same IDs at the same CAN interfaces.
In the further program cycle CANx_RECEIVE_RANGE is called for reading the corresponding receive
buffer, also repeatedly in case of long program cycles. The programmer has to ensure by evaluating
the byte AVAILABLE that newly received data objects are retrieved from buffer SOFORT and are
further processed as the data are only available for one cycle.
Each call of the function decrements the byte AVAILABLE by 1. If the value of AVAILABLE is 0, there
is no data in the buffer.
76
ifm System Manual ecomatmobile SmartController (CR2500) V05
By evaluating the output OVERFLOW, an overflow of the data buffer can be detected. If
OVERFLOW = TRUE, at least 1 data object has been lost.
Receive buffer: max. 16 software buffers per identifier.
77
ifm System Manual ecomatmobile SmartController (CR2500) V05
78
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CANx_EXT_RECEIVE_ALL
CONFIG ID
CLEAR DATA
DLC
AVAILABLE
OVERFLOW
Description
CANx_EXT_RECEIVE_ALL configures all data receive objects and reads the receive buffer of the
data objects.
The function must be called once during initialisation to inform the CAN controller about the identifiers
of the data objects.
In the further program cycle CANx_EXT_RECEIVE_ALL is called for reading the corresponding
receive buffer, also repeatedly in case of long program cycles. The programmer must ensure by
evaluating the byte AVAILABLE that newly received data objects are retrieved from the buffer and
further processed.
Each call of the function decrements the byte AVAILABLE by 1. If the value of AVAILABLE is 0, there
is no data in the buffer.
By evaluating the output OVERFLOW, an overflow of the data buffer can be detected. If
OVERFLOW = TRUE at least 1 data object has been lost.
Receive buffer: max. 16 software buffers per identifier.
79
ifm System Manual ecomatmobile SmartController (CR2500) V05
80
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CAN1_ERRORHANDLER
BUSOFF_RECOVER
CAN_RESTART
CAN2_ERRORHANDLER
BUSOFF_RECOVER
Description
Error routine for monitoring the CAN interfaces
The function CANx_ERRORHANDLER monitors the CAN interfaces and evaluates the CAN errors. If
a certain number of transmission errors occurs, the CAN participant becomes error passive. If the
error frequency decreases, the participant becomes error active again (= normal condition).
If a participant already is error passive and still transmission errors occur, it is disconnected from the
bus (= bus off) and the error bit CANx_BUSOFF is set. Returning to the bus is only possible if the "bus
off" condition has been removed (signal BUSOFF_RECOVER).
The function input CAN_RESTART is used for rectifying other CAN errors. The CAN interface is
reinitialised.
Afterwards, the error bit must be reset in the application program.
The procedures for the restart of the interfaces are different:
• For CAN interface 1 or devices with only one CAN interface:
set the input CAN_RESTART = TRUE (only 1 cycle)
• For CAN interface 2:
set the input START = TRUE (only 1 cycle) in the function CAN2 (→ page 69)
81
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
In principle, the function CAN2 (→ page 69) must be executed to initialise the second CAN interface,
before functions can be used for it.
If the automatic bus recover function is to be used (default setting) the function
CANx_ERRORHANDLER must not be integrated and instanced in the program!
82
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
Irrespective of the device used the structure of the function interfaces of all libraries is the same. The
slight differences (e.g. CANOPEN_LED_STATUS) are directly described in the corresponding
functions.
It is absolutely necessary to use only the corresponding device-specific library. The context can be
seen from the integrated article number of the device, e.g.:
CR0020: → ifm_CR0020_CANopenMaster_V040003.lib
→ chapter Setup the target (→ page 14)
When other libraries are used the device can no longer function correctly.
83
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE:
For all ecomat mobile controllers and the PDM360 smart you must use CANopen libraries with the
following addition:
• For CR0032 target version up to V01, all other devices up to V04.00.05: "OptTable"
• For CR0032 target version from V02 onwards, all other devices from V05 onwards: "OptTableEx"
If a new project is created, these libraries are in general automatically loaded. If you add the libraries
via the library manager, you must ensure a correct selection.
The CANopen libraries without this addition are used for all other programmable devices (e.g. PDM360
compact).
"Addresses" in CANopen
In CANopen there are different types of addresses (IDs):
• COB ID
The CAN Object Identifier addresses the message (= the CAN object) in the list of devices.
Identical messages have the same COB ID. The COB ID entries in the object directory contain the
CAN identifier (CAN ID) among others.
• CAN ID
The CAN Identifier identifies CAN messages in the complete network. The CAN ID is part of the
COB ID in the object directory.
• Node ID
The Node Identifier identifies the CANopen devices in the complete network. The Node ID is part
of some predefined CAN IDs (lower 7 bits).
84
ifm System Manual ecomatmobile SmartController (CR2500) V05
85
ifm System Manual ecomatmobile SmartController (CR2500) V05
The following functions defined in CANopen are at present not supported by the CANopen 3S (Smart
Software Solutions) library:
• Dynamic identifier assignment,
• Dynamic SDO connections,
• SDO transfer block by block, segmented SDO transfer (the functionality can be implemented via
the function CANx_SDO_READ (→ page 139) and function CANx_SDO_WRITE (→ page 141) in
the corresponding ifm device library).
• All options of the CANopen protocol which are not mentioned above.
86
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
For the ecomatmobile controllers and PDM360 smart the CANopen support by CoDeSys can only be
activated for the 1st CAN interface.
If the CAN master has already been added, the controller can no longer be used as a CAN device via
CoDeSys.
Implementation of a separate protocol on interface 2 or using the protocol to SAE J1939 or ISO11992 is
possible at any time.
For PDM360 and for PDM360 compact both CAN interfaces can be used as CANopen master or CAN
device.
For CRnn32 devices you can use all CAN interfaces with all protocols.
Baud rate
Select the baud rate for the master. It must correspond to the transmission speed of the other network
participants.
87
ifm System Manual ecomatmobile SmartController (CR2500) V05
Zeit
Time
Sync. COB ID
In this field the identifier for the SYNC message can be set. It is always transmitted after the
communication cycle period has elapsed. The default value is 128 and should normally not be
changed. To activate transmission of the SYNC message, the checkbox [activate] must be set.
NOTE
The SYNC message is always generated at the start of a program cycle. The inputs are then read, the
program is processed, the outputs are written to and then all synchronous PDOs are transmitted.
Please note that the SYNC time becomes longer if the set SNYC time is shorter than the program cycle
time.
Example: communication cycle period = 10 ms and program cycle time = 30 ms.
The SYNC message is only transmitted after 30 ms.
Node ID
Enter the node number (not the download ID!) of the master in this field. The node number may only
occur once in the network, otherwise the communication is disturbed.
Automatic startup
After successful configuration the network and the connected nodes are set to the state [operational]
and then started.
If the checkbox is not activated, the network must be started manually.
Heartbeat
If the other participants in the network support heartbeat, the option [support DSP301, V4.01...] can be
selected. If necessary, the master can generate its own heartbeat signal after the set time has
elapsed.
88
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
If a slave is added via the configuration dialogue in CoDeSys, source code is dynamically integrated in
the application program for every node. At the same time every additionally inserted slave extends the
cycle time of the application program. This means: In a network with many slaves the master can
process no further time-critical tasks (e.g. FB OCC_TASK).
A network with 27 slaves has a basic cycle time of 30 ms.
Please note that the maximum time for a PLC cycle of approx. 50 ms should not be exceeded
(watchdog time: 100 ms).
89
ifm System Manual ecomatmobile SmartController (CR2500) V05
Node reset
The slave is reset ("load") as soon as the configuration is loaded to the controller.
Optional device
If the option [optional device] is activated, the master tries only once to read from this node. In case of
a missing response, the node is ignored and the master goes to the normal operating state.
If the slave is connected to the network and detected at a later point in time, it is automatically started.
To do so, you must have selected the option [Automatic startup] in the CAN parameters of the master.
No initialization
If this option is activated, the master immediately takes the node into operation without transmitting
configuration SDOs. (Nevertheless, the SDO data is generated and stored in the controller.)
Nodeguarding / heartbeat settings
Depending on the device [nodeguarding] and [life time factor] or [heartbeat] must be set.
We recommend: It is better to work with the heartbeat function for current devices since then the bus
load is lower.
Emergency telegram
This option is normally selected. The EMCY messages are transferred with the specified identifier.
Communication cycle
In special applications a monitoring time for the SYNC messages generated by the master can be set
here. Please note that this time must be longer than the SYNC time of the master. The optimum value
must be determined experimentally, if necessary.
In most cases nodeguarding and heartbeat are sufficient for node monitoring.
90
ifm System Manual ecomatmobile SmartController (CR2500) V05
Transmission For transmission type you receive a selection of possible transmission modes for
Type this module:
acyclic – synchronous
After a change the PDO is transferred with the next SYNC.
cyclic – synchronous
The PDO is transferred synchronously. [Number of SYNCs] indicates the number of
the synchronisation messages between two transmissions of this PDO.
asynchronous – device profile specific
The PDO is transmitted on event, i.e. when the value is changed. The device profile
defines which data can be transferred in this way.
asynchronous – manufacturer specific
The PDO is transmitted on event, i.e. when the value is changed. The device
manufacturer defines which data is transferred in this way.
(a)synchronous – RTR only
These services are not implemented.
Number of SYNCs
Depending on the transmission type this field can be edited to enter the number of
synchronisation messages (definition in the CAN parameter dialogue of [Com. Cycle
Period], [Sync Window Length], [Sync. COB ID]) after which the PDO is to be
transmitted again.
Event-Time
Depending on the transmission type the period in milliseconds [ms] required
between two transmissions of the PDO is indicated in this field.
Master at runtime
Here you find information about the functionality of the CANopen master libraries at runtime.
The CANopen master library provides the CoDeSys application with implicit services which are
sufficient for most applications. These services are integrated for users in a transparent manner and
are available in the application without additional calls. The following description assumes that the
library ifm_CRnnnn_CANopenMaster_Vxxyyzz.LIB was manually added to the library manager to
use the network diagnostic, status and EMCY functions.
Services of the CANopen master library:
Reset of all configured slaves on the bus at the system start
To reset the slaves, the NMT command "Reset Remote Node" is used as standard explicitly for every
slave separately. (NMT stands for Network Management according to CANopen. The individual
commands are described in the CAN document DSP301.) In order to avoid overload of slaves having
less powerful CAN controllers it is useful to reset the slaves using the command "All Remote Nodes".
The service is performed for all configured slaves using the function CANx_MASTER_STATUS
91
ifm System Manual ecomatmobile SmartController (CR2500) V05
(→ page 123) with GLOBAL_START=TRUE. If the slaves are to be reset individually, this input must
be set to FALSE.
Polling of the slave device type using SDO (polling for object 100016) and comparison with the
configured slave ID
Indication of an error status for the slaves from which a wrong device type was received. The request
is repeated after 0.5 s if no device type was received AND the slave was not identified as optional in
the configuration AND the timeout has not elapsed.
Configuration of all correctly detected devices using SDO
Every SDO is monitored for a response and repeated if the slave does not respond within the
monitoring time.
Automatic configuration of slaves using SDOs while the bus is in operation
Prerequisite: The slave logged in the master via a bootup message.
Start of all correctly configured slaves after the end of the configuration of the corresponding
slave
To start the slaves the NMT command "Start remote node" is normally used. As for the "reset" this
command can be replaced by "Start All Remote Nodes". The service can be called via the function
CANx_Master_STATUS with GLOBAL_START=TRUE.
Cyclical transmission of the SYNC message
This value can only be set during the configuration.
Setting of nodeguarding with lifetime monitoring for every slave possible
The error status can be monitored for max. 8 slaves via the function CANx_MASTER_STATUS with
ERROR_CONTROL=TRUE.
We recommend: It is better to work with the heartbeat function for current devices since then the bus
load is lower.
Heartbeat from the master to the slaves and monitoring of the heartbeats of the slaves
The error status can be monitored for max. 8 slaves via the function CANx_MASTER_STATUS with
ERROR_CONTROL=TRUE.
Reception of emergency messages for every slave, the emergency messages received last are
stored separately for every slave
The error messages can be read via the function CANx_MASTER_STATUS with
EMERGENCY_OBJECT_SLAVES=TRUE. In addition this function provides the EMCY message
generated last on the output GET_EMERGENCY.
92
ifm System Manual ecomatmobile SmartController (CR2500) V05
93
ifm System Manual ecomatmobile SmartController (CR2500) V05
Network states
Here you read how to interpret the states of the CANopen network and how to react.
For the start-up (→ page 93) of the CANopen network and during operation the individual functions of
the library pass different states.
NOTE
In the monitor mode (online mode) of CoDeSys the states of the CAN network can be seen in the
global variable list "CANOpen implicit variables". This requires exact knowledge of CANopen and the
structure of the CoDeSys CANopen libraries.
To facilitate access the function CANx_MASTER_STATUS (→ page 123) from the library
ifm_CRnnnn_CANopenMaster_Vxxyyzz.LIB is available.
94
ifm System Manual ecomatmobile SmartController (CR2500) V05
95
ifm System Manual ecomatmobile SmartController (CR2500) V05
Nodeguarding/heartbeat error
State Description
99 In case of a nodeguarding timeout the variable NODE_STATE in the array
NODE_STATE_SLAVE of the function CANx_MASTER_STATUS (→ page 123) is set
to 99.
As soon as the node reacts again to nodeguard requests and the option [Automatic
startup] is activated, it is automatically started by the master. Depending on the status
contained in the response to the nodeguard requests, the node is newly configured or
only started.
To start the slave manually it is sufficient to use the method "NodeStart".
The same applies to heartbeat errors.
The current CANopen state of a node can be called via the structure element LAST_STATE from the
array NODE_STATE_SLAVE of the function CANx_MASTER_STATUS.
State Description
0 The node is in the boot up state.
4 The node is in the PREPARED state.
5 The node is in the OPERATIONAL state.
127 The node is in the PREOPERATIONAL state.
96
ifm System Manual ecomatmobile SmartController (CR2500) V05
Variable declaration
VAR
FB_MasterStatus:= CR0020_MASTER_STATUS;
:
END_VAR
program code
If FB_MasterStatus. NODE_STATE = 5 then
<application code>
End_if
97
ifm System Manual ecomatmobile SmartController (CR2500) V05
The object directory is accessed by the application via an array with the following structure:
98
ifm System Manual ecomatmobile SmartController (CR2500) V05
If index and sub-index of the object directory are known, an entry can be addressed as follows:
I := GetODMEntryValue(16#iiiiss00, pCanOpenMaster[0].wODMFirstIdx,
pCanOpenMaster[0].wODMFirstIdx + pCanOpenMaster[0]. wODMCount;
For "iii" the index must be used and for "ss" the sub-index (as hex values).
The number of the array entry is available in I. You can now directly access the components of the
entry.
It is sufficient to enter address, length and flags so that this entry can be directly transferred to an IEC
variable:
ODMEntries[I].dwContent := ADR(<variable name>);
ODMEntries[I].wLen := sizeof(<variable name>);
ODMEntries[I]. dwIdxSubIdxF := ODMEntries[I]. dwIdxSubIdxF OR
OD_ENTRYFLG_WRITE OR OD_ENTRYFLG_ISPOINTER;
It is sufficient to change the content of "dwContent" to change only the content of the entry.
99
ifm System Manual ecomatmobile SmartController (CR2500) V05
Functionality
The CAN device library in combination with the CANopen configurator provides the user with the
following options:
• In CoDeSys configuration of the properties for nodeguarding/heartbeat, emergency, node ID and
baud rate at which the device is to operate.
• Together with the parameter manager in CoDeSys, a default PDO mapping can be created which
can be changed by the master at runtime. The PDO mapping is changed by the master during the
configuration phase. By means of mapping IEC variables of the application can be mapped to
PDOs. This means IEC variables are assigned to the PDOs to be able to easily evaluate them in
the application program.
• The CAN device library provides an object directory. The size of this object directory is defined
while compiling CoDeSys. This directory contains all objects which describe the CAN device and
in addition the objects defined by the parameter manager. In the parameter manager only the list
types parameters and variables can be used for the CAN device.
• The library manages the access to the object directory, i.e. it acts as SDO server on the bus.
• The library monitors nodeguarding or the heartbeat consumer time (always only of one producer)
and sets corresponding error flags for the application.
• An EDS file can be generated which describes the configured properties of the CAN device so that
the device can be integrated and configured as a slave under a CAN master.
The CAN device library explicitly does not provide the following functionalities described in CANopen
(all options of the CANopen protocol which are not indicated here or in the above section are not
implemented either):
• Dynamic SDO and PDO identifiers
• SDO block transfer
• Automatic generation of emergency messages. Emergency messages must always be generated
by the application using the function CANx_SLAVE_EMCY_HANDLER (→ page 131) and the
function CANx_SLAVE_SEND_EMERGENCY (→ page 133). To do so, the library
ifm_CRnnnn_CANopenSlave_Vxxyyzz.LIB provides these functions.
• Dynamic changes of the PDO properties are currently only accepted on arrival of a StartNode
NMT message, not with the mechanisms defined in CANopen.
100
ifm System Manual ecomatmobile SmartController (CR2500) V05
Bus identifier
is currently not used.
Name of updatetask
Name of the task where the CAN device is called.
Generate EDS file
If an EDS file is to be generated from the settings to be able to add the CAN device to any master
configuration, the option [Generate EDS file] must be activated and the name of a file must be
indicated. As an option a template file can be indicated whose entries are added to the EDS file of the
CAN device. In case of overlapping the template definitions are not overwritten.
101
ifm System Manual ecomatmobile SmartController (CR2500) V05
BaudRate_50=1
BaudRate_100=1
BaudRate_125=1
BaudRate_250=1
BaudRate_500=1
BaudRate_800=1
BaudRate_1000=1
SimpleBootUpMaster=1
SimpleBootUpSlave=0
ExtendedBootUpMaster=1
ExtendedBootUpSlave=0
...
[1018sub0]
ParameterName=Number of entries
ObjectType=0x7
DataType=0x5
AccessType=ro
DefaultValue=2
PDOMapping=0
[1018sub1]
ParameterName=VendorID
ObjectType=0x7
DataType=0x7
AccessType=ro
DefaultValue=0x0
PDOMapping=0
[1018sub2]
ParameterName=Product Code
ObjectType=0x7
DataType=0x7
AccessType=ro
DefaultValue=0x0
PDOMapping=0
For the meaning of the individual objects please see the CANopen specification DS301.
In addition to the prescribed entries, the EDS file contains the definitions for SYNC, guarding,
emergency and heartbeat. If these objects are not used, the values are set to 0 (preset). But as the
objects are present in the object directory of the slave at runtime, they are written to in the EDS file.
The same goes for the entries for the communication and mapping parameters. All 8 possible sub-
indices of the mapping objects 16xx16 or 1Axx16 are present, but possibly not considered in the sub-
index 0.
NOTE: Bit mapping is not supported by the library!
102
ifm System Manual ecomatmobile SmartController (CR2500) V05
Here you can set the node ID and the baud rate.
Device type
(this is the default value of the object 100016 entered in the EDS) has 19116 as default value (standard
IO device) and can be freely changed.
The index of the CAN controller results from the position of the CAN device in the controller
configuration.
The nodeguarding parameters, the heartbeat parameters and the emergency COB ID can also be
defined in this tab. The CAN device can only be configured for the monitoring of a heartbeat.
We recommend: It is better to work with the heartbeat function for current devices since then the bus
load is lower.
103
ifm System Manual ecomatmobile SmartController (CR2500) V05
In this tab the assignment between local object directory (OD editor) and PDOs transmitted/received
by the CAN device can be defined. Such an assignment is called "mapping".
In the object directory entries used (variable OD) the connection to variables of the application is made
between object index/sub-index. You only have to ensure that the sub-index 0 of an index containing
more than one sub-index contains the information concerning the number of the sub-indices.
104
ifm System Manual ecomatmobile SmartController (CR2500) V05
Info
[Variables] and [parameters] can be selected as list type.
For the exchange of data (e.g. via PDOs or other entries in the object directory) a variable list is
created.
The parameter list should be used if you do not want to link object directory entries to application
variables. For the parameter list only the index 100616 / SubIdx 0 is currently predefined. In this entry
the value for the "Com. Cycle Period" can be entered by the master. This signals the absence of the
SYNC message.
So you have to create a variable list in the object directory (parameter manager) and link an index/sub-
index to the variable PLC_PRG.a.
► To do so, add a line to the variable list (a click on the right mouse button opens the context menu)
and enter a variable name (any name) as well as the index and sub-index.
► The only allowed access right for a receive PDO is [write only].
► Enter "PLC_PRG.a" in the column [variable] or press [F2] and select the variable.
NOTE
Data to be read by the CAN master (e.g. inputs, system variables) must have the access right [read
only].
Data to be written by the CAN master (e.g. outputs in the slave) must have the access right [write only].
SDO parameters to be written and at the same time to be read from and written to the slave application
by the CAN master must have the access right [read-write].
To be able to open the parameter manager the parameter manager must be activated in the target
settings under [Network functionality]. The areas for index/sub-index already contain sensible values
and should not be changed.
105
ifm System Manual ecomatmobile SmartController (CR2500) V05
In the default PDO mapping of the CAN device the index/sub-index entry is then assigned to a receive
PDO as mapping entry. The PDO properties can be defined via the dialogue known from Add and
configure CANopen slaves (→ page 89).
Only objects from the parameter manager with the attributes [read only] or [write only] are marked in
the possibly generated EDS file as mappable (= can be assigned) and occur in the list of the
mappable objects. All other objects are not marked as mappable in the EDS file.
NOTE
If more than 8 data bytes are mapped to a PDO, the next free identifiers are then automatically used
until all data bytes can be transferred.
To obtain a clear structure of the identifiers used you should add the correct number of the receive and
transmit PDOs and assign them the variable bytes from the list.
106
ifm System Manual ecomatmobile SmartController (CR2500) V05
Setting of the node numbers and the baud rate of a CAN device
For the CAN device the node number and the baud rate can be set at runtime of the application
program.
► For setting the node number the function CANx_SLAVE_NODEID (→ page 130) of the library
ifm_CRnnnn_CANopenSlave_Vxxyyzz.lib is used.
► For setting the baud rate the function CAN1_BAUDRATE (→ page 58) or the function CAN1_EXT
(→ page 63) or the function CANx of the corresponding device library is used for the controllers
and the PDM360 smart. For PDM360 or PDM360 compact the function
CANx_SLAVE_BAUDRATE is available via the library
ifm_CRnnnn_CANopenSlave_Vxxyyzz.lib.
107
ifm System Manual ecomatmobile SmartController (CR2500) V05
General information
Network variables
Network variables are one option to exchange data between two or several controllers. For users the
mechanism should be easy to use. At present network variables are implemented on the basis of CAN
and UDP. The variable values are automatically exchanged on the basis of broadcast messages. In
UDP they are implemented as broadcast messages, in CAN as PDOs. These services are not
confirmed by the protocol, i.e. it is not checked whether the receiver receives the message. Exchange
of network variables corresponds to a "1 to n connection" (1 transmitter to n receivers).
Object directory
The object directory is another option to exchange variables. This is a 1 to 1 connection using a
confirmed protocol. The user can check whether the message arrived at the receiver. The exchange is
not carried out automatically but via the call of functions from the application program.
→ chapter The object directory of the CANopen master (→ page 97)
108
ifm System Manual ecomatmobile SmartController (CR2500) V05
► Please note the particularities when using network variables for the corresponding device types.
→ Chapter Particularities for network variables (→ page 112)
109
ifm System Manual ecomatmobile SmartController (CR2500) V05
110
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
In CAN networks the basic identifier is directly used as COB-ID of the CAN messages. It is not checked
whether the identifier is also used in the remaining CAN configuration.
To ensure a correct exchange of data between two controllers the global variable lists in the two
projects must match. To ensure this you can use the feature [Link to file]. A project can export the
variable list file before compilation, the other projects should import this file before compilation.
In addition to simple data types a variable list can also contain structures and arrays. The elements of
these combined data types are transmitted separately.
Strings must not be transmitted via network variables as otherwise a runtime error will occur and the
watchdog will be activated.
If a variable list is larger than a PDO of the corresponding network, the data is split up to several PDOs.
Therefore it cannot be ensured that all data of the variable list is received in one cycle. Parts of the
variable list can be received in different cycles. This is also possible for variables with structure and
array types.
Transmit checksum
This option is not supported.
Acknowledgement
This option is not supported.
Read
The variable values of one (or several) controllers are read.
Write
The variables of this list are transmitted to other controllers.
NOTE
You should only select one of these options for every variable list, i.e. either only read or only write.
If you want to read or write several variables of a project, please use several variable lists (one for
reading, one for writing).
In a network the same variable list should only be exchanged between two participants.
Cyclic transmission
Only valid if [write] is activated. The values are transmitted in the specified [interval] irrespective of
whether they have changed.
Transmit on change
The variable values are only transmitted if one of the values has been changed. With [Minimum gap]
(value > 0) a minimum time between the message packages can be defined.
Transmit on event
If this option is selected, the CAN message is only transmitted if the indicated binary [variable] is set to
TRUE. This variable cannot be selected from the list of the defined variables via the input help.
111
ifm System Manual ecomatmobile SmartController (CR2500) V05
112
ifm System Manual ecomatmobile SmartController (CR2500) V05
Device Description
PDM360: CR1050, Network variables are supported on interface 1 (value = 0) and 2 (value =
CR1051, CR1060 1).
PDM360 compact: CAN master
CR1052, CR1053, Transmit and receive lists are processed directly.
CR1055, CR1056 You only have to make the settings described above.
CAN device
Transmit and receive lists are processed directly.
You only have to make the settings described above.
Important!
If [support network variables] is selected in the PDM360 or PDM360
compact, you must at least create one variable in the global variable list and
call it once in the application program. Otherwise the following error
message is generated when compiling the program:
Error 4601: Network variables 'CAN': No cyclic or freewheeling task for
network variable exchange found.
113
ifm System Manual ecomatmobile SmartController (CR2500) V05
Identifier
The identifier for the error message consists of the sum of the following elements:
EMCY default identifier 128 (8016)
+
node ID
114
ifm System Manual ecomatmobile SmartController (CR2500) V05
115
ifm System Manual ecomatmobile SmartController (CR2500) V05
116
ifm System Manual ecomatmobile SmartController (CR2500) V05
117
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_MASTER_EMCY_HANDLER
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenMaster_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0032, CR0505
• ExtendedController: CR0200, CR0232
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7032, CR7200, CR7201, CR7232, CR7505, CR7506
• SmartController: CR2500
• PDM360: CR1050, CR1051, CR1060
• PDM360 compact: CR1052, CR1053, CR1055, CR1056
• PDM360 smart: CR1070, CR1071
Function symbol:
CANx_MASTER_EMCY_HANDLER
CLEAR_ERROR_FIELD ERROR_REGISTER
ERROR_FIELD
Description
Monitoring device-specific error states
The function CANx_MASTER_EMCY_HANDLER monitors the device-specific error status of the
master. The function must be called in the following cases:
• the error status is to be transmitted to the network and
• the error messages of the application are to be stored in the object directory.
NOTE
If application-specific error messages are to be stored in the object directory, the function
CANx_MASTER_EMCY_HANDLER must be called after (repeatedly) calling the function
CANx_MASTER_SEND_EMERGENCY (→ page 120).
118
ifm System Manual ecomatmobile SmartController (CR2500) V05
119
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_MASTER_SEND_EMERGENCY
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenMaster_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0032, CR0505
• ExtendedController: CR0200, CR0232
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7032, CR7200, CR7201, CR7232, CR7505, CR7506
• SmartController: CR2500
• PDM360: CR1050, CR1051, CR1060
• PDM360 compact: CR1052, CR1053, CR1055, CR1056
• PDM360 smart: CR1070, CR1071
Function symbol:
CANx_MASTER_SEND_EMERGENCY
ENABLE
ERROR
ERROR_CODE
ERROR_REGISTER
MANUFACTURER_ERROR_FIELD
Description
Transmission of application-specific error states.
The function CANx_MASTER_SEND_EMERGENCY transmits application-specific error states. The
function is called if the error status is to be transmitted to other devices in the network.
NOTE
If application-specific error messages are to be stored in the object directory, the function
CANx_MASTER_EMCY_HANDLER (→ page 118) must be called after (repeatedly) calling the
function CANx_MASTER_SEND_EMERGENCY.
120
ifm System Manual ecomatmobile SmartController (CR2500) V05
121
ifm System Manual ecomatmobile SmartController (CR2500) V05
122
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_MASTER_STATUS
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenMaster_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0505
• ExtendedController: CR0200
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7200, CR7201, CR7505, CR7506
• SmartController: CR2500
Function symbol:
CANx_MASTER_STATUS
CANOPEN_LED_STATUS NODE_ID
GLOBAL_START BAUDRATE
CLEAR_RX_OVERFLOW_FLAG NODE_STATE
CLEAR_RX_BUFFER SYNC
CLEAR_TX_OVERFLOW_FLAG RX_OVERFLOW
CLEAR_TX_BUFFER TX_OVERFLOW
CLEAR_OD_CHANGED_FLAG OD_CHANGED
CLEAR_ERROR_CONTROL ERROR_CONTROL
RESET_ALL_NODES GET_EMERGENCY
START_ALL_NODES
NODE_STATE_SLAVE
EMERGENCY_OBJECT_SLAVES
Description
Status indication of the device used with CANopen.
The function shows the status of the device used as CANopen master. Furthermore, the status of the
network and of the connected slaves can be monitored.
The function simplifies the use of the CoDeSys CANopen master libraries. We urgently recommend to
carry out the evaluation of the network status and of the error messages via this function.
123
ifm System Manual ecomatmobile SmartController (CR2500) V05
124
ifm System Manual ecomatmobile SmartController (CR2500) V05
125
ifm System Manual ecomatmobile SmartController (CR2500) V05
126
ifm System Manual ecomatmobile SmartController (CR2500) V05
Detailed description of the functionalities of the CANopen master and the mechanisms → chapter
CANopen master (→ page 85).
Using the controller CR0020 as an example the following code fragments show the use of the function
CANx_MASTER_STATUS (→ page 123).
Slave information
To be able to access the information of the individual CANopen nodes, an array for the corresponding
structure must be generated. The structures are contained in the library. You can see them under
"Data types" in the library manager.
The number of the array elements is determined by the global variable MAX_NODEINDEX which is
automatically generated by the CANopen stack. It contains the number of the slaves minus 1 indicated
in the network configurator.
NOTE
The numbers of the array elements do not correspond to the node ID. The identifier can be read from
the corresponding structure under NODE_ID.
127
ifm System Manual ecomatmobile SmartController (CR2500) V05
Structure Emergency_Message
128
ifm System Manual ecomatmobile SmartController (CR2500) V05
129
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_SLAVE_NODEID
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenSlave_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0032, CR0505
• ExtendedController: CR0200, CR0232
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7032, CR7200, CR7201, CR7232, CR7505, CR7506
• SmartController: CR2500
• PDM360: CR1050, CR1051, CR1060
• PDM360 compact: CR1052, CR1053, CR1055, CR1056
• PDM360 smart: CR1070, CR1071
Function symbol:
CANx_SLAVE_NODEID
ENABLE
NODEID
Description
The function CANx_SLAVE_NODEID enables the setting of the node ID of a CAN device (slave) at
runtime of the application program.
Normally, the function is called once during initialisation of the controller, in the first cycle. Afterwards,
the input ENABLE is set to FALSE again.
130
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_SLAVE_EMCY_HANDLER
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenSlave_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0032, CR0505
• ExtendedController: CR0200, CR0232
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7032, CR7200, CR7201, CR7232, CR7505, CR7506
• SmartController: CR2500
• PDM360: CR1050, CR1051, CR1060
• PDM360 compact: CR1052, CR1053, CR1055, CR1056
• PDM360 smart: CR1070, CR1071
Function symbol:
CANx_SLAVE_EMCY_HANDLER
CLEAR_ERROR_FIELD ERROR_REGISTER
ERROR_FIELD
Description
The function CANx_SLAVE_EMCY_HANDLER monitors the device-specific error status (device
operated as slave).
The function must be called in the following cases:
• the error status is to be transmitted to the CAN network and
• the error messages of the application are to be stored in the object directory.
NOTE
If application-specific error messages are to be stored in the object directory, the function
CANx_SLAVE_EMCY_HANDLER must be called after (repeatedly) calling the function
CANx_SLAVE_SEND_EMERGENCY (→ page 133).
131
ifm System Manual ecomatmobile SmartController (CR2500) V05
132
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_SLAVE_SEND_EMERGENCY
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenSlave_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0032, CR0505
• ExtendedController: CR0200, CR0232
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7032, CR7200, CR7201, CR7232, CR7505, CR7506
• SmartController: CR2500
• PDM360: CR1050, CR1051, CR1060
• PDM360 compact: CR1052, CR1053, CR1055, CR1056
• PDM360 smart: CR1070, CR1071
Function symbol:
CANx_SLAVE_SEND_EMERGENCY
ENABLE
ERROR
ERROR_CODE
ERROR_REGISTER
MANUFACTURER_ERROR_FIELD
Description
Using the function CANx_SLAVE_SEND_EMERGENCY application-specific error states are
transmitted. These are error messages which are to be sent in addition to the device-internal error
messages (e.g. short circuit on the output).
The function is called if the error status is to be transmitted to other devices in the network.
NOTE
If application-specific error messages are to be stored in the object directory, the function
CANx_SLAVE_EMCY_HANDLER (→ page 131) must be called after (repeatedly) calling the function
CANx_SLAVE_SEND_EMERGENCY.
133
ifm System Manual ecomatmobile SmartController (CR2500) V05
134
ifm System Manual ecomatmobile SmartController (CR2500) V05
135
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_SLAVE_STATUS
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_CANopenSlave_Vxxyyzz.LIB
Available for the following devices:
• CabinetController: CR0301, CR0302, CR0303
• ClassicController: CR0020, CR0505
• ExtendedController: CR0200
• PCB controller: CS0015
• SafetyController: CR7020, CR7021, CR7032, CR7200, CR7201, CR7232, CR7505, CR7506
• SmartController: CR2500
Function symbol:
CANx_SLAVE_STATUS
CANOPEN_LED_STATUS NODE_ID
CLEAR_RX_OVERFLOW_FLAG BAUDRATE
CLEAR_RX_BUFFER NODE_STATE
CLEAR_TX_OVERFLOW_FLAG SYNC
CLEAR_TX_BUFFER SYNC_ERROR
CLEAR_RESET_FLAGS GUARD_HEARTBEAT_ERROR
CLEAR_OD_CHANGED_FLAG RX_OVERFLOW
TX_OVERFLOW
RESET_NODE
RESET_COM
OD_CHANGED
OD_CHANGED_INDEX
Description
The function CANx_SLAVE_STATUS shows the status of the device used as CANopen slave. The
function simplifies the use of the CoDeSys CAN device libraries. We urgently recommend to carry out
the evaluation of the network status via this function.
Info
For a detailed description of the functions of the CANopen slave and the mechanisms
→ chapter CANopen device (→ page 100).
At runtime you can then access the individual function outputs of the block to obtain a status overview.
136
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example:
137
ifm System Manual ecomatmobile SmartController (CR2500) V05
138
ifm System Manual ecomatmobile SmartController (CR2500) V05
139
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_SDO_READ
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_Vxxyyzz.LIB ifm_CANx_SDO_Vxxyyzz.LIB
Available for the following devices: Available for the following devices:
CabinetController: CR0301, CR0302, CR0303 PDM360: CR1050, CR1051, CR1060
ClassicController: CR0020, CR0032, CR0505 PDM360 compact: CR1052, CR1053, CR1055,
CR1056
ExtendedController: CR0200, CR0232
PCB controller: CS0015
SafetyController: CR7020, CR7021, CR7032,
CR7200, CR7201, CR7232, CR7505, CR7506
SmartController: CR2500
PDM360 smart: CR1070, CR1071
Function symbol:
CANx_SDO_READ
ENABLE RESULT
NODE LEN
IDX
SUBIDX
DATA
Description
CANx_SDO_READ reads the SDO (→ page 91) with the indicated indexes from the node.
By means of these, the entries in the object directory can be read. So it is possible to selectively read
the node parameters.
ecomatmobile controller PDM360 compact
PCB controller PDM360 dialogue module
PDM360 smart
From the device library From the device library
ifm_CRnnnn_Vxxyyzz.LIB ifm_CANx_SDO_Vxxyyzz.LIB
Prerequisite: Node must be in the mode "Pre- Prerequisite: The node must be in the mode
Operational" or "Operational". "CANopen master" or "CAN device".
For controllers, only CAN1_SDO_READ is
available.
140
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example:
141
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function CANx_SDO_WRITE
x = number 1...n of the CAN interface (depending on the device, → data sheet)
Contained in the library:
ifm_CRnnnn_Vxxyyzz.LIB ifm_CANx_SDO_Vxxyyzz.LIB
Available for the following devices: Available for the following devices:
CabinetController: CR0301, CR0302, CR0303 PDM360: CR1050, CR1051, CR1060
ClassicController: CR0020, CR0032, CR0505 PDM360 compact: CR1052, CR1053, CR1055,
CR1056
ExtendedController: CR0200, CR0232
PCB controller: CS0015
SafetyController: CR7020, CR7021, CR7032,
CR7200, CR7201, CR7232, CR7505, CR7506
SmartController: CR2500
PDM360 smart: CR1070, CR1071
Function symbol:
CANx_SDO_WRITE
ENABLE RESULT
NODE
IDX
SUBIDX
LEN
DATA
Description
CANx_SDO_WRITE writes the SDO (→ page 91) with the specified indexes to the node.
Using this function, the entries can be written to the object directory. So it is possible to selectively set
the node parameters.
ecomatmobile controller PDM360 compact
PCB controller PDM360 dialogue module
PDM360 smart
From the device library From the device library
ifm_CRnnnn_Vxxyyzz.LIB ifm_CANx_SDO_Vxxyyzz.LIB
Prerequisite: the node must be in the state "Pre- Prerequisite: The node must be in the mode
Operational" or "Operational" and in the mode "CANopen master" or "CAN device".
"CANopen master".
For controllers, there only is CAN1_SDO_WRITE
available.
NOTE
The value for LEN must correspond to the length of the transmit array. Otherwise, problems with SDO
communication will occur.
142
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example:
143
ifm System Manual ecomatmobile SmartController (CR2500) V05
144
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
NOTE
To use the functions to SAE J1939 the protocol description of the aggregate manufacturer (e.g. for
motors, gears) is definitely needed. For the messages implemented in the aggregate control device this
description must be used because not every manufacturer implements all messages or implementation
is not useful for all aggregates.
destination
Data page
Reserved
Source /
address
Priority
29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
The following information and tools should be available to develop programs for functions to
SAE J1939:
• List of the data to be used by the aggregates
• Overview list of the aggregate manufacturer with all relevant data
• CAN monitor with 29-bit support
• If required, the standard SAE J1939
145
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
146
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
0 C F 0 0 2 0 3
As these values are hexadecimal numbers of which individual bits are sometimes needed, the
numbers must be further broken down:
SA / DA Source / destination address (hexadecimal) Source / destination address (decimal)
0 3 00 03 0 3
F 0 0F 00 16 0
0 2 00 02 0 2
0 C 0000 1100
Out of the 8 bits (0C16) only the 5 least significant bits are needed:
Not required Priority Res. PG
x x x 02 12 12 02 02
0310 010 010
x x x 12 12 02 02 02
610 010 010
1C16:
Not required Priority Res. PG
x x x 12 12 12 02 02
710 010 010
147
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
Function symbol:
J1939_x
ENABLE
START
MY_ADRESS
Description
J1939_x serves as protocol handler for the communication profile SAE J1939.
To handle the communication, the protocol handler must be called in each program cycle. To do so,
the input ENABLE is set to TRUE.
The protocol handler is started if the input START is set to TRUE for one cycle.
Using MY_ADDRESS, a device address is assigned to the controller. It must differ from the addresses
of the other J1939 bus participants. It can then be read by other bus participants.
NOTE
J1939 communication via the 1st CAN interface: J1939 communication via the 2nd CAN interface:
► First initialise the interface via the function ► Initialise the interface first with the function
CAN1_EXT (→ page 63)! CAN2 (→ page 69)!
148
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
149
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
Function symbol:
J1939_x_RECEIVE
ENABLE RESULT
CONFIG DEVICE
PG LEN
PF
PS
DST
RPT
LIFE
Description
J1939_x_RECEIVE serves for receiving one individual message or a block of messages.
To do so, the function must be initialised for one cycle via the input CONFIG. During initialisation, the
parameters PG, PF, PS, RPT, LIFE and the memory address of the data array DST are assigned. The
address must be determined via the function ADR.
The receipt of data must be evaluated via the RESULT byte. If RESULT = 1 the data can be read from
the memory address assigned via DST and can be further processed. When a new message is
received, the data in the memory address DST is overwritten.
The number of received message bytes is indicated via the function output LEN.
If RESULT = 3, no valid messages have been received in the indicated time window (LIFE * RPT).
NOTE
This block must also be used if the messages are requested using the functions J1939_..._REQUEST.
150
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
151
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
Function symbol:
J1939_x_TRANSMIT
ENABLE RESULT
PRIO
PG
PF
PS
SRC
LEN
RPT
Description
J1939_x_TRANSMIT serves for the transmission of messages.
The function is responsible for transmitting individual messages or blocks of messages. To do so, the
parameters PG, PF, PS, RPT and the address of the data array SRC are assigned to the function. The
address must be determined via the function ADR. In addition, the number of data bytes to be
transmitted and the priority (typically 3, 6 or 7) must be assigned.
Given that the transmission of data is processed via several control cycles, the process must be
evaluated via the RESULT byte. All data has been transmitted if RESULT = 1.
Info
If more than 8 bytes are to be sent, a "multi package transfer" is carried out.
152
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
153
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
Function symbol:
J1939_x_RESPONSE
ENABLE RESULT
CONFIG
PG
PF
PS
SRC
LEN
Description
J1939_x_RESPONSE handles the automatic response to a request message.
This function is responsible for the automatic sending of messages to "Global Requests" and "Specific
Requests". To do so, the function must be initialised for one cycle via the input CONFIG.
The parameters PG, PF, PS, RPT and the address of the data array SRC are assigned to the function.
The address must be determined via the function ADR. In addition, the number of data bytes to be
transmitted is assigned.
154
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
155
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
Function symbol:
J1939_x_SPECIFIC_REQUEST
ENABLE RESULT
PRIO LEN
DA
PG
PF
PS
DST
Description
J1939_x_SPECIFIC_REQUEST handles the request and receipt of data from a specific network
participant.
The function is responsible for the automatic requesting of individual messages from a specific J1939
network participant. To do so, the logical device address DA, the parameters PG, PF, PS and the
address of the array DST in which the received data is stored are assigned to the function. The
address must be determined via the function ADR. In addition, the priority (typically 3, 6 or 7) must be
assigned.
Given that the request of data can be handled via several control cycles, this process must be
evaluated via the RESULT byte. All data has been received if RESULT = 1.
The output LEN indicates how many data bytes have been received.
156
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
157
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
Function symbol:
J1939_x_GLOBAL_REQUEST
ENABLE RESULT
PRIO SA
PG LEN
PF
PS
DST
Description
J1939_x_GLOBAL_REQUEST handles global requesting and receipt of data from the network
participants.
The function is responsible for the automatic requesting of individual messages from all (global) active
J1939 network participants. To do so, the logical device address DA, the parameters PG, PF, PS and
the address of the array DST in which the received data is stored are assigned to the function. The
address must be determined via the function ADR. In addition, the priority (typically 3, 6 or 7) must be
assigned.
Given that the request of data can be handled via several control cycles, this process must be
evaluated via the RESULT byte. All data has been received if RESULT = 1.
The output LEN indicates how many data bytes have been received.
158
ifm System Manual ecomatmobile SmartController (CR2500) V05
CAN in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
159
ifm System Manual ecomatmobile SmartController (CR2500) V05
PWM in the ecomatmobile controller Use of the CAN interfaces to SAE J1939
In this chapter you will find out more about the pulse width modulation in the controller.
PWM is available in the following controllers:
Number of available of which current- PWM frequency
PWM outputs controlled PWM [Hz]
outputs
ClassicController: CR0032 16 16 2...2000
ClassicController: CR0020, 12 / 8 8/8 25...250
CR0505
ExtendedController: CR0232 32 32 2...2000
ExtendedController: CR0200 24 16 25...250
SmartController: CR2500 4 4 25...250
SafetyController: CR7020, 12 / 8 / 24 8 / 8 / 16 25...250
CR7021, CR7200, CR7201,
CR7505, CR7506
CabinetController: CR0301, 4/8/8 0/0/0 25...250
CR0302, CR0303
PCB controller: CS0015 8 0 25...250
PDM360 smart: CR1070, 4 0 25...250
CR1071
160
ifm System Manual ecomatmobile SmartController (CR2500) V05
UB
UB
The PWM output signal is a pulsed signal between GND and supply voltage. Within a defined period
(PWM frequency) the mark-to-space ratio is then varied. Depending on the mark-to-space ratio, the
connected load determines the corresponding RMS current.
The PWM function of the ecomatmobile controller is a hardware function provided by the processor.
To use the integrated PWM outputs of the controller, they must be initialised in the application program
and parameterised corresponding to the requested output signal.
PWM / PWM1000
Depending on the application and the requested resolution, the function PWM or PWM1000 can be
selected for the application programming. High accuracy and thus resolution is required when using
the control functions. This is why the more technical PWM function is used in this case.
If the implementation is to be kept simple and if there are no high requirements on the accuracy, the
function PWM1000 (→ page 169) can be used. For this function the PWM frequency can be directly
entered in [Hz] and the mark-to-space ratio in steps of 1 ‰.
PWM frequency
Depending on the valve type, a corresponding PWM frequency is required. For the PWM function the
PWM frequency is transmitted via the reload value (function PWM, → page 165) or directly as a
numerical value in [Hz] (function PWM1000, → page 169). Depending on the controller, the PWM
outputs differ in their operating principle but the effect is the same.
161
ifm System Manual ecomatmobile SmartController (CR2500) V05
The PWM frequency is implemented by means of an internally running counter, derived from the CPU
pulse. This counter is started with the initialisation of the function PWM. Depending on the PWM
output group (0...3 and / or 4...7 or 4...11), it counts from FFFF16 backwards or from 000016 forwards. If
a transmitted comparison value (VALUE) is reached, the output is set. In case of an overflow of the
counter (change of the counter reading from 000016 to FFFF16 or from FFFF16 to 000016), the output is
reset and the operation restarts.
If this internal counter shall not operate between 000016 and FFFF16, another preset value (RELOAD)
can be transmitted for the internal counter. In doing so, the PWM frequency increases. The
comparison value must be within the now specified range.
0000 FFFF
100% 0%
Reload
The RELOAD value of the internal PWM counter is calculated on the basis of the parameter DIV64
and the CPU frequency as follows:
ClassicController SmartController
ExtendedController CabinetController (CR0301/CR0302)
SafetyController PCB controller
CabinetController (CR0303)
DIV64 = 0 RELOAD = 20 MHz / fPWM RELOAD = 10 MHz / fPWM
DIV64 = 1 RELOAD = 312.5 kHz / fPWM RELOAD = 156.25 kHz / fPWM
Depending on whether a high or a low PWM frequency is required, the input DIV64 must be set to
FALSE (0) or TRUE (1). In case of frequencies below 305 Hz respectively 152 Hz (according to the
controller), DIV64 must be set to "1" to ensure that the RELOAD value is not greater than FFFF16.
162
ifm System Manual ecomatmobile SmartController (CR2500) V05
20 MHz 10 MHz
_________ = 50 00010 = C35016 = RELOAD _________ = 50 00010 = C35016 = RELOAD
400 Hz 200 Hz
Thus the permissible range of the PWM value Thus the permissible range of the PWM value
is the range from 000016 to C35016. is the range from 000016 to C35016.
The comparison value at which the output The comparison value at which the output
switches must then be between 000016 and switches must then be between 000016 und
C35016. C35016.
0000 FFFF
100% 0%
Reload
The RELOAD value of the internal PWM counter is calculated (for all ecomatmobile controllers) on
the basis of the parameters DIV64 and the CPU frequency as follows:
DIV64 = 0 RELOAD = 10 00016 – ( 2.5 MHz / fPWM )
DIV64 = 1 RELOAD = 10 00016 – ( 312.5 kHz / fPWM )
Depending on whether a high or a low PWM frequency is required, the input DIV64 must be set to
FALSE (0) or TRUE (1). In case of PWM frequencies below 39 Hz, DIV64 must be set to "1" to ensure
that the RELOAD value is not smaller than 000016.
163
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example:
The PWM frequency shall be 200 Hz.
2.5 MHz
_________ = 12 50010 = 30D416
200 Hz
RELOAD value = 10 00016 – 30D416 = CF2C16
Thus the permissible range of the PWM value is the range from CF2C16 to FFFF16
The comparison value at which the output switches must then be between CF2C16 and FFFF16.
NOTE
The PWM frequency is the same for all PWM outputs (4...7 or 4...11).
The functions PWM and PWM1000 must not be mixed.
NOTE
for ClassicController and ExtendedController applies:
If the PWM outputs 4... 7 are used (regardless of whether current-controlled or via one of the PWM
functions) the same frequency and the corresponding reload value have to be set for the outputs 8...11.
This means that the same functions have to be used for these outputs.
PWM dither
For certain hydraulic valve types a so-called dither frequency must additionally be superimposed on
the PWM frequency. If valves were triggered over a longer period by a constant PWM value, they
could block due to the high system temperatures.
To prevent this, the PWM value is increased or reduced on the basis of the dither frequency by a
defined value (DITHER_VALUE). As a consequence a vibration with the dither frequency and the
amplitude DITHER_VALUE is superimposed on the constant PWM value. The dither frequency is
indicated as the ratio (divider, DITHER_DIVIDER * 2) of the PWM frequency.
164
ifm System Manual ecomatmobile SmartController (CR2500) V05
Ramp function
In order to prevent abrupt changes from one PWM value to the next, e.g. from 15 % ON to 70 % ON
(→ figure in PWM signal processing, → page 161), it is possible to delay the increase by using the
function PT1. The ramp function used for PWM is based on the CoDeSys library UTIL.LIB. This
allows a smooth start e.g. for hydraulic systems.
NOTE
When installing the ecomatmobile CD "Software, Tools and Documentation", projects with examples
have been stored in the program directory of your PC:
…\ifm electronic\CoDeSys V…\Projects\DEMO_PLC_CDV… (for controllers) or
…\ifm electronic\CoDeSys V…\Projects\DEMO_PDM_CDV… (for PDMs).
There you also find projects with examples regarding this subject. It is strongly recommended to follow
the shown procedure.
→ chapter ifm demo programs (→ page 25)
NOTE
The PWM function of the controller is a hardware function provided by the processor. The PWM
function remains set until a hardware reset (switching on and off the supply voltage) has been carried
out at the controller.
165
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
PWM
INIT
RELOAD
DIV64
CHANNEL
VALUE
CHANGE
DITHER_VALUE
DITHER_DIVIDER
Description
PWM is used for initialisation and parameter setting of the PWM outputs.
The function PWM has a more technical background. Due to their structure, PWM values can be very
finely graded. So, this function is suitable for use in controllers.
The function PWM is called once for each channel during initialisation of the application program.
When doing so, input INIT must be set to TRUE. During initialisation, the parameter RELOAD is also
assigned.
NOTE
The value RELOAD must be identical for the channels 4...7 (for the ClassicController or
ExtendedController: 4...11).
For these channels, the function PWM and function PWM1000 (→ page 169) must not be mixed.
The PWM frequency (and so the RELOAD value) is internally limited to 5 kHz.
Depending on whether a high or a low PWM frequency is required, the input DIV64 must be set to
FALSE (0) or TRUE (1).
During cyclical processing of the program INIT is set to FALSE. The function is called and the new
PWM value is assigned. The value is adopted if the input CHANGE = TRUE.
166
ifm System Manual ecomatmobile SmartController (CR2500) V05
Using the function OUTPUT_CURRENT (→ page 176) a current measurement for the initialised PWM
channel can be implemented.
PWM_Dither is called once for each channel during initialisation of the application program. When
doing so, input INIT must be set to TRUE. During initialisation, the DIVIDER for the determination of
the dither frequency and the VALUE are assigned.
Info
The parameters DITHER_FREQUENCY and DITHER_VALUE can be individually set for each channel.
167
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
PWM100
INIT
FREQUENCY
CHANNEL
VALUE
CHANGE
DITHER_VALUE
DITHER_FREQUENCY
Description
PWM100 handles the initialisation and parameter setting of the PWM outputs.
The function enables a simple application of the PWM function in the ecomatmobile controller. The
PWM frequency can be directly indicated in [Hz] and the mark-to-space ratio in steps of 1 %. This
function is not suited for use in controllers, due to the relatively coarse grading.
The function is called once for each channel in the initialisation of the application program. For this, the
input INIT must be set to TRUE. During initialisation, the parameter FREQUENCY is also assigned.
NOTE
The value FREQUENCY must be identical for the channels 4...7 (for the ClassicController or
ExtendedController: 4...11).
For these channels, the function PWM (→ page 165) and function PWM100 must not be mixed.
The PWM frequency is limited to 5 kHz internally.
During cyclical processing of the program INIT is set to FALSE. The function is called and the new
PWM value is assigned. The value is adopted if the input CHANGE = TRUE.
168
ifm System Manual ecomatmobile SmartController (CR2500) V05
Info
The parameters DITHER_FREQUENCY and DITHER_VALUE can be individually set for each channel.
169
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
PWM1000
INIT
FREQUENCY
CHANNEL
VALUE
CHANGE
DITHER_VALUE
DITHER_FREQUENCY
Description
PWM1000 handles the initialisation and parameter setting of the PWM outputs.
The function enables a simple use of the PWM function in the ecomatmobile controller. The PWM
frequency can be directly indicated in [Hz] and the mark-to-space ratio in steps of 1 ‰.
The function is called once for each channel during initialisation of the application program. When
doing so, input INIT must be set to TRUE. During initialisation, the parameter FREQUENCY is also
assigned.
NOTE
The value FREQUENCY must be identical for the channels 4...7 (for the ClassicController or
ExtendedController: 4...11).
For these channels, the function PWM (→ page 165) and function PWM1000 must not be mixed.
The PWM frequency is limited to 5 kHz internally.
During cyclical processing of the program INIT is set to FALSE. The function is called and the new
PWM value is assigned. The value is adopted if the input CHANGE = TRUE.
170
ifm System Manual ecomatmobile SmartController (CR2500) V05
Info
The parameters DITHER_FREQUENCY and DITHER_VALUE can be individually set for each channel.
171
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTICE
Overload protection with ClassicConroller and ExtendedController:
In principle, the current-controlled outputs are protected against short circuit. In the event of overload, in
which the currents are limited by cable lengths and cross sections to for example between 8 A and
20 A, the measuring resistors (shunts) are thermally overloaded.
► Since the maximum permissible current cannot always be preset, the operating mode
OUT_OVERLOAD_PROTECTION should always be selected for the outputs in the application
program. With currents > 4.1 A the respective output is switched off automatically.
> If the output is no longer overloaded, the output is automatically switched on again.
The function OUT_OVERLOAD_PROTECTION is not active in the PWM mode (without current
control)!
NOTE
The following applies to ClassicController and ExtendedController:
The current-control function OCC_TASK (→ page 174) and function OUTPUT_CURRENT_CONTROL
(→ page 172) are based on the function PWM (→ page 165). If the current control functions are used,
only the PWM function may be used for channels 8...11. The RELOAD value corresponding to the
frequency must be calculated.
172
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
OUTPUT_CURRENT_CONTROL
ENABLE PWM_RATIO
INIT
OUTPUT_CHANNEL
ACTUAL_CURRENT
DESIRED_CURRENT
PWM_FREQUENCY
DITHER_FREQUENCY
DITHER_VALUE
MODE
MANUAL
Description
OUTPUT_CURRENT_CONTROL operates as current controller for the PWM outputs.
The controller is designed as an adaptive controller so that it is self-optimising. If this self-optimising
performance is not desired, a value > 0 can be transmitted via the input MANUAL; the self-optimising
performance is then deactivated. The numerical value represents a compensation value, which has an
influence on the integral and differential components of the controller. To determine the best settings
of the controller in the MANUAL mode, the value 50 is suitable. Depending on the requested controller
characteristics the value can then be incremented step-by-step (controller becomes more sensitive /
faster) or decremented (controller becomes less sensitive / slower).
If the function input MANUAL is set to 0, the controller is always self-optimising. The performance of
the controlled system is permanently monitored and the updated compensation values are
automatically and permanently stored in each cycle. Changes in the controlled system are immediately
recognised and corrected.
NOTE
To obtain a stable output value the function OUTPUT_CURRENT_CONTROL should be called
cyclically at regular intervals.
If a precise cycle time (5 ms) is required: use function OCC_TASK (→ page 174).
OUTPUT_CURRENT_CONTROL is based on the function PWM (→ page 165).
If OUTPUT_CURRENT_CONTROL is used for the outputs 4...7, only the PWM function may be used
there if the PWM outputs 8...11 are used simultaneously.
173
ifm System Manual ecomatmobile SmartController (CR2500) V05
174
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
OCC_TASK
ENABLE PWM_RATIO
INIT
OUTPUT_CHANNEL
DESIRED_CURRENT
PWM_FREQUENCY
DITHER_FREQUENCY
DITHER_VALUE
MODE
MANUAL
Description
OCC_TASK operates as current controller for the PWM outputs.
The controller is designed as an adaptive controller so that it is self-optimising. If the self-optimising
performance is not desired, a value > 0 can be transmitted via the input MANUAL (the self-optimising
performance is deactivated). The numerical value represents a compensation value, which has an
influence on the integral and differential components of the controller. To determine the best settings
of the controller in the MANUAL mode, the value 50 is suitable. Depending on the requested controller
characteristics the value can then be incremented step-by-step (controller becomes more sensitive /
faster) or decremented (controller becomes less sensitive / slower).
If the function input MANUAL is set to 0, the controller is always self-optimising. The performance of
the controlled system is permanently monitored and the updated compensation values are
automatically and permanently stored in each cycle. Changes in the controlled system are immediately
recognised and corrected.
NOTE
OCC_TASK operates with a fixed cycle time of 5 ms. No actual values need to be entered because
these are detected internally by the function.
OCC_TASK is based on the function PWM (→ page 165).
If function OUTPUT_CURRENT_CONTROL (→ page 172) is used for the outputs 4...7, only the PWM
function may be used there if the PWM outputs 8...11 are used simultaneously.
175
ifm System Manual ecomatmobile SmartController (CR2500) V05
176
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
OUTPUT_CURRENT
ENABLE ACTUAL_CURRENT
OUTPUT_CHANNEL
DITHER_RELATED
Description
OUTPUT_CURRENT handles the current measurement in conjunction with an active PWM channel.
The function provides the current output current if the outputs are used as PWM outputs. The current
measurement is carried out in the device, i.e. no external measuring resistors are required.
177
ifm System Manual ecomatmobile SmartController (CR2500) V05
178
ifm System Manual ecomatmobile SmartController (CR2500) V05
Info
In the following sketches the current profiles are shown as a stylised straight line. In reality the current
flows to an e-function.
Figure: The profile of the PWM voltage U and the coil current I at 10 % switch-on time:
The effective coil current Ieff is also 10 %
Figure: The profile of the PWM voltage U and the coil current I at 50 % switch-on time:
The effective coil current Ieff is also 50 %
179
ifm System Manual ecomatmobile SmartController (CR2500) V05
Figure: The profile of the PWM voltage U and the coil current I at 100 % switch-on time:
The effective coil current Ieff is also 100 %
180
ifm System Manual ecomatmobile SmartController (CR2500) V05
At a higher PWM frequency (standard value 250 Hz up to 1 kHz) the remaining movement of the valve
piston is so short or so slow that this effectively results in a standstill so that the valve piston can again
get stuck in its current position (and will do so!) (→ next figures):
Figure: A high frequency of the PWM signal results in an almost direct current in the coil. The valve piston does not move
enough any longer. With each signal change the valve piston has to overcome the break-away torque again.
Figure: Too low frequencies of the PWM signal only allow rare, jerking movements of the valve piston. Each pulse moves the
valve piston again from its off position; every time the valve piston has to overcome the break-away torque again.
NOTE
With a switch-on time below 10 % and above 90 % the dither does not have any measurable effect any
longer. In such cases it makes sense and it is necessary to superimpose the PWM signal with a dither
signal.
NOTE
The dither frequency must be an integer part of the PWM frequency. Otherwise the hydraulic system
would not work evenly but it would oscillate.
181
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example Dither
The dither frequency is 1/8 of the PWM frequency.
The dither amplitude is 10 %.
With the switch-on time of 50 % in the figure, the actual switch-on time for 4 pulses is 60 % and for the
next 4 pulses it is 40 % which means an average of 50 % switch-on time. The resulting effective coil
current will be 50 % of the maximum coil current.
The result is that the valve piston always oscillates around its off position to be ready to take a new
position with the next signal change without having to overcome the break-away torque before.
The following functions are needed from the library UTIL.Lib (in the CoDeSys®package):
• Function RAMP_INT
• Function CHARCURVE
These functions are automatically activated by the functions of
ifm_HYDRAULIC_16bitOS05_Vxxyyzz.Lib and configured.
182
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
CONTROL_OCC
ENABLE DESIRED_CURRENT
INIT ACTUAL_CURRENT
R_RAMP BREAK
F_RAMP SHORT
TIMEBASE
X
XH
XL
MAX_CURRENT
MIN_CURRENT
TOLERANCE
CHANNEL
PWM_FREQUENCY
DITHER_FREQUENCY
DITHER_VALUE
MODE
MANUAL
Description
CONTROL_OCC scales the input value X to a specified current range.
Each instance of the function is called once in each PLC cycle. The function uses the function
OUTPUT_CURRENT_CONTROL (→ page 172) and function OUTPUT_CURRENT (→ page 176)
from the library ifm_CRnnnn_Vxxyyzz.Lib. The controller is designed as an adaptive controller so
that it is self-optimising.
If this self-optimising performance is not desired, a value > 0 can be transferred via the input
MANUAL: → the self-optimising performance is deactivated.
The numerical value in MANUAL represents a compensation value, which has an influence on the
integral and differential components of the controller. To determine the best settings of the controller in
the MANUAL mode, the value 50 is suitable.
Increase the value MANUAL: → controller becomes more sensitive / faster
Decrease the value MANUAL: → controller becomes less sensitive / slower
183
ifm System Manual ecomatmobile SmartController (CR2500) V05
If the function input MANUAL is set to "0", the controller is always self-optimising. The performance of
the controlled system is permanently monitored and the updated compensation values are
automatically and permanently stored in each cycle. Changes in the controlled system are immediately
recognised and corrected.
Info
Input X of the function CONTROL_OCC should be supplied by the output of the JOYSTICK functions.
184
ifm System Manual ecomatmobile SmartController (CR2500) V05
185
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
JOYSTICK_0
X OUT1
XH_POS OUT2
XL_POS OUT3
XH_NEG WRONG_MODE
XL_NEG ERR1
MODE ERR2
Description
JOYSTICK_0 scales signals from a joystick to clearly defined characteristic curves, standardised
to 0...1000.
For this function the characteristic curve values are specified (→ figures):
• Rising edge of the ramp = 5 increments/PLC cycle
• Falling edge of the ramp = no edge
186
ifm System Manual ecomatmobile SmartController (CR2500) V05
Mode 0:
characteristic curve linear for the
range XL to XH
Mode 1:
Characteristic curve linear with dead
band
Values fixed to:
Dead band:
0…10% of 1000 increments
Mode 2:
2-step linear characteristic curve with
dead band
Values fixed to:
Dead band:
0…10% of 1000 increments
Step:
X = 50 % of 1000 increments
Y = 20 % of 1000 increments
187
ifm System Manual ecomatmobile SmartController (CR2500) V05
188
ifm System Manual ecomatmobile SmartController (CR2500) V05
189
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
JOYSTICK_1
X OUT1
XH_POS OUT2
XL_POS OUT3
XH_NEG WRONG_MODE
XL_NEG ERR1
R_RAMP ERR2
F_RAMP
TIMEBASE
MODE
DEAD_BAND
CHANGE_POINT_X
CHANGE_POINT_Y
Description
JOYSTICK_1 scales signals from a joystick to configurable characteristic curves, standardised to
0...1000.
For this function the characteristic curve values can be configured (→ figures):
Mode 0:
Linear characteristic curve
100 % = 1000 increments
190
ifm System Manual ecomatmobile SmartController (CR2500) V05
Mode 1:
Characteristic curve linear with dead
band
Value for the dead band (DB) can be
set in % of 1000 increments
100 % = 1000 increments
DB = Dead_Band
Mode 2:
2-step linear characteristic curve with
dead band
Values can be configured to:
Dead band:
0…DB in % of 1000 increments
Step:
X = CPX in % of 1000 increments
Y= CPY in % of 1000 increments
100 % = 1000 increments
DB = Dead_Band
CPX = Change_Point_X
CPY = Change_Point_Y
Characteristic curve mode 3:
Curve rising (line is fixed)
191
ifm System Manual ecomatmobile SmartController (CR2500) V05
192
ifm System Manual ecomatmobile SmartController (CR2500) V05
193
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
JOYSTICK_2
X OUT1
XH_POS OUT2
XL_POS OUT3
XH_NEG ERR1
XL_NEG ERR1
R_RAMP
F_RAMP
TIMEBASE
VARIABLE_GAIN
N_POINT
Description
JOYSTICK_2 scales the signals from a joystick to a configurable characteristic curve. Free selection of
the standardisation.
For this function, the characteristic curve is freely configurable (→ figure):
Characteristic curve freely
configurable
194
ifm System Manual ecomatmobile SmartController (CR2500) V05
195
ifm System Manual ecomatmobile SmartController (CR2500) V05
196
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
NORM_HYDRAULIC
X Y
XH X_OUT_OF_RANGE
XL
YH
YL
Description
NORM_HYDRAULIC standardises input values with fixed limits to values with new limits.
Please note: This function corresponds to the 3S function NORM_DINT from the CoDeSys library
UTIL.Lib.
The function standardises a value of type DINT within the limits of XH and XL to an output value within
the limits of YH and YL.
Due to rounding errors deviations from the standardised value of 1 may occur. If the limits (XH/XL or
YH/YL) are indicated in inversed form, standardisation is also inverted.
If X outside the limits XL…XH, the error message X_OUT_OF_RANGE = TRUE.
197
ifm System Manual ecomatmobile SmartController (CR2500) V05
198
ifm System Manual ecomatmobile SmartController (CR2500) V05
Examples NORM_HYDRAULIC
Parameter Case 1 Case 2 Case 3
Upper limit value input XH 100 100 2000
Lower limit value input XL 0 0 0
Upper limit value output YH 2000 0 100
Lower limit value output YL 0 2000 0
Non standardised value X 20 20 20
Standardised value Y 400 1600 1
Case 1:
Input with relatively coarse resolution.
Output with high resolution.
1 X increment results in 20 Y increments.
Case 2:
Input with relatively coarse resolution.
Output with high resolution.
1 X increment results in 20 Y increments.
Output signal is inverted as compared to the input signal.
Case 3:
Input with high resolution.
Output with relatively coarse resolution.
20 X increments result in 1 Y increment.
199
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
In this chapter you will find more functions that you can use in the ecomatmobile controller.
200
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
10.1.1 Applications
It must be taken into account that the different measuring methods can cause errors in the frequency
detection.
The function FREQUENCY (→ page 201) is suitable for frequencies between 100 Hz and 30 kHz; the
error decreases at high frequencies.
The function PERIOD (→ page 203) carries out a period measurement. It is thus suitable for
frequencies lower than 1000 Hz. In principle it can also measure higher frequencies, but this has a
significant impact on the cycle time. This must be taken into account when setting up the application
software.
201
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
Function symbol:
FREQUENCY
INIT F
CHANNEL
TIMEBASE
Description
FREQUENCY measures the signal frequency at the indicated channel. Maximum input frequency
→ data sheet.
This function measures the frequency of the signal at the selected CHANNEL. To do so, the positive
edge is evaluated. Depending on the TIMEBASE, frequency measurements can be carried out in a
wide value range. High frequencies require a short time base, low frequencies a correspondingly
longer time base. The frequency is provided directly in [Hz].
NOTE
For the function FREQUENCY only the inputs FRQ0...FRQ3 can be used.
202
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
NOTE
The function may provide wrong values before initialisation. Do not evaluate the output before the
function has been initialised.
203
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
Function symbol:
PERIOD
INIT C
CHANNEL F
PERIODS ET
Description
PERIOD measures the frequency and the cycle period (cycle time) in [µs] at the indicated channel.
Maximum input frequency → data sheet.
This function measures the frequency and the cycle time of the signal at the selected CHANNEL. To
calculate, all positive edges are evaluated and the average value is determined by means of the
number of indicated PERIODS.
In case of low frequencies there will be inaccuracies when using the function FREQUENCY. To avoid
this, the function PERIOD can be used. The cycle time is directly indicated in [µs].
The maximum measuring range is approx. 71 min.
NOTE
For the function PERIOD only the inputs CYL0...CYL3 can be used.
Frequencies < 0.5 Hz are no longer clearly indicated!
204
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
NOTE
The function may provide wrong values before initialisation. Do not evaluate the output before the
function has been initialised.
We urgently recommend to initialise all required instances of this function at the same time. Otherwise,
wrong values may be provided.
205
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
Function symbol:
PERIOD_RATIO
INIT C
CHANNEL F
PERIODS ET
RATIO1000
Description
PERIOD_RATIO measures the frequency and the cycle period (cycle time) in [µs] during the indicated
periods at the indicated channel. In addition, the mark-to-space ratio is indicated in per mill. Maximum
input frequency → data sheet.
This function measures the frequency and the cycle time of the signal at the selected CHANNEL. To
calculate, all positive edges are evaluated and the average value is determined by means of the
number of indicated PERIODS. In addition, the mark-to-space ratio is indicated in [‰].
For example: In case of a signal ratio of 25 ms high level and 75 ms low level the value RATIO1000 is
provided as 250 ‰.
In case of low frequencies there will be inaccuracies when using the function FREQUENCY. To avoid
this, the function PERIOD_RATIO can be used. The cycle time is directly indicated in [µs].
The maximum measuring range is approx. 71 min.
NOTE
For the function PERIOD_RATIO only the inputs CYL0...CYL3 can be used.
The output RATIO1000 provides the value 0 for a mark-to-space ratio of 100 % (input signal
permanently at supply voltage).
Frequencies < 0.05 Hz are no longer clearly indicated!
206
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
NOTE
The function may provide wrong values before initialisation. Do not evaluate the output before the
function has been initialised.
We urgently recommend to initialise all required instances of this function at the same time. Otherwise,
wrong values may be provided.
207
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
Function symbol:
PHASE
INIT C
CHANNEL P
ET
Description
PHASE reads a pair of channels with fast inputs and compares the phase position of the signals.
Maximum input frequency → data sheet.
This function compares a pair of channels with fast inputs so that the phase position of two signals
towards each other can be evaluated. An evaluation of the cycle period is possible even in the range
of seconds.
NOTE
For frequencies lower than 15 Hz a cycle period or phase shift of 0 is indicated.
208
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
NOTE
The function may provide wrong values before initialisation. Do not evaluate the output before the
function has been initialised.
We urgently recommend to program an own instance of this function for each channel to be evaluated.
Otherwise, wrong values may be provided.
209
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
Function symbol:
INC_ENCODER
INIT COUNTER
CHANNEL UP
PRESET_VALUE DOWN
PRESET
RESOLUTION
Description
INC_ENCODER handles up/down counter functions for the evaluation of encoders.
The function is designed as up/down counter. Two frequency inputs form the input pair which is
evaluated by means of the function. The following table shows the permissible limit frequencies and
the max. number of incremental encoders that can be connected:
Device Limit frequency max. number of encoders
ClassicController: CR0020, CR0505 10 kHz 4
ClassicController: CR0032 30 kHz 8
ExtendedController: CR0200 10 kHz 8
ExtendedController: CR0232 30 kHz 16
SmartController: CR2500 10 kHz 2
SafetyController: CR7020, CR7505 10 kHz 4
ExtendedSafetyController: CR7200 10 kHz 8
SafetyController: CR7021, CR7506 10 kHz 4
ExtendedSafetyController: CR7201 10 kHz 8
CabinetController: CR0301, CR0302, CR0303 10 kHz 2
PCB controller: CS0015 0.5 kHz 2
PDM360 smart: CR1071 1 kHz 2
210
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
NOTE
Depending on the further load on the unit the limit frequency might fall when "many" encoders are
evaluated.
If the load is too high the cycle time can get unacceptably long (→ system resources, → page 42).
Via PRESET_VALUE the counter can be set to a preset value. The value is adopted if PRESET is set
to TRUE. Afterwards, PRESET must be set to FALSE again for the counter to become active again.
The current counter value is available at the output COUNTER. The outputs UP and DOWN indicate
the current counting direction of the counter. The outputs are TRUE if the counter has counted in the
corresponding direction in the preceding program cycle. If the counter stops, the direction output in the
following program cycle is also reset.
On input RESOLUTION the resolution of the encoder can be evaluated in multiples:
1 = normal resolution (identical with the resolution of the encoder),
2 = double evaluation of the resolution,
4 = 4-fold evaluation of the resolution.
All other values on this input mean normal resolution.
1 3 1 3 1 3 1 RESOLUTION = 1
A In the case of normal resolution only the falling
2 4 2 4 2 4 2
edge of the B-signal is evaluated.
B
v v v
+1 +1 +1
1 1 1 1 1 1 1
RESOLUTION = 2
A
2 2 2 2 2 2 2 In the case of double resolution the falling and the
B rising edges of the B-signal are evaluated.
v v v v v v v
+1 +1 +1 +1 +1 +1 +1
1 1 1 1 1 1 1
A RESOLUTION = 4
1 1 1 1 1 1 1 In the case of 4-fold resolution the falling and the
B rising edges of the A-signal and the B-signal are
evaluated.
v v v v v v v
+1 +1 +1 +1 +1 +1 +1
v v v v v v v
+1 +1 +1 +1 +1 +1 +1
211
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
212
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
Function symbol:
FAST_COUNT
ENABLE CV
INIT
CHANNEL
MODE_UP_DOWN
LOAD
PV
Description
FAST_COUNT operates as counter block for fast input pulses.
This function detects fast pulses at the FRQ input channels 0...3. With the FRQ input channel 0
FAST_COUNT operates like the block CTU. Maximum input frequency → data sheet.
NOTE
For the ecomatmobile controllers channel 0 can only be used as up counter. The channels 1...3 can
be used as up and down counters.
213
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Counter functions for frequency and period measurement
NOTE
After setting the parameter ENABLE the counter counts as from the indicated start value.
The counter does NOT continue from the value which was valid at the last deactivation of ENABLE.
214
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SOFTRESET
ENABLE
Description
SOFTRESET leads to a complete reboot of the controller.
The function can for example be used in conjunction with CANopen if a node reset is to be carried out.
The behaviour of the controller after a SOFTRESET corresponds to that after switching the supply
voltage off and on.
NOTE
In case of active communication, the long reset period must be taken into account because otherwise
guarding errors will be signalled.
215
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
Info
By means of the storage partitioning (→ data sheet or operating instructions) the programmer can find
out which memory area is available.
216
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
Function symbol:
MEMCPY
DST
SRC
LEN
Description
MEMCPY enables writing and reading different types of data directly in the memory.
The function writes the contents of the address of SRC to the address DST. In doing so, as many
bytes as indicated under LEN are transmitted. So it is also possible to transmit exactly one byte of a
word file.
NOTE
The address must be determined by means of the function ADR and assigned to MEMCPY.
217
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
Function symbol:
FLASHWRITE
ENABLE
DST
LEN
SRC
Description
WARNING
Danger due to uncontrollable process operations!
The status of the inputs/outputs is "frozen" during execution of FLASHWRITE.
► Do not execute this function when the machine is running!
FLASHWRITE enables writing of different data types directly into the flash memory.
The function writes the contents of the address SRC (must be determined by means of the function
ADR) into the flash memory. In doing so, as many bytes as indicated under LEN are transmitted.
An erasing operation must be carried out before the memory is written again. This is done by writing
any content to the address "0".
Info
Using this function, large data volumes are to be stored during set-up, to which there is only read
access in the process.
218
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
219
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
Function symbol:
FLASHREAD
ENABLE
SRC
LEN
DST
Description
FLASHREAD enables reading of different types of data directly from the flash memory.
The function reads the contents as from the address of SRC from the flash memory. In doing so, as
many bytes as indicated under LEN are transmitted.
NOTE
The address for DST must be determined using the function ADR and assigned to FLASHREAD.
220
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
Function symbol:
E2WRITE
ENABLE RESULT
DST
LEN
SRC
Description
E2WRITE enables writing of different data types directly to the serial EEPROM.
The function writes the contents as from the address of SRC to the serial EEPROM. The execution of
the function takes some time, therefore it must be monitored via the function output RESULT. If
RESULT =1 , the input ENABLE must be set to FALSE again.
NOTE
The address for SRC must be determined using the function ADR and assigned to E2WRITE.
221
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Saving, reading and converting data in the memory
Function symbol:
E2READ
ENABLE RESULT
SRC
LEN
DST
Description
E2READ enables reading of different data from the serial EEPROM.
The function reads the contents as from the address of SRC from the serial EEPROM. Given that the
processing of the function takes some time it must be monitored via the function output RESULT. If
RESULT =1 , the input ENABLE must be set to FALSE again.
NOTE
The address for DST must be determined using the function ADR and assigned to E2READ.
222
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
Function symbol:
SET_DEBUG
ENABLE
DEBUG
Description
SET_DEBUG handles the DEBUG mode without active test input (→ chapter TEST mode,
→ page 38).
If the input DEBUG of the function is set to TRUE, the programming system or the downloader, for
example, can communicate with the controller and execute system commands (e.g. for service
functions via the GSM modem CANremote).
NOTE
In this operating mode a software download is not possible because the test input is not connected to
supply voltage.
223
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
Function symbol:
SET_IDENTITY
ID
Description
SET_IDENTITY sets an application-specific program identification.
Using this function, a program identification can be created by the application program. This
identification (i.e. the software version) can be read via the software tool DOWNLOADER.EXE in order
to identify the loaded program.
224
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
The following figure shows the correlations of the different identifications as indicated by the different
software tools. (Example: ClassicController CR0020):
Identity Identity
BOOTLD_H 020923 CR0020
V2.0.0 041004
Extended identity
CR0020 00.00.01 Hardware version
CR0020 00.00.01
SET_IDENTITY
Software version Nozzle in front
Nozzle in front
Hardware version
OBV 1009
CR0020 00.00.01
225
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
Function symbol:
GET_IDENTITY
ENABLE DEVICENAME
FIRMWARE
RELEASE
APPLICATION
Description
GET_IDENTITY reads the application-specific program identification stored in the controller.
With this function the stored program identification can be read by the application program. The
following information is available:
• Hardware name and version
e.g.: "CR0032 00.00.01"
• Name of the runtime system
e.g.: "CR0032"
• Version and build of the runtime system
e.g.: "V00.00.01 071128"
• Name of the application
e.g.: "Crane1704"
The name of the application can be changed with the function SET_IDENTITY (→ page 223).
226
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
227
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
Function symbol:
SET_PASSWORD
ENABLE
PASSWORD
Description
SET_PASSWORD sets a user password for the program and memory upload with the
DOWNLOADER.
If the password is activated, reading of the application program or the data memory with the software
tool DOWNLOADER is only possible if the correct password has been entered.
If an empty string (default condition) is assigned to the input PASSWORD, an upload of the application
software or of the data memory is possible at any time.
ATTENTION
Please note for CR2500, CR0301, CR0302 and CS0015:
The EEPROM memory module may be destroyed by the permanent use of this function!
► Only carry out the function once during initialisation in the first program cycle!
Afterwards block the function again (ENABLE = "FALSE")!
NOTE
The password is reset when loading a new application program.
228
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
229
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
Function symbol:
CHECK_DATA
STARTADR RESULT
LENGTH CHECKSUM
UPDATE
Description
CHECK_DATA stores the data in the application data memory via a CRC code.
The function serves for monitoring a range of the data memory (possible WORD addresses as from
%MW0) for unintended changes to data in safety-critical applications. To do so, the function
determines a CRC checksum of the indicated data range.
If the input UPDATE = FALSE and data in the memory are changed inadvertently, RESULT = FALSE.
The result can then be used for further actions (e.g. deactivation of the outputs).
Data changes in the memory (e.g. by the application program or ecomatmobile device) are only
permitted if the output UPDATE is set to TRUE. The value of the checksum is then recalculated. The
output RESULT is permanently TRUE again.
The start address (type WORD e.g. %MW0) must be assigned to the function via the address operator
ADR. In addition, the number of data bytes LENGTH (length as from the STARTDR) must be
indicated.
NOTE
This function is a safety function. However, the controller does not automatically become a safety
controller by using this function. Only a tested and approved controller with a special operating system
can be used as safety controller.
230
ifm System Manual ecomatmobile SmartController (CR2500) V05
More functions in the ecomatmobile controller Data access and data check
NOTE: The method shown here is not suited for the flash memory.
231
ifm System Manual ecomatmobile SmartController (CR2500) V05
232
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SET_INTERRUPT_XMS
ENABLE
REPEATTIME
READ_INPUTS
WRITE_OUTPUTS
ANALOG_INPUTS
Description
SET_INTERRUPT_XMS handles the execution of a program part at an interval of x ms.
In the conventional PLC the cycle time is decisive for real-time monitoring. So, the PLC is at a
disadvantage as compared to customer-specific controllers. Even a "real-time operating system" does
not change this fact when the whole application program runs in one single block which cannot be
changed.
A possible solution would be to keep the cycle time as short as possible. This often leads to splitting
the application up to several control cycles. This, however, makes programming complex and difficult.
Another possibility is to call a certain program part at fixed intervals (every x ms) independently of the
control cycle.
The time-critical part of the application is integrated by the user in a block of the type PROGRAM
(PRG). This block is declared as the interrupt routine by calling the function SET_INTERRUPT_XMS
once (during initialisation). As a consequence, this program block is always processed after the
REPEATTIME has elapsed (every x ms). If inputs and outputs are used in this program part, they are
also read and written in the defined cycle. Reading and writing can be stopped via the function inputs
READ_INPUTS, WRITE_OUTPUTS and ANALOG_INPUTS.
So, in the program block all time-critical events can be processed by linking inputs or global variables
and writing outputs. So, timers can be monitored more precisely than in a "normal cycle".
233
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
To avoid that the program block called by interrupt is additionally called cyclically, it should be skipped
in the cycle (with the exception of the initialisation call).
Several timer interrupt blocks can be active. The time requirement of the interrupt functions must be
calculated so that all called functions can be executed. This in particular applies to calculations, floating
point arithmetic or controller functions.
Please note: In case of a high CAN bus activity the set REPEATTIME may fluctuate.
NOTE
The uniqueness of the inputs and outputs in the cycle is affected by the interrupt routine. Therefore only
part of the inputs and outputs is serviced. If initialised in the interrupt program, the following inputs and
outputs will be read or written.
Inputs, digital:
%IX0.0...%IX0.7 (CRnn32)
%IX0.12...%IX0.15, %IX1.4...%IX1.8 (all other ClassicController, ExtendedController, SafetyController)
%IX0.0, %IX0.8 (SmartController)
IN08...IN11 (CabinetController)
IN0...IN3 (PCB controller)
Inputs, analogue:
%IX0.0...%IX0.7 (CRnn32)
All channels (selection bit-coded) (all other controller)
Outputs, digital:
%QX0.0...%QX0.7 (ClassicController, ExtendedController, SafetyController)
%QX0.0, %QX0.8 (SmartController)
OUT00...OUT03 (CabinetController)
OUT0...OUT7 (PCB controller)
Global variants, too, are no longer unique if they are accessed simultaneously in the cycle and by the
interrupt routine. This problem applies in particular to larger data types (e.g. DINT).
All other inputs and outputs are processed once in the cycle, as usual.
234
ifm System Manual ecomatmobile SmartController (CR2500) V05
WRITE_OUTPUTS BOOL TRUE: outputs integrated into the routine are written to.
FALSE: outputs integrated into the routine are not written to.
ANALOG_INPUTS BOOL TRUE: Analogue inputs integrated into the routine are read
and the raw value of the voltage is transferred to the system
flags ANALOG_IRQxx.
FALSE: Analogue inputs integrated into the routine are not
read.
235
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SET_INTERRUPT_I
ENABLE
CHANNEL
MODE
READ_INPUTS
WRITE_OUTPUTS
ANALOG_INPUTS
(only for devices with analogue channels)
SET_INTERRUPT_I
ENABLE
CHANNEL
MODE
READ_INPUTS
WRITE_OUTPUTS
(for devices without analogue channels)
Description
SET_INTERRUPT_I handles the execution of a program part by an interrupt request via an input
channel.
In the conventional PLC the cycle time is decisive for real-time monitoring. So the PLC is at a
disadvantage as compared to customer-specific controllers. Even a "real-time operating system" does
not change this fact when the whole application program runs in one single block which cannot be
changed.
A possible solution would be to keep the cycle time as short as possible. This often leads to splitting
the application up to several control cycles. This, however, makes programming complex and difficult.
Another possibility is to call a certain program part only upon request by an input pulse independently
of the control cycle.
The time-critical part of the application is integrated by the user in a block of the type PROGRAM
(PRG). This block is declared as the interrupt routine by calling the function SET_INTERRUPT_I once
(during initialisation). As a consequence, this program block will always be executed if an edge is
detected on the input CHANNEL. If inputs and outputs are used in this program part, these are also
236
ifm System Manual ecomatmobile SmartController (CR2500) V05
read and written in the interrupt routine, triggered by the input edge. Reading and writing can be
stopped via the function inputs READ_INPUTS, WRITE_OUTPUTS and ANALOG_INPUTS.
So in the program block all time-critical events can be processed by linking inputs or global variables
and writing outputs. So functions can only be executed if actually called by an input signal.
NOTE
The program block should be skipped in the cycle (except for the initialisation call) so that it is not
cyclically called, too.
The input (CHANNEL) monitored for triggering the interrupt cannot be initialised and further processed
in the interrupt routine.
The inputs must be in the operating mode IN_FAST, otherwise the interrupts cannot be read.
NOTE
The uniqueness of the inputs and outputs in the cycle is affected by the interrupt routine. Therefore only
part of the inputs and outputs is serviced. If initialised in the interrupt program, the following inputs and
outputs will be read or written.
Inputs, digital:
%IX0.0...%IX0.7 (CRnn32)
%IX0.12...%IX0.15, %IX1.4...%IX1.8 (all other ClassicController, ExtendedController, SafetyController)
%IX0.0, %IX0.8 (SmartController)
IN08...IN11 (CabinetController)
IN0...IN3 (PCB controller)
Inputs, analogue:
%IX0.0...%IX0.7 (CRnn32)
All channels (selection bit-coded) (all other controller)
Outputs, digital:
%QX0.0...%QX0.7 (ClassicController, ExtendedController, SafetyController)
%QX0.0, %QX0.8 (SmartController)
OUT00...OUT03 (CabinetController)
OUT0...OUT7 (PCB controller)
Global variants, too, are no longer unique if they are accessed simultaneously in the cycle and by the
interrupt routine. This problem applies in particular to larger data types (e.g. DINT).
All other inputs and outputs are processed once in the cycle, as usual.
237
ifm System Manual ecomatmobile SmartController (CR2500) V05
238
ifm System Manual ecomatmobile SmartController (CR2500) V05
The serial interface can be used in the application program by means of the following functions.
239
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SERIAL_SETUP
ENABLE
BAUDRATE
DATABITS
PARITY
STOPBITS
Description
SERIAL_SETUP initialises the serial RS232 interface.
SERIAL_SETUP sets the serial interface to the indicated parameters. Using the function input
ENABLE, the function is activated for one cycle.
The SERIAL functions form the basis for the creation of an application-specific protocol for the serial
interface.
NOTE
In principle, the serial interface is not available for the user, because it is used for program download
and debugging.
The interface can be freely used if the user sets the system flag bit SERIAL_MODE to TRUE. Then
however, program download and debugging are only possible via the CAN interface.
For CRnn32: Debugging of the application software is then only possible via all 4 CAN interfaces or via
USB.
ATTENTION
The driver module of the serial interface can be damaged!
Disconnecting the serial interface while live can cause undefined states which damage the driver
module.
► Do not disconnect the serial interface while live.
240
ifm System Manual ecomatmobile SmartController (CR2500) V05
241
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SERIAL_TX
ENABLE
DATA
Description
SERIAL_TX transmits one data byte via the serial RS232 interface.
Using the function input ENABLE the transmission can be enabled or blocked.
The SERIAL functions form the basis for the creation of an application-specific protocol for the serial
interface.
NOTE
In principle, the serial interface is not available for the user, because it is used for program download
and debugging.
The interface can be freely used if the user sets the system flag bit SERIAL_MODE to TRUE. Then
however, program download and debugging are only possible via the CAN interface.
For CRnn32: Debugging of the application software is then only possible via all 4 CAN interfaces or via
USB.
242
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SERIAL_RX
CLEAR RX
AVAILABLE
OVERFLOW
Description
SERIAL_RX reads a received data byte from the serial receive buffer at each call.
Then, the value of AVAILABLE is decremented by 1.
If more than 1000 data bytes are received, the buffer overflows and data is lost. This is indicated by
the bit OVERFLOW.
The SERIAL functions form the basis for the creation of an application-specific protocol for the serial
interface.
NOTE
In principle, the serial interface is not available for the user, because it is used for program download
and debugging.
The interface can be freely used if the user sets the system flag bit SERIAL_MODE to TRUE. Then
however, program download and debugging are only possible via the CAN interface.
For CRnn32: Debugging of the application software is then only possible via all 4 CAN interfaces or via
USB.
243
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example:
3 bytes are received:
1st call of SERIAL_RX
1 valid value at output RX
→ AVAILABLE = 3
2nd call of SERIAL_RX
1 valid value at output RX
→ AVAILABLE = 2
3rd call of SERIAL_RX
1 valid value at output RX
→ AVAILABLE = 1
4th call of SERIAL_RX
invalid value at the output RX
→ AVAILABLE = 0
If AVAILABLE = 0, the function can be skipped during processing of the program.
244
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
SERIAL_PENDING
NUMBER
Description
SERIAL_PENDING determines the number of data bytes stored in the serial receive buffer.
In contrast to the function SERIAL_RX (→ page 242) the contents of the buffer remain unchanged
after calling this function.
The SERIAL functions form the basis for the creation of an application-specific protocol for the serial
interface.
NOTE
In principle, the serial interface is not available for the user, because it is used for program download
and debugging.
The interface can be freely used if the user sets the system flag bit SERIAL_MODE to TRUE. Then
however, program download and debugging are only possible via the CAN interface.
For CRnn32: Debugging of the application software is then only possible via all 4 CAN interfaces or via
USB.
245
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
TIMER_READ
T
Description
TIMER_READ reads the current system time.
When the supply voltage is applied, the controller generates a clock pulse which is counted upwards in
a register. This register can be read using the function call and can for example be used for time
measurement.
NOTE
The system timer goes up to FFFF FFFF16 at the maximum (corresponds to about 49.7 days) and then
starts again from 0.
246
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
TIMER_READ_US
TIME_US
Description
TIMER_READ_US reads the current system time in [µs].
When the supply voltage is applied, the controller generates a clock pulse which is counted upwards in
a register. This register can be read by means of the function call and can for example be used for
time measurement.
Info
The system timer runs up to the counter value 4 294 967 295 µs at the maximum and then starts again
from 0.
4 294 967 295 µs = 71 582.8 min = 1 193 h = 49.7 d
247
ifm System Manual ecomatmobile SmartController (CR2500) V05
248
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
INPUT_ANALOG
ENABLE OUT
MODE
CHANNEL
Description
INPUT_ANALOG enables current and voltage measurements at the analogue channels.
The function provides the current analogue value at the selected analogue channel. The measurement
and the output value result from the operating mode specified via MODE (digital input, 0...20 mA,
0...10 V, 0...30 V). For parameter setting of the operating mode, the indicated global system variables
should be used. The analogue values are provided as standardised values.
249
ifm System Manual ecomatmobile SmartController (CR2500) V05
250
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
INPUT_VOLTAGE
ENABLE ACTUAL_VOLTAGE
MODE_10V_32V
INPUT_CHANNEL
Description
INPUT_VOLTAGE processes analogue voltages measured on the analogue channels.
The function returns the current input voltage in [mV] on the selected analogue channel. The
measurement refers to the voltage range defined via MODE_10V_32V (10 000 mV or 32 000 mV).
Info
INPUT_VOLTAGE is a compatibility function for older programs. In new programs, the more powerful
function INPUT_ANALOG (→ page 248) should be used.
251
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
INPUT_CURRENT
ENABLE ACTUAL_CURRENT
INPUT_CHANNEL
Description
INPUT_CURRENT processes analogue currents measured at the analogue channels.
The function returns the actual input current in [µA] at the analogue current inputs.
Info
INPUT_CURRENT is a compatibility function for older programs. In new programs, the more powerful
function INPUT_ANALOG (→ page 248) should be used.
252
ifm System Manual ecomatmobile SmartController (CR2500) V05
253
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
NORM
X Y
XH
XL
YH
YL
Description
NORM normalises a value within defined limits to a value with new limits.
The function normalises a value of type WORD within the limits of XH and XL to an output value within
the limits of YH and YL. This function is for example used for generating PWM values from analogue
input values.
NOTE
The value for X must be in the defined input range between XL and XH (there is no internal plausibility
check of the value).
Due to rounding errors the normalised value can deviate by 1.
If the limits (XH/XL or YH/YL) are defined in an inverted manner, normalisation is also done in an
inverted manner.
254
ifm System Manual ecomatmobile SmartController (CR2500) V05
Example 1
lower limit value input 0 XL
upper limit value input 100 XH
lower limit value output 0 YL
upper limit value output 2000 YH
then the function converts the input signal for example as follows:
from X = 50 0 100 75
to Y = 1000 0 2000 1500
Example 2
lower limit value input 2000 XL
upper limit value input 0 XH
lower limit value output 0 YL
upper limit value output 100 YH
then the function converts the input signal for example as follows:
from X = 1000 0 2000 1500
to Y = 50 100 0 25
255
ifm System Manual ecomatmobile SmartController (CR2500) V05
11.1 General
Controlling is a process during which the unit to be controlled (control variable x) is continuously
detected and compared with the reference variable w. Depending on the result of this comparison, the
control variable is influenced for adaptation to the reference variable.
Störgröße d
Disturbance variable d
Führungsgröße w
Reference variable w Regelgröße x
Controlled variable x
Regeleinrichtung Regelstrecke
Controller Controlled system
Stellgröße y
Manipulated variable y
The selection of a suitable control device and its optimum setting require exact indication of the
steady-state behaviour and the dynamic behaviour of the controlled system. In most cases these
characteristic values can only be determined by experiments and can hardly be influenced.
Three types of controlled systems can be distinguished:
256
ifm System Manual ecomatmobile SmartController (CR2500) V05
For controlled systems with dead time the control variable does not react to a change of the control
variable before the dead time Tt has elapsed. The dead time Tt or the sum of Tt + Tu relates to the
controllability of the system. The controllability of a system is the better, the greater the ratio Tg/Tu.
The controllers which are integrated in the library are a summary of the preceding basic functions. It
depends on the respective controlled system which functions are used and how they are combined.
257
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
For this setting process it has to be noted that the controlled system is not harmed by the oscillation
generated. For sensitive controlled systems KP must only be increased to a value at which no
oscillation occurs.
258
ifm System Manual ecomatmobile SmartController (CR2500) V05
259
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
DELAY
X Y
T
Description
DELAY delays the output of the input value by the time T (dead-time element).
The function is used to delay an input value by the time T.
y
1
Tt
t=0 t
Figure: Time characteristics of DELAY
NOTE
To ensure that the function works correctly, it must be called in each cycle.
260
ifm System Manual ecomatmobile SmartController (CR2500) V05
261
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
PT1
X Y
T1
Description
PT1 handles a controlled system with a first-order time delay.
This function is a proportional controlled system with a time delay. It is for example used for generating
ramps when using the PWM functions.
The output variable Y of the low-pass filter has the following time characteristics (unit step):
y
Tt
t=0 t
Figure: Time characteristics of PT1
262
ifm System Manual ecomatmobile SmartController (CR2500) V05
263
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
PID1
X Y
XS
XMAX
KP
KI
KD
Description
PID1 handles a PID controller.
The change of the manipulated variable of a PID controller has a proportional, integral and differential
component. The manipulated variable changes first by an amount which depends on the rate of
change of the input value (D component). After the end of the derivative action time the manipulated
variable returns to the value corresponding to the proportional range and changes in accordance with
the reset time.
NOTE
The manipulated variable Y is already standardised to the PWM function (RELOAD value = 65,535).
Note the reverse logic:
65,535 = minimum value
0 = maximum value.
Note that the input values KI and KD depend on the cycle time. To obtain stable, repeatable control
characteristics, the function should be called in a time-controlled manner.
264
ifm System Manual ecomatmobile SmartController (CR2500) V05
KI * Xd
KP * Xd
~TV TN t
Recommended setting
KP = 50
KI = 30
KD = 5
With the values indicated above the controller operates very quickly and in a stable way. The controller
does not fluctuate with this setting.
► To optimise the controller, the values can be gradually changed afterwards.
265
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
PID2
X Y
XS
XMAX
KP
KI
TN
KD
TV
RESET
Description
PID2 handles a PID controller with self optimisation.
The change of the manipulated variable of a PID controller has a proportional, integral and differential
component. The manipulated variable changes first by an amount which depends on the rate of
change of the input value (D component). After the end of the derivative action time TV the
manipulated variable returns to the value corresponding to the proportional component and changes in
accordance with the reset time TN.
The values entered at the function inputs KP and KD are internally divided by 10. So, a finer grading
can be obtained (e.g.: KP = 17, which corresponds to 1.7).
NOTE
The manipulated variable Y is already standardised to the PWM function (RELOAD value = 65,535).
Note the reverse logic:
65,535 = minimum value
0 = maximum value.
Note that the input value KD depends on the cycle time. To obtain stable, repeatable control
characteristics, the function should be called in a time-controlled manner.
266
ifm System Manual ecomatmobile SmartController (CR2500) V05
KI * Xd
KP * Xd
~TV TN t
267
ifm System Manual ecomatmobile SmartController (CR2500) V05
Recommended setting
► Select TN according to the time characteristics of the system:
fast system = small TN
slow system = large TN
► Slowly increment KP gradually, up to a value at which still definitely no fluctuation will occur.
► Readjust TN if necessary.
► Add differential component only if necessary:
Select a TV value approx. 2...10 times smaller than TN.
Select a KD value more or less similar to KP.
Note that the maximum control deviation is + 127. For good control characteristics this range should
not be exceeded, but it should be exploited to the best possible extent.
268
ifm System Manual ecomatmobile SmartController (CR2500) V05
Function symbol:
GLR
X1 Y1
X2 Y2
XS
XMAX
KP
TN
KD
TV
Description
GLR handles a synchro controller.
The synchro controller is a controller with PID characteristics.
The values entered at the function inputs KP and KD are internally divided by 10. So, a finer grading
can be obtained (e.g.: KP = 17, which corresponds to 1.7).
The manipulated variable referred to the greater actual value is increased accordingly.
The manipulated variable referred to the smaller actual value corresponds to the reference variable.
Reference variable = 65 536 – (XS / XMAX * 65 536).
NOTE
The manipulated variables Y1 and Y2 are already standardised to the PWM function (RELOAD value
= 65 535). Note the reverse logic:
65 535 = minimum value
0 = maximum value.
Note that the input value KD depends on the cycle time. To obtain stable, repeatable control
characteristics, the function should be called in a time-controlled manner.
269
ifm System Manual ecomatmobile SmartController (CR2500) V05
270
ifm System Manual ecomatmobile SmartController (CR2500) V05
12 Annex
Address assignment and I/O operating modes ...................................................................... 272
System flags ........................................................................................................................... 274
Overview of the files and libraries used.................................................................................. 275
Additionally to the indications in the data sheets you find summary tables in the annex.
271
ifm System Manual ecomatmobile SmartController (CR2500) V05
272
ifm System Manual ecomatmobile SmartController (CR2500) V05
I4…I7 IN_CURRENT 1
IN_VOLTAGE10 2
IN_VOLTAGE30 3 (default)
273
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE
Only symbol names should be used for the programming since the corresponding flag addresses can
change in case of an extension of the PLC configuration.
274
ifm System Manual ecomatmobile SmartController (CR2500) V05
275
ifm System Manual ecomatmobile SmartController (CR2500) V05
NOTE:
The software versions suitable for the selected target must always be used:
• of the operating system (CRnnnn_Vxxyyyzz.H86),
• of the PLC configuration (CRnnnn_Vxx.CFG),
• of the device library (CRnnnn_Vxxyyyzz.LIB),
• and the further files (→ chapter Overview of the files and libraries used, → page 275)
CRnnnn device article number
Vxx: 00...99 target version number
yy: 00...99 release number
zz: 00...99 patch number
The basic file name (e.g. "CR0032") and the software version number "xx" (e.g. "02") must always have
the same value! Otherwise the controller goes to the STOP mode.
The values for "yy" (release number) and "zz" (patch number) do not have to match.
276
ifm System Manual ecomatmobile SmartController (CR2500) V05
12.3.2 What are the individual files and libraries used for?
The following overview shows which files/libraries can and may be used with which unit. It may be
possible that files/libraries which are not indicated in this list can only be used under certain conditions
or the functionality has not yet been tested.
Target file
File name Function Available for:
ifm_CRnnnn_Vxx.TRG Target file all ecomatmobile controllers
all PDM360 monitors
277
ifm System Manual ecomatmobile SmartController (CR2500) V05
278
ifm System Manual ecomatmobile SmartController (CR2500) V05
¹) valid for CRnn32 target version up to V01, all other devices up to V04
²) valid for CRnn32 target version from V02 onwards, all other devices from V05 onwards:
279
ifm System Manual ecomatmobile SmartController (CR2500) V05
280
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
13 Glossary of C
Terms
CAN
A CAN = Controller Area Network
CAN is a priority controlled fieldbus system for
Address larger data volumes. It is available in different
variants, e.g. "CANopen" or "CAN in
This is the "name" of the bus participant. All Automation" (CiA).
participants need a unique address so that the
signals can be exchanged without problem.
Category (CAT)
Application software Classification of the safety-related parts of a
control system in respect of their resistance to
Software specific to the application, faults and their subsequent behaviour in the
implemented by the machine manufacturer, fault condition. This safety is achieved by the
generally containing logic sequences, limits structural arrangement of the parts, fault
and expressions that control the appropriate detection and/or by their reliability.
inputs, outputs, calculations and decisions
(→ EN 954).
Necessary to meet the specific (→SRP/CS)
requirements.
→ Programming language, safety-related CCF
Common Cause Failure
Failures of different items, resulting from a
Architecture common event, where these failures are not
Specific configuration of hardware and consequences of each other.
software elements in a system.
CiA
B CiA = CAN in Automation e.V.
User and manufacturer organisation in
Baud Germany / Erlangen. Definition and control
Baud, abbrev.: Bd = unit for the data body for CAN and CAN-based network
transmission speed. Do not confuse baud with protocols.
"bits per second" (bps, bits/s). Baud indicates
Homepage → http://www.can-cia.org
the number of changes of state (steps, cycles)
per second over a transmission length. But it is
not defined how many bits per step are
transmitted. The name baud can be traced CiA DS 304
back to the French inventor J. M. Baudot DS = Draft Standard
whose code was used for telex machines.
CAN device profile CANopen safety for safety-
1 MBd = 1024 x 1024 Bd = 1 048 576 Bd related communication.
281
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
CiA DS 405
DS = Draft Standard D
Specification for interface to programmable
controllers (IEC 61131-3) DC
Direct Current
CiA DS 406
DS = Draft Standard DC
CAN device profile for encoders Diagnostic Coverage
Diagnostic coverage is the measure of the
effectiveness of diagnostics as the ratio
between the failure rate of detected dangerous
CiA DS 407 failures and the failure rate of total dangerous
DS = Draft Standard failures:
CAN application profile for local public Formula: DC = failure rate detected dangerous failures /
transport total dangerous failures
Designation Range
none DC < 60 %
Clamp 15
low 60 % < DC < 90 %
In vehicles clamp 15 is the plus cable switched
by the ignition lock. medium 90 % < DC < 99 %
high 99 % < DC
282
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
none DC < 60 %
EMCY
Diversity abbreviation for emergency
In technology diversity is a strategy to increase
failure safety.
EMV
The systems are designed redundantly,
however different implementations are used EMC = Electro Magnetic Compatibility
intentionally and not any individual systems of According to the EC directive (2004/108/EEC)
the same design. It is assumed that systems of concerning electromagnetic compatibility (in
the same performance, however of different short EMC directive) requirements are made
implementation, are sensitive or insensitive to for electrical and electronic apparatus,
different interference and will therefore not fail equipment, systems or components to operate
simultaneously. satisfactorily in the existing electromagnetic
283
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
environment. The devices must not interfere hardware failure is less likely to lead to the
with their environment and must not be overall dangerous or fail-to-function state.
adversely influenced by external
electromagnetic interference.
Failure, systematic
A systematic failure is a failure related in a
Ethernet
deterministic way (not coincidental) to a certain
Ethernet is a widely used, manufacturer- cause. The systematic failure can only be
independent technology which enables data eliminated by a modification of the design or of
transmission in the network at a speed of 10 or the manufacturing process, operational
100 million bits per second (Mbps). Ethernet procedures, documentation or other relevant
belongs to the family of so-called "optimum factors.
data transmission" on a non exclusive
Corrective maintenance without modification of
transmission medium. The concept was
the system will usually not eliminate the failure
developed in 1972 and specified as
cause.
IEEE 802.3 in 1985.
EUC Fault
A fault is the state of an item characterized by
EUC = "Equipment Under Control"
the inability to perform the requested function,
EUC is equipment, machinery, apparatus or excluding the inability during preventive
plant used for manufacturing, process, maintenance or other planned actions, or due
transportation, medical or other activities to lack of external resources.
(→ IEC 61508-4, section 3.2.3). Therefore, the
A fault is often the result of a failure of the item
EUC is the set of all equipment, machinery,
itself, but may exist without prior failure.
apparatus or plant that gives rise to hazards
for which the safety-related system is required. In ISO 13849-1 "fault" means "random fault".
If any reasonably foreseeable action or
inaction leads to hazards with an intolerable
risk arising from the EUC, then safety functions Fault tolerance time
are necessary to achieve or maintain a safe The max. time it may take between the
state for the EUC. These safety functions are occurrence of a fault and the establishment of
performed by one or more safety-related the safe state in the application without having
systems. to assume a danger for people.
The max. cycle time of the application program
F (in the worst case 100 ms, → Watchdog,
→ page 44) and the possible delay and
response times due to switching elements
Failure have to be considered.
Failure is the termination of the ability of an The resulting total time must be smaller than
item to perform a required function. the fault tolerance time of the application.
After a failure, the item has a fault. Failure is
an event, fault is a state.
Firmware
The concept as defined does not apply to
items consisting of software only. System software, basic program in the device,
virtually the operating system.
The firmware establishes the connection
Failure, dangerous between the hardware of the device and the
A dangerous failure has the potential to put the user software. This software is provided by the
SRP/SC in a hazardous or fail-to-function manufacturer of the controller as a part of the
state. Whether or not the potential is realized system and cannot be changed by the user.
can depend on the channel architecture of the
system; in redundant systems a dangerous
284
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
285
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
Link
MTBF
A link is a cross-reference to another part in
the document or to an external document. Mean Time Between Failures (MTBF)
Is the expected value of the operating time
between two consecutive failures of items that
M are maintained.
NOTE: For items that are NOT maintained the
MAC-ID mean life →MTTF is the expected value (mean
value) of the distribution of lives.
MAC = Manufacturer‘s Address Code =
manufacturer's serial number
→ID = Identifier MTTF
Every network card has a MAC address, a Mean Time To Failure (MTTF) or: mean life.
clearly defined worldwide unique numerical
code, more or less a kind of serial number.
Such a MAC address is a sequence of
MTTFd
6 hexadecimal numbers, e.g. "00-0C-6E-D0-
02-3F". Mean Time To Failure (MTTF) or: mean life.
The MTTFd is the expectation of the mean time
to dangerous failure.
Master
Designation Range
Handles the complete organisation on the bus.
low 3 years < MTTFd < 10 years
The master decides on the bus access time
and polls the →slaves cyclically. medium 10 years < MTTFd < 30 years
high 30 years < MTTFd < 100 years
Table: Mean time of each channel to the dangerous failure
Mission time TM MTTFd
Mission time TM is the period of time covering
the intended use of an SRP/CS.
Muting
Muting is the temporary automatic suspension
Misuse
of a safety function(s) by the SRP/CS.
The use of a product in a way not intended by
Example: The safety light curtain is bridged, if
the designer.
the closing tools have reached a finger-proof
The manufacturer of the product has to warn distance to each other. The operator can now
against readily predictable misuse in his user approach the machine without any danger and
information. guide the workpiece.
286
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
N Operational
Operating state of a CANopen participant. In
NMT this mode SDOs, NMT commands and PDOs
can be transferred.
NMT = Network Management = (here: in the
CAN bus)
The NMT master controls the operating states P
of the NMT slaves.
PC card
Node →PCMCIA card
287
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
288
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
289
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
• hazard identification (intervention of - bring the machine into a safe state in time in
people, operating status of the machine, the event of a failure of the safety function.
foreseeable misuse) and
• the risk estimation (degree of injury, extent Safety-standard types
of damage, frequency and duration of the
risk, probability of occurrence, possibility of The safety standards in the field of machines
avoiding the hazard or limiting the harm). are structured as below:
Type-A standards (basic safety standards)
giving basic concepts, principles for design,
Risk assessment and general aspects that can be applied to all
Overall process comprising risk analysis and machinery. Examples: basic terminology,
risk evaluation. methodology (ISO 12100-1), technical
principles (ISO 12100-2), risk assessment
According to Machinery Directive 2006/42/EU (ISO 14121), ...
the following applies: "The manufacturer of
machinery or his authorised representative Type-B standards (generic safety standards)
must ensure that a risk assessment is carried dealing with one safety aspect or one type of
out in order to determine the health and safety safeguard that can be used across a wide
requirements which apply to the machinery. range of machinery.
The machinery must then be designed and • Type-B1 standards on particular safety
constructed taking into account the results of aspects. Examples: safety distances
the risk assessment." (→ Annex 1, General (EN 294), hand/arm speeds (EN 999),
principles) safety-related parts of control systems
(ISO 13849), temperatures, noise, ...
• Type-B2 standards on safeguards.
Risk evaluation
Examples: emergency stop circuits
Judgement, on the basis of the risk analysis, of ((ISO 13850), two-hand controls,
whether risk reduction objectives have been interlocking devices or electro-sensitive
achieved. protective equipment (ISO 61496), ...
Type-C standards (machine safety standards)
dealing with detailed safety requirements for a
ro particular machine or group of machines.
RO = read only for reading only
Unidirectional data transmission: Data can only SCT
be read and not changed.
In CANopen safety the Safeguard Cycle Time
(SCT) monitors the correct function of the
rw periodic transmission (data refresh) of the
SRDOs. The data must have been repeated
RW = read/ write within the set time to be valid. Otherwise the
Bidirectional data transmission: Data can be receiving controller signals a fault and passes
read and also changed. into the safe state (= outputs switched off).
S SDO
SDO = Service Data Object.
Safety function SDO is a specification for a manufacturer-
Function of the machine whose failure can dependent data structure for standardised data
result in an immediate increase of the risk(s). access. "Clients" ask for the requested data
The designer of such a machine therefore has from "servers". The SDOs always consist of
to: 8 bytes. Longer data packages are distributed
- safely prevent a failure of the safety function, to several messages.
- reliably detect a failure of the safety function
in time,
290
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
Examples: SRVT
• Automatic configuration of all slaves via The SRVT (Safety-Related Object Validation
SDOs at the system start, Time) ensures with CANopen safety that the
time between the SRDO-message pairs is
• reading error messages from the object adhered to.
directory.
Only if the redundant, inverted message has
Every SDO is monitored for a response and been transmitted after the original message
repeated if the slave does not respond within within the SRVT set are the transmitted data
the monitoring time. valid. Otherwise the receiving controller signals
a fault and will pass into the safe state
(= outputs switched off).
SIL
According to IEC 62061 the safety-integrity
level SIL is a classification (SIL CL 1...4) of the State, safe
safety integrity of the safety functions. It is The state of a machine is said to be safe when
used for the evaluation of there is no more hazard formed by it. This is
electrical/electronic/programmable electronic usually the case if all possible dangerous
(E/E/EP) systems with regard to the reliability movements are switched off and cannot start
of safety functions. The safety-related design again unexpectedly.
principles that have to be adhered to so that
the risk of a malfunction can be minimised
result from the required level.
Symbols
Pictograms are figurative symbols which
Slave convey information by a simplified graphic
representation.
Passive participant on the bus, only replies on
request of the →master. Slaves have a clearly → Chapter What do the symbols and formats
defined and unique →address in the bus. stand for? (→ page 7)
SRDO T
Safe data is exchanged via SRDOs (Safety-
Related Data Objects). An SRDO always Target
consists of two CAN messages with different The target indicates the target system where
identifiers: the PLC program is to run. The target contains
• message 1 contains the original user data, the files (drivers and if available specific help
files) required for programming and parameter
• message 2 contains the same data which setting.
are inverted bit by bit.
TCP
SRP/CS
The Transmission Control Protocol is part of
Safety-Related Part of a Control System the TCP/IP protocol family. Each TCP/IP data
connection has a transmitter and a receiver.
Part of a control system that responds to
This principle is a connection-oriented data
safety-related input signals and generates
transmission. In the TCP/IP protocol family the
safety-related output signals. The combined
TCP as the connection-oriented protocol
safety-related parts of a control system start at
assumes the task of data protection, data flow
the point where the safety-related input signals
control and takes measures in the event of
are initiated (including, for example, the
data loss.
actuating cam and the roller of the position
switch) and end at the output of the power (compare: →UDP)
control elements (including, for example, the
main contacts of a contactor).
291
ifm System Manual ecomatmobile SmartController (CR2500) V05
Glossary of Terms
Template W
A template can be filled with content.
Here: A structure of pre-configured software Watchdog
elements as basis for an application program. In general the term watchdog is used for a
component of a system which watches the
function of other components. If a possible
Test rate rt malfunction is detected, this is either signalled
The test rate rt is the frequency of the or suitable program branchings are activated.
automatic tests to detect errors in an SRP/CS The signal or branchings serve as a trigger for
in time. other co-operating system components to
solve the problem.
U
wo
UDP WO = write only
UDP (User Datagram Protocol) is a minimal Unidirectional data transmission: Data can only
connectionless network protocol which belongs be changed and not read.
to the transport layer of the internet protocol
family. The task of UDP is to ensure that data
which is transmitted via the internet is passed
to the right application.
At present network variables based on CAN
and UDP are implemented. The values of the
variables are automatically exchanged on the
basis of broadcast messages. In UDP they are
implemented as broadcast messages, in CAN
as PDOs. These services are not confirmed by
the protocol, i.e. it is not checked whether the
message is received. Exchange of network
variables corresponds to a "1 to n connection"
(1 transmitter to n receivers).
Uptime, mean
Mean Time Between Failures (MTBF)
Is the expected value of the operating time
between two consecutive failures of items that
are maintained.
NOTE: For items that are NOT maintained the
mean life →MTTF is the expected value (mean
value) of the distribution of lives.
Use, intended
Use of a product in accordance with the
information provided in the instructions for use.
292
ifm System Manual ecomatmobile SmartController (CR2500) V05
Index
293
ifm System Manual ecomatmobile SmartController (CR2500) V05
Index
294
ifm System Manual ecomatmobile SmartController (CR2500) V05
Index
295
ifm System Manual ecomatmobile SmartController (CR2500) V05
Index
296
ifm System Manual ecomatmobile SmartController (CR2500) V05
Index
297
ifm System Manual ecomatmobile SmartController (CR2500) V05
Index
298