IFM CR2042 I/O modules for mobile machine Owner's Manual

Add to My manuals
240 Pages

advertisement

IFM CR2042 I/O modules for mobile machine Owner's Manual | Manualzz

>

>

Programming Manual ioControl

CR2042

CR2052

Runtime system > V03.04.00

CODESYS® > V2.3.9.33

English

2 ioControl CR2042, CR2052

Contents

1

1.1

1.2

1.3

1.4

1.5

2

2.1

2.2

2.3

2.4

About this manual 4

Copyright .............................................................................................................................. 4

Overview: documentation modules for CR2042, CR2052 ................................................... 5

What do the symbols and formats mean? ........................................................................... 6

How is this documentation structured? ................................................................................ 7

History of the instructions ..................................................................................................... 7

Safety instructions 8

Please note .......................................................................................................................... 8

What previous knowledge is required? ................................................................................ 8

Start-up behaviour of the controller...................................................................................... 9

Notes: serial number ............................................................................................................ 9

3 System description 10

3.1

3.2

Information about the device ..............................................................................................10

Overview device family ioControl .......................................................................................10

3.3

Hardware description .........................................................................................................11

3.3.1

Hardware structure ..................................................................................................................... 11

3.3.2

Inputs (technology) ..................................................................................................................... 13

3.3.3

Outputs (technology) .................................................................................................................. 17

3.3.4

Note on wiring ............................................................................................................................ 22

3.3.5

Safety instructions about Reed relays ........................................................................................ 22

3.3.6

Indicators .................................................................................................................................... 23

3.3.7

Operating elements .................................................................................................................... 26

3.4

Interface description ...........................................................................................................27

3.4.1

CAN interfaces ........................................................................................................................... 27

3.5

Software description ..........................................................................................................28

3.5.1

Software modules for the device ................................................................................................ 28

3.5.2

Programming notes for CODESYS projects ............................................................................... 31

3.5.3

Operating states ......................................................................................................................... 34

3.5.4

Performance limits of the device ................................................................................................ 37

4 Configurations 39

4.1

Set up the runtime system .................................................................................................39

4.1.1

Install the runtime system ........................................................................................................... 40

4.1.2

Update the runtime system ......................................................................................................... 41

4.1.3

Verify the installation .................................................................................................................. 41

4.2

Set up the programming system ........................................................................................42

4.2.1

Set up the programming system manually ................................................................................. 42

4.3

4.2.2

Set up the programming system via templates ........................................................................... 46

Function configuration in general .......................................................................................46

4.3.1

System variables ........................................................................................................................ 46

4.4

Function configuration of the inputs and outputs ...............................................................47

4.4.1

Configuration of the inputs and outputs (default setting) ............................................................ 47

4.4.2

Configure inputs ......................................................................................................................... 48

4.4.3

Configure outputs ....................................................................................................................... 53

4.5

Variables ............................................................................................................................57

4.5.1

Retain variables .......................................................................................................................... 57

4.5.2

Network variables ....................................................................................................................... 58

ioControl CR2042, CR2052

9

5 ifm function elements 59

5.1

ifm libraries for the device CR20n2 ....................................................................................59

5.1.1

Bibliothek ifm_CR20n2_V01yyzz.LIB ......................................................................................... 59

5.1.2

Bibliothek ifm_ioControl_Display_LED_Vxxyyzz.LIB .................................................................. 60

5.1.3

Library ifm_RAWCan_NT_Vxxyyzz.LIB...................................................................................... 61

5.1.4

Library ifm_CANopen_NT_Vxxyyzz.LIB ..................................................................................... 61

5.1.5

Library ifm_J1939_NT_Vxxyyzz.LIB ........................................................................................... 63

5.2

ifm function elements for the device CR20n2 ....................................................................64

5.2.1

Function element outputs ........................................................................................................... 65

5.2.2

Function elements: RAW-CAN (Layer 2) .................................................................................... 66

5.2.3

Function elements: CANopen ..................................................................................................... 92

5.2.4

Function elements: SAE J1939 ................................................................................................ 138

5.2.5

Function elements: processing input values ............................................................................. 170

5.2.6

Function elements: output functions ......................................................................................... 181

5.2.7

Function elements: system ....................................................................................................... 188

6 Diagnosis and error handling 215

6.1

6.2

Diagnosis .........................................................................................................................215

Fault .................................................................................................................................215

6.3

Response to system errors ..............................................................................................216

6.3.1

Example process for response to an error message ................................................................ 216

6.4

CAN / CANopen: errors and error handling .....................................................................216

7 Appendix 217

7.1

System flags .....................................................................................................................217

7.1.1

System flags: voltages.............................................................................................................. 217

7.1.2

System flags: system ............................................................................................................... 217

7.1.3

System flags: keys ................................................................................................................... 217

7.2

Address assignment and I/O operating modes ................................................................218

7.2.1

Address assignment inputs / outputs ........................................................................................ 218

7.3

7.2.2

Possible operating modes inputs/outputs ................................................................................. 220

Error tables .......................................................................................................................222

7.3.1

Error flags ................................................................................................................................. 222

7.3.2

Errors: CAN / CANopen............................................................................................................ 222

8 Terms and abbreviations 224

Index 237

3

4 ioControl CR2042, CR2052

>

1 About this manual

Content

Copyright .................................................................................................................................................. 4

Overview: documentation modules for CR2042, CR2052 ....................................................................... 5

What do the symbols and formats mean? ................................................................................................ 6

How is this documentation structured? .................................................................................................... 7

History of the instructions ......................................................................................................................... 7

26077

1.1

Copyright

26002

© All rights reserved by ifm electronic gmbh . No part of this manual may be reproduced and used without the consent of ifm electronic gmbh .

All product names, pictures, companies or other brands used on our pages are the property of the respective rights owners:

• AS-i is the property of the AS-International Association, (→ www.as-interface.net

)

• CAN is the property of the CiA (CAN in Automation e.V.), Germany (→ www.can-cia.org

)

• CODESYS™ is the property of the 3S – Smart Software Solutions GmbH, Germany (→ www.codesys.com

)

• DeviceNet™ is the property of the ODVA™ (Open DeviceNet Vendor Association), USA (→ www.odva.org

)

• EtherNet/IP ® is the property of the →ODVA™

• EtherCAT ® is a registered trade mark and patented technology, licensed by Beckhoff Automation GmbH, Germany

• IO-Link ® (→ www.io-link.com

) is the property of the →PROFIBUS Nutzerorganisation e.V., Germany

• ISOBUS is the property of the AEF – Agricultural Industry Electronics Foundation e.V., Deutschland

(→ www.aef-online.org

)

• Microsoft ® is the property of the Microsoft Corporation, USA (→ www.microsoft.com

)

• Modbus ® is the property of the Schneider Electric SE, France (→ www.schneider-electric.com

)

• PROFIBUS ® is the property of the PROFIBUS Nutzerorganisation e.V., Germany (→ www.profibus.com

)

• PROFINET ® is the property of the →PROFIBUS Nutzerorganisation e.V., Germany

• Windows ® is the property of the →Microsoft Corporation, USA

> ioControl CR2042, CR2052

1.2

Overview: documentation modules for CR2042, CR2052

The documentation for this devices consists of the following modules:

(Downloads from ifm's website → www.ifm.com

)

Document Contents / Description

Data sheet

Installation instructions

(are supplied with the device)

Technical data in a table

Instructions for installation, electrical installation, and commissioning

Technical data

Programming manual

Functions of the setup menu of the device

Creation of a CODESYS project with this device

Target settings with CODESYS

Programming of the device-internal PLC with CODESYS

Description of the device-specific CODESYS function libraries

System manual

"Know-How ecomatmobile"

Know-how about the following topics (examples):

Overview Templates and demo programs

CAN, CANopen

Control outputs

Visualisations

Overview of the files and libraries

28035

5

6

> ioControl CR2042, CR2052

1.3

What do the symbols and formats mean?

The following symbols or pictograms illustrate the notes in our instructions:

WARNING

Death or serious irreversible injuries may result.

CAUTION

Slight reversible injuries may result.

NOTICE

Property damage is to be expected or may result.

→ ...

Important note

Non-compliance can result in malfunction or interference

Information

Supplementary note

► ... Request for action

> ... Reaction, result

"see" abc

123

0x123

0b010

[...]

Cross-reference

Decimal number

Hexadecimal number

Binary number

Designation of pushbuttons, buttons or indications

26329

> ioControl CR2042, CR2052

>

1.4

How is this documentation structured?

204

26041

This documentation is a combination of different types of manuals. It is for beginners and also a reference for advanced users. This document is addressed to the programmers of the applications.

How to use this manual:

Refer to the table of contents to select a specific subject.

Using the index you can also quickly find a term you are looking for.

At the beginning of a chapter we will give you a brief overview of its contents.

Abbreviations and technical terms → Appendix.

In case of malfunctions or uncertainties please contact the manufacturer at:

Contact → www.ifm.com

We want to become even better! Each separate section has an identification number in the top right corner. If you want to inform us about any inconsistencies, indicate this number with the title and the language of this documentation. Thank you very much for your support!

We reserve the right to make alterations which can result in a change of contents of the documentation. You can find the current version on ifm's website:

→ www.ifm.com

1.5

History of the instructions

What has been changed in this manual? An overview:

Date Theme

2017-11-16

2018-07-09

2018-11

Memory for application

List of the ifm branch offices

Device: CR2042

Change is 128 kBytes (instead of 512 kBytes) removed added

50311

7

8 ioControl CR2042, CR2052

2 Safety instructions

>

Content

Please note ............................................................................................................................................... 8

What previous knowledge is required? .................................................................................................... 8

Start-up behaviour of the controller .......................................................................................................... 9

Notes: serial number ................................................................................................................................ 9

28333

2.1

Please note

6091

35944

No characteristics are warranted with the information, notes and examples provided in this manual.

With the drawings, representations and examples given no responsibility for the system is assumed and no application-specific particularities are taken into account.

► The manufacturer of the machine/equipment is responsible for ensuring the safety of the machine/equipment.

► Follow the national and international regulations of the country in which the machine/installation is to be placed on the market!

WARNING

>

Non-observance of these instructions can lead to property damage or personal injury. 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 in this manual before working on and with this device.

► The acting person must be authorised to work on the machine/equipment.

► The acting person must have the qualifications and training required to perform this work.

► Adhere to the technical data of the devices!

You can find the current data sheet on the ifm website.

► Note the installation and wiring information as well as the functions and features of the devices!

→ supplied installation instructions or on the ifm website.

Homepage → www.ifm.com

2.2

What previous knowledge is required?

28341

This document is intended for people with knowledge of control technology and PLC programming with IEC 61131-3.

To program the PLC, the people should also be familiar with the CODESYS software.

The document is intended for specialists. These specialists are people who are qualified by their training and their experience to see risks and to avoid possible hazards that may be caused during operation or maintenance of a product. The document contains information about the correct handling of the product.

Read this document before use to familiarise yourself with operating conditions, installation and operation. Keep the document during the entire duration of use of the device.

Adhere to the safety instructions.

> ioControl CR2042, CR2052

2.3

Start-up behaviour of the controller

6827

15233

WARNING

Danger due to unintentional and dangerous start of machine or plant sections!

► When creating the program, the programmer must ensure that no unintentional and dangerous start of machines or plant sections after a fault (e.g. e-stop) and the following fault elimination can occur!

 Realise restart inhibit.

► In case of an error, set the outputs concerned to FALSE in the program!

>

A restart can, for example, be caused by:

• Voltage restoration after power failure

• Reset after the watchdog responded because the cycle time was too long

• Error elimination after an E-stop

To ensure safe controller behaviour:

► monitor the voltage supply in the application program.

► In case of an error switch off all relevant outputs in the application program.

► Additionally monitor actuators which can cause hazardous movements in the application program

(feedback).

► Monitor relay contacts which can cause hazardous movements in the application program

(feedback).

► If necessary, ensure that welded relay contacts in the application project cannot trigger or continue hazardous movements.

2.4

Notes: serial number

28582

► In the user's production facility, draw a diagram of the controller network in the machine. Enter the serial number of each controller installed into the network diagram.

► Before downloading a software component, read out this serial number and check the network diagram to make sure that you are accessing the right controller.

9

ioControl CR2042, CR2052

3 System description

>

Content

Information about the device ..................................................................................................................10

Overview device family ioControl ...........................................................................................................10

Hardware description ..............................................................................................................................11

Interface description ...............................................................................................................................27

Software description ...............................................................................................................................28

28392

3.1

Information about the device

>

This manual describes of the ecomatmobile family for mobile machines of ifm electronic gmbh :

 ioControl: CR2042, CR2052

36544

3.2

Overview device family ioControl

Device family ioControl:

Equipment

16 inputs

0 outputs

0 inputs

16 outputs

8 inputs

8 outputs

Details →Data sheet

Deutsch connectors

CR2050

CR2051

CR2052

M12 connectors

CR2040

CR2041

CR2042

46130

10

ioControl CR2042, CR2052

3.3

Hardware description

Content

Hardware structure .................................................................................................................................11

Inputs (technology) .................................................................................................................................13

Outputs (technology) ..............................................................................................................................17

Note on wiring .........................................................................................................................................22

Safety instructions about Reed relays ....................................................................................................22

Indicators ................................................................................................................................................23

Operating elements ................................................................................................................................26

28381

>

3.3.1

Hardware structure

Content

Conditions ...............................................................................................................................................11

Principle block diagram ..........................................................................................................................12

Available memory ...................................................................................................................................12

28382

Conditions

34718

The device does not start until sufficient voltage is applied to the supply connection VBBs.

Permissible operating voltage → data sheet

11

ioControl CR2042, CR2052

Principle block diagram

36715

>

Figure: Block diagram of the supply

Available memory

>

FLASH memory

FLASH memory (non-volatile, slow memory) overall existing in the device

Thereof the following memory areas are reserved for ... maximum size of the application program data other than the application program read data with FB FLASH_READ

(→ p. 190 )

(files: 128 bytes less for header)

>

The remaining rest of the memory is reserved for system internal purposes.

SRAM

SRAM (volatile, fast memory) overall existing in the device

SRAM indicates here all kinds of volatile and fast memories.

Thereof the following memory areas are reserved for ... data reserved by the application program

>

The remaining rest of the memory is reserved for system internal purposes.

FRAM

FRAM (non-volatile, fast memory) overall existing in the device

FRAM indicates here all kinds of non-volatile and fast memories.

Thereof the following memory areas are reserved for ... variables in the application program, declared as VAR_RETAIN fixed as remanent defined flags (%MB0...127)

The remaining rest of the memory is reserved for system internal purposes.

28798

35699

1 536 kByte

128 kByte

64 kByte

592 kByte

36599

512 kByte

2 kByte

35700

128 Byte

128 Byte

12

ioControl CR2042, CR2052

>

3.3.2

Inputs (technology)

Content

Analogue inputs ......................................................................................................................................13

Binary inputs ...........................................................................................................................................14

Input group IN00, IN01, IN04, IN05 ........................................................................................................15

Input group IN02, IN03, IN06, IN07 ........................................................................................................15

28353

Analogue inputs

15444

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...32 V

• resistance measurement 16...30 000 

(measurement to GND)

The voltage measurement can also be carried out ratiometrically (0...1000 ‰, adjustable via function blocks). This means potentiometers or joysticks can be evaluated without additional reference voltage.

A fluctuation of the supply voltage has no influence on this measured value.

As an alternative, an analogue channel can also be evaluated binarily.

In case of ratiometric measurement the connected sensors should be supplied with VBBs of the device. So, faulty measurements caused by offset voltage are avoided.

33386

In = pin multifunction input n

(CR) = device

(1) = input filter

(2) = analogue current measuring

(3a) = binary-input plus switching

(3b) = binary-input minus switching

(4a) = analogue voltage measuring 0...10 V

(4b) = analogue voltage measuring 0...32 V

(5) = voltage

(6) = reference voltage

Figure: principle block diagram multifunction input

8972

Figure: block diagram of the resistor survey input

In = pin resistor survey input n

(CR) = device

(1) = input filter

(2) = constant-current source

(3) = internal resistance

(4) = voltage

13

ioControl CR2042, CR2052

>

Binary inputs

The binary input can be operated in following modes:

• binary input plus switching (BL) for positive sensor signal

• binary input minus switching (BH) for negative sensor signal

Depending on the device the binary inputs can configured differently. In addition to the protective mechanisms against interference, the binary 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

1015

28811

In = pin binary-input n

(CR) = device

(1) = input filter

(2a) = input minus switching

(2b) = input plus switching

(3) = voltage

Figure: basic circuit of binary input minus switching / plus switching for negative and positive sensor signals

In = pin binary input n

(S) = sensor

In = pin binary input n

(S) = sensor

Basic circuit of binary input plus switching (BL) for positive sensor signal:

Input = open  signal = low (GND)

Basic circuit of binary input minus switching (BH) for negative sensor signal:

Input = open  signal = high (supply)

For some of these inputs ( → data sheet) the potential can be selected to which it will be switched.

14

ioControl CR2042, CR2052

>

Input group IN00, IN01, IN04, IN05

These inputs are a group of multifunction channels.

These inputs can be used as follows (each input separately configurable):

• analogue input 0...20 mA

• analogue input 0...10 V

• analogue input 0...32 V

• voltage measurement ratiometric 0...1000 ‰

• binary input plus switching (BL) for positive sensor signal (with/without diagnosis)

• binary input minus switching (BH) for negative sensor signal

• fast input for e.g. incremental encoders and frequency or interval measurement

→ chapter Possible operating modes inputs/outputs

(→ p. 220 )

Sensors with diagnostic capabilities to NAMUR can be evaluated.

All inputs show the same behaviour concerning function and diagnosis.

Detailed description → chapter Address assignment inputs / outputs

(→ p. 218 )

>

Configuration of each input is made via the application program:

• FB INPUT

(→ p. 175 ) > input MODE

• FBs FASTCOUNT

(→ p. 171 ),

INC_ENCODER

(→ p. 173 ) or

PERIOD

(→ p. 178 )

> If the analogue inputs are configured for current measurement, the device switches to the safe voltage measurement range (0...32 V DC) and the output RESULT is set accordingly in the function block INPUT when the final value (23 mA for > 40 ms) is exceeded. After about one second the input automatically switches back to the current measuring range.

36702

Input group IN02, IN03, IN06, IN07

36690

These inputs are a group of multifunction channels.

These inputs can be used as follows (each input separately configurable):

• binary input plus switching (BL) for positive sensor signal

• input for resistance measurement (e.g. temperature sensors or fuel sensors)

→ chapter Possible operating modes inputs/outputs

(→ p. 220 )

Sensors with diagnostic capabilities to NAMUR can be evaluated.

► Configuration of each input is made via the application program:

• FB INPUT

(→ p. 175 ) > input MODE

15

ioControl CR2042, CR2052

>

Resistance measurement

Typical sensors on these inputs:

• tank level

• temperature (PT1000, NTC)

Figure: block diagram of the resistor survey input

In = pin resistor survey input n

(CR) = device

(1) = input filter

(2) = constant-current source

(3) = internal resistance

(4) = voltage

The resistance for this device is not linearly dependent on the resistance value, → figure:

9773

8972

8970

Figure: resolution dependent on the resistance value

(1) = resistance value at the input

(2) = resolution

By how many ohms does the measured value change when the signal of the A/D converter on the input changes by 1?

Examples:

• In the range of 1...100 

the resolution is 1.2

.

• In the range of 1 k 

the resolution is approx. 2

.

• In the range of 2 k 

the resolution is approx. 3

.

• In the range of 3 k 

the resolution is approx. 6

.

• In the range of 6 k 

the resolution is approx. 10

.

• In the range of 10 k 

the resolution is approx. 11

• In the range of 20 k 

the resolution is approx. 60

.

16

ioControl CR2042, CR2052

>

3.3.3

Outputs (technology)

Content

Protective functions of the outputs .........................................................................................................17

Output group OUT00...OUT03 ...............................................................................................................18

Output group OUT04...OUT07 ...............................................................................................................20

28572

Protective functions of the outputs

15248

>

The outputs of this device are protected against overload and short circuit within specific ranges.

→ data sheet

Definition: overload

28846

>

Overload can only be detected on an output with current measurement.

Overload is defined as ...

"a nominal maximum current of 12.5 %".

Definition: short circuit

35510

>

A short circuit can be detected on all outputs with diagnostic capabilities.

Diagnostics is possible in case of voltage feedback and current feedback.

A short circuit is defined as ...

"a drop of the output voltage below 93.5% (± 2.0% of the measured value) of the corresponding supply voltage."

> A ground fault can only be detected in case of output = TRUE.

Reaction of the outputs to overload or short circuit

15251

>

Self-protection of the output

35775

The hardware protects itself, irrespective of the operating mode of the output and of the fault detection. In case of a too high thermal load (caused by short circuit or overload), the output driver begins to clock.

The driver may be damaged in case of too long clocking of the output (several hours).

We therefore recommend: that you operate device outputs with diagnostic capabilities in the following mode, since, in this case, the software protects the drivers additionally by switching off:

• FB OUTPUT

(→ p. 184 ) > input MODE = 16

This is also the default setting if only the flags in the control configuration are used.

17

ioControl CR2042, CR2052

Reaction according to the operating mode of the output

>

In case of an overload or a short circuit, the behaviour of the output depends on its operating mode

( → function block OUTPUT

(→ p. 184 ) > input MODE):

MODE=2: binary output plus-switching: no diagnostics and no protection

> the output continues to operate.

MODE=15: binary output plus-switching with diagnostics

> Error is detected and signalled by the FB OUTPUT at the RESULT output: e.g.: RESULT = 128, 141, 142 or 145.

This depends on the type of output and the current or voltage at the output.

The programmer can react in the program to the error.

MODE=16: binary output plus-switching with diagnostics and protection

> Error is detected and signalled by the FB OUTPUT at the RESULT output.

> The respective output is switched off.

> The logic state of the output remains unaffected by this!

 Reboot: Switch output logically off and on!

35526

Reaction when using PWM or CURRENT_CONTROL

35785

>

The situation is different when the FBs PWM or CURRENT_CONTROL are used:

There is no diagnosis. The Self-protection of the output

(→ p. 17 ) becomes active.

► For outputs with current feedback:

Query the typical current for the output in the application program!

It is the responsibility of the programmer to react to the event.

Output group OUT00...OUT03

36686

These outputs are a group of multifunction channels.

These outputs provide several function options (each output separately configurable):

• binary output, plus switching (BH) with/without diagnostic function

• analogue current-controlled output (PWMi)

• analogue output with Pulse Width Modulation (PWM)

→ chapter Possible operating modes inputs/outputs

(→ p. 220 )

► Configuration of each output is made via the application program:

→ FB OUTPUT

(→ p. 184 )> input MODE

PWM output: → FB PWM1000

(→ p. 186 )

Current control and load current indication → FB CURRENT_CONTROL

(→ p. 182 )

► For the limit values please make sure to adhere to the data sheet!

18

ioControl CR2042, CR2052

>

Diagnosis: binary outputs (via current and voltage measurement)

19433

19434

The diagnostics of these outputs is made via internal current and voltage measurement in the output:

Figure: principle block diagram

(1) Output channel

(2a) Read back channel for diagnosis via current measuring

(2b) Read back channel for diagnosis via voltage measuring

(3) Pin output n

(4) Load

>

Diagnosis: overload (via current measurement)

19437

28851

>

Overload can only be detected on an output with current measurement.

Overload is defined as ...

"a nominal maximum current of 12.5 %".

>

Diagnosis: wire break (via voltage measurement)

19436

33415

Wire-break detection is done via the read back channel inside the output.

Prerequisite for diagnosis: output = FALSE

Diagnosis = wire break: the resistor Ru pulls the read back channel to HIGH potential (power supply)

Without the wire break the low-resistance load (RL < 10 kΩ) would force a

LOW (logical 0).

Diagnosis: short circuit (via voltage measurement)

Wire-break detection is done via the read back channel inside the output.

Prerequisite for diagnosis: output = TRUE

Diagnosis = short circuit against GND: the read back channel is pulled to LOW potential (GND)

28852

19

ioControl CR2042, CR2052

>

Output group OUT04...OUT07

36685

>

These outputs are a group of multifunction channels.

These outputs provide several function options (each output separately configurable):

• binary output, plus switching (BH) with/without diagnostic function

• analogue current-controlled output (PWMi)

• analogue output with Pulse Width Modulation (PWM)

→ chapter Possible operating modes inputs/outputs

(→ p. 220 )

► Configuration of each output is made via the application program:

→ FB OUTPUT

(→ p. 184 )> input MODE

PWM output: → FB PWM1000

(→ p. 186 )

Current control and load current indication → FB CURRENT_CONTROL

(→ p. 182 )

► For the limit values please make sure to adhere to the data sheet!

Diagnosis: binary outputs (via current and voltage measurement)

19433

19434

The diagnostics of these outputs is made via internal current and voltage measurement in the output:

Figure: principle block diagram

(1) Output channel

(2a) Read back channel for diagnosis via current measuring

(2b) Read back channel for diagnosis via voltage measuring

(3) Pin output n

(4) Load

>

Diagnosis: overload (via current measurement)

19437

28851

>

Overload can only be detected on an output with current measurement.

Overload is defined as ...

"a nominal maximum current of 12.5 %".

Diagnosis: wire break (via voltage measurement)

19436

33415

Wire-break detection is done via the read back channel inside the output.

Prerequisite for diagnosis:

Diagnosis = wire break: output = FALSE the resistor Ru pulls the read back channel to HIGH potential (power supply)

Without the wire break the low-resistance load (RL < 10 kΩ) would force a

LOW (logical 0).

20

ioControl CR2042, CR2052

>

Diagnosis: short circuit (via voltage measurement)

Wire-break detection is done via the read back channel inside the output.

Prerequisite for diagnosis: output = TRUE

Diagnosis = short circuit against GND: the read back channel is pulled to LOW potential (GND)

28852

21

ioControl CR2042, CR2052

3.3.4

Note on wiring

28579

The wiring diagrams ( → installation instructions of the devices, chapter "Wiring") describe the standard device configurations. The wiring diagram helps allocate the input and output channels to the IEC addresses and the device terminals.

The individual abbreviations have the following meaning:

A

BH

Analogue input

Binary high side input: minus switching for negative sensor signal

Binary high side output: plus switching for positive output signal

BL

CYL

ENC

FRQ

H bridge

PWM

PWMi

IH

IL

Binary low side input: plus switching for positive sensor signal

Binary low side output: minus switching for negative output signal

Input period measurement

Input encoder signals

Frequency input

Output with H-bridge function

P ulsew idth m odulated signal

PWM output with current measurement

Pulse/counter input, high side: minus switching for negative sensor signal

Pulse/counter input, low side: plus switching for positive sensor signal

R Read back channel for one output

>

Allocation of the input/output channels: → Catalogue, mounting instructions or data sheet

3.3.5

Safety instructions about Reed relays

28354

For use of non-electronic switches please note the following:

Contacts of Reed relays may be clogged (reversibly) if connected to the device inputs without series resistor.

► Remedy: Install a series resistor for the Reed relay:

Series resistor = max. input voltage / permissible current in the Reed relay

Example: 32 V / 500 mA = 64 Ohm

► The series resistor must not exceed 5 % of the input resistance RE of the device input  → data sheet). Otherwise, the signal will not be detected as TRUE.

Example:

RE = 3 000 Ohm

max. series resistor = 150 Ohm

28354

22

ioControl CR2042, CR2052

>

3.3.6

Indicators

Content

LEDs for input and output status ............................................................................................................23

Multifunction display ...............................................................................................................................24

36643

This device has several indicators:

LEDs for input and output status

36736

16 orange LEDs signal the status of the binary inputs and outputs:

OFF: status = FALSE

On: status = TRUE

7 8

IN03

IN07

OUT 07

OUT 03

5 6

IN02

IN06

OUT 06

OUT 02

3 4

IN01

IN05

OUT 05

OUT 01

1 2

IN00 OUT 04

IN04 OUT 00

Graphics: LEDs for input and output status

23

ioControl CR2042, CR2052

Multifunction display

Content

LED [PWR], power .................................................................................................................................24

LED [M], mode ........................................................................................................................................25

LED [A]...[D] ............................................................................................................................................25

LED [Lock] ..............................................................................................................................................25

LED [DIA], diagnostics ............................................................................................................................25

4-digit 10-segment display......................................................................................................................26

36631

PWR M A B C D DIA

2 = LED [Power], green

3 = LED [Mode], green

4 = Application LEDs, green

5 = LED [Lock], green

6 = LED [Diagnostics], red

7 = 4-digit 10-segment display, red/green

>

LED [PWR], power

The green LED [PWR] signals the system status.

LED colour Display

Permanently off

Description

No operating voltage

Off briefly on initialisation or reset checks

Green

Flashing with 5 Hz

(time frame = 200 ms) no runtime system loaded

Green

Flashing with 2 Hz

(time frame = 200 ms)

Application = RUN

Green

(time frame = 200 ms)

Permanently on Application = STOP

>

Green

With the FB SET_LED_PWR_DIA_4_10

(→ p. 211 ) in the application program it is possible to set a

different representation.

36630

24

ioControl CR2042, CR2052

LED [M], mode

>

The green LED [M] is at the disposal of the programmer.

→ FB SET_BAR

(→ p. 201 )

LED [A]...[D]

>

The 4 green LEDs [A]...[D] are at the disposal of the programmer.

→ FB SET_BAR

(→ p. 201 )

LED [Lock]

>

The green LED [Lock] is at the disposal of the programmer.

→ FB SET_BAR

(→ p. 201 )

LED [DIA], diagnostics

The red LED [DIA] signals the diagnostic status.

LED colour Display

Permanently off

Description

No operating voltage

Off briefly on initialisation or reset checks

Red

Red

Flashing with 10 Hz

(time frame = 200 ms)

Application = STOP with error application program is stopped

Cause: exceeded timeout of the application or visualisation:

Delete the application!

PowerOn reset

 Reload the application into the device

Flashing with 5 Hz

(time frame = 200 ms)

Application = stopped because of undervoltage

Red

Permanently on

(time frame = 200 ms)

System error (FATAL ERROR):

Application = STOP

Red

With the FB SET_LED_PWR_DIA_4_10

(→ p. 211 ) in the application program it is possible to set a

different representation.

36639

36636

36634

36635

25

ioControl CR2042, CR2052

>

4-digit 10-segment display

>

The 4-digit 10-segment display is at the disposal of the programmer. ifm provides the following function blocks: ifm_ioControl_Display_LED_Vxxyyzz.LIB

Represent a 4-digit character string: SET_DISPLAY_4_DIGIT

(→ p. 207 )

This POU displays the four left characters of the input character string.

Permissible characters = A...Z, a...z, 0...9, +, -, blank.

Selectable display colours = red, green, orange.

Represent an individual character: SET_DIGIT_TO_ALPHA

(→ p. 203 )

This POU displays a selectable character on a selectable digit.

Permissible characters = A...Z, a...z, 0...9, +, -, blank.

The points between the digits can be controlled.

Selectable display colours = red, green, orange.

Represent an individual number: SET_DIGIT_TO_NUM

(→ p. 205 )

This POU displays a selectable number on a selectable digit.

Permissible characters = 0...9.

The points between the digits can be controlled.

Selectable display colours = red, green, orange.

3.3.7

Operating elements

The following pushbuttons on the device are at the disposal of the programmer:

Pushbutton

Description

UP

Name in the program

Switch_S1

DOWN

ENTER

Switch_S2

Switch_S3

The pushbuttons are not debounced.

► Debounce the input signal with respect to software if required!

36644

36640

26

ioControl CR2042, CR2052

3.4

Interface description

Content

CAN interfaces .......................................................................................................................................27

28337

>

3.4.1

CAN interfaces

Content

CAN: interfaces and protocols ................................................................................................................27

28810

Connections and data → data sheet

CAN: interfaces and protocols

The devices are equipped with several CAN interfaces depending on the hardware design. Basically, all interfaces can be used with the following functions independently of each other:

• RAW-CAN (Layer 2): CAN on level 2 (→ chapter Function elements: RAW-CAN (Layer 2)

(→ p. 66 ))

• CANopen master / CANopen slave (→ chapter Function elements: CANopen

(→ p. 92 ))

• CANopen network variables (via CODESYS) (→ chapter Network variables

(

→ p. 58 ))

• SAE J1939 (for drive management, → chapter Function elements: SAE J1939

(→ p. 138 ))

• Bus load detection

• Error frame counter

• Download interface

• 100 % bus load without package loss

35809

The following CAN interfaces and CAN protocols are available in this ecomatmobile device:

35809

35809

CAN interface CAN 1 CAN 2 CAN 3 CAN 4

Default download ID

CAN protocols

ID 127

CAN Layer 2

CANopen

SAE J1939

ID 126

CAN Layer 2

CANopen

SAE J1939

ID 125

Interface does not exist

ID 124

Interface does not exist

Standard baud rate = 250 Kbits/s

All CAN interfaces can operate with all CAN protocols at the same time. The IDs used must not impair each other!

27

ioControl CR2042, CR2052

3.5

Software description

Content

Software modules for the device ............................................................................................................28

Programming notes for CODESYS projects ...........................................................................................31

Operating states .....................................................................................................................................34

Performance limits of the device ............................................................................................................37

28396

>

3.5.1

Software modules for the device

Content

Software modules on delivery as IO module ..........................................................................................28

Software modules for controller function ................................................................................................29

Bootloader ..............................................................................................................................................29

Runtime system ......................................................................................................................................29

Application program ................................................................................................................................29

Libraries ..................................................................................................................................................30

36600

The software in this device communicates with the hardware as below:

Software module Can the user change the module?

By means of what tool?

Application program with libraries yes

CODESYS 2.3,

MaintenanceTool

Runtime system *)

Bootloader

(Hardware)

Upgrade yes

Downgrade no no no

MaintenanceTool

---

---

*) The runtime system version number must correspond to the target version number in the CODESYS target system setting.

→ chapter Set up the target

(→ p. 43 )

Software modules on delivery as IO module

36597

On delivery, the "ioControl" devices have the following software modules:

Application program "BasicController Slave Application" to use the device as an IO module

Runtime system

28

ioControl CR2042, CR2052

>

Software modules for controller function

To use the device as a controller, the programmer must download and install a package from ifm electronic gmbh's website ( → www.ifm.com

):

For CR2042: ifm_CR2042_Vxxyyzz_Package_nnn.ZIP

For CR2052: ifm_CR2052_Vxxyyzz_Package_nnn.ZIP

This package consists of the following software modules:

Runtime system

(for installation on the device)

Version > V03.04.00

Configuration files

(to install the target under CODESYS 2.3 on the PC / laptop)

Libraries

(To program the application under CODESYS 2.3 on the PC / laptop)

>

In the following, we describe these software modules:

36612

Bootloader

36498

>

The boot loader is a start program that allows to reload the runtime system and the application program on the device.

The boot loader contains basic routines...

• for communication between hardware modules,

• for reloading the runtime system.

The boot loader is the first software module to be saved on the device.

Runtime system

36619

Basic program in the device, establishes the connection between the hardware of the device and the application program.

→ chapter Software modules for the device

(→ p. 28 )

On delivery, a runtime system is loaded on the device to use it as an IO module (CANopen slave).

To use the device as a controller, the corresponding runtime download must be executed once. The application program can then be loaded in the controller (also several times) without affecting the runtime system.

>

The runtime system can be downloaded from ifm electronic gmbh 's website:

→ www.ifm.com

Application program

28795

Software specific to the application, implemented by the machine manufacturer, generally containing logic sequences, limits and expressions that control the appropriate inputs, outputs, calculations and decisions.

28795

WARNING

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.

29

ioControl CR2042, CR2052

>

Libraries

35719 ifm electronic offers several libraries ( *.LIB

) to match each device containing program modules for the application program. Examples:

Library ifm_CR20n2_Vxxyyzz.LIB

Use ifm_RawCAN_NT_Vxxyyzz.LIB

ifm_CANopen_NT_Vxxyyzz.LIB

ifm_J1939_NT_Vxxyyzz.LIB

Device-specific library

Must always be contained in the application program!

(optional) when a CAN interface of the device is to be operated with CAN

Layer 2

(optional) when a CAN interface of the device is to be operated as

CANopen master or CANopen slave

(optional) when a CAN interface of the device is to communicate with a motor control

Details:

→ chapter ifm libraries for the device CR20n2

(→ p.

59 )

30

ioControl CR2042, CR2052

>

3.5.2

Programming notes for CODESYS projects

Content

FB, FUN, PRG in CODESYS .................................................................................................................31

Note the cycle time! ................................................................................................................................32

Creating application program .................................................................................................................33

Using ifm maintenance tool ....................................................................................................................34

Distribution of the application program ...................................................................................................34

28583

Here you receive tips how to program the device.

► See the notes in the CODESYS programming manual.

FB, FUN, PRG in CODESYS

35283

In CODESYS we differentiate between the following types of function elements:

FB = function block

• An FB can have several inputs and several outputs.

• An FB may be called several times in a project.

• An instance must be declared for each call.

• Permitted: Call FB and FUN in FB.

FUN = function

• A function can have several inputs but only one output.

• The output is of the same data type as the function itself.

PRG = program

• A PRG can have several inputs and several outputs.

• A PRG may only be called once in a project.

• Permitted: Call PRG, FB and FUN in PRG.

NOTE

Function blocks must NOT be called in functions!

Otherwise: During execution the application program will crash.

All function elements must NOT be called recursively, nor indirectly!

An IEC application may contain maximum 8000 function elements; in this device maximum 512 function elements!

Background:

All variables of functions...

• are initialised when called and

• become invalid after return to the caller.

Function blocks have 2 calls:

• an initialisation call and

• the actual call to do something.

Consequently that means for the function block call in a function:

• every time there is an additional initialisation call and

• the data of the last call gets lost.

31

ioControl CR2042, CR2052

>

Note the cycle time!

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 units use more or fewer system resources depending on their complexity it is not always possible to use all units at the same time and several times.

28578

NOTICE

Risk that the device 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.

32

ioControl CR2042, CR2052

>

Creating application program

28845

The application program is generated by the CODESYS 2.3 programming system and loaded in the controller several times during the program development for testing:

In CODESYS: [Online] > [Login] > load the new program.

For each such download via CODESYS 2.3 the source code is translated again. The result is that each time a new checksum is formed in the controller memory. This process is also permissible for safety controllers until the release of the software.

Graphics: Creation and distribution of the software

33

ioControl CR2042, CR2052

>

Using ifm maintenance tool

27717

The ifm Maintenance Tool 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 Maintenance Tool. Advantage: A programming system with CODESYS licence is not required.

>

Here you will find the current ifm Maintenance Tool:

Homepage → www.ifm.com

>

Distribution of the application program

35311

We recommend the following sequence, if the application software is to be copied to the series machine and used:

Saving the software

After completion of program development the latest version of the application program loaded in the controller using the ifm Maintenance Tool has to be read from the controller and saved on a data carrier using the name project_file.RESX

. Only this process ensures that the application software and its checksums are stored.

Download of the software.

To equip all machines of a series production with an identical software only this file may be loaded in the controllers using the ifm Maintenance Tool.

An error in the data of this file is automatically recognised by the integrated checksum when loaded again using the ifm Maintenance Tool.

3.5.3

Operating states

35979

>

After power on the ecomatmobile device can be in one of five possible operating states:

• BOOTLOADER

• INIT

• STOP

• RUN

• SYSTEM STOP

INIT status (reset)

36548

Condition: a valid runtime system is installed.

With each power-on reset the following procedure is carried out:

> The runtime system is initialised.

> Various checks are made, e.g. waiting for valid supply voltage.

>

This temporary state is replaced by the RUN or STOP state.

>

The LEDs [PWR] and [DIA] are briefly lit simultaneously.

A transition from this state into one of the following states is possible:

• RUN

• STOP

34

ioControl CR2042, CR2052

>

STOP state

A transition into this state is possible in the following cases:

• From the INIT state if no application program is loaded.

• From the RUN state if the following condition is met:

• The STOP command is sent via the CODESYS interface.

In the STOP state:

>

The outputs of the device are switched off.

> The processing of the application program has been stopped.

> The green LED [PWR] is on.

The red LED [DIA] is off.

>

A transition from this state into one of the following states is possible:

• RUN

• ERROR

• FATAL ERROR

• INIT (after power-on-reset)

RUN state

A transition into this state is possible in the following cases:

 from the INIT state (autostart) if the following conditions are met:

• The operating voltage has reached a minimum value. AND:

• The application program is available.

From the STOP state:

• via the CODESYS RUN command.

• The operating voltage has reached or exceeded a minimum value.

In the RUN state:

> The runtime system is running.

> The application program is running.

> The green LED [PWR] flashes at 2Hz.

The red LED [DIA] is off.

A transition from this state into one of the following states is possible:

• INIT (after power-on-reset)

• STOP

• ERROR

• FATAL ERROR

36611

36626

35

ioControl CR2042, CR2052

>

ERROR state

A transition into this state is possible in the following cases:

• if the supply voltage is too low.

In the ERROR state:

> The outputs of the device are off.

> The processing of the application program has been stopped.

>

System parameters are saved.

> The red LED [DIA] flashes at 5 Hz.

The green LED [PWR] is off.

>

A transition from this state into one of the following states is possible:

• RUN

• STOP

• FATAL ERROR

• INIT (after power-on-reset)

FATAL ERROR state

A transition into this state is possible in the following cases:

• Memory error (RAM / Flash)

• Exceptional error

• Runtime system error

In the FATAL ERROR state:

> The outputs of the device are switched off.

>

The application program is terminated.

> The runtime system is terminated.

> The red LED [DIA] is on.

The green LED [PWR] is off.

A transition from this state into one of the following states is possible:

• INIT (after power-on-reset)

36539

36542

36

> ioControl CR2042, CR2052

3.5.4

Performance limits of the device

Note the limits of the device! → Data sheet

>

Watchdog behaviour

A watchdog monitors the program runtime of the CODESYS application on this device.

If the maximum watchdog time (100 ms) is exceeded:

> the device changes to the "Timeout Error" state

> all processes are stopped (reset)

> all outputs are switched off

> the red LED [DIA] flashes at 10 Hz

> the green LED [PWR] is off

Eliminate the fault:

Delete the application program!

 PowerOn reset

 Reload the application program into the device

If the described watchdog fails:

> a second watchdog leads the device to the state "Fatal Error"

> the red LED [DIA] is on

> the green LED [PWR] is off

Eliminate the fault:

 PowerOn-Reset

If without success:

 Goto Bootloader

 PowerOn-Reset

 Reload the runtime system into the device

 Reload the application program into the device

If without success:

 Hardware error: send device back to ifm !

28571

36578

37

ioControl CR2042, CR2052

>

>

Limitations for CAN in this device

35727

FIFO ( F irst I n, F irst O ut) = Operating principle of the stack memory: The data packet that was written into the stack memory first, will also be read first. Each identifier has such a buffer (queue).

Some Raw-CAN function elements enable transmitting and receiving of several messages in one PLC cycle as the messages are temporarily stored in a FiFo:

- CAN_TX..., → Function elements: transmit RAW-CAN data

- CAN_RX_ENH_FIFO

(→ p. 76 )

- CAN_RX_RANGE_FIFO

(→ p. 80 )

The number of FIFo messages is limited. The following limitations of the devices are valid:

Device

Criterion

BasicController: CR040n, CR041n,

CR043n

BasicDisplay: CR045n ioControl: CR205n

SmartController: CR253n

PDM360 NG: CR108n, CR120n max. FiFo transmit

- with FB CAN_TX...

- with FB CAN_TX_ENH... max. FiFo receive

- with FB CAN_RX_..._FIFO

4 messages

16 messages

32 messages

4 messages

16 messages

32 messages

Limitations for CANopen in this device

35924

>

The following limitations of the devices are valid:

Device

Criterion

BasicController: CR040n, CR041n,

CR043n

BasicDisplay: CR045n ioControl: CR205n

SmartController: CR253n max. guarding error max. SDO data

32 messages

2 048 bytes

Limitations for CAN J1939 in this device

PDM360 NG: CR108n, CR120n

128 messages

2 048 bytes

35923

The following limitations of the devices are valid:

Device

Criterion

BasicController: CR040n, CR041n,

CR043n

BasicDisplay: CR045n ioControl: CR205n

SmartController: CR253n max. FiFo transmit

- with FB J1939_TX

- with FB J1939_TX_ENH max. FiFo receive

- with FB J1939_RX_FIFO max. DTCs max. data J1939

4 messages

16 messages

32 messages

64 messages

1 785 bytes

PDM360 NG: CR108n, CR120n

4 messages

16 messages

32 messages

64 messages

1 785 bytes

38

ioControl CR2042, CR2052

4 Configurations

Content

Set up the runtime system ......................................................................................................................39

Set up the programming system ............................................................................................................42

Function configuration in general ...........................................................................................................46

Function configuration of the inputs and outputs ...................................................................................47

Variables .................................................................................................................................................57

28785

The device configurations described in the corresponding installation instructions or in the Appendix (→

p. 217 ) 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.

4.1

Set up the runtime system

Content

Install the runtime system .......................................................................................................................40

Update the runtime system.....................................................................................................................41

Verify the installation ..............................................................................................................................41

28320

39

> ioControl CR2042, CR2052

4.1.1

Install the runtime system

36531

→ chapter Software modules for the device

(→ p. 28 )

Normally it is necessary to download the runtime system only once. The application program can then be loaded to the device (also several times) without affecting the runtime system.

The runtime system can be downloaded from ifm electronic gmbh 's website:

→ www.ifm.com

36531

NOTICE

Risk of data loss!

In case of power failure during the data transmission data can be lost so that the device is no longer functionable. Repair is only possible by ifm electronic .

► Ensure an uninterrupted power supply during the data transmission!

36531

NOTE

The software versions suitable for the selected target must always be used:

• runtime system ( ifm_CR20n2_Vxxyyzz.RESX

),

• PLC configuration ( ifm_CR20n2_Vxx.CFG

),

• device library ( ifm_CR20n2_Vxxyyzz.LIB

) and

• the further files.

V xx: 00...99 yy: 00...99 zz: 00...99 version target version number release number patch number

The basic file name (e.g. " CR20n2 ") and the software version number "xx" (e.g. " 01 ") must always have the same value! Otherwise the device goes to the STOP mode.

The values for "yy" (release number) and "zz" (patch number) do not have to match.

36531

The following files must also be loaded:

• the internal libraries (created in IEC 1131) required for the project,

• the configuration files ( *.CFG

) and

• the target files ( *.TRG

).

It may happen that the target system cannot or only partly be programmed with your currently installed version of CODESYS. In such a case, please contact the technical support department of ifm electronic gmbh .

Contact → www.ifm.com

The runtime system is transferred to the device using the independent program "Maintenance Tool".

This program can be downloaded from the ifm website:

→ www.ifm.com

Usually, the application program is loaded via the programming system to the device. However, it can also be loaded using "Maintenance Tool" if it was first read from the device.

40

> ioControl CR2042, CR2052

4.1.2

Update the runtime system

28404

An older runtime system is already installed on the device. Now, you would like to update the runtime system on the device?

28404

NOTICE

Risk of data loss!

When deleting or updating the runtime system all data and programs on the device are deleted.

► Save all required data and programs before deleting or updating the runtime system!

>

For this operation, the same instructions apply as in the previous chapter 'Reinstall the runtime system'.

4.1.3

Verify the installation

► After loading of the runtime system into the controller:

• Check whether the runtime system was transmitted correctly!

• Check whether the correct runtime system is loaded in the controller!

► 1st test:

Test with the ifm maintenance tool if the correct runtime system version was loaded:

• Read name and version of the runtime system in the device!

• Manually compare this information with the target data!

► 2nd test (optional):

Check in the application program if the correct runtime system version was loaded:

• read name and version of the runtime system in the device!

• Compare this data with the specified values!

The following FB serves for reading the data:

GET_SW_INFO

(→ p. 194 )

Delivers information about the system software of the device:

• software name,

• software version,

• build number,

• build date

► If the application detects an incorrect version of a runtime system: bring all safety functions into the safe state.

35017

41

ioControl CR2042, CR2052

4.2

Set up the programming system

Content

Set up the programming system manually .............................................................................................42

Set up the programming system via templates ......................................................................................46

35802

4.2.1

Set up the programming system manually

Content

Set up the target .....................................................................................................................................43

Activate the PLC configuration ...............................................................................................................44

CAN declaration (e.g. CR1080) ..............................................................................................................45

28307

42

ioControl CR2042, CR2052

>

Set up the target

35782

35782

When creating a new project in CODESYS the target file corresponding to the device must be loaded.

► Select the requested target file in the dialogue window [Target Settings] in the menu

[Configuration].

> The target file constitutes the interface to the hardware for the programming system.

> At the same time, several important libraries and the PLC configuration are loaded when selecting the target.

► If necessary, in the window [Target settings] > tab [Network functionality] > activate [Support parameter manager] and / or activate [Support network variables].

► If necessary, remove the loaded (3S) libraries or complement them by further (ifm) libraries.

► Always complement the appropriate device library ifm_CR20n2_Vxxyyzz.LIB

manually!

35782

NOTE

The software versions suitable for the selected target must always be used:

• runtime system ( ifm_CR20n2_Vxxyyzz.RESX

),

• PLC configuration ( ifm_CR20n2_Vxx.CFG

),

• device library ( ifm_CR20n2_Vxxyyzz.LIB

) and

• the further files.

V xx: 00...99 yy: 00...99 zz: 00...99 version target version number release number patch number

The basic file name (e.g. " CR20n2 ") and the software version number "xx" (e.g. " 01 ") must always have the same value! Otherwise the device goes to the STOP mode.

The values for "yy" (release number) and "zz" (patch number) do not have to match.

35782

The following files must also be loaded:

• the internal libraries (created in IEC 1131) required for the project,

• the configuration files ( *.CFG

) and

• the target files ( *.TRG

).

It may happen that the target system cannot or only partly be programmed with your currently installed version of CODESYS. In such a case, please contact the technical support department of ifm electronic gmbh .

Contact → www.ifm.com

43

ioControl CR2042, CR2052

>

Activate the PLC configuration

35713

The PLC configuration is automatically loaded with the target system. The PLC configuration maps the contents of the file CR20n2.cfg in CODESYS. Like this, the programmer has easy access to predefined system and error flags, inputs and outputs as well as to the CAN interfaces of the device.

To access the PLC configuration (e.g. CR1080):

► Click on the tab [Resources] in CoDeSys:

► Double-click on [PLC Configuration] in the left column.

>

Display of the current PLC configuration (

following figure):

> Based on the configuration the following is available in the program environment for the user:

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.

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].

44

ioControl CR2042, CR2052

>

CAN declaration (e.g. CR1080)

35422

In the CODESYS PLC configuration you now have to declare the CAN interface(s).

► Right-click on the name of the PLC configuration. [CANopen Interface [FIX]] of the desired CAN interface.

► Click on [Append Subelement].

► Even if the device is operated as a CANopen slave: Click on [CANopen Master...]:

Info

If the device is operated as a slave, the selection [CanSlave_Device] would also be possible.

For the simpler configuration as a master, all CAN Layer 2 and network variable functions can also be used.

> The CAN parameters of the PLC configuration are displayed. Some CAN parameters are already set as default:

► If the device is operated on CAN Layer 2 or as a slave via network variables or CAN_RX /

CAN_TX:

Check whether the correct baud rate is set for the device (baud rate must be identical for all participants).

► If the device is operated as a CANopen master:

Check all parameter settings.

► Close the window [PLC Configuration].

45

ioControl CR2042, CR2052

>

► In the menu [File] > [Save as ...] give a sensible name to the project and save it in the requested directory.

► In the application program always call an own instance of the FB CANOPEN_ENABLE

(→ p. 93 )

for every CAN interface!

4.2.2

Set up the programming system via templates

28325 ifm offers ready-to-use templates (program templates), by means of which the programming system can be set up quickly, easily and completely.

28325

>

When installing the ecomatmobile DVD "Software, tools and documentation", projects with templates have been stored in the program directory of your PC:

…\ifm electronic\CoDeSys V…\Projects\Template_DVD_V…

► 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.

4.3

Function configuration in general

28350

>

4.3.1

System variables

All system variables ( → chapter System flags

(→ p. 217 )) have defined addresses which cannot be

shifted.

28414

46

ioControl CR2042, CR2052

>

4.4

Function configuration of the inputs and outputs

Content

Configuration of the inputs and outputs (default setting) ........................................................................47

Configure inputs .....................................................................................................................................48

Configure outputs ...................................................................................................................................53

7995

35755

For some devices of the ecomatmobile controller family, additional diagnostic functions can be activated for the inputs and outputs. So, the corresponding input and output signal can be monitored and the application program can react in case of a fault.

Depending on the input and output, certain marginal conditions must be taken into account when using the diagnosis:

► It must be checked by means of the data sheet if the device used has the described input and output groups ( → data sheet).

Constants are predefined (e.g. IN_DIGITAL_H) in the device libraries ( ifm_CR20n2_Vxxyyzz.LIB

) for the configuration of the inputs and outputs.

For details → Possible operating modes inputs/outputs

(→ p. 220 ).

4.4.1

Configuration of the inputs and outputs (default setting)

All inputs and outputs are in the binary mode (plus switching!) when delivered.

The diagnostic function is not active.

The overload protection is active.

28792

47

ioControl CR2042, CR2052

>

4.4.2

Configure inputs

Content

Safety instructions about Reed relays ....................................................................................................48

Analogue inputs: configuration and diagnosis ........................................................................................49

Binary inputs: configuration and diagnosis .............................................................................................51

Fast inputs ..............................................................................................................................................52

28784

Valid operating modes → chapter Possible operating modes inputs/outputs

(→ p. 220 )

Safety instructions about Reed relays

28354

For use of non-electronic switches please note the following:

Contacts of Reed relays may be clogged (reversibly) if connected to the device inputs without series resistor.

► Remedy: Install a series resistor for the Reed relay:

Series resistor = max. input voltage / permissible current in the Reed relay

Example: 32 V / 500 mA = 64 Ohm

► The series resistor must not exceed 5 % of the input resistance RE of the device input  → data sheet). Otherwise, the signal will not be detected as TRUE.

Example:

RE = 3 000 Ohm

max. series resistor = 150 Ohm

28354

48

ioControl CR2042, CR2052

>

Analogue inputs: configuration and diagnosis

35685

Configuration of each input is made via the application program:

• FB INPUT

(→ p. 175 ) > input MODE

► If the analogue inputs are configured for current measurement, the device switches to the safe voltage measurement range (0...32 V DC) and the output RESULT is set accordingly in the function block INPUT when the final value (23 mA for > 40 ms) is exceeded. After about one second the input automatically switches back to the current measuring range.

As an alternative, an analogue channel can also be evaluated binarily.

35685

In = pin multifunction input n

(CR) = device

(1) = input filter

(2) = analogue current measuring

(3a) = binary-input plus switching

(3b) = binary-input minus switching

(4a) = analogue voltage measuring 0...10 V

(4b) = analogue voltage measuring 0...32 V

(5) = voltage

(6) = reference voltage

Figure: principle block diagram multifunction input

49

ioControl CR2042, CR2052

>

Configure the software filters of the inputs

35752

Via the input FILTER in the FB INPUT

(→ p. 175 ) a software filter can be configured which filters the

measured input voltage at the analogue inputs.

The filter behaves like a low-pass filter; the filter frequency is set with the value entered in FILTER. For

FILTER, values from 0...8 are permitted.

Table: limit frequency software low-pass filter at the analogue input

FILTER Filter frequency [Hz]

0…70 %

Step response [ms] for ...

0…90 % 0…99 %

Remarks

3

4

5

6

7

0

1

2

Filter deactivated

120

47

22

10

5

2.5

1.2

10

19

38

2

5

77

154

8 0.7 308 589

The following statements of the step response are relevant:

• Input analogue: 0...90 % and 0...99 %

• Input binary: 0...70 %

18

36

73

4

9

147

294

7

17

35

72

146

293

588

1177 recommended

Figure: course of time binary signal at the input upon switch-on / switch-off

50

ioControl CR2042, CR2052

>

>

Binary inputs: configuration and diagnosis

36482

Configuration of each input is made via the application program:

• FB INPUT

(→ p. 175 ) > input MODE

MODE BYTE Operating mode of input channel:

0 = 0x00 off

1 = 0x01

(only for inputs with binary evaluation) binary input, plus-switching (BL)

3 = 0x03 voltage input

6 = 0x06 voltage input, ratiometric

7 = 0x07 current input

9 = 0x09 voltage input

0…10 000 mV

0...1 000 ‰

0…20 000 µA

0…32 000 mV

10 = 0x0A

11 = 0x0B

(only for inputs with analogue evaluation) binary input, plus-switching (BL)

(only for inputs with analogue evaluation) binary input, plus-switching (BL) with diagnostic

(Namur)

12 = 0x0C binary input, minus-switching (BH)

18 = 0x12 Resistance input 16…30 000 Ω

Activation of the input diagnosis

35688

If the diagnosis is to be used, it needs to be activated additionally.

► Set the mode of the input via input MODE of the function block INPUT

(→ p. 175 ).

> The FB INPUT

(→ p. 175 ) provides the diagnostic messages of the inputs on its RESULT output.

NAMUR diagnosis for binary signals of non-electronic switches:

► Equip the switch with an additional resistor connection!

Figure: non-electronic switch S at input Inn

Sensors with diagnostic capabilities to NAMUR can be used on these inputs.

In this case, no additional resistor connection is required.

51

ioControl CR2042, CR2052

>

Fast inputs

35691

The devices dispose of fast counting/pulse inputs for an input frequency up to 30 kHz ( → data sheet).

14677

If, for example, mechanical switches are connected to these inputs, there may be faulty signals in the controller due to contact bouncing.

Appropriate function blocks are e.g.:

FASTCOUNT

(→ p. 171 )

INC_ENCODER

(→ p. 173 )

PERIOD

(→ p. 178 )

Counter block for fast input pulses

Up/down counter function for the evaluation of encoders

Measures the frequency and the cycle period (cycle time) in [µs] at the indicated channel

>

When using these units, the parameterised inputs and outputs are automatically configured, so the programmer of the application does not have to do this.

Use as binary inputs

3804

The permissible high input frequencies also ensure the detection of faulty signals, e.g. bouncing contacts of mechanical switches.

► If required, suppress the faulty signals in the application program!

52

ioControl CR2042, CR2052

>

4.4.3

Configure outputs

Content

Configure the software filters of the outputs ...........................................................................................53

Binary outputs: configuration and diagnosis...........................................................................................54

PWM outputs ..........................................................................................................................................55

28788

Valid operating modes → chapter Possible operating modes inputs/outputs

(→ p. 220 )

Configure the software filters of the outputs

36013

Via the input FILTER in the FB OUTPUT

(→ p. 184 ) a software filter can be configured which filters the

measured output current at the PWM outputs.

The FILTER byte is only valid for outputs with current measurement.

For outputs without current measurement: set FILTER = 0!

The current at the output is averaged over a PWM period.

If dithering is set, the current is averaged over the dither period.

The filter behaves like a low-pass filter; the limit frequency is set by the value entered in FILTER. For

FILTER, values from 0...8 are permitted.

Table: limit frequency software low-pass filter on PWM output

FILTER Filter frequency [Hz]

0…90 %

Step response [ms] for ...

0…95 % 0…99 %

Remarks

0

1

6

7

4

5

2

3

Filter deactivated

600

233

109

52

26

13

6

0.8

1.8

3.6

7.2

14.6

29.4

58.8

1.0

2.2

4.6

9.4

19.0

38.2

76.4

8 4 117.8 153.2

The following statements of the step response are relevant:

• Output current: 0...90 % and 0...99 %

1.4

3.4

7.0

14.4

29.2

58.6

117.6

235.4 outputs without current measurement recommended

>

Figure: time sequence binary current signal on output upon switch-on / switch-off

53

ioControl CR2042, CR2052

Binary outputs: configuration and diagnosis

The following operating modes are possible for the device outputs ( → data sheet):

• binary output, plus switching (BH) with/without diagnostic function

35708

35708

Qn = pin output n

(L) = load

Basic circuit of output plus switching (BH) for positive output signal

► Configuration of each output is made via the application program:

→ FB OUTPUT

(→ p. 184 )> input MODE.

35708

WARNING

Dangerous restart possible!

Risk of personal injury! Risk of material damage to the machine/plant!

If in case of a fault an output is switched off via the hardware, the logic state generated by the application program is not changed.

► Remedy:

• Reset the output logic in the application program!

• Remove the fault!

• Reset the outputs depending on the situation.

>

Configuration of the output diagnosis

If the diagnosis is to be used, it needs to be activated additionally.

► If using the output as binary output with diagnosis (→ data sheet):

→ FB OUTPUT > input MODE = 15 or 18

>

The FB

OUTPUT

(→ p. 184 ) provides the diagnostic messages of the outputs on its RESULT

output.

35744

54

ioControl CR2042, CR2052

>

PWM outputs

The following operating modes are possible for the device outputs ( → data sheet):

• PWM output, plus switching (BH) without diagnostic function

• PWM output pair H-bridge without diagnostic function

36067

36067

Qn = pin output n

(L) = load

Basic circuit of output plus switching (BH) for positive output signal

16253

WARNING

Property damage or bodily injury possible due to malfunctions!

For outputs in PWM mode:

• There are no diagnostic functions

9980

NOTE

PWM outputs must NOT be operated in parallel, e.g. in order to increase the max. output current. The outputs do not operate synchronously.

Otherwise the entire load current could flow through only one output. The current measurement would no longer function.

>

PWM outputs can be operated with and without current control function.

Current-controlled PWM outputs are mainly used for triggering proportional hydraulic functions.

The medium current across a PWM signal can only be correctly determined via the FB

CURRENT_CONTROL

(→ p. 182 ) if the current flowing in the switched-on state is within the

measuring range.

Availability of PWM

Device

Number of available

PWM outputs of which current-controlled

(PWMi)

36670

PWM frequency

[Hz] ioControl CR2041, CR2051 ioControl CR2042, CR2052

16

8

8

8

20...250

20...250

55

ioControl CR2042, CR2052

>

FBs for PWM functions

36001

>

The following function blocks are available for the PWM function of the outputs:

CURRENT_CONTROL

(→ p. 182 )

PWM1000

(→ p. 186 )

Current controller for a PWMi output channel

Initialises and configures a PWM-capable output channel the mark-to-space ratio can be indicated in steps of 1 ‰

Current control with PWM (= PWMi)

14722

Current measurement of the coil current can be carried out via the current measurement channels integrated in the controller. This way, the current can for example be re-adjusted if the coil heats up.

The hydraulic conditions in the system are maintained.

In principle, the current-controlled outputs are protected against short circuit.

56

ioControl CR2042, CR2052

4.5

Variables

Content

Retain variables ......................................................................................................................................57

Network variables ...................................................................................................................................58

28318

In this chapter you will learn more about how to handle variables.

28318

The device supports the following types of variables:

Declaration place Validity area Variable local local retain global global retain in the declaration part of the function element (POU)

Only valid in the function element

(POU) where it was configured.

In [Resources] > [Global Variables] >

[Globale_Variables]:

Valid in all function elements of this

CODESYS project.

Memory behaviour volatile nonvolatile volatile nonvolatile

Network

Network retain

In [Resources] > [Global Variables] > declaration list

Values are available to all CODESYS projects in the whole network if the variable is contained in its declaration lists. volatile nonvolatile

>

4.5.1

→ CODESYS programming manual

Retain variables

Retain variables can be saved automatically in a protected memory area and be reloaded automatically during a reboot.

Typical applications for retain variables are for example:

• operating hours which are counted up and retained while the machine is in operation,

• position values of incremental encoders,

• preset values entered in the monitor,

• machine parameters, i.e. all variables whose values must not get lost when the device is switched off.

All variable types, also complex structures (e.g. timers), can be declared as retain.

► To do so, activate the control field [RETAIN] in the variable declaration (→ window).

35182

35182

57

ioControl CR2042, CR2052

>

Save retain variables

35034

In the device the data type RETAIN is only stored in the volatile memory (RAM) during the runtime.

To save the data permanently, at the end of each cycle they are automatically be saved in the FRAM memory ¹).

¹) FRAM indicates here all kinds of non-volatile and fast memories.

NOTE

>

In this device, do NOT use the following functions from the 3S library SysLibPlcCtrl.lib

:

- FUN SysSaveRetains

- FUN SysRestoreRetains

Read back retain variables

35229

After power on and before the first program cycle the device automatically writes the saved data back to the working memory once. To do so, no additional FBs must be integrated into the application program.

NOTE

>

In this device, do NOT use the following functions from the 3S library SysLibPlcCtrl.lib

:

- FUN SysSaveRetains

- FUN SysRestoreRetains

4.5.2

Network variables

15242

35116

Global network variables are used for data exchange between controllers in the network. The values of global network variables are available to all CODESYS projects in the whole network if the variables are contained in their declaration lists.

► Integrate the following library/libraries into the CODESYS project:

 3S_CANopenNetVar.lib

 ifm_NetVarLib_NT_Vxxyyzz.lib

58

ioControl CR2042, CR2052

5 ifm function elements

Content

ifm libraries for the device CR20n2 ........................................................................................................59

ifm function elements for the device CR20n2.........................................................................................64

28394

All CODESYS function elements (FBs, PRGs, FUNs) are stored in libraries. Below you will find a list of all the ifm libraries you can use with this device.

This is followed by a description of the function elements, sorted by topic.

5.1

ifm libraries for the device CR20n2

>

Content

Bibliothek ifm_CR20n2_V01yyzz.LIB .....................................................................................................59

Bibliothek ifm_ioControl_Display_LED_Vxxyyzz.LIB .............................................................................60

Library ifm_RAWCan_NT_Vxxyyzz.LIB .................................................................................................61

Library ifm_CANopen_NT_Vxxyyzz.LIB .................................................................................................61

Library ifm_J1939_NT_Vxxyyzz.LIB ......................................................................................................63

28323

5.1.1

Bibliothek ifm_CR20n2_V01yyzz.LIB

36713

This is the device library.This ifm library contains the following function blocks:

Function element Short description

CURRENT_CONTROL

(→ p. 182 )

FASTCOUNT

(→ p. 171 )

FLASH_INFO

(→ p. 189 )

FLASH_READ

(→ p. 190 )

GET_APP_INFO

(→ p. 191 )

GET_HW_INFO

(→ p. 192 )

GET_IDENTITY

(→ p. 193 )

GET_SW_INFO

(→ p. 194 )

GET_SW_VERSION

(→ p. 195 )

Current controller for a PWMi output channel

Counter block for fast input pulses

Reads the information from the user flash memory:

• name of the memory area (user defined),

• software version,

• start address (for simple reading with IEC structure) transfers different data types directly from the flash memory to the RAM

Delivers information about the application program stored in the device:

• name of the application,

• version of the application,

• unique CODESYS build number,

• CODESYS build date

Delivers information about the device hardware:

• ifm article number (e.g. CR0403),

• article designation,

• unambiguous serial number,

• hardware revision,

• production date

Reads the identification of the application stored in the device

(has previously been saved by means of SET_IDENTITY

(→ p. 208 ))

Delivers information about the system software of the device:

• software name,

• software version,

• build number,

• build date

Delivers information about the software versions stored in the device:

• BasicSystem version,

• bootloader version,

• SIS version,

• application program version,

• user flash version

59

ioControl CR2042, CR2052

Function element

INC_ENCODER

(→ p. 173 )

INPUT

(→ p. 175 )

MEM_ERROR

(→ p. 196 )

MEMCPY

(→ p. 197 )

OHC

(→ p. 199 )

OUTPUT

(→ p. 184 )

PERIOD

(→ p. 178 )

PWM1000

(→ p. 186 )

SET_IDENTITY

(→ p. 208 )

SET_LED

(→ p. 209 )

SET_PASSWORD

(→ p. 213 )

TIMER_READ_US

(→ p. 214 )

Short description

Up/down counter function for the evaluation of encoders

Assigns an operating mode to an input channel

Provides the current state of the selected channel

Signals errors in some parameters or in the memory

(Re-)initialisation of system resources

Writes and reads different data types directly in the memory

Adjustable operating hours counter (0...3)

Assigns an operating mode to an output channel

Provides the current state of the selected channel

Measures the frequency and the cycle period (cycle time) in [µs] at the indicated channel

Initialises and configures a PWM-capable output channel the mark-to-space ratio can be indicated in steps of 1 ‰

Sets an application-specific program identification

Change the frequency and color of the status LED in the application program

Sets a user password for access control to program and memory upload

Reads out the current system time in [µs]

Max. value = 1h 11min 34s 967ms 295µs

>

5.1.2

Bibliothek ifm_ioControl_Display_LED_Vxxyyzz.LIB

This ifm library contains the following function blocks:

Function element Short description

SET_BAR

(→ p. 201 )

SET_DIGIT_TO_ALPHA

(→ p. 203 )

SET_DIGIT_TO_NUM

(→ p. 205 )

SET_DISPLAY_4_DIGIT

(→ p. 207 )

SET_LED_PWR_DIA_4_10

(→ p. 211 )

controls in the application program a bar of green LEDs on the multifunction display indicates a selectable character on a selectable digit of the 4-digit 10-segment display.

Permissible characters = A...Z, a...z, 0...9, +, -, blank indicates a selectable character on a selectable digit of the 4-digit 10-segment display.

Permissible characters = 0...9 indicates the first 4 characters (from the left) of a character string on the 4-digit 10-segment display.

Permissible characters = A...Z, a...z, 0...9, +, -, blank can control the following LEDs on the multifunction display in the application program, by circumventing the system configuration:

• green LED [PWR], power

• red LED [DIA], diagnostic

36483

60

> ioControl CR2042, CR2052

>

5.1.3

Library ifm_RAWCan_NT_Vxxyyzz.LIB

35715

This ifm library contains the following function blocks:

Function element

CAN_ENABLE

(→ p. 67 )

CAN_RECOVER

(→ p. 68 )

CAN_REMOTE_REQUEST

(→ p. 89 )

CAN_REMOTE_RESPONSE

(→ p. 90 )

CAN_RX

(→ p. 73 )

CAN_RX_ENH

(→ p. 74 )

CAN_RX_ENH_FIFO

(→ p. 76 )

CAN_RX_RANGE

(→ p. 78 )

CAN_RX_RANGE_FIFO

(→ p. 80 )

CAN_SETDOWNLOADID

(→ p. 69 )

CAN_STATUS

(→ p. 70 )

CAN_TX

(→ p. 83 )

CAN_TX_ENH

(→ p. 84 )

CAN_TX_ENH_CYCLIC

(→ p. 86 )

Short description

Initialises the indicated CAN interface

Configures the CAN baud rate

Activate / deactivate the automatic bus off handling

Restart the CAN interface in case of bus off

Send a corresponding request and return the response of the other device as a result

Provides data to the CAN controller in the device which is automatically sent as a response to the request of a remote message

Configures a data receive object and reads out the receive buffer of the data object

• Configures a data receive object and reads out the receive buffer of the data object

• Frame type and mask can be selected

• Configures a data receive object and reads out the receive buffer of the data object

• Frame type and mask can be selected

• Several CAN messages per cycle possible

• Configures a range of data receive objects and reads out the receive buffer of the data objects

• Frame type and mask can be selected

• Configures a range of data receive objects and reads out the receive buffer of the data objects

• Frame type and mask can be selected

• Several CAN messages per cycle possible

= Set CAN download ID

Sets the download identifier for the CAN interface

Get status information on the CAN bus selected:

BAUDRATE, DOWNLOAD_ID, BUSOFF, WARNING_RX, WARNING_TX, VERSION, BUSLOAD and reset if required: BUSOFF, WARNING_RX, WARNING_TX

Transfers a CAN data object (message) to the configured CAN interface for transmission at each call

Transfers a CAN data object (message) to the configured CAN interface for transmission at each call

CAN-specific characteristics can be set

Cyclically transfers a CAN data object (message) to the configured CAN interface for transmission

CAN-specific characteristics can be set

5.1.4

Library ifm_CANopen_NT_Vxxyyzz.LIB

35712

This ifm library contains the following function blocks:

Function element

CANOPEN_ENABLE

(→ p. 93 )

CANOPEN_GETBUFFERFLAGS

(→ p. 95 )

CANOPEN_GETEMCYMESSAGES

(→ p. 132 )

CANOPEN_GETERRORREGISTER

(→ p. 134 )

Short description

Initialises the indicated CANopen master interface

Configures the CAN baud rate

= CANopen get buffer flags

Provides information on the buffer flags

The flags can be reset via the optional inputs.

= Get CANopen emergency messages

Lists all emergency messages that have been received by the controller from other nodes in the network since the last deletion of messages

The list can be reset by setting the according input.

= Get CANopen error register

Reads the error registers 0x1001 and 0x1003 from the controller

The registers can be reset by setting the respective inputs.

61

ioControl CR2042, CR2052

Function element

CANOPEN_GETGUARDHBERRLIST

CANOPEN_GETGUARDHBSTATSLV

(→ p. 129 )

CANOPEN_GETNMTSTATESLAVE

CANOPEN_GETODCHANGEDFLAG

CANOPEN_GETSTATE

CANOPEN_GETSYNCSTATE

CANOPEN_NMTSERVICES

CANOPEN_READOBJECTDICT

CANOPEN_SDOREAD

CANOPEN_SDOREADBLOCK

(→ p. 113 )

CANOPEN_SDOREADMULTI

(→ p. 115 )

CANOPEN_SDOWRITE

(→ p. 117 )

CANOPEN_SDOWRITEBLOCK

(→ p. 119 )

CANOPEN_SDOWRITEMULTI

CANOPEN_SENDEMCYMESSAGE

CANOPEN_SETSTATE

(→ p.

111

)

(→ p.

(→ p.

(→ p.

CANOPEN_SETSYNCSTATE

97

)

(→ p.

(→ p.

(→ p.

99

CANOPEN_WRITEOBJECTDICT

(→ p.

)

103

(→ p.

(→ p.

(→ p.

124

)

121

126

(→ p.

)

107

)

)

108

)

)

128

102

(→ p. 106

136 )

)

)

)

Short description

= get CANopen guard and heartbeat error list

Lists all nodes in an array for which the master has detected an error: guarding error, heartbeat error

The list can be reset by setting the according input.

= CANopen slave get guard and heartbeat state

Signals the following states to the controller in slave operation: node guarding monitoring, heartbeat monitoring

The signalled errors can be reset by setting the respective input.

= CANopen slave get network management state

Signals the network operating status of the node

= Get object directory changed flag

Reports any change of value for a particular object directory entry

= CANopen set state

Request the parameters of the master, a slave device or a specific node in the network

= CANopen get SYNC state

• Reads the setting of the SYNC functionality (active / not active),

• reads the error state of the SYNC functionality (SyncError)

= CANopen network management services

Updates the internal node status and, depending on the NMT command entries:

• triggers an NMT command or

• triggers the initialisation of a node

= CANopen read object directory

Reads configuration data from the object directory of the device

= CANopen read SDO

Reads an "Expedited SDO" = Expedited Service Data Object

= CANopen read SDO block

Reads the indicated entry in the object directory of a node in the network via SDO block transfer

= CANopen read SDO multi

Reads the indicated entry in the object directory of a node in the network

= SDO write

Writes an "Expedited SDO" = Expedited Service Data Object

= CANopen write SDO block

Writes in the indicated entry in the object directory of a node in the network via SDO block transfer

= CANopen write SDO multi

Writes in the indicated entry in the object directory of a node in the network

= CANopen send emergency message

Sends an EMCY message. The message is assembled from the according parameters and entered in register 0x1003

= CANopen set state

Set the parameters of the master, a slave device or a specific node in the network

= CANopen set SYNC state

Switch the SYNC functionality on and off

= CANopen write object directory

Writes configuration data into the object directory of the device

62

> ioControl CR2042, CR2052

5.1.5

Library ifm_J1939_NT_Vxxyyzz.LIB

35714

This ifm library contains the following function blocks:

Function element

J1939_DM1RX

(→ p. 163 )

J1939_DM1TX

(→ p. 165 )

J1939_DM1TX_CFG

(→ p. 168 )

J1939_DM3TX

(→ p. 169 )

J1939_ENABLE

(→ p. 139 )

J1939_GETDABYNAME

(→ p. 141 )

J1939_NAME

(→ p. 143 )

J1939_RX

(→ p. 150 )

J1939_RX_FIFO

(→ p. 151 )

J1939_RX_MULTI

(→ p. 153 )

J1939_SPEC_REQ

(→ p. 147 )

J1939_SPEC_REQ_MULTI

(→ p. 148 )

J1939_STATUS

(→ p. 145 )

J1939_TX

(→ p. 155 )

J1939_TX_ENH

(→ p. 156 )

J1939_TX_ENH_CYCLIC

(→ p. 158 )

J1939_TX_ENH_MULTI

(→ p. 160 )

Short description

J1939 Diagnostic Message 1 RX

Receives diagnostic messages DM1 or DM2 from other ECUs

J1939 Diagnostic Message 1 TX

Transmit an active error message to the CAN stack

J1939 Diagnostic Message 1 TX configurable

CAN stack does not send cyclic DM1 "zero active faults" messages

J1939 Diagnostic Message 3 TX

Deletes inactive DTCs (DM2) on a device

Initialises the J1939 stack

= Get destination arbitrary name

Determine the target address of one or several participants by means of the name information

Give the device a name for identification in the network

Receives a single frame message

Shows the message last read on the CAN bus

= J1939 RX with FIFO

Receives all specific messages and successively reads them from a FiFo

= J1939 RX multiframe message

Receives multiframe messages

= J1939 specific request

Requests and receives a specific message from another controller

= J1939 specific request multiframe message

Requests and receives a specific multiframe message from another controller

Shows relevant information on the J1939 stack

Sends individual single frame messages

= J1939 TX enhanced

Sends individual single frame messages

Can also be set: transmission priority, data length

= J1939 TX enhanced cyclic

Cyclically sends single frame messages

Can also be set: transmission priority, data length, period

= J1939 TX enhanced Multiframe Message

Sends individual multiframe messages

63

ioControl CR2042, CR2052

5.2

ifm function elements for the device CR20n2

Content

Function element outputs .......................................................................................................................65

Function elements: RAW-CAN (Layer 2) ...............................................................................................66

Function elements: CANopen ................................................................................................................92

Function elements: SAE J1939 ............................................................................................................138

Function elements: processing input values ........................................................................................170

Function elements: output functions .....................................................................................................181

Function elements: system ...................................................................................................................188

13988

28309

Here you will find the description of the ifm function elements suitable for this device, sorted by topic.

64

> ioControl CR2042, CR2052

5.2.1

Function element outputs

Some function elements return a RESULT message.

Possible results for RESULT:

Value dec | hex

Description

0 00

15

241

242

247

250

252

253

7

8

14

5

6

1

4

255

1...31

32

10

...63

64

10

…127

128

10

...255

238 EE

239

240

EF

F0

F1

F2

F7

FA

FC

FD

07

08

0E

01

04

05

06

0F

FF

FB is inactive

Global return values; examples:

FB execution completed without error

– data is valid

FB is being processed – data is cyclically processed

FB is being processed

– still receiving

FB is being processed – still sending

FB is being processed – remote for ID active function block is active

FB is active

CANopen manager configures devices and sends SDOs

FB is active

CANopen manager is started

FB specific return values

FB specific error messages

Global error messages; examples:

Error: CANopen configuration is too large and cannot be started

Error: CANopen manager could not be started

Error: several modal inputs are active e.g. CANopen NTM services

Error: CANopen state transition is not permitted

Error: setting is not possible

Error: memory exceeded (length larger than array)

Error: FiFo is full – data was lost

Error: CAN multiframe transmission failed

Error: CAN transmission failed.

Data cannot be sent.

Error: not enough memory available for the consuming multiframe

8354

35758

65

ioControl CR2042, CR2052

5.2.2

Function elements: RAW-CAN (Layer 2)

Content

Function elements: RAW-CAN status ....................................................................................................66

Function elements: receive RAW-CAN data ..........................................................................................72

Function elements: transmit RAW-CAN data .........................................................................................82

Function elements: RAW-CAN remote ...................................................................................................88

35756

Here we describe the RAW-CAN function blocks (CAN Layer 2) of ifm electronic to be used in the application program.

Function elements: RAW-CAN status

Content

CAN_ENABLE ........................................................................................................................................67

CAN_RECOVER ....................................................................................................................................68

CAN_SETDOWNLOADID ......................................................................................................................69

CAN_STATUS ........................................................................................................................................70

35750

66

ioControl CR2042, CR2052

CAN_ENABLE

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35432

>

Description

>

With CAN_ENABLE the CAN hardware is initialised. Without this call no other calls are possible in

RAW-CAN or they return an error.

In order to change the baud rate the following procedure is required:

► Maintain the function block on ENABLE=FALSE for the duration of one cycle.

> All protocols are reset.

> Re-initialisation of the CAN interface and the CAN protocols running on it. Any information available for cyclical transmission is lost as well and must be newly created.

> At renewed ENABLE=TRUE, the new baud rate is adopted.

35407

Parameters of the inputs

35231

Parameter

ENABLE

CHANNEL

BAUDRATE

Data type

BOOL := FALSE

BYTE

WORD := 250

Description

TRUE: enable CAN interface

FALSE: disable CAN interface

CAN interface (1...n) depending on the device

Baudrate [kbits/s] permissible = 20, 50, 100, 125, 250, 500, 1000

>

Parameters of the outputs

35103

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

8

01

08

FB is inactive

FB execution completed without error – data is valid function block is active

9

242

09

F2

CAN is not active

Error: setting is not possible

67

ioControl CR2042, CR2052

CAN_RECOVER

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35435

>

Description

35366

CAN_RECOVER has the following tasks:

 to activate / deactivate the automatic bus off handling

 to restart the CAN interface in case of bus off

> In case of bus off: CAN Controller deletes all buffers (including the buffers of the other protocols).

>

If CAN_RECOVER is not used (ENABLE=FALSE):

> in case of a bus off a recovery attempt is automatically made after 1 s.

> after 4 failed recovery attempts in a row the affected CAN interface is deactivated.

Parameters of the inputs

35241

Parameter

ENABLE

CHANNEL

RECOVER_EXECUTE

Data type

BOOL := FALSE

BYTE

BOOL

TIME := T#1s

Description

TRUE: No automatic recovery after CAN bus off

FALSE: Automatic recovery after CAN bus off

CAN interface (1...n) depending on the device

TRUE (only for 1 cycle): restart of CAN interface remedy bus off condition

FALSE: function element is not executed

Waiting time between bus off and restart of the CAN interface InhibitTime

(optional use of the parameter)

68

ioControl CR2042, CR2052

CAN_SETDOWNLOADID

= Set download ID

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35077

>

Description

>

35373

The download ID is required for data exchange when connecting the runtime system and the

CODESYS development environment. When the device is started the download ID is set with the default value from the hardware configuration.

With CAN_SETDOWNLOADID this value can be set in the PLC program (e.g. using certain inputs).

The changed ID is also written into the hardware configuration.

Parameters of the inputs

35242

Parameter

EXECUTE

CHANNEL

DOWNLOAD_ID

Data type

BOOL := FALSE

BYTE

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

1...127 = set download ID

0 = read download ID

>

Parameters of the outputs

35090

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

242

01

08

F2 function block execution completed without error function block is active

Error: setting is not possible

69

ioControl CR2042, CR2052

CAN_STATUS

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35064

>

Description

>

CAN_STATUS provides information on the chosen CAN bus.

Without hardware initialisation the following flags can be reset to FALSE:

- BUSOFF

- WARNING_RX

- WARNING_TX

Parameters of the inputs

Parameter

ENABLE

CHANNEL

CLEAR

Data type

BOOL := FALSE

BYTE

BOOL := FALSE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

TRUE: Reset the following flags:

• WARNING_RX

• WARNING_TX

• BUSOFF

FALSE: function element is not executed

35367

35228

70

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

BAUDRATE

DOWNLOAD_ID

BUSOFF

WARNING_RX

WARNING_TX

VERSION

BUSLOAD

RESULT

Data type

WORD

BYTE

BOOL

BOOL

BOOL

DWORD

BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

8

9

0

1

242

00

01

08

09

F2

FB is inactive function block execution completed without error function block is active

CAN is not active

Error: setting is not possible

Description current baudrate of the CANopen node in [kBaud] current download ID

Error CAN BUS OFF at the interface

Warning threshold for receiving is exceeded at the interface

Warning threshold for transmitting is exceeded at the interface

Version of the ifm CAN stack library

Current bus load in [%] feedback of the function block

(possible messages → following table)

35094

71

ioControl CR2042, CR2052

Function elements: receive RAW-CAN data

Content

CAN_RX .................................................................................................................................................73

CAN_RX_ENH .......................................................................................................................................74

CAN_RX_ENH_FIFO .............................................................................................................................76

CAN_RX_RANGE ..................................................................................................................................78

CAN_RX_RANGE_FIFO ........................................................................................................................80

35705

72

ioControl CR2042, CR2052

CAN_RX

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35412

>

Description

35369

>

CAN_RX is used for receiving a message.

The FB limits itself to a few functions and the required memory space is low.

CAN_RX filters for the set identifier. If several CAN messages with the same identifier are received in one cycle, only the last / latest message is available.

Parameters of the inputs

35221

Parameter

ENABLE

CHANNEL

ID

Data type

BOOL

BYTE

DWORD

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF

>

Parameters of the outputs

35096

Parameter

DATA

RESULT

Data type

ARRAY [0..7] OF BYTE

BYTE

Description received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

5

9

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

73

ioControl CR2042, CR2052

CAN_RX_ENH

= CAN RX enhanced

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35415

>

Description

In addition, CAN_RX_ENH provides the following possibilities (as opposed to CAN_RX

(→ p. 73 )):

• select the frame type (11 or 29 bits),

• define a mask for the evaluation of the CAN ID.

35364

Bit comparison of

ID and mask:

If ID_MASK-Bit = 0, then CAN-ID-Bit may be = 0 or 1.

If ID_MASK-Bit = 1, then CAN-ID-Bit must be = ID-Bit.

>

With the mask several identifiers can be defined as filters.

Example:

ID = 0x100 = 0b0001 0000 0000

Result

ID_MASK = 0x1F1 = 0b0001 1111 0001

The CAN IDs with the following bit pattern are evaluated:

0bxxx1 0000 xxx0 (x = any), i.e. for this example (all in [hex]):

100, 102, 104, 106, 108, 10A, 10C, 10E,

300, 302, 304, 306, 308, 30A, 30C, 30E,

500, 502, 504, 506, 508, 50A, 50C, 50E,

700, 702, 704, 706, 708, 70A, 70C, 70E

Parameters of the inputs

35227

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

ID_Mask

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

BOOL := FALSE

DWORD := 0

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1) filter mask for the identifier: if ID_MASK bit = 0, CAN ID bit may be = 0 or 1 if ID_MASK bit = 1, CAN ID bit must be = ID bit

74

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

MATCHED_ID

DATALENGTHCOUNT

DATA

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

Description number of the data object identifier

= Data Length Count number of the data bytes received received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

34987

75

ioControl CR2042, CR2052

CAN_RX_ENH_FIFO

= CAN RX enhanced with FiFo

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35434

>

Description

35359

In addition, CAN_RX_ENH_FIFO provides a FiFo for the received data (as opposed to CAN_RX_ENH

(→ p. 74 )). Thus several CAN messages can be received in one cycle.

No overwriting takes place when the FiFo is full. Inbound messages will be lost.

>

In this event:

► Deactivate and reactive the FB via ENABLE.

>

The FiFo is deleted and can be newly filled.

Description to the filter mask: → CAN_RX_ENH

(→ p. 74 ) > chapter

Description

Parameters of the inputs

35227

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

ID_Mask

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

BOOL := FALSE

DWORD := 0

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1) filter mask for the identifier: if ID_MASK bit = 0, CAN ID bit may be = 0 or 1 if ID_MASK bit = 1, CAN ID bit must be = ID bit

76

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

MATCHED_ID

DATALENGTHCOUNT

DATA

MORE_DATA_AVAILABLE

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BOOL

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

250

00

01

05

09

F2

FA

FB is inactive function block execution completed without error

FB is being processed

– still receiving

CAN is not active

Error: setting is not possible

Error: FiFo is full – data was lost

Description number of the data object identifier

= Data Length Count number of the data bytes received received data, (1...8 bytes)

TRUE: further received data available in the FiFo

FALSE: no further data available in the FiFo feedback of the function block

(possible messages → following table)

34990

77

ioControl CR2042, CR2052

CAN_RX_RANGE

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35413

>

Description

35368

CAN_RX_RANGE provides the following settings:

 select the message type (11 or 29 bits),

 define an identifier range.

>

CAN_RX filters for the set identifier. If several CAN messages with the same identifier are received in one cycle, only the last / latest message is available.

Parameters of the inputs

35226

Parameter

ENABLE

CHANNEL

ID_START

ID_STOP

Extended

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

DWORD

BOOL := FALSE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device start number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF end number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

78

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

ID

DATALENGTHCOUNT

DATA

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

Description

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF

= Data Length Count number of the data bytes received received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

34989

79

ioControl CR2042, CR2052

CAN_RX_RANGE_FIFO

= CAN RX range with FiFo

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35066

>

Description

CAN_RX_RANGE_FIFO basically works like CAN_RX_RANGE

(→ p. 78 ).

In addition, CAN_RX_RANGE_FIFO provides a FiFo for the received data. Thus several CAN messages can be received in one cycle.

No overwriting takes place when the FiFo is full. Inbound messages will be lost.

>

In this event:

► Use ENABLE to deactivate and reactivate the function.

> The FiFo is deleted and can be newly filled.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

ID_START

ID_STOP

Extended

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

DWORD

BOOL := FALSE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device start number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF end number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

35370

35226

80

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

ID

DATALENGTHCOUNT

DATA

MORE_DATA_AVAILABLE

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BOOL

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

250

00

01

05

09

F2

FA

FB is inactive function block execution completed without error

FB is being processed

– still receiving

CAN is not active

Error: setting is not possible

Error: FiFo is full – data was lost

Description

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF

= Data Length Count number of the data bytes received received data, (1...8 bytes)

TRUE: further received data available in the FiFo

FALSE: no further data available in the FiFo feedback of the function block

(possible messages → following table)

34984

81

ioControl CR2042, CR2052

Function elements: transmit RAW-CAN data

Content

CAN_TX..................................................................................................................................................83

CAN_TX_ENH ........................................................................................................................................84

CAN_TX_ENH_CYCLIC .........................................................................................................................86

35711

82

ioControl CR2042, CR2052

CAN_TX

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35067

>

Description

35372

CAN_TX sends a standard message per cycle.

The FB limits itself to a few functions and the required memory space is low.

> If an instance of this FB is called several times during a cycle, the data is also sent several times.

>

In case of the simple functions CAN_TX and CAN_RX, it is determined by means of the ID whether a standard or an extended frame is to be sent. With the enhanced versions this is set via the input

EXTENDED. Therefore, extended frames in the ID area 0...2047 cannot be sent via the easy functions.

Parameters of the inputs

35243

Parameter

ENABLE

CHANNEL

ID

Data type

BOOL

BYTE

DWORD

ARRAY [0..7] OF BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF data to be sent (1...8 bytes)

>

DATA

Parameters of the outputs

35093

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

242

250

00

01

F2

FA

FB is inactive function block execution completed without error

Error: setting is not possible

Error: FiFo is full – data was lost

83

ioControl CR2042, CR2052

CAN_TX_ENH

= CAN TX enhanced

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35078

>

Description

35347

>

Additional setting options are offered through CAN_TX_ENH (for: enhanced). Here, all CAN specific characteristics can be set individually, e.g.:

Is it an 11 or a 29 bit identifier?

The additional inputs can be preset so that CAN_TX

(→ p. 83 ) is not required.

> If an instance of this FB is called several times during a cycle, the data is also sent several times.

Parameters of the inputs

35557

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

DATALENGTHCODE

DATA

Data type

BOOL := FALSE

BYTE

DWORD

BOOL := FALSE

BYTE

ARRAY [0..7] OF BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

= Data Length Code number of the data bytes to be sent (0...8) data to be sent (1...8 bytes)

84

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

242

250

01

F2

FA function block execution completed without error

Error: setting is not possible

Error: FiFo is full – data was lost

35093

85

ioControl CR2042, CR2052

CAN_TX_ENH_CYCLIC

= CAN TX enhanced cyclic

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35073

>

Description

35346

CAN_TX_ENH_CYCLIC serves for cyclical transmitting of CAN messages.

Otherwise, the FB corresponds to CAN_TX_ENH

(→ p. 84 ).

► Set the period duration via the parameter PERIOD.

>

If a period is too short, this could lead to a high bus load which could affect the performance of the complete system.

Parameters of the inputs

35240

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

DataLengthCode

(optional use of the parameter)

DATA

PERIOD

Data type

BOOL

BYTE

DWORD

BOOL := FALSE

BYTE := 8

ARRAY [0..7] OF BYTE

TIME

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1) length of the data to be sent (0...8 bytes) data to be sent (1...8 bytes) period duration

86

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

9

242

250

0

1

8

00

01

08

09

F2

FA

FB is inactive

FB execution completed without error

– data is valid function block is active

CAN is not active

Error: setting is not possible

Error: FiFo is full – data was lost

35095

87

ioControl CR2042, CR2052

Function elements: RAW-CAN remote

Content

CAN_REMOTE_REQUEST ...................................................................................................................89

CAN_REMOTE_RESPONSE.................................................................................................................90

35757

88

ioControl CR2042, CR2052

CAN_REMOTE_REQUEST

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35438

>

Description

>

In order to request a remote message, an according requirement is dispatched via

CAN_REMOTE_REQUEST and the response of the other device is sent back as result.

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

ID

>

Extended

(optional use of the parameter)

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

DWORD

BOOL := FALSE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

35362

35220

34983

Parameter

DATALENGTHCOUNT

DATA

RESULT

Data type

BYTE

ARRAY [0..7] OF BYTE

BYTE

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

5

9

242

01

05

09

F2 function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

Description

= Data Length Count number of the data bytes received received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

89

ioControl CR2042, CR2052

CAN_REMOTE_RESPONSE

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35433

>

Description

35365

CAN_REMOTE_RESPONSE provides data to the CAN controller in the device which is automatically sent upon the request of a remote message.

This FB strongly depends on the device type. Only a limited number of remote messages can be set up:

BasicController: CR040n, CR041n, CR043n

BasicDisplay: CR045n max. 40 remote messages

>

PDM360 NG: CR108n, CR120n max. 100 remote messages

Parameters of the inputs

35738

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

DATALENGTHCODE

DATA

Data type

BOOL := FALSE

BYTE

DWORD

BOOL := FALSE

BYTE

ARRAY [0..7] OF BYTE

Description

TRUE: execute this function element

Edge: enter the new values

FALSE: unit is not executed reset internal remote values

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

= Data Length Code number of the data bytes to be sent (0...8) data to be sent (1...8 bytes)

90

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

8

10

242

0

6

7

08

0A

F2

00

06

07

FB is inactive

FB is being processed

– remote for ID not active

FB is being processed – remote for ID active function block is active no further remote entrys available

Error: setting is not possible

34996

91

ioControl CR2042, CR2052

5.2.3

Function elements: CANopen

Content

Function elements: CANopen status ......................................................................................................92

Function elements: CANopen network management ...........................................................................101

Function elements: CANopen object directory .....................................................................................105

Function elements: CANopen SDOs ....................................................................................................110

Function elements: CANopen SYNC ...................................................................................................123

Function elements: CANopen guarding ...............................................................................................127

Function elements: CANopen emergency ............................................................................................131

35751

For CANopen, ifm electronic provides a number of function elements which will be explained in the following.

Function elements: CANopen status

Content

CANOPEN_ENABLE ..............................................................................................................................93

CANOPEN_GETBUFFERFLAGS ..........................................................................................................95

CANOPEN_GETSTATE .........................................................................................................................97

CANOPEN_SETSTATE .........................................................................................................................99

35741

92

ioControl CR2042, CR2052

CANOPEN_ENABLE

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35076

>

Description

35343

CANOPEN_ENABLE allows to switch the CANopen master on or off.

► In the application program always call an own instance of the FB CANOPEN_ENABLE

(→ p. 93 )

for every CAN interface!

To avoid guarding or heartbeat errors the nodes must be "shut down" via an appropriate sequence first.

If the master is restarted after a stop, all other connected nodes also have to be re-initialised.

>

Without CANOPEN_ENABLE, the CANopen master is started automatically, as far as this has been selected in the configuration.

The configured baud rate is only adopted if CAN_ENABLE

(→ p. 67 ) has not been activated before.

Parameters of the inputs

35162

Parameter

ENABLE

CHANNEL

Baud rate

(optional use of the parameter)

Data type

BOOL := TRUE

BYTE

WORD := 0

Description

TRUE:

• Enable CANopen for the selected channel

• Start CANopen manager or CANopen device

according to the configuration settings

FALSE:

• Disable CANopen for the selected channel

• Terminate CANopen manager or CANopen device

CAN interface (1...n) depending on the device

Baud rate [kbits/s] permissible values = 20, 50, 100, 125, 250, 500, 800, 1 000

0 = use setting from the PLC configuration

93

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameters

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

14

15

238

239

242

00

01

0E

0F

EE

EF

F2

FB is inactive function block execution completed without error

FB is active

CANopen manager configures devices and sends SDOs

FB is active

CANopen manager is started

Error: CANopen configuration is too large and cannot be started

Error: CANopen manager could not be started

Error: setting is not possible

35009

94

ioControl CR2042, CR2052

CANOPEN_GETBUFFERFLAGS

= Get buffer flags

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35079

>

Description

CANOPEN_GETBUFFERFLAGS supplies information on the buffer flags.

The flags can be reset via the optional inputs.

>

The function block returns the state of the overflow flags.

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

ResetRXFlags

(optional use of the parameter)

ResetTXFlags

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BOOL := FALSE

BOOL := FALSE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

TRUE: Provide fag status at the output and then reset

FALSE: function element is not executed

TRUE: Provide flag status at the output and then reset

FALSE: function element is not executed

35340

35146

95

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RXOVFL

RXWARN

TXOVFL

TXWARN

RESULT

Data type

BOOL

BOOL

BOOL

BOOL

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error function block not yet executed

Error: setting is not possible

Description condition of the RX overflow flag

TRUE: overflow in the receive buffer

FALSE: no overflow in receive buffer condition of the RX overflow warning flag

TRUE: level in the receive buffer is critical

FALSE: level in the input buffer is uncritical condition of the TX overflow flag

TRUE: overflow in the transmit buffer

FALSE: no overflow in transmit buffer

Condition of the TX overflow warning flag

TRUE: Level in the transmit buffer is critical

FALSE: Level in the transmit buffer is uncritical feedback of the function block

(possible messages → following table)

35056

96

ioControl CR2042, CR2052

CANOPEN_GETSTATE

= Get state

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35070

>

Description

35339

>

Via CANOPEN_GETSTATE, parameters of the master, a slave device or a specific node in the network can be set.

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

NODE

Data type

BOOL := FALSE

BYTE

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

Node ID = ID of the node (0...127)

Device as CANopen master:

Value = 0:

Only the status information of the device itself is returned at the outputs. The outputs with information on the nodes are invalid.

Value not 0:

Node ID of a node in the network. For this one as well as for the device the states are returned at the outputs.

Device as CANopen slave:

Value = 0 (preset):

The status information of the slave is returned at the outputs.

Value not 0: no action

35178

97

ioControl CR2042, CR2052

>

Parameters of the outputs

35057

Parameter

MASTERSTATE

PLCNODEID

PLCBAUDRATE

PLCVERSION

CANSTATE

NODESTATE

LASTNODESTATE

RESULT

Data type

BYTE

BYTE

DWORD

DWORD

BYTE

BYTE

BYTE

BYTE

Description

Master state = internal state of the master:

0 = 0x00 = master starts up

4 = 0x04 = node configuration running

5 = 0x05 = normal operating state of the master

255 = 0xFF = PLC running as slave

PLC node ID = node ID of the PLC the program is running on

Value = 0...127 = 0x00...0x7F

Baudrate of the PLC

PLC version

Status of the CANopen network

Device operated as master:

Node ID = 0 (device as such):

0 = 0x00 = OK

128 = 0x80 = BUSOFF

Node ID ≠ 0 (node):

0 = 0x00 = OK

1 = 0x01 = guard or heartbeat error on node

128 = 0x80 = BUSOFF

Device operated as slave:

0 = 0x00 = OK

1 = 0x01 = guard or heartbeat error

128 = 0x80 = BUSOFF

Node state = internal node state of a slave seen from the master's perspective. The input NODEID identifies the node.

-1 = 0xFF = reset after ResetNode

1 = 0x01 = waiting for BOOTUP

2 = 0x02 = after receipt of the BOOTUP message

3 = 0x03 = not yet configured: STOPPED

4 = 0x04 = after configuration with SDOs: PRE-OPERATIONAL

5 = 0x05 = after starting the node: OPERATIONAL

97 = 0x61 = optional node

98 = 0x62 = other device type configured than in 0x1000

99 = 0x63 = node guarding

Last Node State

Node state according to CANopen (with these values the status is also coded in the corresponding messages with regard to the node).

0

4

5

127

0x00 BOOTUP

0x04 STOPPED

0x05 OPERATIONAL

0x7F PRE-OPERATIONAL feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

8

01

08

FB is inactive

FB execution completed without error – data is valid

FB is active – not yet processed

242 F2 Error: setting is not possible

98

ioControl CR2042, CR2052

CANOPEN_SETSTATE

= Set state

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35382

>

Description

35344

Via CANOPEN_SETSTATE, parameters of the master, a slave device or a node in the network can be set.

The treatment of the NMT state of master, node or device is carried out in the CAN stack or via the commands of the FB

CANOPEN_NMTSERVICES

(→ p. 103 ). At the same time admissibility checks are

carried out. For reasons of consistency no inputs are provided for this purpose.

99

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

NODE

GlobalStart

(optional use of the parameter)

CfgTimeout

(optional use of the parameter)

InitNoSdos

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE

BOOL := TRUE

TIME := T#0ms

BOOL := FALSE

35165

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

Node ID = ID of the node (0...127)

Device as CANopen master:

Value = 0:

The changes only refer to the device itself.

Value not 0:

Node ID of a node in the network the parameters of which are to be changed. The established settings are only adopted for this node (not for the device).

Device as CANopen slave:

In slave mode, the node ID of the slave can be set via this input.

Value = 0: no action

Value not 0:

The function block adopts this value as the new node ID of the device.

Requirement: FB must be called immediately after starting the IEC program. This setting overwrites the setting of the configuration.

TRUE: Start all participants simultaneously

FALSE: Start all participants one after the other set configuration timeout for a node:

Value = 0: no action – retain configuration data

Value not 0: overwrite data from the configuration with the new value

To the node indicated in NODE, during initialisation,...

TRUE: do not send configuration data

FALSE: send configured SDOs

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive

FB execution completed without error – data is valid

FB is active – not yet processed

Error: setting is not possible

35060

100

ioControl CR2042, CR2052

Function elements: CANopen network management

Content

CANOPEN_GETNMTSTATESLAVE ...................................................................................................102

CANOPEN_NMTSERVICES ................................................................................................................103

35754

101

ioControl CR2042, CR2052

CANOPEN_GETNMTSTATESLAVE

= Get network management state slave

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35416

>

Description

>

► Only use the FB if the device is operated as CANopen slave!

With CANOPEN_GETNMTSTATESLAVE, only the operating state according to CANopen and an error message are reported to the application if an invalid state transition has been requested.

35345

Parameters of the inputs

35164

Parameter

EXECUTE

Data type

BOOL := FALSE

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

>

CHANNEL

Parameters of the outputs

35061

Parameter

NMTSTATE

RESULT

Data type

BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error

FB is active – not yet processed

Error: setting is not possible

Description

Network operating status of the node

0 = INIT

1 = OPERATIONAL

2 = PRE-OPERATIONAL

3 = STOPPED feedback of the function block

(possible messages → following table)

102

ioControl CR2042, CR2052

CANOPEN_NMTSERVICES

= Network management services

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35068

>

Description

Depending on its NMT command entries, CANOPEN_NMTSERVICES either triggers an NMT command or the initialisation of a node.

NMT = N etworkM anagemen T

The function block updates the internal node status. If a state transition to CANopen ( → system manual "Know-How ecomat mobile " >

NMT state

) should not be permitted, the command is not executed.

>

A CANopen device can automatically change its CANopen state by means of the FB: preoperational  operational

Parameters of the inputs

35354

35163

Parameter

EXECUTE

CHANNEL

NODE

NMTSERVICE

Timeout

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE

BYTE

TIME := T#0ms

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

CANopen ID of the node permissible = 0...127 = 0x00...0x7F

NODE = 0: command applies to all nodes in the network

NODE = Node ID of the device: command applies to the device as such network command

0 = init node (except master)

1 = enter PRE-OPERATIONAL

2 = start node

3 = reset node

4 = reset communication

5 = stop node waiting time of the FB for the initialisation when the time has elapsed, the FB stops waiting.

0 = use value from the configuration

103

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

35

36

37

43

241

242

24

25

2B

F1

F2

01

08

23 function block execution completed without error function block is active at least 1 SDO of the configuration was not successful node was already initialised when initialisation was requested the node was not in the PRE-OPERATIONAL mode master / slave is not initialised

Error: CANopen state transition is not permitted

Error: setting is not possible

35062

104

ioControl CR2042, CR2052

Function elements: CANopen object directory

Content

CANOPEN_GETODCHANGEDFLAG .................................................................................................106

CANOPEN_READOBJECTDICT .........................................................................................................107

CANOPEN_WRITEOBJECTDICT .......................................................................................................108

35759

105

ioControl CR2042, CR2052

CANOPEN_GETODCHANGEDFLAG

= Get object directory changed flag

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35071

>

Description

35332

>

CANOPEN_GETODCHANGEDFLAG reports any change of value for a particular object directory entry.

Parameters of the inputs

35167

Parameter

EXECUTE

>

CHANNEL

IDX

SUBIDX

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

WORD

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device index in object directory sub-index referred to the index in the object directory

35074

Parameter

DATA

RESULT

Data type

DWORD

BYTE

Description parameter value feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error

FB is active – not yet processed

Error: setting is not possible

106

ioControl CR2042, CR2052

CANOPEN_READOBJECTDICT

= Read object directory

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35375

>

Description

35331

>

CANOPEN_READOBJECTDICT reads up to 4 bytes of configuration data from the object directory of the device for use in the application program.

Parameters of the inputs

35177

Parameter

EXECUTE

>

CHANNEL

IDX

SUBIDX

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

WORD

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device index in object directory sub-index referred to the index in the object directory

35055

Parameter

DATA

RESULT

Data type

DWORD

BYTE

Description parameter value feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

8

40

242

00

01

08

28

F2

FB is inactive function block execution completed without error function block not yet executed object directory entry is invalid

Error: setting is not possible

107

ioControl CR2042, CR2052

CANOPEN_WRITEOBJECTDICT

= Write object directory

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35399

>

Description

CANOPEN_WRITEOBJECTDICT writes configuration data to the object directory of the controller.

35330

>

NOTICE

This could lead to falsification of important system settings, e.g.:

- guarding times

- heartbeat times

► Carefully verify input parameters!

Parameters of the inputs

35147

Parameter

EXECUTE

CHANNEL

IDX

SUBIDX

DATA

Data type

BOOL := FALSE

BYTE

WORD

BYTE

DWORD

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device index in object directory sub-index referred to the index in the object directory parameter value

108

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

8

40

242

00

01

08

28

F2

FB is inactive function block execution completed without error function block not yet executed object directory entry is invalid

Error: setting is not possible

35048

109

ioControl CR2042, CR2052

Function elements: CANopen SDOs

Content

CANOPEN_SDOREAD ........................................................................................................................111

CANOPEN_SDOREADBLOCK ............................................................................................................113

CANOPEN_SDOREADMULTI .............................................................................................................115

CANOPEN_SDOWRITE ......................................................................................................................117

CANOPEN_SDOWRITEBLOCK ..........................................................................................................119

CANOPEN_SDOWRITEMULTI ...........................................................................................................121

28407

Here you will find ifm function elements for CANopen handling of Service Data Objects (SDOs).

110

ioControl CR2042, CR2052

CANOPEN_SDOREAD

= SDO read

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35378

>

Description

35342

CANOPEN_SDOREAD is an easy function block for editing "Expedited SDOs", i.e. SDOs with max.

4 bytes of user data. This type usually represents the bigger part of the SDO communication.

>

Expedited SDO = Expedited Service Data Object

A considerable amount of memory space can be saved due to the limitation of the data volume to max. 4 bytes of user data, as this FB only needs to reserve 4 bytes as buffer storage and does not create a large data array itself.

Parameters of the inputs

35161

Parameter

EXECUTE

CHANNEL

NODE

IDX

SUBIDX

Timeout

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE

WORD

BYTE

TIME := T#10ms

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

ID of the node permissible values = 1...127 = 0x01...0x7F index in object directory sub-index referred to the index in the object directory waiting time of the FB for the response when the time has elapsed, the FB stops waiting. value = 0: use value from the configuration

111

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

LEN

DATA

RESULT

Data type

BYTE

DWORD

BYTE

Description number of the bytes received (1...4) the received data value (up to 4 bytes) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

5

32

33

01

05

20

21

FB is inactive

FB execution completed without error – data is valid

FB is active

– no data received yet

SDO transmission aborted by client or server

(SDO abort code 0x80)

TIMEOUT elapsed

242

255

F2

FF

Error: setting is not possible buffer overflow

– too many data bytes were received

35008

112

ioControl CR2042, CR2052

CANOPEN_SDOREADBLOCK

= SDO Read Block

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35381

>

Description

35363

CANOPEN_SDOREADBLOCK reads the indicated entry in the object directory of a node in the network via SDO block transfer.

>

If the node doesn't support block transfer, the FB automatically changes to "segmented transfer".

You can also directly change to "segmented transfer" via the input.

>

The COB ID for the SDO is calculated from the transmitted node ID.

The length of multiframe SDOs is generally not limited.

For systems without a file system (e.g. BasicController CR04nn) the following applies:

► transmit an address to the FB which is accessed by the pointer for writing. The memory area determined by the start address DATA and the amount of data MAX_LEN must be available!

> If the amount of data is greater than indicated, the transfer is stopped and signalled via RESULT.

For systems with a file system (e.g. PDM360NG CR108n) the following applies:

► transmit the path and name of a file to the FB, in which the data is to be saved in binary format.

>

The output RESULT provides information on the status of the SDO transmission.

113

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

NODE

IDX

SUBIDX

DATA

FILE

MAX_LEN

SegmentedTransfer

(optional use of the parameter)

Timeout

(optional use of the parameter)

>

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

BYTE

WORD

BYTE

DWORD

STRING(80)

DWORD

BOOL := FALSE

TIME := T#10ms

35002

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

(Node ID) ID of the node allowed = 1...127 = 0x01...0x7F

The COB ID of the SDO is calculated from the node ID + 0x600 index in object directory sub-index referred to the index in the object directory

Address of the data zone for storage of the received data

Input is without function for devices with file system (Linux).

Path and file name for storage of the received data in binary format

Input without function for device without file system

(BasicSystem).

Maximum permitted number of bytes which may be received

TRUE: Segmented SDO transfer

FALSE: SDO block transfer waiting time of the FB for the response when the time has elapsed, the FB stops waiting. value = 0: use value from the configuration

Parameter

LEN

RESULT

Data type

DWORD

BYTE

Description number of received data bytes feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

33

64

65

66

242

16

17

32

0

1

5

21

40

41

42

F2

10

11

20

00

01

05

FB is inactive

FB execution completed without error – data is valid

FB is active – no data received yet

Transmission is active as a segmented download

Transmission is active as a block download

SDO transmission aborted by client or server

(SDO abort code 0x80)

TIMEOUT elapsed

Error: Write pointer outside admissible data range

Error: File could not be opened

Error when writing to file

Error: setting is not possible

114

35204

ioControl CR2042, CR2052

CANOPEN_SDOREADMULTI

= SDO read multi

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35376

>

Description

>

35349

CANOPEN_SDOREADMULTI reads the indicated entry in the object directory of a node in the network. The COB ID for the SDO is calculated from the transmitted node ID according to CANopen convention.

Parameters of the inputs

35156

Parameter

EXECUTE

CHANNEL

NODE

IDX

SUBIDX

Timeout

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE

WORD

BYTE

TIME := T#10ms

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

(Node ID) ID of the node allowed = 1...127 = 0x01...0x7F

The COB ID of the SDO is calculated from the node ID + 0x600 index in object directory sub-index referred to the index in the object directory waiting time of the FB for the response when the time has elapsed, the FB stops waiting. value = 0: use value from the configuration

115

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

LEN

DATA

RESULT

Data type

DWORD

Description number of the bytes received permissible values = 1...2 048 = 0x0000 0001...0x0000 0800

ARRAY [0..SDOMAXDATA] OF

BYTE buffer memory for user data of the SDO data transmission

BYTE feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

5

32

33

242

255

21

F2

FF

00

01

05

20

FB is inactive

FB execution completed without error – data is valid

FB is active – no data received yet

SDO transmission aborted by client or server

(SDO abort code 0x80)

TIMEOUT elapsed

Error: setting is not possible

Error: not enough memory available for the consuming multiframe

35007

116

ioControl CR2042, CR2052

CANOPEN_SDOWRITE

= SDO write

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35387

>

Description

35348

CANOPEN_SDOWRITE is an easy function block for editing "Expedited SDOs", i.e. SDOs with max.

4 bytes user data. This type usually represents the bigger part of the SDO communication.

>

Expedited SDO = expedited service data object

A considerable amount of memory space can be saved due to the limitation of the data volume to max. 4 bytes of user data because this FB only needs to reserve 4 bytes as buffer storage and does not create a large data array itself.

Parameters of the inputs

35157

Parameter

EXECUTE

CHANNEL

NODE

IDX

SUBIDX

LEN

DATA

Timeout

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE

WORD

BYTE

BYTE

ARRAY [0..3] OF BYTE

TIME := T#10ms

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

ID of the node permissible values = 1...127 = 0x01...0x7F index in object directory sub-index referred to the index in the object directory number of the data bytes to be transmitted permissible values = 1...4 = 0x01...0x04 data area (1...4 bytes) waiting time of the FB for the response when the time has elapsed, the FB stops waiting. value = 0: use value from the configuration

117

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

8

01

08

FB is inactive

FB execution completed without error – data is valid function block is active

32 20

33

242

21

F2

SDO transmission aborted by client or server

(SDO abort code 0x80)

TIMEOUT elapsed

Error: setting is not possible

35087

118

ioControl CR2042, CR2052

CANOPEN_SDOWRITEBLOCK

= SDO Write Block

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35390

>

Description

35320

CANOPEN _SDOWRITEBLOCK writes in the indicated entry in the object directory of a node in the network via SDO block transfer.

You can change to segmented transfer via the FB input if required.

> The COB ID for the SDO is calculated from the transmitted node ID.

> The output RESULT provides information on the status of the SDO transmission.

The length of multiframe SDOs is generally not limited.

For systems without a file system (e.g. BasicController CR04nn) the following applies:

► transmit an address to the FB which is accessed by the pointer for reading.

For systems with a file system (e.g. PDM360NG CR108n) the following applies:

► Transmit the path and name of a file to the FB, from which the data is to be read in binary format.

119

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

NODE

IDX

SUBIDX

LEN

DATA

FILE

SegmentedTransfer

(optional use of the parameter)

Timeout

(optional use of the parameter)

>

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

BYTE

WORD

BYTE

DWORD

DWORD

STRING(80)

BOOL := FALSE

TIME := T#10ms

35005

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

(Node ID) ID of the node allowed = 1...127 = 0x01...0x7F

The COB ID of the SDO is calculated from the node ID + 0x600 index in object directory sub-index referred to the index in the object directory number of data bytes to be transmitted in DATA allowed = 1...2 048 = 0x0000 0001...0x0000 0800

Address of the data zone for reading of the data to be transmitted

Input is without function for devices with file system (Linux).

Path and file name for reading of the data to be transmitted in binary format

Input without function for device without file system

(BasicSystem).

TRUE: Segmented SDO transfer

FALSE: SDO block transfer waiting time of the FB for the response when the time has elapsed, the FB stops waiting. value = 0: use value from the configuration

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

8

16

17

32

33

65

242

21

41

F2

00

01

08

10

11

20

FB is inactive

FB execution completed without error – data is valid

FB is active – not yet processed

Transmission is active as a segmented download

Transmission is active as a block download

SDO transmission aborted by client or server

(SDO abort code 0x80)

TIMEOUT elapsed

Error: File could not be opened

Error: setting is not possible

120

35203

ioControl CR2042, CR2052

CANOPEN_SDOWRITEMULTI

= SDO write multi

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35377

>

Description

35355

>

CANOPEN_SDOWRITEMULTI writes the indicated entry in the object directory of a node in the network. The COB ID for the SDO is calculated from the transmitted node ID according to CANopen convention.

Parameters of the inputs

35166

Parameter

EXECUTE

CHANNEL

NODE

IDX

SUBIDX

LEN

DATA

Timeout

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE

WORD

BYTE

DWORD

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

ID of the node permissible values = 1...127 = 0x01...0x7F index in object directory sub-index referred to the index in the object directory number of the data bytes to be transmitted permissible values = 1...2 048 = 0x0000 0001...0x0000 0800

ARRAY [0..SDOMAXDATA] OF

BYTE buffer memory for user data of the SDO data transmission

TIME := T#10ms waiting time of the FB for the response when the time has elapsed, the FB stops waiting. value = 0: use value from the configuration

121

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

8

01

08

FB is inactive

FB execution completed without error – data is valid function block is active

32 20

33

242

21

F2

SDO transmission aborted by client or server

(SDO abort code 0x80)

TIMEOUT elapsed

Error: setting is not possible

35063

122

ioControl CR2042, CR2052

Function elements: CANopen SYNC

Content

CANOPEN_GETSYNCSTATE .............................................................................................................124

CANOPEN_SETSYNCSTATE .............................................................................................................126

35742

123

ioControl CR2042, CR2052

CANOPEN_GETSYNCSTATE

= Get SYNC state

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35069

>

Description

35334

CANOPEN_GETSYNCSTATE reads...

• the setting of the SYNC functionality (active / not active),

• the error state of the SYNC functionality (SyncError).

If the PLC CAN runs as CANopen slave, it is signalled via this FB whether SYNC signals are absent or appear regularly.

>

Synchronous PDOS etc. are handled in the CAN stack. CANOPEN_GETSYNCSTATE, however, provides the error state so that the application program can react accordingly.

Parameters of the inputs

35175

Parameter

EXECUTE

CHANNEL

Data type

BOOL := FALSE

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

124

ioControl CR2042, CR2052

>

Parameters of the outputs

35058

Parameter

SYNC

SYNCERROR

RESULT

Data type

BOOL

BYTE

BYTE

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

242

01

08

F2 function block execution completed without error function block not yet executed

Error: setting is not possible

Description status of the SYNC functionality

TRUE: SYNC is activated:

In the master mode SYNC telegrams are generated according to the settings in the configuration, and synchronous PDOs are transmitted and received.

In the slave mode SYNC telegrams are received and accordingly processed.

FALSE: SYNC is not active

(sync error) SYNC error message

0 = no error

>0 = SYNC error (slave mode) feedback of the function block

(possible messages → following table)

125

ioControl CR2042, CR2052

CANOPEN_SETSYNCSTATE

= Set SYNC state

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35400

>

Description

35337

>

With CANOPEN_SETSYNCSTATE, the SYNC functionality is switched on and off.

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

SYNC

Data type

BOOL := FALSE

BYTE

BOOL

35176

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device status of the SYNC functionality

TRUE: SYNC is activated:

In the master mode SYNC telegrams are generated according to the settings in the configuration, and synchronous PDOs are transmitted and received.

In the slave mode SYNC telegrams are received and accordingly processed.

FALSE: SYNC is not active

>

Parameters of the outputs

35080

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

38

242

01

08

26

F2 function block execution completed without error function block not yet executed

SYNC could not be activated

Error: setting is not possible

126

ioControl CR2042, CR2052

Function elements: CANopen guarding

Content

CANOPEN_GETGUARDHBERRLIST .................................................................................................128

CANOPEN_GETGUARDHBSTATSLV ................................................................................................129

35753

127

ioControl CR2042, CR2052

CANOPEN_GETGUARDHBERRLIST

= Get guard and heartbeat error list

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35418

>

Description

35335

>

CANOPEN_GETGUARDHBERRLIST lists all nodes in an array for which the master has detected an error:

• guarding error

• heartbeat error

Parameters of the inputs

35124

Parameter

EXECUTE

CHANNEL

ResetList

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BOOL := FALSE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

Reset error list

TRUE: Provide the error list as well as number of faulty nodes at the output and then reset.

FALSE: function element is not executed

>

Parameters of the outputs

35059

Parameter

N_NODES

NODEID

RESULT

Data type

WORD

ARRAY

[0..MAXGUARDERROR] OF

BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error

FB is active – not yet processed

Error: setting is not possible

Description

Number of nodes with heartbeat or guarding error

0 = none of the nodes has a guarding or heartbeat error

List of node IDs with heartbeat or guarding error.

The most recent entry is in index 0.

MAXGUARDERROR depends on device

→ chapter Limitations for CANopen in this device

(→ p. 38 )

feedback of the function block

(possible messages → following table)

128

ioControl CR2042, CR2052

CANOPEN_GETGUARDHBSTATSLV

= Get guard and heartbeat state slave

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35417

>

Description

35314

CANOPEN_GETGUARDANDHBSTATESLAVE reports the following states to the controller in slave operation:

- monitoring of node guarding

- monitoring of heartbeat

>

The controller can either be the heartbeat producer or the heartbeat consumer.

Parameters of the inputs

35125

Parameter

EXECUTE

CHANNEL

Reset

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BOOL := FALSE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

TRUE: Provide the current states at the outputs and then reset to "No error"

FALSE: function element is not executed

129

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

GUARDSTATE

PROD_HBSTATE

CONS_HBSTATE

CONS_HBCOBID

RESULT

Data type

BYTE

BYTE

BYTE

WORD

BYTE

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

242

01

08

F2 function block execution completed without error

FB is active

– not yet processed

Error: setting is not possible

Description

Status of node guarding:

0 = 0x00 = no error (or: not active)

1 = 0x01 = timeout (configuration)

127 = 0x7F = no guarding message received controller as heartbeat producer:

0 = 0x00 = inactive

1 = 0x01 = active controller as heartbeat consumer:

0 = 0x00 = no fault

1 = 0x01 = timeout (configuration)

127 = 0x7F = no heartbeat message received yet

COB-ID of the heartbeat message the consumer heartbeat of the controller is reacting to (configuration) feedback of the function block

(possible messages → following table)

35050

130

ioControl CR2042, CR2052

Function elements: CANopen emergency

Content

CANOPEN_GETEMCYMESSAGES ....................................................................................................132

CANOPEN_GETERRORREGISTER ...................................................................................................134

CANOPEN_SENDEMCYMESSAGE ...................................................................................................136

35740

131

ioControl CR2042, CR2052

CANOPEN_GETEMCYMESSAGES

= Get emergency messages

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35065

>

Description

35338

>

CANOPEN_GETEMCYMESSAGES returns all emergency messages that have been received by the controller from other nodes in the network since the last deletion of messages.

The list can be reset by setting the according input. A maximum of MAXEMCYMSGS messages is stored. Each message contains information from which the node it was sent. The most recent message is in index 0.

Parameters of the inputs

35170

Parameter

EXECUTE

CHANNEL

RstList

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BOOL := FALSE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

TRUE: Provide list with accumulated CAN messages at the output and then delete

FALSE: function element is not executed

132

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

N_MSGS

EMCY

RESULT

Data type

DWORD

ARRAY [0..MAXEMCYMSGS]

OF T_EMCY

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error

FB is active – not yet processed

Error: setting is not possible

Description

Number of accumulated messages

Emergency messages

The most recent entry is in index 0.

Structure of T_EMCY:

.NODEID

.EEC

.ER

.MSEF

ID of the node from which the message came

Emergency Error Code

Error register

Manufacturer Specific Error Code

MAXEMCYMSG = 10 feedback of the function block

(possible messages → following table)

35075

133

ioControl CR2042, CR2052

CANOPEN_GETERRORREGISTER

= Get error register

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35419

>

>

Description

35336

CANOPEN_GETERRORREGISTER reads the error registers 0x1001 and 0x1003 from the controller.

Parameters of the inputs

35169

Parameter

EXECUTE

CHANNEL

Reset_1001

(optional use of the parameter)

Reset_1003

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BOOL := FALSE

BOOL := FALSE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

TRUE: Reset error register 0x1001

FALSE: function element is not executed

TRUE: Reset error register 0x1003

Set number of entries to 0

FALSE: function element is not executed

The inputs remain unchanged.

134

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

ER

ERROR_FIELD

RESULT

Data type

BYTE

ARRAY [0..MAXERR] OF

DWORD

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error

FB is active – not yet processed

Error: setting is not possible

Description

Content of the error register 0x1001

Content of the error register 0x1003

Index 0 = number of the stored errors

Index 1...MAXERR = stored errors

The most recent error is in index 1

Preset: MAXERR = 5 feedback of the function block

(possible messages → following table)

35052

135

ioControl CR2042, CR2052

CANOPEN_SENDEMCYMESSAGE

= Send emergency message

Unit type = function block (FB)

Unit is contained in the library ifm_CANopen_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35388

>

Description

35333

>

CANOPEN_SENDEMCYMESSAGE sends an EMCY message. The message is assembled from the according parameters and entered in register 0x1003. The COB ID for the emergency message is determined from the configuration data.

Parameters of the inputs

35168

Parameter

EXECUTE

CHANNEL

ERRORACTIVE

EEC

ER

(optional use of the parameter)

MSEF

Data type

BOOL := FALSE

BYTE

BOOL

WORD

BYTE := 0

ARRAY [0..4] OF BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

FALSE  TRUE (edge): sends the next error code

TRUE  FALSE (edge):

If the error is no longer given, a message that there is no error is sent after a delay of 1 s.

EEC = Emergency Error Code

0 = use value from error register 0x1001

Write1003

(optional use of the parameter)

SendSysStatus

(optional use of the parameter)

BOOL := FALSE

BOOL := FALSE

MSEF = Manufacturer Specific Error Code =

Additional error code which is defined by the manufacturer.

Value comes from the application.

TRUE: Enter this EMCY message in object 0x1003

FALSE: function element is not executed

Send system status

TRUE: The system status is checked and in case of an error state this is transmitted to the network.

FALSE: function element is not executed

136

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

39

242

01

08

27

F2 function block execution completed without error

FB is active – not yet processed no object 1001

16

in the configuration

Error: setting is not possible

35053

137

ioControl CR2042, CR2052

5.2.4

Function elements: SAE J1939

Content

Function elements: SAE J1939 status .................................................................................................138

Function elements: SAE J1939 request ...............................................................................................146

Function elements: receive SAE J1939 ..............................................................................................149

Function elements: transmit SAE J1939 ..............................................................................................154

Function elements: SAE J1939 diagnosis ............................................................................................162

28361

For SAE J1939, ifm electronic provides a number of function elements which will be explained in the following.

Function elements: SAE J1939 status

Content

J1939_ENABLE ....................................................................................................................................139

J1939_GETDABYNAME ......................................................................................................................141

J1939_NAME .......................................................................................................................................143

J1939_STATUS ....................................................................................................................................145

35717

138

ioControl CR2042, CR2052

J1939_ENABLE

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35252

>

Description

For initialisation of the J1939 stack, J1939_ENABLE is set to TRUE=1.

> This FB also causes booting of the soft I/Os of the CFG file.

> A different baud rate is only adopted if CAN_ENABLE has not been activated before.

>

ACE = A ddress C laiming E nable:

If an ifm controller communicates with only one engine controller via J1939: set ACE = FALSE.

If however several engine controllers are working on the same bus: set ACE = TRUE.

In this case the engine controllers must support the address claiming!

Otherwise you will risk an overlapping of addresses with subsequent system failure.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

Baud rate

(optional use of the parameter)

PreferredAddress

(optional use of the parameter)

Ace

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

WORD := 250

BYTE = 252

BOOL := TRUE

Description

TRUE: Enable J1939 channel

Ace=TRUE: Address claiming effected

FALSE: Block J1939 channel

CAN interface (1...n) depending on the device

Baud rate [Kbits/s] permissible values: 20, 50, 100, 125, 250, 500, 800, 1 000 preferred source address

Address Claiming Enable

TRUE: Address claiming enabled

(control unit is self-configuring)

FALSE: No address claiming

35360

35222

139

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

9

242

01

08

09

F2 function block execution completed without error function block is active

CAN is not active

Error: setting is not possible

35102

140

ioControl CR2042, CR2052

J1939_GETDABYNAME

= get destination arbitrary name

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35246

>

Description

35358

Via J1939_GETDABYNAME, the target address of one or several participants can be determined by means of the name information.

If a specific value is set on the optional inputs:

 the result list will only show the participants with this specific value.

If no value or the default value is set on the optional inputs:

 this entry is not taken into account during filtration of the list.

141

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

CHANNEL

IndustryGroup

(optional use of the parameter)

VehicleSystemInstance

(optional use of the parameter)

VehicleSystem

(optional use of the parameter) nFunction

(optional use of the parameter)

FunctionInstance

(optional use of the parameter)

ECUInstance

(optional use of the parameter)

ManufacturerCode

(optional use of the parameter)

IdentityNumber

(optional use of the parameter)

>

Parameters of the outputs

Data type

BOOL

BYTE

BYTE = 0xFF

BYTE := 0xFF

BYTE := 0xFF

WORD := 0xFFFF

BYTE := 0xFF

BYTE := 0xFF

WORD := 0xFFFF

DWORD := 0xFFFF FFFF

35212

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device industry group = industry group of the device permissible values = 0...7

255 = 0xFF = filter for all instance of the vehicle system permissible values = 0...15 = 0x00...0x0F

255 = 0xFF = filter for all vehicle system permissible values = 0...127 = 0x00...0x7F

255 = 0xFF = filter for all function of the device permissible values = 0...255 = 0x0000...0x00FF

65 535 = 0xFFFF = filter for all instance of the function permissible values = 0...31 = 0x00...0x1F

255 = 0xFF = filter for all instance of the control device permissible values = 0...7

255 = 0xFF = filter for all manufacturer code (must be requested from SAE) permissible values = 0...2047 (2 11 -1) = 0x0000...0x07FF

65 535 = 0xFFFF = filter for all serial number of the device (should not be overwritten) permissible values = 0...2047 (2 11 -1) = 0x0000 0000...0x0000 07FF

4 294 967 295 = 0xFFFF FFFF = filter for all

Parameter

DA

NUMBER

RESULT

Data type

ARRAY [0..254] OF BYTE

BYTE

BYTE

Description

List of found participants

255 = no participant found with this number

Number of found bus participants. feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

1 01

Description

FB is inactive

FB execution completed without error – data is valid

8

242

08

F2 function block is active

Error: setting is not possible

34986

142

ioControl CR2042, CR2052

J1939_NAME

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35257

>

Description

35371

Via J1939_NAME, the device can be given a name for identification in the network.

By default the name of ifm is used.

The user has the following options to change the name of the device:

► use the information from the CFG file or

► overwrite the requested data via J1939_NAME.

> If no value or a default value is set at the optional inputs:

 the preset value is not overwritten.

The following list shows the composition of the 64 bit NAME information according to SAE J1939-81:

Parameter arbitrary address capable industry group vehicle system instance vehicle system reserved function function instance

Data type

1 bit

3 bits

4 bits

7 bits

1 bit

8 bits

5 bits

Description any desired address available industry group of the device instance of the vehicle system vehicle system reserved function of the device instance of the function

ECU instance manufacturer code

3 bits

11 bits instance of the controller manufacturer code (must be applied for at SAE) identify number 21 bits serial number of the device (should not be overwritten)

Table: Composition of the 64 bit NAME information according to SAE J1939-81

143

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

CHANNEL

IndustryGroup

(optional use of the parameter)

VehicleSystemInstance

(optional use of the parameter)

VehicleSystem

(optional use of the parameter) nFunction

(optional use of the parameter)

FunctionInstance

(optional use of the parameter)

ECUInstance

(optional use of the parameter)

ManufacturerCode

(optional use of the parameter)

IdentityNumber

(optional use of the parameter)

>

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

BYTE = 0xFF

BYTE := 0xFF

BYTE := 0xFF

WORD := 0xFFFF

BYTE := 0xFF

BYTE := 0xFF

WORD := 0xFFFF

DWORD := 0xFFFF FFFF

35223

Description

TRUE: Any desired address available

FALSE: Fixed address

CAN interface (1...n) depending on the device industry group = industry group of the device permissible values = 0...7

255 = 0xFF = filter for all instance of the vehicle system permissible values = 0...15 = 0x00...0x0F

255 = 0xFF = filter for all vehicle system permissible values = 0...127 = 0x00...0x7F

255 = 0xFF = filter for all function of the device permissible values = 0...255 = 0x0000...0x00FF

65 535 = 0xFFFF = filter for all instance of the function permissible values = 0...31 = 0x00...0x1F

255 = 0xFF = filter for all instance of the control device permissible values = 0...7

255 = 0xFF = filter for all manufacturer code (must be requested from SAE) permissible values = 0...2047 (2 11 -1) = 0x0000...0x07FF

65 535 = 0xFFFF = filter for all serial number of the device (should not be overwritten) permissible values = 0...2047 (2 11 -1) = 0x0000 0000...0x0000 07FF

4 294 967 295 = 0xFFFF FFFF = filter for all

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive function block execution completed without error function block is active

Error: setting is not possible

34995

144

ioControl CR2042, CR2052

J1939_STATUS

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35259

>

Description

>

Via J1939_STATUS, relevant information can be read back to the J1939 stack.

Parameters of the inputs

Parameter

ENABLE

Data type

BOOL

BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

>

CHANNEL

Parameters of the outputs

Parameter

SA

CYCLIC

TIMEOUT

Data type

BYTE

WORD

BYTE

35361

35213

Description claimed source address number of the cyclic messages source address of the node which did not provided data for the process image in due time

255 = 0xFF = all nodes sent the data in due time

Version of the ifm CAN stack library feedback of the function block

(possible messages → following table)

34985

VERSION

RESULT

DWORD

BYTE

Possible results for RESULT:

Value dec | hex

Description

3

4

242

0

1

2

03

04

F2

00

01

02

FB is inactive

Protocol is active

Protocol is not active

Source address requested

Address lost

Error: setting is not possible

145

ioControl CR2042, CR2052

Function elements: SAE J1939 request

Content

J1939_SPEC_REQ ..............................................................................................................................147

J1939_SPEC_REQ_MULTI .................................................................................................................148

35704

146

ioControl CR2042, CR2052

J1939_SPEC_REQ

= J1939 Specific Request

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35253

>

Description

35321

J1939_SPECIFIC_REQUEST requests and receives a specific message from another controller.

>

If a multiframe message is requested:

• the FB provides the first 8 bytes of the data

• RESULT indicates an error

Parameters of the inputs

35083

Parameter

EXECUTE

CHANNEL

PGN

Data type

BOOL := FALSE

BYTE

DWORD

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF

J1939 address of the requested device

>

DA

Parameters of the outputs

35206

Parameter

PRIO

LEN

DATA

RESULT

Data type

BYTE

WORD

ARRAY [0..7] OF BYTE

BYTE

Description message priority (0…7) number of the bytes received (0...8) received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

5

01

05

FB is inactive

FB execution completed without error – data is valid

FB is active – no data received yet

64

242

40

F2

Error: receive multiframe

Error: setting is not possible

147

ioControl CR2042, CR2052

J1939_SPEC_REQ_MULTI

= J1939 Specific Request Multiframe Message

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35256

>

Description

35315

>

J1939_SPECIFIC_REQUEST requests and receives a specific multiframe message from another controller.

Parameters of the inputs

35082

Parameter

EXECUTE

CHANNEL

PGN

Data type

BOOL := FALSE

BYTE

DWORD

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF

J1939 address of the requested device

>

DA

Parameters of the outputs

35183

Parameter

PRIO

LEN

DATA

RESULT

Data type

BYTE

WORD

ARRAY [0..1784] OF BYTE

BYTE

Description message priority (0…7) number of data bytes to be transmitted allowed = 1...1 785 = 0x0001...0x06F9

Received data (1...1785 bytes) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

5

242

00

01

05

F2

FB is inactive

FB execution completed without error – data is valid

FB is active

– no data received yet

Error: setting is not possible

148

ioControl CR2042, CR2052

Function elements: receive SAE J1939

Content

J1939_RX .............................................................................................................................................150

J1939_RX_FIFO ...................................................................................................................................151

J1939_RX_MULTI ................................................................................................................................153

35702

149

ioControl CR2042, CR2052

J1939_RX

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35244

>

Description

>

35264

J1939_RX is the easiest method for receiving single frame messages. The message read last on the

CAN bus is returned.

Parameters of the inputs

35214

Parameter

ENABLE

CHANNEL

PGN

Data type

BOOL

BYTE

DWORD

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF

The PGN = 0 is not used.

>

Parameters of the outputs

35001

Parameter

SA

PRIO

LEN

DATA

RESULT

Data type

BYTE

BYTE

WORD

ARRAY [0..7] OF BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is active

– no data received yet

CAN is not active

Error: setting is not possible

Description

Source address of the transmitter message priority (0…7) number of the bytes received (0...8) received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

150

ioControl CR2042, CR2052

J1939_RX_FIFO

= J1939 RX with FIFO

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35247

>

Description

35267

>

J1939_RX_FIFO enables receipt of all specified messages and their successive reading from a FIFO.

Parameters of the inputs

35155

Parameter

ENABLE

CHANNEL

PGN

Data type

BOOL

BYTE

DWORD

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF

The PGN = 0 is not used.

151

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

SA

PRIO

LEN

DATA

MORE_DATA_AVAILABLE

RESULT

Data type

BYTE

BYTE

BYTE

ARRAY [0..7] OF BYTE

BOOL

BYTE

Description

Source address of the transmitter message priority (0…7) number of the bytes received (0...8) received data, (1...8 bytes)

TRUE: further received data available in the FiFo

FALSE: no further data available in the FiFo feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

5

01

05

FB is inactive

FB execution completed without error – data is valid

FB is active – no data received yet

242 F2 Error: setting is not possible

250 FA Error: FiFo is full – data was lost

35012

152

ioControl CR2042, CR2052

J1939_RX_MULTI

= J1939 RX multiframe message

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35258

>

Description

>

J1939_RX_MULTI enables receipt of multi-frame messages.

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

PGN

The PGN = 0 is not used.

>

Parameters of the outputs

Data type

BOOL := FALSE

BYTE

DWORD

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF

35352

35158

35013

Parameter

SA

PRIO

LEN

DATA

RESULT

Data type

BYTE

BYTE

WORD

ARRAY [0..1784] OF BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

5

242

00

01

05

F2

FB is inactive

FB execution completed without error – data is valid

FB is active – no data received yet

Error: setting is not possible

Description

Source address of the transmitter message priority (0…7) number of the bytes received permissible values = 0...1 785 = 0x0000 0000...0x0000 06F9 data to be sent (1...1785 bytes) feedback of the function block

(possible messages → following table)

153

ioControl CR2042, CR2052

Function elements: transmit SAE J1939

Content

J1939_TX .............................................................................................................................................155

J1939_TX_ENH ....................................................................................................................................156

J1939_TX_ENH_CYCLIC ....................................................................................................................158

J1939_TX_ENH_MULTI .......................................................................................................................160

35706

154

ioControl CR2042, CR2052

J1939_TX

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35072

>

Description

>

J1939_TX is the easiest method for transmitting single frame messages.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

DA

PGN

>

DATA

Parameters of the outputs

Data type

BOOL

BYTE

BYTE := 249

DWORD

ARRAY [0..7] OF BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

DA = Destination Address of the ECU

PGN > 61139: parameter DA is ignored

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF data to be sent (1...8 bytes)

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

242

250

00

01

F2

FA

FB is inactive function block execution completed without error

Error: setting is not possible

Error: FiFo is full – data was lost

35350

35218

34988

155

ioControl CR2042, CR2052

J1939_TX_ENH

= J1939 TX enhanced

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35144

>

Description

>

35353

Additional setting options are provided by J1939_TX_ENH (for: enhanced) for single frame messages:

 transmitting priority

 data length

Multi frame messages

 J1939_TX_ENH_MULTI

(→ p. 160 ).

Parameters of the inputs

35215

Parameter

ENABLE

CHANNEL

DA

Prio

(optional use of the parameter)

PGN

Len

(optional use of the parameter)

DATA

Data type

BOOL

BYTE

BYTE := 249

BYTE := 3

DWORD

BYTE := 8

ARRAY [0..7] OF BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

DA = Destination Address of the ECU

PGN > 61139: parameter DA is ignored message priority permissible values = 0…7

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF number of the bytes to be transmitted permissible values = 0...8 data to be sent (1...8 bytes)

156

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

242

250

01

F2

FA function block execution completed without error

Error: setting is not possible

Error: FiFo is full – data was lost

35051

157

ioControl CR2042, CR2052

J1939_TX_ENH_CYCLIC

= J1939 TX enhanced cyclic

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35145

>

Description

J1939_TX_ENH_CYCLIC serves for cyclic transmitting of CAN messages.

Otherwise, the FB corresponds to J1939_TX_ENH

(→ p. 156 ).

► Set the period duration via the parameter PERIOD.

>

If a period is too short, this could lead to a high bus load!

The bus load can affect the performance of the complete system.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

DA

Prio

(optional use of the parameter)

PGN

Len

(optional use of the parameter)

DATA

PERIOD

Data type

BOOL

BYTE

BYTE := 249

BYTE := 3

DWORD

BYTE := 8

ARRAY [0..7] OF BYTE

TIME

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

DA = Destination Address of the ECU

PGN > 61139: parameter DA is ignored message priority permissible values = 0…7

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF number of the bytes to be transmitted permissible values = 0...8 data to be sent (1...8 bytes) period duration

35351

35225

158

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

8

242

08

F2 function block is active

Error: setting is not possible

Description feedback of the function block

(possible messages → following table)

35014

159

ioControl CR2042, CR2052

J1939_TX_ENH_MULTI

= J1939 TX enhanced multiframe message

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35142

>

Description

35356

>

The transmission of multi-frame messages is carried out via J1939_TX_ENH_MULTI.

The FB corresponds to J1939_TX_ENH

(→ p. 156 ). In addition, it can be determined whether the

transmission shall be executed as BAM ( B roadcast A nnounce M essage).

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

DA

Prio

(optional use of the parameter)

PGN

Len

(optional use of the parameter)

DATA

Bam

(optional use of the parameter)

Data type

BOOL := FALSE

BYTE

BYTE := 249

BYTE := 3

DWORD

BYTE := 8

ARRAY [0..1784] OF BYTE

BOOL := FALSE

35224

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

DA = Destination Address of the ECU

PGN > 61139: parameter DA is ignored message priority permissible values = 0…7

PGN = Parameter Group Number permissible = 0...262 143 = 0x00000000...0x0003FFFF number of the bytes to be transmitted permissible values = 0...8 data to be sent (1...1785 bytes)

BAM = Broadcast Announce Message = message to all participants

TRUE: multi-frame transmission as BAM message to all participants

FALSE: automatic; message only to target address

160

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

8

65

242

01

08

41

F2 function block execution completed without error function block is active

Error: transmission is not possible

Error: setting is not possible

35011

161

ioControl CR2042, CR2052

Function elements: SAE J1939 diagnosis

Content

J1939_DM1RX .....................................................................................................................................163

J1939_DM1TX ......................................................................................................................................165

J1939_DM1TX_CFG ............................................................................................................................168

J1939_DM3TX ......................................................................................................................................169

35703

162

ioControl CR2042, CR2052

J1939_DM1RX

= J1939 Diagnostic Message 1 RX

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35299

>

Description

35357

>

J1939_RX_DM1 receives diagnostic messages DM1 or DM2 from other ECUs.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

DA

ACTIVE

Data type

BOOL := FALSE

BYTE

BYTE

BOOL

35000

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

DA = Destination Address of the ECU from where the DTCs are to be retrieved.

DA = 254: read DTCs from the device itself

TRUE: Read active DTCs (DM1)

FALSE: Read previously active DTCs (DM2)

163

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

REDSTOPLAMP

AMBERWARNINGLAMP

PROTECTLAMP

NUMBER

SPN

FMI

SPN_CM

OC

RESULT

MIL_FC

REDSTOPLAMP_FC

AMBERWARNINGLAMP_FC

PROTECTLAMP_FC

Data type

BOOL

BOOL

BOOL

BYTE

WORD

BYTE

BOOL

BYTE

BYTE

BYTE

BYTE

BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

8

242

00

01

08

F2

FB is inactive

FB execution completed without error – data is valid

FB is active – no data was received

Error: setting is not possible

Description red stop lamp (for older projects only)

TRUE: ON

FALSE: OFF

Amber warning lamp (for older projects only)

TRUE: ON

FALSE: OFF protect lamp (for older projects only)

TRUE: ON

FALSE: OFF number of the DTCs received (0...8)

Suspect Parameter Number (→ J1939 specification)

Failure Mode Indicator (→ J1939 specification) permissible values = 0...31 = 0x00...0x1F conversion method (→ J1939 specification) occurrence count feedback of the function block

(possible messages → following table)

Status of the electronic component:

Malfunction indicatation light status and flash code:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

Status of the electronic component: red stop light status and flash code:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

Status of the electronic component:

Yellow warning light status and flash code:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

Status of the electronic component: protection light status and flash mode:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

164

35210

ioControl CR2042, CR2052

J1939_DM1TX

= J1939 Diagnostic Message 1 TX

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35294

>

Description

35265

With J1939_TX_DM1 (DM = D iagnostic M essage) the controller can only transmit an active error message to the CAN stack.

>

This message is stored in the hardware configuration.

> The message is marked "active" and transmitted once per second as DM1.

> If the error has already occurred, the event counter is incremented.

The event counter is managed by the CAN stack.

> A disjunction of all bits of the trouble codes is executed. As soon as a bit is set in one of the trouble codes, it is equally set in the lamp state.

Upon arrival of a request at DM2, the CAN stack can read the according information from the hardware configuration and transmit it.

>

When a DM3 message arrives, all inactive errors are deleted in the error memory in the hardware configuration.

165

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

EXECUTE

CHANNEL

ACTIVE

REDSTOPLAMP

AMBERWARNINGLAMP

PROTECTLAMP

SPN

FMI

SPN_CM

MIL_FC

REDSTOPLAMP_FC

AMBERWARNINGLAMP_FC

PROTECTLAMP_FC

BOOL

BOOL

BOOL

WORD

BYTE

BOOL

BYTE

Data type

BOOL := FALSE

BYTE

BOOL

BYTE

BYTE

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

TRUE: DTC is active

Cyclically transmitted (1x per second) as DM1

FALSE: DTC is no longer active

Saved in the hardware configuration

Transmitted as DM2 when requested red stop lamp (for older projects only)

TRUE: ON

FALSE: OFF

Amber warning lamp (for older projects only)

TRUE: ON

FALSE: OFF protect lamp (for older projects only)

TRUE: ON

FALSE: OFF

Suspect Parameter Number (→ J1939 specification)

Failure Mode Indicator (→ J1939 specification) permissible values = 0...31 = 0x00...0x1F conversion method (→ J1939 specification)

Status of the electronic component:

Malfunction indicatation light status and flash code:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

Status of the electronic component: red stop light status and flash code:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

Status of the electronic component:

Yellow warning light status and flash code:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

Status of the electronic component: protection light status and flash mode:

0 = off

1 = on

2 = flash slowly

3 = flash quickly

35089

166

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

242

01

F2 data was marked "active" in the error memory

Error: setting is not possible

Description feedback of the function block

(possible messages → following table)

35010

167

ioControl CR2042, CR2052

J1939_DM1TX_CFG

= J1939 Diagnostic Message 1 TX configurable

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_V02.00.02.LIB

or higher

Symbol in CODESYS:

35297

>

>

Description

35313

As from runtime system V03.00.03 the CAN stack automatically sends a DM1 message every second as soon as the FB J1939_ENABLE

(→ p. 139 ) is called for the corresponding CAN interface.

► Use the FB J1939_DM1TX_CFG if you do not want the CAN stack to automatically and cyclically transmit DM1 messages.

The FB offers the following modes for cyclic transmission of DM1 messages:

MODE = 0

(preset)

The CAN stack sends DM1 "zero active faults" messages in compliance with standards every second.

A manual transmission of DM1 messages via the FB

J1939_DM1TX

(→ p. 165 )is possible.

MODE = 1

MODE = 2

The CAN stack does not send DM1 "zero active faults" messages.

DM2 requests are answered automatically.

A manual transmission of DM1 messages via the FB J1939_DM1TX

(→ p. 165 ) is possible.

The CAN stack does not send cyclic DM1 "zero active faults" messages

Nor does the CAN stack automatically reply to DM2 requests.

Parameters of the inputs

35081

Parameter

ENABLE

CHANNEL

MODE

Data type

BOOL

BYTE

BYTE := 0

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Operating mode of the function block allowed = 0...2 (→ Description of the FB)

>

Parameters of the outputs

35186

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

242

01

F2 function block execution completed without error

Error: setting is not possible

168

ioControl CR2042, CR2052

J1939_DM3TX

= J1939 Diagnostic Message 3 TX

Unit type = function block (FB)

Unit is contained in the library ifm_J1939_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35300

>

Description

>

35319

With J1939_DM3TX (DM = D iagnostic M essage) you can delete the inactive DTCs on another device.

>

As soon as a DM3 message is received, all inactive errors in the error memory are deleted in the hardware configuration.

Parameters of the inputs

35084

Parameter

EXECUTE

CHANNEL

DA

Data type

BOOL := FALSE

BYTE

BYTE

Description

FALSE  TRUE (edge): execute function element once otherwise: function element is not active

A function element already started is processed.

CAN interface (1...n) depending on the device

DA = Destination Address of the ECU on which the DTCs are to be deteled.

DA = 254: delete DTCs (DM2) in the device itself

>

Parameters of the outputs

35209

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

242

01

F2 function block execution completed without error

Error: setting is not possible

169

ioControl CR2042, CR2052

5.2.5

Function elements: processing input values

Content

FASTCOUNT ........................................................................................................................................171

INC_ENCODER ...................................................................................................................................173

INPUT ...................................................................................................................................................175

PERIOD ................................................................................................................................................178

28373

In this chapter we show you ifm FBs which allow you to read and process the analogue or digital signals at the device input.

170

ioControl CR2042, CR2052

FASTCOUNT

= Fast Count

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35684

>

>

Description

35694

FASTCOUNT operates as counter block for fast input pulses (up to 30 kHz).

This FB detects pulses at the fast input channels (

data sheet).

Overflow or underflow of the counter value is not detected.

35694

NOTE

>

In case of higher frequencies (higher than those guaranteed by ifm ) the following problems may occur:

The switch-on and switch-off times of the outputs become more important.

Undue heating of the components may occur.

The influences mentioned above depend on the components used in the individual case.

These possible influences cannot be exactly predicted.

Parameters of the inputs

23911

Parameter

ENABLE

CHANNEL

MODE

PRESET_VALUE

PRESET

Data type

BOOL

BYTE

BYTE

DWORD

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> initiated processes continue in the background

> FB outputs are not updated number of the fast input channel

0 / 1 / 4 / 5 for the inputs IN00 / IN01 / IN04 / IN05

Operating mode of the function block:

0 = 0x00 = stop counter

21 = 0x15 = up counter, signal = plus-switching

22 = 0x16 = up counter, signal = plus-switching

32 = 0x20 = up counter, signal = minus-switching

33 = 0x21 = down counter, signal = minus-switching counter start value

TRUE (for only 1 cycle): load the start value PRESET_VALUE

FALSE: counter is active

171

ioControl CR2042, CR2052

Parameters of the outputs

Parameter

VALUE

RESULT

Data type

DWORD

BYTE

Description ouput value feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

1 01

Description

FB is inactive

FB execution completed without error – data is valid

2

3

130

132

02

03

82

84 function block is active (action not yet completed) function block is active – valid values not yet available channel setting is invalid mode setting is invalid

35954

172

ioControl CR2042, CR2052

INC_ENCODER

= Incremental Encoder

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35689

>

Description

35695

INC_ENCODER handles up/down counter functions for the evaluation of encoders.

Two frequency inputs form the input pair which is evaluated by means of the FB.

Permissible limit frequency = 0...1 000 Hz

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 VALUE. The outputs UP and DOWN indicate the last counting direction of the counter. The outputs are TRUE if the counter has counted in the corresponding direction. If the counter was not changed since the last call of the FB, both the outputs are FLASE.

On input RESOLUTION the resolution of the encoder can be evaluated in multiples:

1 = normal resolution (-536 870 912...536 870 911, identical with the resolution of the encoder),

2 = double evaluation of the resolution (-1 073 741 824...1 073 741 823),

4 = 4-fold evaluation of the resolution (-2 147 483 648...2 147 483 647).

All other values on this input mean normal resolution.

RESOLUTION = 1 counts for every fourth edge

(= resolution of the encoder).

RESOLUTION = 2 counts for every second edge

RESOLUTION = 4 counts for every rising and falling edge

173

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

CHANNEL

PRESET_VALUE

PRESET

RESOLUTION

Data type

BOOL

BYTE

DINT

BOOL

BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> initiated processes continue in the background

> FB outputs are not updated

Number of the input channel pair

0 = channel pair 0 = inputs IN00 + IN01

4 = channel pair 4 = inputs IN04 + IN05 counter start value

TRUE (for only 1 cycle): load the start value PRESET_VALUE

FALSE: counter is active evaluation of the encoder resolution:

01 = counts for every fourth edge (= resolution of the encoder)

02 = counts for every second edge

04 = counts for every rising and falling edge

All other values count as "01".

36734

>

Parameters of the outputs

Parameter

VALUE

UP

DOWN

RESULT

Data type

DINT

BOOL

BOOL

BYTE

Description if RESOLUTION = 1:

VALUE = –536 870 912...536 870 911

(= ¼ area of DINT) if RESOLUTION = 2:

VALUE = –1 073 741 824...1 073 741 823

(= ½ area of DINT) if RESOLUTION = 4:

VALUE = –2 147 483 648…2 147 483 647

(= area of DINT)

TRUE: counter counts upwards in the last cycle

FALSE: counter counts not upwards in the last cycle

TRUE: counter counts downwards in the last cycle

FALSE: counter counts not downwards in the last cycle feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

2

3

0

1

130

138

00

01

02

03

82

8A

FB is inactive

FB execution completed without error – data is valid function block is active (action not yet completed) function block is active – valid values not yet available channel setting is invalid resolution setting is invalid

35952

174

ioControl CR2042, CR2052

INPUT

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35275

>

Description

INPUT assigns an operating mode to an input channel ( → data sheet).

The FB enables the status detection on the selected channel.

.

The measurement and the output value result from the operating mode indicated via MODE:

• binary input plus switching (BL) for positive sensor signal (with/without diagnosis)

• binary input minus switching (BH) for negative sensor signal

• analogue input 0...20 mA

• analogue input 0...10 V

• analogue input 0...32 V

• analogue input ratiometric 0...32 V

• analogue input Resistance measurement 16...30 000 

→ chapter Possible operating modes inputs/outputs

(→ p. 220 )

The operating mode should not be changed during operation.

The analogue values are provided as standardised values.

36054

175

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

FILTER

CHANNEL

MODE

Data type

BOOL

BYTE

BYTE

BYTE

36730

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

Number of input channel

0...7 for the inputs IN00...IN07

Operating mode of input channel:

0 = 0x00 off

1 = 0x01

(only for inputs with binary evaluation) binary input, plus-switching (BL)

3 = 0x03 voltage input

6 = 0x06 voltage input, ratiometric

7 = 0x07 current input

9 = 0x09 voltage input

0…10 000 mV

0...1 000 ‰

0…20 000 µA

0…32 000 mV

11 = 0x0B

(only for inputs with analogue evaluation) binary input, plus-switching (BL) with diagnostic

(Namur)

12 = 0x0C binary input, minus-switching (BH)

18 = 0x12 Resistance input 16…30 000 Ω filter for the measurement on the input: valid= 0...8 recommended = 4

→ chapter Configure the software filters of the inputs

(→ p. 50 )

176

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

VALUE

RESULT

Data type

WORD

BYTE

Description current value or status of the input channel

(according to the selected operating mode MODE) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

130

132

136

2

3

0

1

141

142

144

82

84

88

00

01

02

03

8D

8E

90

FB is inactive

FB execution completed without error – data is valid function block is active (action not yet completed) function block is active – valid values not yet available channel setting is invalid mode setting is invalid filter setting is invalid wire break occurred short to supply voltage occurred

Current at the input is too high

35049

177

ioControl CR2042, CR2052

PERIOD

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35733

>

.

Description

36550

PERIOD measures the frequency in [Hz] or the period time (cycle time) in [µs] or the phase shift in [°] on the specified channel, depending on the set operating mode:

MODE dec | hex

Description

0

14

19

20

25

28

29

31

35

00 No measurement

0E Frequency measurement

Signal = plus-switching

Count the positive edges for a certain time.

13 Period duration measurement (better replace by MODE = 20!)

Signal = plus-switching

Measure the time interval between two positive edges.

Specify the average value over a certain number of periods.

14 Period duration and ratio measurement

Signal = plus-switching

Measure the time interval between two positive edges.

Specify the average value over a certain number of periods.

19 Phase shift (0...359°) between channel A and channel B of an input channel pair

Signal = plus-switching

(message makes only sense if no great jumps > 179° can occur in the system)

1C Period duration measurement (better replace by MODE = 29!)

Signal = minus-switching

Measure the time interval between two positive edges.

Specify the average value over a certain number of periods.

1D Period duration and ratio measurement

Signal = minus-switching

Measure the time interval between two positive edges.

Specify the average value over a certain number of periods.

1F Frequency measurement

Signal = minus-switching

Count the positive edges for a certain time.

23 Phase shift (0...359°) between channel A and channel B of an input channel pair

Signal = minus-switching

(message makes only sense if no great jumps > 179° can occur in the system)

The operating mode should not be changed during operation.

If MODE = 19 / 20 / 25 / 28 / 29 / 35:

Permissible input frequency = 0.1...3 000 Hz.

If the load is too high, the cycle time can get unacceptably long.

→ chapter Performance limits of the device

(→ p. 37 )

178

ioControl CR2042, CR2052

36550

NOTE

>

In case of higher frequencies (higher than those guaranteed by ifm ) the following problems may occur:

The switch-on and switch-off times of the outputs become more important.

Undue heating of the components may occur.

The influences mentioned above depend on the components used in the individual case.

These possible influences cannot be exactly predicted.

Parameters of the inputs

36732

Parameter

ENABLE

CHANNEL

MODE

PERIODS

TIMEBASE

Data type

BOOL

BYTE

BYTE

BYTE

TIME

Description

TRUE: execute this function element

FALSE: unit is not executed

> initiated processes continue in the background

> FB outputs are not updated

(MODE = 14 / 19 / 20 / 28 / 29 / 31)

Number of the fast input channel

0 / 1 / 4 / 5 for the inputs IN00 / IN01 / IN04 / IN05

(MODE = 25 / 35)

Number of the fast input A channel

0 / 4 for the inputs IN00 / IN04

B channel = A channel + 1

Operating mode of the function block:

0 = 0x00 = no measurement

14 = 0x0E = frequency measurement, plus-switching

19 = 0x13 = period duration measurement, plus-switching

20 = 0x14 = period duration and ratio measurement, plus-switching

25 = 0x19 = phase shift of two signals, plus-switching

28 = 0x1C = period duration measurement, minus-switching

29 = 0x1D = period duration and ratio measurement, minus-switching

31 = 0x1F = frequency measurement, minus-switching

35 = 0x23 = phase shift of two signals, minus-switching

Number of periods to be averaged (1...4)

• if MODE = 19 / 20 / 28 / 29  average arithmetically

• if MODE = 25 / 35  average geometrically

• if PERIODS = 1  no averaging

(only relevant if MODE = 14 / 31) time for counting the edges in [ms] permissible values = 1...2 000

179

ioControl CR2042, CR2052

>

Parameters of the outputs

36523

Parameter

VALUE_CYCLE

VALUE_FREQ

VALUE_TIME

VALUE_RATIO

RESULT

Data type

DWORD

REAL

TIME

WORD

BYTE

Possible results for RESULT:

Value dec | hex

Description

3

130

132

137

146

0

1

2

03

82

84

89

92

00

01

02

FB is inactive

FB execution completed without error – data is valid function block is active (action not yet completed) function block is active

– valid values not yet available channel setting is invalid mode setting is invalid value for PERIODS or TIMEBASE is invalid

Period duration is too long

Description

(MODE = 14 / 19 / 20 / 28 / 29 / 31)

Cycle time in [µs] at the input

(MODE = 25 / 35)

Cycle time in [µs] at the A channel of the input pair

(MODE = 14 / 19 / 20 / 28 / 29 / 31)

Frequency of the detected periods in [Hz] at the input

(MODE = 25 / 35)

Frequency of the detected periods in [Hz] at the A channel of the input pair

(MODE = 14 / 31)

Value = 0 (not detected)

(MODE = 19 / 20 / 28 / 29)

Time elapsed since the last positive edge

(MODE = 25 / 35)

Time elapsed since the last valid measurement

(MODE = 14 / 31)

Value = 0 (not detected)

(MODE = 19 / 20 / 28 / 29)

Mark-to-space ratio of the input signal in [‰]

(MODE = 25 / 35)

Phase shift in [°] feedback of the function block

(possible messages → following table)

180

ioControl CR2042, CR2052

5.2.6

Function elements: output functions

Content

CURRENT_CONTROL ........................................................................................................................182

OUTPUT ...............................................................................................................................................184

PWM1000 .............................................................................................................................................186

15075

10462

For this device you can set the mode of some or all outputs. Here we show you a couple of function elements to it.

181

ioControl CR2042, CR2052

CURRENT_CONTROL

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

36049

>

Description

36050

CURRENT_CONTROL operates as a current controller for the PWMI outputs.

The controller operates in dependence of the period duration of the PWM signal. The setting parameters KI and KP represent the i ntegral and the p roportional component of the controller.

► It is recommended to set KI=50 and KP=50 as start values so as to determine the best setting of the controller. Depending on the requested controller behaviour the values can gradually be incremented (controller is stronger / faster) or decremented (controller is weaker / slower).

>

At the desired value DESIRED_CURRENT=0 the output is immediately switched to 0 mA and is not adjusted downward to 0 mA in accordance with the set parameters.

The controller has a fast compensation mechanism for voltage drops of the supply voltage. In addition to the controller behaviour of the controller and on the basis of the voltage drop, the ratio of the PWM is increased such that the controller reaches as quickly as possible the desired value.

Depending on the controller hardware used, a different teach performance has to be noted.

NOTE

► When defining the parameter DITHER_VALUE make sure that the resulting PWM ratio in the operating range of the loop control remains between 0...1000 %:

• PWM ratio + DITHER_VALUE < 1000 ‰ and

• PWM ratio - DITHER_VALUE > 0 ‰.

> With PWM frequencies below 100 Hz plus additional dither, the current control can no longer reach the indicated accuracy (

data sheet).

182

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

CHANNEL

DESIRED_CURRENT

FREQUENCY

DITHER_FREQUENCY

DITHER_VALUE

KP

>

KI

Parameters of the outputs

Data type

BOOL

BYTE

WORD

WORD

WORD

WORD

BYTE

BYTE

36678

Description

TRUE: execute this function element

FALSE: unit is not executed

> initiated processes continue in the background

> FB outputs are not updated

Number of the current-controlled output channel

0...7 for the outputs OUT00...OUT07 desired current value of the output in [mA]

Permissible PWM frequency at the output in [Hz] allowed = 20...250 = 0x0014...0x00FA dither frequency in [Hz] value range = 0...FREQUENCY / 2

FREQUENCY / DITHER_FREQUENCY must be even-numbered!

The FB increases all other values to the next matching value. peak-to-peak value of the dither in [‰] permissible values = 0...1 000 = 0000...03E8 proportional component of the output signal integral component of the output signal

2

3

128

129

130

131

134

Parameter

PWM_RATIO

CURRENT

RESULT

Data type

WORD

WORD

BYTE

Description for monitoring purposes: display PWM pulse ratio 0...1000 ‰ only available for current controlable outputs: current output current in [mA] feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

1 01

Description

FB is inactive

FB execution completed without error – data is valid

82

83

86

02

03

80

81 function block is active (action not yet completed) function block is active – valid values not yet available undervoltage on VBBx overvoltage on VBBx channel setting is invalid value for DESIRED_CURRENT is invalid dither setting is invalid

36011

183

ioControl CR2042, CR2052

OUTPUT

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35931

.

>

>

Description

36669

OUTPUT assigns an operating mode to an output channel ( → data sheet). The FB enables the status detection on the selected output channel.

.

The measurement and the output value result from the operating mode indicated via MODE:

• binary output, plus switching (BH) with/without diagnostic function

• binary output, plus switching (BH) with diagnostic function and protection

→ chapter Possible operating modes inputs/outputs (

→ p. 220 )

The operating mode should not be changed during operation.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

VALUE

MODE

FILTER

Data type

BOOL

BYTE

BOOL

BYTE

BYTE

36728

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

Number of the output channel

0...7 for the outputs OUT00...OUT07

TRUE: activate output

FALSE: deactivate output

Operating mode of the output:

0 = 0x00 = off

2 = 0x02 = binary output plus switching

15 = 0x0F = binary output plus switching with diagnosis

16 = 0x10 = binary output plus switching with diagnosis

and protection

only for outputs with current feedback: filter for the measurement on the output: valid = 0...8 recommended = 4

→ chapter Configure the software filters of the outputs

(→ p. 53 )

For outputs without current feedback:

FILTER = 0 or: do not set the parameter FILTER!

The operating mode should not be changed during operation.

184

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

OUTPUT

CURRENT

RESULT

Data type

BOOL

WORD

BYTE

Description

TRUE: output is activated

FALSE: output is deactivated only available for current controlable outputs: current output current in [mA] feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

128

129

130

132

2

3

0

1

136

141

80

81

82

84

00

01

02

03

88

8D

142

145

8E

91

FB is inactive

FB execution completed without error – data is valid function block is active (action not yet completed) function block is active – valid values not yet available undervoltage on VBBx overvoltage on VBBx channel setting is invalid mode setting is invalid filter setting is invalid a wire break was detected

(for binary output, plus switching (BH) with diagnosis) a short circuit was detected

(for binary output plus switching (BH) with diagnosis) current at the output is too high

(for binary output plus switching (BH) with diagnosis and protection)

35945

185

ioControl CR2042, CR2052

PWM1000

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35763

>

Description

35328

PWM1000 handles the initialisation and parameter setting of the PWM outputs.

The FB enables a simple use of the PWM FB in the device. For each channel an own PWM frequency, the mark-to-space ratio and the dither can be set.

>

The PWM frequency FREQUENCY can be directly indicated in [Hz] and the mark-to-space ratio

VALUE in steps of 1 ‰.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

FREQUENCY

VALUE

DITHER_FREQUENCY

DITHER_VALUE

Data type

BOOL

BYTE

WORD

WORD

WORD

WORD

36729

Description

TRUE: execute this function element

FALSE: unit is not executed

> initiated processes continue in the background

> FB outputs are not updated

Number of the output channel

0...7 for the outputs OUT00...OUT07

PWM frequency in [Hz] allowed = 20...250 = 0x0014...0x00FA

PWM value (mark-to-space ratio) in [‰] allowed = 0...1 000 = 0x0000...0x03E8

Values > 1 000 are regarded as = 1 000 dither frequency in [Hz] value range = 0...FREQUENCY / 2

FREQUENCY / DITHER_FREQUENCY must be even-numbered!

The FB increases all other values to the next matching value. peak-to-peak value of the dither in [‰] permissible values = 0...1 000 = 0000...03E8

186

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

CURRENT

RESULT

Data type

WORD

BYTE

Description only available for current controlable outputs: current output current in [mA] feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

3

128

130

131

0

1

2

133

134

03

80

82

83

00

01

02

85

86

FB is inactive

FB execution completed without error – data is valid function block is active (action not yet completed) function block is active

– valid values not yet available undervoltage on VBBx channel setting is invalid value for VALUE is invalid value for FREQUENCY is invalid dither setting is invalid

35937

187

ioControl CR2042, CR2052

5.2.7

Function elements: system

Content

FLASH_INFO .......................................................................................................................................189

FLASH_READ ......................................................................................................................................190

GET_APP_INFO ..................................................................................................................................191

GET_HW_INFO ....................................................................................................................................192

GET_IDENTITY ....................................................................................................................................193

GET_SW_INFO ....................................................................................................................................194

GET_SW_VERSION ............................................................................................................................195

MEM_ERROR ......................................................................................................................................196

MEMCPY ..............................................................................................................................................197

OHC ......................................................................................................................................................199

SET_BAR .............................................................................................................................................201

SET_DIGIT_TO_ALPHA ......................................................................................................................203

SET_DIGIT_TO_NUM ..........................................................................................................................205

SET_DISPLAY_4_DIGIT ......................................................................................................................207

SET_IDENTITY ....................................................................................................................................208

SET_LED ..............................................................................................................................................209

SET_LED_PWR_DIA_4_10 .................................................................................................................211

SET_PASSWORD ................................................................................................................................213

TIMER_READ_US ...............................................................................................................................214

35718

Here we show you ifm functions that enable you to

• manage memory contents

• read information from software and hardware

• set or read various data and parameters

188

ioControl CR2042, CR2052

FLASH_INFO

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35306

>

Description

>

FLASH_INFO reads the information from the user flash memory:

• name of the memory area (user defined),

• software version,

• start address (for simple reading with IEC structure).

Parameters of the inputs

Parameter

ENABLE

Data type

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

>

Parameters of the outputs

Parameter

NAME

VERSION

START_ADDR

RESULT

Data type

STRING(24)

STRING(24)

DWORD

BYTE

Description

Name of the memory area (user defined)

Software version

Start address of the data feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

157

00

01

9D

FB is inactive

FB execution completed without error

– data is valid

Software header invalid (CRC error)

35318

35152

35101

189

ioControl CR2042, CR2052

FLASH_READ

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35293

>

Description

35325

>

FLASH_READ enables reading of different types of data directly from the flash memory.

The FB 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.

► The address resulting from SRC + LEN must be < 65 408.

► To the destination address DST applies:

Determine the address by means of the operator ADR and assigne it to the POU!

Parameters of the inputs

35174

Parameter

ENABLE

DST

SRC

Data type

BOOL

DWORD

DWORD

WORD

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified destination address

Determine the address by means of the operator ADR and assigne it to the POU! relative start address in the memory valid = 0...65 407 = 0x0000 0000...0x0000 FF7F number (> 1) of the data bytes to be transmitted

>

LEN

Parameters of the outputs

35111

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

152

01

98

FB is inactive

FB execution completed without error – data is valid inadmissible memory area:

• invalid source address

• invalid destination address

• invalid number of bytes

190

ioControl CR2042, CR2052

GET_APP_INFO

= get application information

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35291

>

Description

>

GET_APP_INFO provides information about the application software stored in the device:

• name (= file name of the CODESYS project),

• version (= from CODESYS menu [Project] > [Project Info] > [Version]),

• unambiguous CoDeSys build number,

• CoDeSys build date.

Parameters of the inputs

Parameter

ENABLE

Data type

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

>

Parameters of the outputs

Parameter

NAME

VERSION

BUILD_NUM

BUILD_DATE

RESULT

Data type

STRING(24)

STRING(24)

STRING(24)

STRING(24)

BYTE

Description

Name of the application

Version of the application program

Unique CODESYS build number (e.g.: "45")

CODESYS build date (e.g.: "20111006123800") feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive

FB execution completed without error

– data is valid

35317

35004

35098

191

ioControl CR2042, CR2052

GET_HW_INFO

= get hardware information

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35270

>

Description

>

GET_HW_INFO provides information about the hardware of the device:

• ifm article number (e.g. CR0403),

• article designation,

• unambiguous serial number,

• hardware revision,

• production date.

Parameters of the inputs

35022

35092

Parameter

ENABLE

Data type

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

>

Parameters of the outputs

Parameter

ORDER_NUM

NAME

SERIAL

REVISION

MAN_DATE

RESULT

Data type

STRING(24)

STRING(24)

STRING(24)

STRING(24)

STRING(24)

BYTE

Description ifm article no. (e.g.: CR0403)

Article designation (e.g.: "BasicController 12/12")

Serial number of the device (e.g.: "000045784")

Hardware revision level of the device (e.g.: "V01.00.01")

Date of manufacture of the device (e.g.: "20111007123800") feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive

FB execution completed without error

– data is valid

192

35110

ioControl CR2042, CR2052

GET_IDENTITY

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35249

>

>

Description

35310

GET_IDENTITY reads the identification stored in the device (has previously been saved by means of

SET_IDENTITY

(→ p. 208 )).

Parameters of the inputs

35172

Parameter

ENABLE

Data type

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

>

Parameters of the outputs

35085

Parameter

APP_IDENT

RESULT

Data type

STRING(80)

BYTE

Description identifier of the application as a string of max. 80 characters, e.g.: "Crane1704" feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

155

00

01

9B

FB is inactive

FB execution completed without error

– data is valid value could not be read

193

ioControl CR2042, CR2052

GET_SW_INFO

= get software information

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35268

>

Description

>

GET_SW_INFO provides information about the system software of the device:

• software name,

• software version,

• build number,

• build date.

Parameters of the inputs

Parameter

ENABLE

Data type

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

>

Parameters of the outputs

Parameter

NAME

VERSION

BUILD_NUM

BUILD_DATE

RESULT

Data type

STRING(24)

STRING(24)

STRING(24)

STRING(24)

BYTE

Description

Name of the system software (e.g.: "BasicSystem")

Version of the system software (e.g.: "V02.00.03")

Build number of the system software (e.g.: "45")

Build date of the system software (e.g.: "20111006123800") feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive

FB execution completed without error – data is valid

35324

35003

35099

194

ioControl CR2042, CR2052

GET_SW_VERSION

= get software version

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35271

>

Description

>

GET_SW_VERSION provides information on the software in the device:

• BasicSystem version

• bootloader version

• SIS version

• IEC application program version

• IEC user flash version

Parameters of the inputs

Parameter

ENABLE

Data type

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

>

Parameters of the outputs

Parameter

BS_VERSION

BL_VERSION

SIS_VERSION

IEC_VERSION

USER_VERSION

RESULT

Data type

STRING(24)

STRING(24)

STRING(24)

STRING(24)

STRING(24)

BYTE

Description

Basic system version

Bootloader version

SIS version (SIS = System Information Service)

IEC application program version

IEC user flash version feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

1 01

Description

FB is inactive

FB execution completed without error – data is valid

35323

35091

35097

195

ioControl CR2042, CR2052

MEM_ERROR

= Memory Error

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35126

>

Description

>

MEM_ERROR signals errors in some parameters or in the memory.

The memory areas can be deleted via the corresponding FB inputs.

Parameters of the inputs

Parameter

ENABLE

RESET_RETAIN

RESET_OHC

>

Parameters of the outputs

Data type

BOOL

BOOL

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

TRUE: Delete non-volatile retain memory

FALSE: No changes to memory contents

TRUE: Delete non-volatile OHC memory

FALSE: No changes to memory contents

Parameter

COM_ERR

CALIB_ERR

RETAIN_ERR

OHC_ERR

RESULT

Data type

BOOL

BOOL

BOOL

BOOL

BYTE

Description

Download ID and baud rate are set to default values

(download parameters got lost)

Calibration values are invalid

(analogue inputs, PWM outputs, system voltages)

Retain memory is invalid

(e.g. partially deleted due to strong magnetic field)

OHC values are invalid

(e.g. partially deleted due to strong magnetic field) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive

FB execution completed without error

– data is valid

196

35341

35006

35100

ioControl CR2042, CR2052

MEMCPY

= memory copy

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35127

>

Description

>

MEMCPY enables writing and reading different types of data directly in the memory.

The FB writes the contents of the address of SRC to the address DST.

► To the addresses SRC and DST apply:

Determine the address by means of the operator ADR and assigne it to the POU!

> 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 variable.

Parameters of the inputs

27777

35171

Parameter

ENABLE

DST

SRC

LEN

SWAP_TYPE

Data type

BOOL

DWORD

DWORD

WORD

BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified destination address

Determine the address by means of the operator ADR and assigne it to the POU! source address number (> 1) of the data bytes to be transmitted

Swap the byte sequence:

0 = no swapping e.g.: 1A 2B 3C 4D  1A 2B 3C 4D

1 = swap 2 bytes (WORD, INT, ...) e.g.: 1A 2B 3C 4D  2B 1A 4D 3C

LEN must be a multiple of 2!

2 = swap 4 bytes (DWORD, DINT, REAL, TIME, ...) e.g.: 1A 2B 3C 4D  4D 3C 2B 1A

LEN must be a multiple of 4!

197

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

1

152

01

98

FB is inactive

FB execution completed without error – data is valid inadmissible memory area:

• invalid source address

• invalid destination address

• invalid number of bytes

156 9C inadmissible values:

• invalid value for SWAP_TYPE

• LEN does not match SWAP_TYPE

35108

198

ioControl CR2042, CR2052

OHC

= Operating Hours Counter

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35980

>

Description

OHC provides 4 operating hours counters for universal use.

However, for hardware version < AD: only 2 operating hours counters possible.

Valid counting range: 0:00...4 294 967 295:59 hours (= 490 293 years, 25 days, 15 hours)

>

If hardware version of device < AD: reset the memory area for OHC once:

 In the FB MEM_ERROR

(→ p. 196 ), set input RESET_OHC = TRUE!

> Only now can the operating hours counters be used.

Parameters of the inputs

Parameter

ENABLE

OHC_NUM

MODE

PRESET_HOURS

PRESET_MINUTES

Data type

BOOL

BYTE

BYTE

DWORD

BYTE

35692

Description

TRUE: execute this function element

FALSE: unit is not executed

> initiated processes continue in the background

> FB outputs are not updated

Operating Hours Counter

Number of the counter (0...3)

Operating mode of the counter permissible values =

0 = stop counter

1 = continue counting at the last stored value

2 = reset counter

3 = preset counter with the following values

Preset hours

(0...4 294 967 295 = 0x0000 0000...0xFFFF FFFF)

Preset minutes (0...59 = 0x00...0x3B)

35938

199

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

HOURS

MINUTES

RESULT

Data type

DWORD

BYTE

BYTE

Description

Counter value hours

(0...4 294 967 295 = 0x0000 0000...0xFFFF FFFF)

Counter value minutes (0...59 = 0x00...0x3B) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

1 01

Description

FB is inactive

FB execution completed without error – data is valid

130

131

132

158

82

83

84

9E

Counter number in OHC_NUM is invalid

Preset value is invalid mode setting is invalid

Remanent memory is invalid (CRC error)

35942

200

ioControl CR2042, CR2052

SET_BAR

Unit type = function block (FB)

Unit is contained in the library ifm_ioControl_Display_LED_Vxxyyzz.LIB

Symbol in CODESYS:

36586

>

>

Description

36534

With SET_BAR, the application program can control various LEDs on the Multifunction display (→ p.

24 ):

• MODE

• A

• B

• C

• D

• LOCK

Parameters of the inputs

36490

Parameter

ENABLE

MODE

A

B

C

D

LOCK

Data type

BOOL

BOOL

BOOL

BOOL

BOOL

BOOL

BOOL

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

TRUE: Switch on LED [M] (Mode)

FALSE: Switch off LED [M] (Mode)

TRUE: Switch on LED [A]

FALSE: Switch off LED [A]

TRUE: Switch on LED [B]

FALSE: Switch off LED [B]

TRUE: Switch on LED [C]

FALSE: Switch off LED [C]

TRUE: Switch on LED [D]

FALSE: Switch off LED [D]

TRUE: Switch on LED [Lock]

FALSE: Switch off LED [Lock]

201

ioControl CR2042, CR2052

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive function block execution completed without error

36524

202

ioControl CR2042, CR2052

SET_DIGIT_TO_ALPHA

Unit type = function block (FB)

Unit is contained in the library ifm_ioControl_Display_LED_Vxxyyzz.LIB

Symbol in CODESYS:

36594

>

Description

36533

SET_DIGIT_TO_ALPHA shows a selectable character on a selectable digit of the 4-digit 10-segment display.

Permissible characters = A...Z, a...z, 0...9, +, -, blank.

The points between the digits can be controlled.

The point in the bottom right corner and the point in the top left corner belong to one digit.

Controlling a non existing point (e.g. to the left of the first digit) ignores the controller without any error message.

>

Selectable display colours = red, green, orange.

Parameters of the inputs

36491

Parameter

ENABLE

DIGIT

ALPHA

POINTS

COLOUR

Data type

BOOL

BYTE

STRING[1]

BYTE

BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

Number of the display position to be controlled permissible values = 1...4 = 0x01...0x04

1 = to the left, 4 = to the right character to be displayed permissible = A...Z, a...z, 0...9, +, -, blank points to be displayed next to the digit:

0 = switch off both points

1 = only switch on the point in the right bottom corner

2 = only switch on the point in the top felt corner

3 = switch on both points

Display colour:

0 = off

1 = green

2 = rot

3 = orange

203

ioControl CR2042, CR2052

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive function block execution completed without error

36524

204

ioControl CR2042, CR2052

SET_DIGIT_TO_NUM

Unit type = function block (FB)

Unit is contained in the library ifm_ioControl_Display_LED_Vxxyyzz.LIB

Symbol in CODESYS:

36592

>

Description

36535

SET_DIGIT_TO_NUM indicates a selectable character on a selectable digit of the 4-digit 10-segment display.

Permissible characters = 0...9.

The points between the digits can be controlled.

The point in the bottom right corner and the point in the top left corner belong to one digit.

Controlling a non existing point (e.g. to the left of the first digit) ignores the controller without any error message.

>

Selectable display colours = red, green, orange.

Parameters of the inputs

36492

Parameter

ENABLE

DIGIT

NUM

POINTS

COLOUR

Data type

BOOL

BYTE

BYTE

BYTE

BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

Number of the display position to be controlled permissible values = 1...4 = 0x01...0x04

1 = to the left, 4 = to the right number to be displayed permissible = 0...9 = 0x00...0x09 points to be displayed next to the digit:

0 = switch off both points

1 = only switch on the point in the right bottom corner

2 = only switch on the point in the top felt corner

3 = switch on both points

Display colour:

0 = off

1 = green

2 = rot

3 = orange

205

ioControl CR2042, CR2052

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive function block execution completed without error

36524

206

ioControl CR2042, CR2052

SET_DISPLAY_4_DIGIT

Unit type = function block (FB)

Unit is contained in the library ifm_ioControl_Display_LED_Vxxyyzz.LIB

Symbol in CODESYS:

36591

>

Description

SET_DISPLAY_4_DIGIT indicates the first 4 characters (from the left) of a character string on the 4-digit 10-segment display.

Permissible characters = A...Z, a...z, 0...9, +, -, blank.

>

Selectable display colours = red, green, orange.

This function block uses the function block SET_DIGIT_TO_ALPHA

(→ p. 203 ) from the same library.

36537

Parameters of the inputs

36499

Parameter

ENABLE

ALPHA_4_DIGIT

COLOUR

Data type

BOOL

STRING[4]

BYTE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified character string to be displayed permissible = A...Z, a...z, 0...9, +, -, blank

After the 4th character, the FB ignores all characters of the character string at the input.

Display colour:

0 = off

1 = green

2 = rot

3 = orange

>

Parameters of the outputs

36525

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

2

131

00

01

02

83

FB is inactive function block execution completed without error function block is active (action not yet completed)

Preset value is invalid

207

ioControl CR2042, CR2052

SET_IDENTITY

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

34994

>

Description

>

SET_IDENTITY sets an application-specific program identification.

Using this FB, a program identification can be created by the application program.

► This identification can be read in order to identify the loaded program:

• via the software "Maintenance Tool"

• in the application program via the FB GET_IDENTITY

(→ p. 193 )

Parameters of the inputs

Parameter

ENABLE

APP_IDENT

Data type

BOOL

STRING(80)

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified identifier of the application as a string of max. 80 characters, e.g.: "Crane1704"

Reset with APP_IDENT = ""

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive

FB execution completed without error – data is valid

35326

35173

35088

208

ioControl CR2042, CR2052

SET_LED

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

34997

>

Description

With SET_LED the green LED [PWR] and the red LED [DIA] in the application program can be controlled different from the system configuration.

The FB

SET_LED_PWR_DIA_4_10

(→ p. 211 ) uses the function block SET_LED.

COLOR = LED_GREEN means the LED [PWR]

COLOR = LED_RED means the LED [DIA]

COLOR = LED_YELLOW means both LEDs simultaneously

NOTE

This FB overwrites the preset of the system settings.

Only in case of an error, the system controls the display again, e.g.:

• Application program stopped,

• Undervoltage,

• Fatal-Error.

LED display in case of an error:

• the green LED [PWR] is switched off,

• the red LED [DIA] is on according to the error (→ Chapter LED [DIA], diagnostics

(→ p. 25 )).

36638

209

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

COLOR_1

COLOR_2

FREQUENCY

Data type

BOOL

BYTE

BYTE

BYTE

35151

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

LED color for "switched on" color constant from the data structure "System LED Color"; allowed:

00 = LED_BLACK (= LED out)

01 = LED_RED

02 = LED_GREEN

03 = LED_YELLOW

LED color for "switched off" color constant from the data structure "System LED Color"; allowed:

00 = LED_BLACK (= LED out)

01 = LED_RED

02 = LED_GREEN

03 = LED_YELLOW

LED flashing frequency

Frequency constant from the data structure "System LED Frequency"; allowed:

00 = LED_0HZ = permanently ON

01 = LED_05HZ = flashes at 0.5 Hz

02 = LED_1HZ = flashes at 1 Hz

04 = LED_2HZ = flashes at 2 Hz

10 = LED_5HZ = flashes at 5 Hz

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

2

133

151

00

01

02

85

97

FB is inactive function block execution completed without error function block is active (action not yet completed) value for FREQUENCY is invalid value for color is invalid

35109

210

ioControl CR2042, CR2052

SET_LED_PWR_DIA_4_10

Unit type = function block (FB)

Unit is contained in the library ifm_ioControl_Display_LED_Vxxyyzz.LIB

Symbol in CODESYS:

36581

>

Description

With SET_LED_PWR_DIA_4_10, the application program can control the following LEDs on the

Multifunction display

(→ p. 24 ) simultaneously, by circumventing the system configuration:

• green LED [PWR], power

• red LED [DIA], diagnostic

This function block uses the function block SET_LED

(→ p. 209 ) from the device library.

NOTE

This FB overwrites the preset of the system settings.

Only in case of an error, the system controls the display again, e.g.:

• Application program stopped,

• Undervoltage,

• Fatal-Error.

LED display in case of an error:

• the green LED [PWR] is switched off,

• the red LED [DIA] is on according to the error (→ Chapter LED [DIA], diagnostics

(→ p. 25 )).

36536

211

ioControl CR2042, CR2052

>

Parameters of the inputs

Parameter

ENABLE

GREEN_ON

GREEN_INVERT

RED_ON

RED_INVERT

FREQUENCY

Data type

BOOL

BOOL

BOOL

BOOL

BOOL

BYTE

36500

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

TRUE: the green LED [PWR] is active

FALSE: the green LED [PWR] is not active

TRUE: LED [PWR] is on during the second time of the flashing period

FALSE: LED [PWR] is on during the first half of the flashing period

Prerequisite:

GREEN_ON = TRUE;

FREQUENCY is NOT LED_0HZ

TRUE: the red LED [DIA] is active

FALSE: the red LED [DIA] is not active

TRUE: LED [DIA] is on during the second half of the flashing period

FALSE: LED [DIA] is on during the first half of the flashing period

Prerequisite:

RED_ON = TRUE;

FREQUENCY is NOT LED_0HZ

LED flashing frequency

Frequency constant from the data structure "System LED Frequency"; allowed:

00 = LED_0HZ = permanently ON

01 = LED_05HZ = flashes at 0.5 Hz

02 = LED_1HZ = flashes at 1 Hz

04 = LED_2HZ = flashes at 2 Hz

10 = LED_5HZ = flashes at 5 Hz

>

Parameters of the outputs

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

Description

FB is inactive

1

133

151

01

85

97 function block execution completed without error value for FREQUENCY is invalid value for color is invalid

36520

212

ioControl CR2042, CR2052

SET_PASSWORD

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

34992

>

>

Description

35327

SET_PASSWORD sets a user password for program and memory upload via the maintenance tool.

If the user password is active, reading of the application program or the data memory via the maintenance tool is only possible if the correct password has been entered.

If an empty string (default condition) is assigned to the PASSWORD input, the password is reset. Than an upload of the application software or of the data memory is possible at any time.

The password is reset when loading a new application program.

Parameters of the inputs

35154

Parameter

ENABLE

PASSWORD

Data type

BOOL

STRING(16)

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified password

If PASSWORD = "", than access is possible without enter of a password

>

Parameters of the outputs

35107

Parameter

RESULT

Data type

BYTE

Description feedback of the function block

(possible messages → following table)

Possible results for RESULT:

0

Value dec | hex

00

1 01

Description

FB is inactive

FB execution completed without error – data is valid

213

ioControl CR2042, CR2052

TIMER_READ_US

Unit type = function block (FB)

Unit is contained in the library ifm_CR20n2_Vxxyyzz.LIB

Symbol in CODESYS:

35040

>

Description

27793

TIMER_READ_US reads the current system time in [µs].

When the supply voltage is applied, the device generates a clock pulse which is counted upwards in a register. This register can be read by means of the FB 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 = 1h 11min 34s 967ms 295µs

Parameters of the outputs

35086

Parameter

TIME_US

RESULT

Data type

DWORD

BYTE

Description current system time [  s] feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

00

01

FB is inactive

FB execution completed without error – data is valid

214

ioControl CR2042, CR2052

>

6 Diagnosis and error handling

Content

Diagnosis ..............................................................................................................................................215

Fault ......................................................................................................................................................215

Response to system errors...................................................................................................................216

CAN / CANopen: errors and error handling..........................................................................................216

28855

The runtime-system (RTS) checks the device by internal error checks:

• during the boot phase (reset phase)

• during executing the application program

→ chapter O perating states

(→ p. 34 )

In so doing a high operating reliability is provided, as much as possible.

6.1

Diagnosis

During the diagnosis, the "state of health" of the device is checked. It is to be found out if and what

→faults are given in the device.

>

Depending on the device, the inputs and outputs can also be monitored for their correct function.

- wire break,

- short circuit,

- value outside range.

For diagnosis, configuration and log data can be used, created during the "normal" operation of the device.

The correct start of the system components is monitored during the initialisation and start phase.

Errors are recorded in the log file.

For further diagnosis, self-tests can also be carried out.

28856

6.2

Fault

28834

A fault is the state of an item characterized by the inability to perform the requested function, excluding the inability during preventive maintenance or other planned actions, or due to lack of external resources.

A fault is often the result of a failure of the item itself, but may exist without prior failure.

In →ISO 13849-1 "fault" means "random fault".

215

> ioControl CR2042, CR2052

6.3

Response to system errors

>

35831

In principle, the programmer is responsible to react to the error messages in the application program.

An error description is provided via the error message.

> The system resets the error message as soon as the error causing state is not present anymore.

6.3.1

Example process for response to an error message

35698

>

The runtime system cyclically writes the system flag TEMPERATURE.

The application program detects the device temperature by retrieving the INT variable.

If permissible values for the application are exceeded or not reached:

> The application program deactivates the outputs.

► Rectify the cause of the error.

>

The application program detects the temperature value which has returned to normal:

The machine / system can be restarted or operation can be continued.

6.4

CAN / CANopen: errors and error handling

→ System manual "Know-How ecomat mobile "

→ chapter CAN / CANopen: errors and error handling

28808

216

ioControl CR2042, CR2052

7 Appendix

Content

System flags .........................................................................................................................................217

Address assignment and I/O operating modes ....................................................................................218

Error tables ...........................................................................................................................................222

28796

Additionally to the indications in the data sheets you find summary tables in the appendix.

>

7.1

System flags

Content

System flags: voltages ..........................................................................................................................217

System flags: system ............................................................................................................................217

System flags: keys ................................................................................................................................217

36632

The addresses of the system flags can change if the PLC configuration is extended.

► While programming only use the symbol names of the system flags!

7.1.1

System flags: voltages

36621

System flags (symbol name)

VBB2

VBBS

>

VU

7.1.2

System flags: system

Type

WORD

WORD

WORD

Description

Supply voltage on VBB2 in [mV]

Supply voltage on VBBS in [mV]

Internal supply voltage in [mV]

36616

System flags (symbol name)

>

TEMP

7.1.3

System flags: keys

Type

INT

Description

Temperature in the device in [°C]

36608

System flags (symbol name)

Switch_S1

Switch_S2

Switch_S3

Type

BOOL

BOOL

BOOL

Description

Key [

] is pressed

Key [  ] is pressed

Key [  ] is pressed

217

ioControl CR2042, CR2052

7.2

Address assignment and I/O operating modes

Content

Address assignment inputs / outputs ...................................................................................................218

Possible operating modes inputs/outputs .............................................................................................220

28801

→ also data sheet

>

7.2.1

Address assignment inputs / outputs

Content

Inputs: address assignment..................................................................................................................218

Outputs: address assignment ...............................................................................................................218

28800

Inputs: address assignment

36731

>

Abbreviations →chapter Note on wiring

(→ p. 22 )

Operating modes of the inputs/outputs →chapter Possible operating modes inputs/outputs

(→ p. 220 )

IEC address Symbolic address

%IB0 IN00

%IB1

%IB02

%IB3

IN01

IN02

IN03

%IB4

%IB5

%IB6

%IB7

IN04

IN05

IN06

IN07

%IB8

%IB9

%IB10

Switch_S1

Switch_S2

Switch_S3

%IW6

%IW7

%IW8

VBBS

VU

VBB2

%IW9 TEMP

Outputs: address assignment

36717

Abbreviations →chapter Note on wiring

(→ p. 22 )

Operating modes of the inputs/outputs

→chapter Possible operating modes inputs/outputs

(→ p.

220 )

IEC address Symbolic address

%QB0

%QB1

%QB2

OUT00

OUT01

OUT02

218

ioControl CR2042, CR2052

IEC address

%QB3

%QB4

%QB5

%QB6

%QB7

%QB16

%QB17

%QB18

%QB19

%QB20

%QB21

%QB22

%QB23

%QB8

%QB9

%QB10

%QB11

%QB12

%QB13

%QB14

%QB15

%QB24

%QB25

%QB26

%QB27

%QB28

%QB29

%QB30

%QB31

%QB32

Symbolic address

OUT03

OUT04

OUT05

OUT06

OUT07

LED_IN00

LED_OUT00

LED_IN01

LED_OUT01

LED_IN02

LED_OUT02

LED_IN03

LED_OUT03

LED_IN04

LED_OUT04

LED_IN05

LED_OUT05

LED_IN06

LED_OUT06

LED_IN07

LED_OUT07

DISP_D1L

DISP_D1H

DISP_D2L

DISP_D2H

DISP_D3L

DISP_D3H

DISP_D4L

DISP_D4H

DISP_BAR

219

ioControl CR2042, CR2052

>

7.2.2

Possible operating modes inputs/outputs

Content

Inputs: operating modes .......................................................................................................................220

Outputs: operating modes ....................................................................................................................221

28584

Inputs: operating modes

36696

= this configuration value is default

inputs Possible operating mode Set with function block FB input

dec

Value

hex

0 00

IN00, IN01,

IN04, IN05 off

Binary input (digital)

Voltage input

Voltage input, ratiometric

Current input

Voltage input

Binary input

Binary input with diagnostics

(Namur)

Binary input

Binary input (digital) plus-switching

0…10 000 mV

0…1 000 ‰

0…20 000 µA

0…32 000 mV plus-switching plus-switching

INPUT

INPUT

INPUT

INPUT

INPUT

INPUT

INPUT

INPUT

MODE

MODE minus-switching minus-switching

INPUT

INPUT

MODE

MODE

Frequency measurement

Interval measurement

Period duration and ratio measurement

Phase shift

0…30 000 Hz

0.1...3 000 Hz

0.1...3 000 Hz

0...359°

PERIOD

PERIOD

PERIOD

PERIOD

MODE

MODE

MODE

MODE

IN02, IN03,

IN06, IN07

Up counter

Down counter

Detect encoder values off

Binary input

Binary input with diagnostics

(Namur)

Resistance measurement 16…30 000 Ohm

Set operating modes with the following function block:

INPUT

(→ p. 175 )

plus-switching INPUT

INPUT

Assigns an operating mode to an input channel

Provides the current state of the selected channel

FASTCOUNT

(→ p. 171 )

INC_ENCODER

(→ p. 173 )

0…30 000 Hz

0…1 000 Hz plus-switching

FASTCOUNT

INC_ENCODER

INPUT

INPUT

MODE

MODE

MODE

MODE

MODE

Counter block for fast input pulses

Up/down counter function for the evaluation of encoders

MODE

MODE

MODE

MODE

MODE

MODE

0

10

11

18

00

0A

0B

12

20

25

21

22

12

37

14

19

1

7

9

3

6

10

11

14

19

15

16

0C

25

0E

13

01

03

06

07

09

0A

0B

220

ioControl CR2042, CR2052

PERIOD

(→ p. 178 )

• measures at the indicated channel:

the frequency and the period length (cycle time) in [µs],

• measures at the indicated channel pair:

the phase shift in [°] between channel A and channel B

>

Outputs: operating modes

Outputs

= this configuration value is default

Possible operating mode Set with function block FB input

OUT00

…OUT07 off

Binary output plus-switching

Binary output with diagnostics plus-switching

Binary output with diagnostics and protection plus-switching

OUTPUT

OUTPUT

OUTPUT

OUTPUT

MODE

MODE

MODE

MODE analogue output with pulse-width modulation

Analogue current-controlled output

Set operating modes with the following function block:

CURRENT_CONTROL

(→ p. 182 )

OUTPUT

(→ p. 184 )

PWM1000

(→ p. 186 )

PWM1000

CURRENT_CONTROL

Current controller for a PWMi output channel

Assigns an operating mode to an output channel

Provides the current state of the selected channel

Initialises and configures a PWM-capable output channel the mark-to-space ratio can be indicated in steps of 1 ‰

36714

2

15

16

dec

Value

hex

0 00

02

0F

10

221

ioControl CR2042, CR2052

>

7.3

Error tables

Content

Error flags .............................................................................................................................................222

Errors: CAN / CANopen ........................................................................................................................222

28817

7.3.1

Error flags

>

→ chapter System flags

(→ p. 217 )

7.3.2

Errors: CAN / CANopen

28818

19610

28819

>

→ System manual "Know-How ecomat mobile "

→ chapter CAN / CANopen: errors and error handling

EMCY codes: CANx

28825

>

The indications for CANx also apply to each of the CAN interfaces.

EMCY code

object 0x1003

Byte 0

[hex]

00

Byte 1

[hex]

80

Object

0x1001

Byte 2

[hex]

11

Byte 3

--

--

Manufactor specific information

Byte 4

--

--

Byte 5

--

--

Byte 6

--

-- 00

10

11

30

81

81

81

81

11

11

11

11

--

--

--

--

--

--

--

--

--

--

--

--

Byte 7 Description

--

--

--

--

--

CANx monitoring SYNC error (only slave)

CANx warning threshold (> 96)

CANx receive buffer overrun

CANx transmit buffer overrun

CANx guard/heartbeat error (only slave)

EMCY codes: I/Os, system

08

00

00

08

08

10

00

EMCY code

object 0x1003

Byte 0

[hex]

00

Byte 1

[hex]

21

23

31

33

33

21

21

23

Object

0x1001

Byte 2

[hex]

03

03

03

03

03

05

05

05

Manufactor specific information

Byte 3 Byte 4

I0 LSB

I0 LSB

I0 MSB

I0 MSB

I0 LSB I0 MSB

Q0 LSB Q0 MSB

Q0 LSB Q0 MSB

Byte 5 Byte 6

Byte 7 Description

Inputs interruption

Inputs short circuit

Excess current 4…20 mA

Outputs interruption

Outputs short circuit

Power supply VBBS

Terminal voltage VU

Output voltage VBB1, VBB2

35746

222

ioControl CR2042, CR2052

EMCY code

object 0x1003

Byte 0

[hex]

Byte 1

[hex]

Object

0x1001

Byte 2

[hex]

Byte 3

Manufactor specific information

Byte 4 Byte 5 Byte 6

Byte 7 Description

00 42 09 Excess temperature

>

In the CANopen stack none of these EMCY codes are fix implemented. Advice:

► Make these EMCY codes with CANOPEN_SENDEMCYMESSAGE.

Manufacturer-specific information (detail)

35560

The EMCY codes of the manufacturer-specific information for the inputs and outputs (if available) are distributed as follows:

Byte BYTE 3

Bit 7 6 5 4 3 2 1 0

I0 LSB IN07 IN06 IN05 IN04 IN03 IN02 IN01 IN00

Q0 LSB OUT07 OUT06 OUT05 OUT04 OUT03 OUT02 OUT01 OUT00

Byte BYTE 4

Bit 7 6 5 4 3 2 1 0

I0 MSB

Q0 MSB

IN15

OUT15

IN14

OUT14

IN13

OUT13

IN12

OUT12

IN11

OUT11

IN10

OUT10

IN09 IN08

OUT09 OUT08

223

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

8

A

Terms and abbreviations

Address

>

This is the "name" of the bus participant. All participants need a unique address so that the signals can be exchanged without problem.

Application software

>

Software specific to the application, implemented by the machine manufacturer, generally containing logic sequences, limits and expressions that control the appropriate inputs, outputs, calculations and decisions.

Architecture

>

Specific configuration of hardware and/or software elements in a system.

B

Baud

>

Baud, abbrev.: Bd = unit for the data transmission speed. Do not confuse baud with "bits per second"

(bps, bits/s). Baud indicates 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 back to the French inventor J. M. Baudot whose code was used for telex machines.

1 MBd = 1024 x 1024 Bd = 1 048 576 Bd

>

Boot loader

On delivery ecomatmobile controllers only contain the boot loader.

The boot loader is a start program that allows to reload the runtime system and the application program on the device.

The boot loader contains basic routines...

• for communication between hardware modules,

• for reloading the operating system.

The boot loader is the first software module to be saved on the device.

Bus

>

Serial data transmission of several participants on the same cable.

C

CAN

>

CAN = C ontroller A rea N etwork

CAN is a priority-controlled fieldbus system for large data volumes. There are several higher-level protocols that are based on CAN, e.g. 'CANopen' or 'J1939'.

CAN stack

CAN stack = software component that deals with processing CAN messages.

224

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

CiA

>

CiA = CAN in Automation e.V.

User and manufacturer organisation in Germany / Erlangen. Definition and control body for CAN and

CAN-based network protocols.

Homepage → www.can-cia.org

CiA DS 304

>

DS = D raft S tandard

CANopen device profile for safety communication

>

CiA DS 401

DS = D raft S tandard

CANopen device profile for binary and analogue I/O modules

>

CiA DS 402

DS = D raft S tandard

CANopen device profile for drives

>

CiA DS 403

DS = D raft S tandard

CANopen device profile for HMI

>

CiA DS 404

DS = D raft S tandard

CANopen device profile for measurement and control technology

>

CiA DS 405

DS = D raft S tandard

CANopen specification of the interface to programmable controllers (IEC 61131-3)

>

CiA DS 406

DS = D raft S tandard

CANopen device profile for encoders

CiA DS 407

>

DS = D raft S tandard

CANopen application profile for local public transport

Clamp 15

>

In vehicles clamp 15 is the plus cable switched by the ignition lock.

COB ID

COB = C ommunication Ob ject

ID = Id entifier

ID of a CANopen communication object

Corresponds to the identifier of the CAN message with which the communication project is sent via the

CAN bus.

225

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

>

CODESYS

CODESYS ® is a registered trademark of 3S – Smart Software Solutions GmbH, Germany.

'CODESYS for Automation Alliance' associates companies of the automation industry whose hardware devices are all programmed with the widely used IEC 61131-3 development tool CODESYS ®

Homepage → www.codesys.com

.

CSV file

CSV = C omma S eparated V alues (also: C haracter S eparated V alues)

A CSV file is a text file for storing or exchanging simply structured data.

The file extension is .csv

.

Example: Source table with numerical values: value 1.0

value 2.0

value 3.0

value 1.1

value 2.1

value 3.1

This results in the following CSV file:

.

> value 1.0;value 1.1;value 1.2;value 1.3

value 2.0;value 2.1;value 2.2;value 2.3

value 3.0;value 3.1;value 3.2;value 3.3

value 1.2

value 2.2

value 3.2

value 1.3

value 2.3

value 3.3

Cycle time

>

This is the time for a cycle. The PLC program performs one complete run.

Depending on event-controlled branchings in the program this can take longer or shorter.

D

INT

UINT

DINT

UDINT

REAL

ULINT

>

STRING

Data type

BOOL

BYTE

WORD

DWORD

SINT

USINT

Data type

Depending on the data type, values of different sizes can be stored.

min. value

FALSE

0

0

0

-128

0

-32 768

0

-2 147 483 648

0

-3.402823466 • 10 38

0

max. value

TRUE

255

65 535

4 294 967 295

127

255

32 767

65 535

2 147 483 647

4 294 967 295

3.402823466 • 10 38

18 446 744 073 709 551 615

DC

D irect C urrent

size in the memory

8 bits = 1 byte

8 bits = 1 byte

16 bits = 2 bytes

32 bits = 4 bytes

8 bits = 1 byte

8 bits = 1 byte

16 bits = 2 bytes

16 bits = 2 bytes

32 bits = 4 bytes

32 bits = 4 bytes

32 bits = 4 bytes

64 Bit = 8 Bytes number of char. + 1

226

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

Diagnosis

During the diagnosis, the "state of health" of the device is checked. It is to be found out if and what

→faults are given in the device.

Depending on the device, the inputs and outputs can also be monitored for their correct function.

- wire break,

- short circuit,

- value outside range.

>

For diagnosis, configuration and log data can be used, created during the "normal" operation of the device.

The correct start of the system components is monitored during the initialisation and start phase.

Errors are recorded in the log file.

For further diagnosis, self-tests can also be carried out.

>

Dither

Dither is a component of the →PWM signals to control hydraulic valves. It has shown for electromagnetic drives of hydraulic valves that it is much easier for controlling the valves if the control signal (PWM pulse) is superimposed by a certain frequency of the PWM frequency. This dither frequency must be an integer part of the PWM frequency.

DLC

>

D ata L ength C ode = in CANopen the number of the data bytes in a message.

For →SDO: DLC = 8

>

DRAM

DRAM = D ynamic R andom A ccess M emory.

Technology for an electronic memory module with random access (Random Access Memory, RAM).

The memory element is a capacitor which is either charged or discharged. It becomes accessible via a switching transistor and is either read or overwritten with new contents. The memory contents are volatile: the stored information is lost in case of lacking operating voltage or too late restart.

>

DTC

DTC = D iagnostic T rouble C ode = error code

In the protocol J1939 faults and errors well be managed and reported via assigned numbers – the

DTCs.

E

ECU

>

(1) E lectronic C ontrol U nit = control unit or microcontroller

(2) E ngine C ontrol U nit = control device of a engine

EDS-file

EDS = E lectronic D ata S heet, e.g. for:

• File for the object directory in the CANopen master,

• CANopen device descriptions.

Via EDS devices and programs can exchange their specifications and consider them in a simplified way.

227

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

>

Embedded software

System software, basic program in the device, virtually the →runtime system.

The firmware establishes the connection between the hardware of the device and the application program. The firmware is provided by the manufacturer of the controller as a part of the system and cannot be changed by the user.

EMC

>

EMC = E lectro M agnetic C ompatibility.

According to the EC directive (2004/108/EEC) concerning electromagnetic compatibility (in short EMC directive) requirements are made for electrical and electronic apparatus, equipment, systems or components to operate satisfactorily in the existing electromagnetic environment. The devices must not interfere with their environment and must not be adversely influenced by external electromagnetic interference.

EMCY

>

Abbreviation for emergency

Message in the CANopen protocol with which errors are signalled.

Ethernet

>

Ethernet is a widely used, manufacturer-independent technology which enables data transmission in the network at a speed of 10...10 000 million bits per second (Mbps). Ethernet belongs to the family of so-called "optimum data transmission" on a non exclusive transmission medium. The concept was developed in 1972 and specified as IEEE 802.3 in 1985.

EUC

>

EUC = E quipment U nder C ontrol.

EUC is equipment, machinery, apparatus or plant used for manufacturing, process, transportation, medical or other activities ( → IEC 61508-4, section 3.2.3). Therefore, the EUC is the set of all equipment, machinery, apparatus or plant that gives rise to hazards for which the safety-related system is required.

If any reasonably foreseeable action or inaction leads to →hazards with an intolerable risk arising from the EUC, then safety functions are necessary to achieve or maintain a safe state for the EUC. These safety functions are performed by one or more safety-related systems.

F

FiFo

FIFO ( F irst I n, F irst O ut) = Operating principle of the stack memory: The data packet that was written into the stack memory first, will also be read first. Each identifier has such a buffer (queue).

228

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

Flash memory

Flash ROM (or flash EPROM or flash memory) combines the advantages of semiconductor memory and hard disks. Similar to a hard disk, the data are however written and deleted blockwise in data blocks up to 64, 128, 256, 1024, ... bytes at the same time.

Advantages of flash memories

The stored data are maintained even if there is no supply voltage.

Due to the absence of moving parts, flash is noiseless and insensitive to shocks and magnetic fields.

>

Disadvantages of flash memories

A storage cell can tolerate a limited number of write and delete processes:

• Multi-level cells: typ. 10 000 cycles

• Single level cells: typ. 100 000 cycles

Given that a write process writes memory blocks of between 16 and 128 Kbytes at the same time, memory cells which require no change are used as well.

FRAM

>

FRAM, or also FeRAM, means Fe rroelectric R andom A ccess M emory. The storage operation and erasing operation is carried out by a polarisation change in a ferroelectric layer.

Advantages of FRAM as compared to conventional read-only memories:

• non-volatile,

• compatible with common EEPROMs, but:

• access time approx. 100 ns,

• nearly unlimited access cycles possible.

H

Heartbeat

>

The participants regularly send short signals. In this way the other participants can verify if a participant has failed.

>

HMI

HMI = H uman M achine I nterface

I

ID

>

ID = Id entifier

Name to differentiate the devices / participants connected to a system or the message packets transmitted between the participants.

IEC 61131

Standard: Basics of programmable logic controllers

• Part 1: General information

• Part 2: Production equipment requirements and tests

• Part 3: Programming languages

• Part 5: Communication

• Part 7: Fuzzy Control Programming

229

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

IEC user cycle

>

IEC user cycle = PLC cycle in the CODESYS application program.

>

Instructions

Superordinate word for one of the following terms: installation instructions, data sheet, user information, operating instructions, device manual, installation information, online help, system manual, programming manual, etc.

Intended use

>

Use of a product in accordance with the information provided in the instructions for use.

IP address

>

IP = I nternet P rotocol.

The IP address is a number which is necessary to clearly identify an internet participant. For the sake of clarity the number is written in 4 decimal values, e.g. 127.215.205.156.

>

ISO 11898

Standard: Road vehicles – Controller area network

• Part 1: Data link layer and physical signalling

• Part 2: High-speed medium access unit

• Part 3: Low-speed, fault-tolerant, medium dependent interface

• Part 4: Time-triggered communication

• Part 5: High-speed medium access unit with low-power mode

ISO 11992

>

Standard: Interchange of digital information on electrical connections between towing and towed vehicles

• Part 1: Physical and data-link layers

• Part 2: Application layer for brakes and running gear

• Part 3: Application layer for equipment other than brakes and running gear

• Part 4: Diagnostics

>

ISO 16845

Standard: Road vehicles – Controller area network (CAN) – Conformance test plan

J

>

J1939

→ SAE J1939

L

LED

LED = L ight E mitting D iode.

Light emitting diode, also called luminescent diode, an electronic element of high coloured luminosity at small volume with negligible power loss.

230

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

Link

>

A link is a cross-reference to another part in the document or to an external document.

LSB

>

L east S ignificant B it/Byte

M

>

MAC-ID

MAC = M anufacturer‘s A ddress C ode

= manufacturer's serial number.

→ID = Id entifier

Every network card has a MAC address, a clearly defined worldwide unique numerical code, more or less a kind of serial number. Such a MAC address is a sequence of 6 hexadecimal numbers, e.g.

"00-0C-6E-D0-02-3F".

Master

>

Handles the complete organisation on the bus. The master decides on the bus access time and polls the →slaves cyclically.

Misuse

>

The use of a product in a way not intended by the designer.

The manufacturer of the product has to warn against readily predictable misuse in his user information.

>

MMI

→ HMI

(→ p. 229 )

MRAM

>

MRAM = M agnetoresistive R andom A ccess M emory

The information is stored by means of magnetic storage elements. The property of certain materials is used to change their electrical resistance when exposed to magnetic fields.

Advantages of MRAM as compared to conventional RAM memories:

• non volatile (like FRAM), but:

• access time only approx. 35 ns,

• unlimited number of access cycles possible.

MSB

>

M ost S ignificant B it/Byte

N

NMT

>

NMT = N etwork M anagemen t = (here: in the CANopen protocol).

The NMT master controls the operating states of the NMT slaves.

Node

This means a participant in the network.

231

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

Node Guarding

>

Node = here: network participant

Configurable cyclic monitoring of each →slave configured accordingly. The →master verfies if the slaves reply in time. The slaves verify if the master regularly sends requests. In this way failed network participants can be quickly identified and reported.

O

Obj / object

>

Term for data / messages which can be exchanged in the CANopen network.

Object directory

>

Contains all CANopen communication parameters of a device as well as device-specific parameters and data.

OBV

>

Contains all CANopen communication parameters of a device as well as device-specific parameters and data.

OPC

>

OPC = O LE for P rocess C ontrol

Standardised software interface for manufacturer-independent communication in automation technology

OPC client (e.g. device for parameter setting or programming) automatically logs on to OPC server

(e.g. automation device) when connected and communicates with it.

>

Operational

Operating state of a CANopen participant. In this mode →SDOs, →NMT commands and →PDOs can be transferred.

P

>

PC card

→PCMCIA card

>

PCMCIA card

PCMCIA = Personal Computer Memory Card International Association, a standard for expansion cards of mobile computers.

Since the introduction of the cardbus standard in 1995 PCMCIA cards have also been called PC card.

PDM

PDM = P rocess and D ialogue M odule.

Device for communication of the operator with the machine / plant.

232

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

>

PDO

PDO = P rocess D ata O bject.

The time-critical process data is transferred by means of the "process data objects" (PDOs). The

PDOs can be freely exchanged between the individual nodes (PDO linking). In addition it is defined whether data exchange is to be event-controlled (asynchronous) or synchronised. Depending on the type of data to be transferred the correct selection of the type of transmission can lead to considerable relief for the →CAN bus.

According to the protocol, these services are unconfirmed data transmission: 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).

PDU

>

PDU = P rotocol D ata U nit = protocol data unit.

The PDU is a term from the →CAN protocol →SAE J1939. It refers to a component of the target address (PDU format 1, connection-oriented) or the group extension (PDU format 2, message-oriented).

PES

>

P rogrammable E lectronic S ystem ...

• for control, protection or monitoring,

• dependent for its operation on one or more programmable electronic devices,

• including all elements of the system such as input and output devices.

PGN

>

PGN = P arameter G roup N umber

PGN = 6 zero bits + 1 bit reserved + 1 bit data page + 8 bit PDU Format (PF) + 8 PDU Specific (PS)

The parameter group number is a term from the →CAN protocol →SAE J1939.

Pictogram

>

Pictograms are figurative symbols which convey information by a simplified graphic representation.

( → chapter What do the symbols and formats mean?

(→ p. 6 ))

>

PID controller

The PID controller (proportional –integral–derivative controller) consists of the following parts:

• P = proportional part

• I = integral part

• D = differential part (but not for the controller CR04nn, CR253n).

>

PLC configuration

Part of the CODESYS user interface.

► The programmer tells the programming system which hardware is to be programmed.

> CODESYS loads the corresponding libraries.

>

Reading and writing the periphery states (inputs/outputs) is possible.

Pre-Op

Pre-Op = PRE-OPERATIONAL mode.

Operating status of a CANopen participant. After application of the supply voltage each participant automatically passes into this state. In the CANopen network only →SDOs and →NMT commands can be transferred in this mode but no process data.

233

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

>

Process image

Process image is the status of the inputs and outputs the PLC operates with within one →cycle.

At the beginning of the cycle the PLC reads the conditions of all inputs into the process image.

During the cycle the PLC cannot detect changes to the inputs.

During the cycle the outputs are only changed virtually (in the process image).

At the end of the cycle the PLC writes the virtual output states to the real outputs.

PWM

>

PWM = pulse width modulation

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 varied. Depending on the mark-to-space ratio, the connected load determines the corresponding RMS current.

R

ratiometric

>

Measurements can also be performed ratiometrically. If the output signal of a sensor is proportional to its suppy voltage then via ratiometric measurement (= measurement proportional to the supply) the influence of the supply's fluctuation can be reduced, in ideal case it can be eliminated.

→ analogue input

>

RAW-CAN

RAW-CAN means the pure CAN protocol which works without an additional communication protocol on the CAN bus (on ISO/OSI layer 2). The CAN protocol is international defined according to

ISO 11898-1 and garantees in ISO 16845 the interchangeability of CAN chips in addition.

remanent

>

Remanent data is protected against data loss in case of power failure.

The →runtime system for example automatically copies the remanent data to a →flash memory as soon as the voltage supply falls below a critical value. If the voltage supply is available again, the runtime system loads the remanent data back to the RAM memory.

The data in the RAM memory of a controller, however, is volatile and normally lost in case of power failure.

ro

>

RO = read only for reading only

Unidirectional data transmission: Data can only be read and not changed.

RTC

>

RTC = R eal T ime C lock

Provides (batter-backed) the current date and time. Frequent use for the storage of error message protocols.

Runtime system

Basic program in the device, establishes the connection between the hardware of the device and the application program.

→ chapter Software modules for the device

(→ p. 28 )

234

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

rw

>

RW = read/ write

Bidirectional data transmission: Data can be read and also changed.

S

>

SAE J1939

The network protocol SAE J1939 describes the communication on a →CAN bus in commercial vehicles for transmission of diagnosis data (e.g.engine speed, temperature) and control information.

Standard: Recommended Practice for a Serial Control and Communications Vehicle Network

• Part 2: Agricultural and Forestry Off-Road Machinery Control and Communication Network

• Part 3: On Board Diagnostics Implementation Guide

• Part 5: Marine Stern Drive and Inboard Spark-Ignition Engine On-Board Diagnostics Implementation

Guide

• Part 11: Physical Layer – 250 kBits/s, Shielded Twisted Pair

• Part 13: Off-Board Diagnostic Connector

• Part 15: Reduced Physical Layer, 250 kBits/s, Un-Shielded Twisted Pair (UTP)

• Part 21: Data Link Layer

• Part 31: Network Layer

• Part 71: Vehicle Application Layer

• Part 73: Application Layer – Diagnostics

• Part 81: Network Management Protocol

SD card

>

An SD memory card (short for S ecure D igital Memory Card) is a digital storage medium that operates to the principle of →flash storage.

SDO

>

SDO = S ervice D ata O bject.

The SDO is used for access to objects in the CANopen object directory. 'Clients' ask for the requested data from 'servers'. The SDOs always consist of 8 bytes.

Examples:

• Automatic configuration of all slaves via →SDOs at the system start,

• reading error messages from the →object directory.

Every SDO is monitored for a response and repeated if the slave does not respond within the monitoring time.

Self-test

>

Test program that actively tests components or devices. The program is started by the user and takes a certain time. The result is a test protocol (log file) which shows what was tested and if the result is positive or negative.

>

Slave

Passive participant on the bus, only replies on request of the →master. Slaves have a clearly defined and unique →address in the bus.

stopped

Operating status of a CANopen participant. In this mode only →NMT commands are transferred.

235

ifm Programming Manual ioControl

Terms and abbreviations

2018-11-20

>

>

Symbols

Pictograms are figurative symbols which convey information by a simplified graphic representation.

( → chapter What do the symbols and formats mean?

(→ p. 6 ))

System variable

>

Variable to which access can be made via IEC address or symbol name from the PLC.

T

Target

>

The target contains the hardware description of the target device for CODESYS, e.g.: inputs and outputs, memory, file locations.

Corresponds to an electronic data sheet.

TCP

>

The T ransmission C ontrol P rotocol is part of the TCP/IP protocol family. Each TCP/IP data connection has a transmitter and a receiver. This principle is a connection-oriented data transmission. In the

TCP/IP protocol family the TCP as the connection-oriented protocol assumes the task of data protection, data flow control and takes measures in the event of data loss. (compare: →UDP)

Template

>

A template can be filled with content.

Here: A structure of pre-configured software elements as basis for an application program.

U

>

UDP

UDP ( U ser D atagram P rotocol) is a minimal connectionless network protocol which belongs 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.

According to the protocol, these services are unconfirmed data transmission: 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).

Use, intended

>

Use of a product in accordance with the information provided in the instructions for use.

W

Watchdog

In general the term watchdog is used for a component of a system which watches the function of other components. If a possible malfunction is detected, this is either signalled or suitable program branchings are activated. The signal or branchings serve as a trigger for other co-operating system components to solve the problem.

236

ioControl CR2042, CR2052

9 Index

4

4-digit 10-segment display ..................................................................... 26

A

About this manual .................................................................................... 4

Activate the PLC configuration .............................................................. 46

Activation of the input diagnosis ............................................................ 53

Address ................................................................................................ 241

Address assignment and I/O operating modes ................................... 234

Address assignment inputs / outputs .................................................. 235

Analogue inputs ..................................................................................... 15 configuration and diagnosis .......................................................................... 51

Appendix .............................................................................................. 232

Application program ............................................................................... 32

Application software............................................................................. 241

Architecture .......................................................................................... 241

Availability of PWM ................................................................................ 56

Available memory .................................................................................. 14

B

Baud ..................................................................................................... 241

Bibliothek ifm_CR20n2_V01yyzz.LIB .................................................... 61

Bibliothek ifm_ioControl_Display_LED_Vxxyyzz.LIB ............................ 62

Binary inputs .......................................................................................... 16 configuration and diagnosis .......................................................................... 52

Binary outputs configuration and diagnosis .......................................................................... 55

Boot loader .......................................................................................... 241

Bootloader.............................................................................................. 31

Bus ....................................................................................................... 241

C

CAN ..................................................................................................... 241 interfaces and protocols ................................................................................ 29

CAN / CANopen errors and error handling............................................................................. 230

CAN declaration (e.g. CR1080) ............................................................. 47

CAN interfaces ....................................................................................... 29

CAN stack ............................................................................................ 241

CAN_ENABLE ....................................................................................... 70

CAN_RECOVER ................................................................................... 71

CAN_REMOTE_REQUEST .................................................................. 93

CAN_REMOTE_RESPONSE................................................................ 95

CAN_RX ................................................................................................ 76

CAN_RX_ENH ....................................................................................... 77

CAN_RX_ENH_FIFO ............................................................................ 79

CAN_RX_RANGE ................................................................................. 81

CAN_RX_RANGE_FIFO ....................................................................... 83

CAN_SETDOWNLOADID ..................................................................... 72

CAN_STATUS ....................................................................................... 73

CAN_TX ................................................................................................. 86

CAN_TX_ENH ....................................................................................... 88

CAN_TX_ENH_CYCLIC ........................................................................ 90

CANOPEN_ENABLE ............................................................................. 99

CANOPEN_GETBUFFERFLAGS ....................................................... 101

CANOPEN_GETEMCYMESSAGES ................................................... 139

CANOPEN_GETERRORREGISTER .................................................. 141

CANOPEN_GETGUARDHBERRLIST ................................................ 134

CANOPEN_GETGUARDHBSTATSLV ............................................... 136

CANOPEN_GETNMTSTATESLAVE .................................................. 108

CANOPEN_GETODCHANGEDFLAG ................................................ 112

CANOPEN_GETSTATE ...................................................................... 103

CANOPEN_GETSYNCSTATE ............................................................ 130

CANOPEN_NMTSERVICES ............................................................... 109

CANOPEN_READOBJECTDICT ........................................................ 113

CANOPEN_SDOREAD ....................................................................... 117

CANOPEN_SDOREADBLOCK ........................................................... 119

CANOPEN_SDOREADMULTI ............................................................ 121

CANOPEN_SDOWRITE ..................................................................... 123

CANOPEN_SDOWRITEBLOCK ......................................................... 125

CANOPEN_SDOWRITEMULTI........................................................... 127

CANOPEN_SENDEMCYMESSAGE .................................................. 143

CANOPEN_SETSTATE ...................................................................... 105

CANOPEN_SETSYNCSTATE ............................................................ 132

CANOPEN_WRITEOBJECTDICT ...................................................... 114

CiA ....................................................................................................... 241

CiA DS 304 .......................................................................................... 242

CiA DS 401 .......................................................................................... 242

CiA DS 402 .......................................................................................... 242

CiA DS 403 .......................................................................................... 242

CiA DS 404 .......................................................................................... 242

CiA DS 405 .......................................................................................... 242

CiA DS 406 .......................................................................................... 242

CiA DS 407 .......................................................................................... 242

Clamp 15.............................................................................................. 242

COB ID ................................................................................................. 242

CODESYS ........................................................................................... 242

Conditions .............................................................................................. 13

Configuration of the inputs and outputs (default setting) ...................... 50

Configuration of the output diagnosis .................................................... 55

Configurations ........................................................................................ 41

Configure inputs ..................................................................................... 51

Configure outputs .................................................................................. 54

Configure the software filters of the inputs ............................................ 52

Configure the software filters of the outputs .......................................... 54

Copyright.................................................................................................. 4

Creating application program ................................................................ 34

CSV file ................................................................................................ 243

Current control with PWM (= PWMi) ..................................................... 56

CURRENT_CONTROL ....................................................................... 193

Cycle time ............................................................................................ 243

D

Data type.............................................................................................. 243

DC ........................................................................................................ 243

Definition overload ......................................................................................................... 19 short circuit .................................................................................................... 19

Description ...... 70, 71, 72, 73, 76, 77, 79, 81, 83, 86, 88, 90, 93, 95, 99,

101, 103, 105, 108, 109, 112, 113, 114, 117, 119, 121, 123, 125, 127,

130, 132, 134, 136, 139, 141, 143, 147, 149, 151, 153, 155, 157, 159,

161, 163, 166, 167, 169, 171, 174, 176, 178, 180, 182, 184, 187, 189,

193, 195, 197, 200, 201, 203, 204, 205, 206, 207, 208, 210, 212, 214,

216, 218, 220, 221, 222, 224, 226, 227

Diagnosis ............................................................................................. 229 binary outputs (via current and voltage measurement) .......................... 20, 21 overload (via current measurement) ....................................................... 20, 22 short circuit (via voltage measurement) .................................................. 21, 22 wire break (via voltage measurement).................................................... 21, 22

237

ioControl CR2042, CR2052

Diagnosis ............................................................................................. 243

Diagnosis and error handling............................................................... 229

Distribution of the application program .................................................. 35

Dither ................................................................................................... 244

DLC ...................................................................................................... 244

DRAM .................................................................................................. 244

DTC ...................................................................................................... 244

E

ECU ..................................................................................................... 244

EDS-file ................................................................................................ 244

Embedded software ............................................................................. 244

EMC ..................................................................................................... 245

EMCY ................................................................................................... 245

EMCY codes

CANx ........................................................................................................... 239

I/Os, system................................................................................................. 239

Error flags ............................................................................................ 239

ERROR state ......................................................................................... 37

Error tables .......................................................................................... 239

Errors

CAN / CANopen .......................................................................................... 239

Ethernet ............................................................................................... 245

EUC ..................................................................................................... 245

Example process for response to an error message .......................... 229

F

Fast inputs ............................................................................................. 53

FASTCOUNT ....................................................................................... 182

FATAL ERROR state ............................................................................. 37

Fault ..................................................................................................... 229

FB, FUN, PRG in CODESYS ................................................................ 33

FBs for PWM functions .......................................................................... 56

FiFo ...................................................................................................... 245

Flash memory ...................................................................................... 245

FLASH memory ..................................................................................... 14

FLASH_INFO ....................................................................................... 200

FLASH_READ ..................................................................................... 201

FRAM .............................................................................................14, 246

Function configuration in general .......................................................... 49

Function configuration of the inputs and outputs .................................. 50

Function element outputs ...................................................................... 66

Function elements

CANopen ....................................................................................................... 97

CANopen emergency .................................................................................. 138

CANopen guarding ...................................................................................... 133

CANopen network management ................................................................. 107

CANopen object directory ........................................................................... 111

CANopen SDOs .......................................................................................... 116

CANopen status ............................................................................................ 98

CANopen SYNC .......................................................................................... 129 output functions ........................................................................................... 192 processing input values............................................................................... 181

RAW-CAN (Layer 2) ...................................................................................... 68

RAW-CAN remote ......................................................................................... 92

RAW-CAN status ........................................................................................... 69 receive RAW-CAN data ................................................................................ 75 receive SAE J1939 ...................................................................................... 158

SAE J1939 ................................................................................................... 145

SAE J1939 diagnosis .................................................................................. 173

SAE J1939 request ..................................................................................... 154

SAE J1939 status ........................................................................................ 146 system ......................................................................................................... 199

238 transmit RAW-CAN data ............................................................................... 85 transmit SAE J1939..................................................................................... 165

G

GET_APP_INFO .................................................................................. 203

GET_HW_INFO ................................................................................... 204

GET_IDENTITY ................................................................................... 205

GET_SW_INFO ................................................................................... 206

GET_SW_VERSION ........................................................................... 207

H

Hardware description ............................................................................. 12

Hardware structure ................................................................................ 13

Heartbeat ............................................................................................. 246

History of the instructions ........................................................................ 6

HMI ...................................................................................................... 246

How is this documentation structured? ................................................... 5

I

ID ......................................................................................................... 246

IEC 61131 ............................................................................................ 246

IEC user cycle ...................................................................................... 246 ifm function elements ............................................................................. 60 ifm function elements for the device CR20n2 ....................................... 66 ifm libraries for the device CR20n2 ....................................................... 61

INC_ENCODER ................................................................................... 184

Indicators ............................................................................................... 24

Information about the device ................................................................. 11

INIT status (reset) .................................................................................. 36

INPUT .................................................................................................. 187

Input group IN00, IN01, IN04, IN05 ....................................................... 16

Input group IN02, IN03, IN06, IN07 ....................................................... 17

Inputs address assignment .................................................................................... 235 operating modes .......................................................................................... 237

Inputs (technology) ................................................................................ 15

Install the runtime system ...................................................................... 42

Instructions .......................................................................................... 246

Intended use ........................................................................................ 246

Interface description .............................................................................. 28

IP address ............................................................................................ 246

ISO 11898 ............................................................................................ 247

ISO 11992 ............................................................................................ 247

ISO 16845 ............................................................................................ 247

J

J1939 ................................................................................................... 247

J1939_DM1RX .................................................................................... 174

J1939_DM1TX ..................................................................................... 176

J1939_DM1TX_CFG ........................................................................... 178

J1939_DM3TX ..................................................................................... 180

J1939_ENABLE ................................................................................... 147

J1939_GETDABYNAME ..................................................................... 149

J1939_NAME ....................................................................................... 151

J1939_RX ............................................................................................ 159

J1939_RX_FIFO .................................................................................. 161

J1939_RX_MULTI ............................................................................... 163

J1939_SPEC_REQ ............................................................................. 155

J1939_SPEC_REQ_MULTI ................................................................ 157

J1939_STATUS ................................................................................... 153

ioControl CR2042, CR2052

J1939_TX............................................................................................. 166

J1939_TX_ENH ................................................................................... 167

J1939_TX_ENH_CYCLIC ................................................................... 169

J1939_TX_ENH_MULTI ...................................................................... 171

L

LED ...................................................................................................... 247

LED [A]...[D] ........................................................................................... 26

LED [DIA], diagnostics ........................................................................... 26

LED [Lock] ............................................................................................. 26

LED [M], mode ....................................................................................... 26

LED [PWR], power................................................................................. 25

LEDs for input and output status ........................................................... 24

Libraries ................................................................................................. 32

Library ifm_CANopen_NT_Vxxyyzz.LIB................................................ 63

Library ifm_J1939_NT_Vxxyyzz.LIB ..................................................... 64

Library ifm_RAWCan_NT_Vxxyyzz.LIB ................................................ 62

Limitations for CAN in this device .......................................................... 38

Limitations for CAN J1939 in this device ............................................... 39

Limitations for CANopen in this device.................................................. 39

Link ...................................................................................................... 247

LSB ...................................................................................................... 247

M

MAC-ID ................................................................................................ 247

Manufacturer-specific information (detail) ........................................... 240

Master .................................................................................................. 247

MEM_ERROR ..................................................................................... 208

MEMCPY ............................................................................................. 210

Misuse .................................................................................................. 248

MMI ...................................................................................................... 248

MRAM .................................................................................................. 248

MSB ..................................................................................................... 248

Multifunction display .............................................................................. 25

N

Network variables .................................................................................. 58

NMT ..................................................................................................... 248

Node .................................................................................................... 248

Node Guarding .................................................................................... 248

Note on wiring ........................................................................................ 23

Note the cycle time! ............................................................................... 33

Notes serial number ................................................................................................... 9

O

Obj / object ........................................................................................... 248

Object directory .................................................................................... 248

OBV ..................................................................................................... 248

OHC ..................................................................................................... 212

OPC ..................................................................................................... 249

Operating elements ............................................................................... 27

Operating states .................................................................................... 36

Operational .......................................................................................... 249

OUTPUT .............................................................................................. 195

Output group OUT00...OUT03 .............................................................. 20

Output group OUT04...OUT07 .............................................................. 21

Outputs address assignment .................................................................................... 235 operating modes .......................................................................................... 238

Outputs (technology) ............................................................................. 19

Overview documentation modules for CR2042, CR2052 ............................................... 4

Overview device family ioControl .......................................................... 11

P

Parameters of the inputs ... 70, 71, 72, 73, 76, 77, 79, 86, 88, 90, 93, 95,

99, 101, 103, 105, 108, 109, 112, 113, 114, 117, 119, 121, 123, 125,

127, 130, 132, 134, 136, 139, 141, 143, 147, 149, 151, 153, 155, 157,

159, 161, 163, 166, 167, 169, 171, 174, 176, 178, 180, 182, 185, 187,

190, 193, 195, 197, 200, 201, 203, 204, 205, 206, 207, 208, 210, 212,

214, 216, 218, 220, 221, 222, 224, 226

Parameters of the inputs ....................................................................... 81

Parameters of the inputs ....................................................................... 83

Parameters of the outputs . 70, 72, 73, 76, 78, 79, 81, 83, 86, 88, 90, 93,

95, 99, 101, 103, 106, 108, 109, 112, 113, 114, 117, 120, 121, 123,

126, 127, 130, 132, 134, 136, 139, 141, 143, 147, 150, 152, 153, 155,

157, 159, 161, 163, 166, 167, 169, 171, 174, 177, 178, 180, 183,

185,188, 190, 194, 196, 197, 200, 201, 203, 204, 205, 206, 207, 208,

210, 212, 214, 216, 218, 220, 221, 223, 225, 226, 227

PC card ................................................................................................ 249

PCMCIA card ....................................................................................... 249

PDM ..................................................................................................... 249

PDO ..................................................................................................... 249

PDU ..................................................................................................... 249

Performance limits of the device ........................................................... 38

PERIOD ............................................................................................... 189

PES ...................................................................................................... 249

PGN ..................................................................................................... 250

Pictogram ............................................................................................. 250

PID controller ....................................................................................... 250

PLC configuration ................................................................................ 250

Please note .............................................................................................. 8

Possible operating modes inputs/outputs ........................................... 237

Pre-Op ................................................................................................. 250

Principle block diagram ......................................................................... 14

Process image ..................................................................................... 250

Programming notes for CODESYS projects ......................................... 33

Protective functions of the outputs ........................................................ 19

PWM .................................................................................................... 250

PWM outputs ......................................................................................... 55

PWM1000 ............................................................................................ 197

R ratiometric ............................................................................................ 250

RAW-CAN ............................................................................................ 251

Reaction according to the operating mode of the output ...................... 19

Reaction of the outputs to overload or short circuit ............................... 19

Reaction when using PWM or CURRENT_CONTROL ........................ 20

Read back retain variables .................................................................... 58 remanent .............................................................................................. 251

Resistance measurement ...................................................................... 17

Response to system errors .................................................................. 229

Retain variables ..................................................................................... 57 ro .......................................................................................................... 251

RTC ...................................................................................................... 251

RUN state .............................................................................................. 37

Runtime system .............................................................................32, 251 rw ......................................................................................................... 251

S

SAE J1939 ........................................................................................... 251

239

ioControl CR2042, CR2052

Safety instructions ................................................................................... 8

Safety instructions about Reed relays .............................................23, 51

Save retain variables ............................................................................. 57

SD card ................................................................................................ 252

SDO ..................................................................................................... 252

Self-protection of the output .................................................................. 19

Self-test ................................................................................................ 252

Set up the programming system ........................................................... 45

Set up the programming system manually ............................................ 46

Set up the programming system via templates ..................................... 49

Set up the runtime system ..................................................................... 42

Set up the target .................................................................................... 46

SET_BAR............................................................................................. 214

SET_DIGIT_TO_ALPHA ..................................................................... 216

SET_DIGIT_TO_NUM ......................................................................... 218

SET_DISPLAY_4_DIGIT ..................................................................... 220

SET_IDENTITY ................................................................................... 221

SET_LED ............................................................................................. 222

SET_LED_PWR_DIA_4_10 ................................................................ 224

SET_PASSWORD ............................................................................... 226

Slave .................................................................................................... 252

Software description .............................................................................. 30

Software modules for controller function ............................................... 31

Software modules for the device ........................................................... 31

Software modules on delivery as IO module ......................................... 31

SRAM ..................................................................................................... 14

Start-up behaviour of the controller ......................................................... 9

STOP state ............................................................................................ 36 stopped ................................................................................................ 252

Symbols ............................................................................................... 252

System description ................................................................................ 11

System flags ........................................................................................ 233 keys ............................................................................................................. 233 system ......................................................................................................... 233 voltages ....................................................................................................... 233

System variable ................................................................................... 252

System variables ................................................................................... 49

T

Target ................................................................................................... 252

TCP ...................................................................................................... 252

Template .............................................................................................. 253

TIMER_READ_US............................................................................... 227

U

UDP ..................................................................................................... 253

Update the runtime system .................................................................... 43

Use as binary inputs .............................................................................. 53

Use, intended ....................................................................................... 253

Using ifm maintenance tool ................................................................... 35

V

Variables ................................................................................................ 57

Verify the installation ............................................................................. 43

W

Watchdog ............................................................................................. 253

Watchdog behaviour .............................................................................. 38

What do the symbols and formats mean? ............................................... 5

What previous knowledge is required? ................................................... 8

240

advertisement

Key Features

  • Compact size, DIN rail mountable for easy installation
  • 8 digital inputs, 4 digital outputs for versatile I/O handling
  • 2 CAN interfaces for flexible communication options
  • Wide operating temperature range (-25 to +60 °C) for harsh environments
  • Software configurable I/O functionality for customized applications
  • Supports CODESYS programming for user-friendly development
  • LED indicators for clear status monitoring

Related manuals

Frequently Answers and Questions

How many digital inputs does the CR2042 have?
It has 8 digital inputs.
What type of communication interfaces does it support?
It supports 2 CAN interfaces for flexible communication.
Is it suitable for use in high-temperature environments?
Yes, it has a wide operating temperature range of -25 to +60 °C, making it suitable for harsh environments.
Can I use CODESYS programming with the CR2042?
Yes, it supports CODESYS programming for user-friendly development.
What is the mounting type of the CR2042?
It is DIN rail mountable for easy installation.
Download PDF

advertisement

Table of contents