Training Manual V23 1006 Ifm

  • Uploaded by: Ovidiu Ciobanu
  • 0
  • 0
  • 2 weeks ago
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Training Manual V23 1006 Ifm as PDF for free.

More details

  • Words: 26,590
  • Pages: 139
Loading documents preview...
Training manual 1 R

Controller family R360 for CoDeSys starting version 2.3

You will find more details at: www.ifm-electronic.com

Training Manual CoDeSys 2.3, 10/ 2006, from software version V020102 Guarantee note This manual was written with the utmost care. However, we cannot assume any guarantee for the contents. Since errors cannot be totally avoided despite all efforts we appreciate your comments. We reserve the right to make technical alterations to the product which might result in a change of contents of the manual.

Training manual ecomatmobile type R360

What you can find in this manual 1.

What you should know...........................................................1-1

1.1.

Required previous knowledge............................................................... 1-1

1.2.

Structure of the manual.......................................................................... 1-1 How to find your way around .................................................................... 1-1

1.3.

Overview of the documentation............................................................. 1-2 Printed media............................................................................................ 1-2 Electronic media ....................................................................................... 1-3

1.4.

Hardware ................................................................................................. 1-3

1.5.

Features of a PLC ................................................................................... 1-5 Cycle......................................................................................................... 1-5 Time response .......................................................................................... 1-7 Watchdog.................................................................................................. 1-9

2.

Installation...............................................................................2-1

2.1.

Hardware of the PC................................................................................. 2-1

2.2.

Software setup ........................................................................................ 2-1

2.3.

Program start .......................................................................................... 2-5

2.4.

Settings.................................................................................................... 2-7 New project............................................................................................... 2-7 Target........................................................................................................ 2-7 Subsequent installation of the target......................................................... 2-8 Main program.......................................................................................... 2-10 Directories................................................................................................2-11 Libraries .................................................................................................. 2-13 PLC configuration ................................................................................... 2-16

3.

The start...................................................................................3-1

3.1.

Basics and concepts .............................................................................. 3-1

3.2.

A small ecolog CoDeSys project as a start .......................................... 3-3

R

I

Description ................................................................................................ 3-3 The first step ............................................................................................. 3-3 Add Program............................................................................................. 3-5 Defining variables ..................................................................................... 3-6 Saving ..................................................................................................... 3-13 Other languages ..................................................................................... 3-14 Program test ........................................................................................... 3-15 Visualisation ............................................................................................ 3-19 1.3.

Online test ............................................................................................. 3-31 Preparations............................................................................................ 3-31 Operating system.................................................................................... 3-32 Online program test ................................................................................ 3-37 Sampling Trace ....................................................................................... 3-45 Documentation ........................................................................................ 3-51

4.

Exercises ................................................................................ 4-1

4.1.

Logic functions ....................................................................................... 4-1 Example 1! Error! ...................................................................................... 4-3 Example 2 ................................................................................................. 4-4

4.2.

Higher-level functions ............................................................................ 4-5 Timer and counter function ....................................................................... 4-5 Practical application .................................................................................. 4-6

4.3.

More details ............................................................................................. 4-6 Notes......................................................................................................... 4-6 Cycle time ................................................................................................. 4-7 Visualisation .............................................................................................. 4-9

5.

Models ..................................................................................... 5-1

5.1.

Overview .................................................................................................. 5-1

5.2.

Task Drill .................................................................................................. 5-2

5.3.

Task: Robot ............................................................................................. 5-3

5.4.

Task: Milling system ............................................................................... 5-5

II

Training manual ecomatmobile type R360

5.5.

Addressing .............................................................................................. 5-6

5.6.

Other remarks ......................................................................................... 5-7

6.

Appendix .................................................................................6-1

6.1.

Buttons .................................................................................................... 6-1 File functions............................................................................................. 6-1 Online functions ........................................................................................ 6-2 General editing functions .......................................................................... 6-2 Editing functions for SFC .......................................................................... 6-3 Editing functions for LD............................................................................. 6-3 Editing functions for FBD .......................................................................... 6-4 Functions for sampling trace..................................................................... 6-4 Functions for Visualisation ........................................................................ 6-5

6.2.

Quick reference guide ............................................................................ 6-7 New project............................................................................................... 6-7 Libraries and hardware configuration........................................................ 6-8

6.3.

Saving work........................................................................................... 6-10 'Save as...' .............................................................................................. 6-10 'Project' 'Merge...'.....................................................................................6-11 'Export project...' 'Import project...' .......................................................... 6-12 Library..................................................................................................... 6-12 Clipboard ................................................................................................ 6-12 Templates ............................................................................................... 6-12 Other steps ............................................................................................. 6-12

6.4.

Remarks for solutions .......................................................................... 6-13

6.5.

Notes on the models............................................................................. 6-14 Declarations............................................................................................ 6-15 Sequence................................................................................................ 6-18 Recap ..................................................................................................... 6-18 Program structure ................................................................................... 6-19 Individually defined function block .......................................................... 6-21

R

III

7.

IV

Index ........................................................................................ 7-1

Training manual ecomatmobile type R360

1.

What you should know In this chapter we will give you an overview of the following points:

Why this manual?



What previous knowledge is required to be able to work with this manual?



What is the structure of this manual?



How do you find your way around this manual?



What information do you find in this manual?

Every user knows the problem: new software and new hardware. You will come across many unknown issues which at the beginning take up a lot of time and thus money.

When you work with the system more frequently you will find that many work steps keep repeating themselves. You no longer concentrate on how to create a new project or how to declare a variable but on the process to be controlled. This manual therefore describes in many details, step by step, the procedure of creating programs and handling the hardware. When you use this manual as recommended, you will be able to quickly reach your goal to effectively use the controller system ecomatmobile.

1.1.

Required previous knowledge This training manual is directed at people who have some basic technical knowledge. Some experience in controller technology and PLC programming skills are useful.

1.2.

Structure of the manual This manual provides learning support for starters. As experience increases more interim steps can be skipped.

How to find your way around To facilitate work with this manual we have added some helps for you. To be able to directly get to a certain subject use the table of contents of this manual. The index will also help you get to the term you are looking for. At the beginning of a chapter we are giving you a brief overview of the contents of that chapter.

R

1-1

Overview of the documentation

Headers

The header of each page on the right provides you with the title of the current chapter. On the left you will find the current header of second order.

Footnotes

In the footnotes of each page you will find the chapter-related number of the page.

Selective reading

In the marginal column you will find comments which make finding certain paragraphs easier for you.

There you will also find pictograms and markings the meaning of which is explained below

Note

Paragraphs marked with this pictogram give safety-related information. Read these paragraphs very carefully.

Arrow

Here you are given important notes to help you with the correct handling of ecomatmobile.

1.3.

Overview of the documentation Working with a controller of the ecomat R360 system requires several documents. A brief overview should help you to cope.

Printed media

1-2



Catalogue Overview of the units with data sheets



Manual for the program development with CoDeSys Software description



System manual ecomatmobile type R360 Technical description, hardware-specific function blocks



Mounting and installation instructions hardware specific, are supplied with the unit



Training manual 1 Step-by-step introduction

What you should know

Electronic media For some devices the system manual is replaced by the online help..

Online Help

It becomes more and more familiar that the programmer gets information just when needed. The search function and the links make it easy to work fast and effective. If you prefer to browse in a printed medium then you may just print out the online help. It is formatted in a way that you should get a well formatted print.

Figure 1: Online Help

www.ifmelectronic.com

Each printed medium such as this manual will become obsolete sooner or later; looking at the speed of technical changes, rather sooner. This also applies to hardware and software. To find out about the current version, please see the web address indicated on the left. Usually you will find there updates of the software and the current version of the documentation for downloading (Æ e.g. page 2-4). This concerns also the online helpÆ Figure 1.

1.4.

Hardware In the training manual reference will be made quite often to the hardware. To be noted: The different types of the controller ecomatmobile type R360 (e. g. CR2500, CR0020, CR0505) vary in their different hardware configurations.

For the programming software this means:

R

1-3

Hardware



It has to be adapted to the hardware. The process is briefly described below. Further information is given in the programming or system manual.



It might be necessary to change e.g. the addresses of inputs or outputs in example programs.

It would be much too complicated to write an introduction into the software for each type. That is why as an example the handling of the controller CR0020

will be described. When you work with another type later on, this must, of course, be taken into account for the examples. Another subdirectory must be set and other libraries must be loaded. Since the type designation, here CR0020, is also used for the directory and file name, e.g. subdirectory ifm_CR0020 etc., this should be no problem. To keep the following text clear, this will not be pointed out separately.

When, for example, you work with the starter set of the controller CR2500, virtually everywhere 0020 can be replaced with 2500 in the following examples. The only difference is that with the starter set some steps can be skipped. Here some settings have already been made to facilitate the start, e.g. the operating system has already been loaded. No harm is done, though, if for example you load the operating system once again for reasons of practical training.

1-4

What you should know

1.5.

Features of a PLC Cycle The advantages of a PLC as compared to a conventional contactor controller does no longer need to be pointed out today. Now there are also controllers with mechanical and electrical features which are necessary for use in mobile machines, e.g. protection IP 67, high mechanical stability and electrical noise immunity. These may also be the reasons why the reader has decided to use the ecomat mobile system. For those who do not yet have any experience with a PLC some features which sometimes present problems will be briefly described in this chapter.

Cyclical program processing

One characteristic of PLC systems is the cyclical program processing. This has some consequences for programming which will be briefly shown below.

Figure2: Cyclical Program Processing An example is to explain why this type of programming makes sense. Let us assume that the following instructions are in the program: If the selector switch is on 0 (logical FALSE), then switch the output "move to the left". If the selector switch is on 1 (logical TRUE), switch the output "move to the right". At first glance everything seems to be clear. The switch can either be on 0 or 1. However, it has to be noted that such a program is processed in sequence, e.g. instruction after instruction. Nevertheless, sometime the following event may come up (this is where Murphy's law applies): The selector switch is on 0, therefore the output "move to the left" is switched.

R

1-5

Features of a PLC

At that very moment somebody flips the selector switch. If the state of the input were enquired about again, the condition for the next program step would also be fulfilled: the output "move to the right" would also be switched with a possibly spectacular result. It may also come to conflicts which cannot be seen and prevented during program creation. Unambiguous signal states

Thus the meaning of cyclical program processing is for example to ensure unambiguous signal states during program processing. The program works with the process data image. This is also of importance for the outputs. It is e.g. possible to switch an output to TRUE and then again to FALSE 10 times during program processing. This cannot result in "chattering" of the output, i.e. constantly changing its state. The state is clearly defined. During program processing only the state of one bit in the process data image changes. The last state is switched, i.e. provided to the physical outputs. The only objection to be raised is that the program structure is unclear.

Priority

This may seem quite theoretical but it does have some consequences for practical use. The priority of instructions can be determined in the program by their sequence! If, for example, there is an instruction in the program: if limit switch reached, then stop drive then it is usually placed behind the instruction for switch-on. Usually the conditions for switch-on and switch-off should not be fulfilled at the same time. If, however, due to a malfunction this does occur, then switch-off takes priority (compare pages 4-2 and 4-3). Thanks to the cyclical program processing, reliability is provided due to unambiguous signal states. However, other consequences have to be put up with.

1-6

What you should know

Time response Only timecritical processes

If the time response is uncritical, if a ms does not matter, then the comments on the time response do not have to be taken into account.

Cycle time

The time the controller needs for one program cycle is called cycle time.

How long is the cycle time?

There is no easy answer to this question. It makes sense that it is longer for long programs and shorter for short ones. It also depends on the type of instructions. Logical conjunctions are processed considerably faster than for example arithmetic operations. The answer is not clear if there are jumps, for example. If the condition for the jump is fulfilled, a program section is skipped. In that case it is not processed. The cycle is shorter. If the condition for the jump is not fulfilled, the cycle time becomes longer.

ms

Therefore only an estimate can be given here. You can expect a short time from an efficient system such as ecomat mobile. It is indeed in the ms range. For shorter programs it may be shorter, for more complex programs it may be several ms. To determine the actual value of the cycle time: Æ page 4-7. Now it is easy to understand the demands on input signals. An input signal has to be active at least during one complete program cycle. If a signal is shorter it depends if it happens to come at that point of time at which the inputs are read. Only then will it be recognised.

Response time:

This value is often used to characterise the time response of a PLC. This is the time that is needed to switch a signal from an input to an output. If you expect the worst case, this means twice the cycle time.

Frequency

In some cases, for example when evaluating encoder signals, you also have to ask about the frequencies that can be processed on the input. If the cycle time is for example 1 ms, the cycle frequency is 1 kHz. However, this does not mean that the frequency on the input can be 1 kHz. To recognise a pulse as a pulse, a FALSE signal and a TRUE signal have to be detected; otherwise the pulse cannot be distinguished from a static state. The signal frequency must be half the cycle frequency at maximum. To allow possible fluctuations in practical use it should be significantly lower. To be more precise, this is only one necessary condition. If the signal frequency is higher than half the cycle frequency, the pulses can no longer be processed accurately. If it is lower, the signal shape also has to be taken into account. If, for example, the cycle frequency is 1 kHz and the signal frequency is 100 Hz, you could think you were on the safe side. If, however, the FALSE signal is 9.5 ms and the TRUE signal only 0.5 ms, the pulses cannot be processed accurately. To be on the safe side it is necessary that the FALSE as well as the TRUE signal, each one separately, is longer than the cycle time.

R

1-7

Features of a PLC

An unfavourable signal shape does indeed occur in practical use. If, for example, speed is to be monitored by evaluating the pulses of a puck, the TRUE signal is short if the diameter of the puck is small. An example is shown on the left side of Figure 3. Often metal screws are used in a plastic disc. If the signals are not detected reliably, a metal strip can be used. Its length should be 1/3 to 1/2 of the circumference. The optimum markto-space ratio of 1:1 can thus be easily obtained.

Figure 3: Target Pucks for Rotational Speed Monitoring

Frequency inputs

Usually there are only higher frequencies if encoders with a high resolution are used. To be able to process higher frequencies the controllers have so-called frequency inputs. This ensures that signals up to 50 kHz are reliably detected. This is an exception from the usual cyclical program cycle.

Filtering

The maximum frequency for standard inputs is limited since they have a lowpass filter. Thus increased protection in the event of noise against interference peaks is obtained. On the other hand the frequency inputs are more susceptible.

Optimisation

The experienced PLC programmer knows ways to optimise the cycle time for time-critical processes. Since this manual is an introduction we will not discuss this any further here.

Bus systems

Using a bus system provides many advantages. In applications for mobile machines CAN is used as a rule (Æ Training manual 2: Introduction into working with CAN). The time response, however, can be negatively affected. If, for example, the input and the output are on separate CAN modules, the response time increases by the time needed for the communication. Time-critical pulses should therefore be put directly on inputs of the controller.

1-8

What you should know

Watchdog A PLC monitors itself if the cycle is correctly processed. The case that a program cycle is not complete is dangerous. Then no inputs are read. A change of the state on the input, e.g. "limit switch reached" cannot be processed. The status of the output cannot change, e.g. the drive keeps on running although the limit switch has been reached. The watchdog function exists to avoid such states. If the end of the cycle has not been reached within a certain time which is started with each new cycle the watchdog becomes active. The controller is stopped and the outputs are disconnected. This time does, of course, depend on a maximum possible cycle time. In ecomat systems it is approx. 40 ms. What can cause such an event? Causes

1. Hardware error If a processor fails, for example, the controller must pass into a safe state. 2. Program error We will describe this second point here in more detail. Those who already have some programming experience, for example on the PC, are especially vulnerable to such errors. In a PC program a window can be created with the text "Enter value" and an input field.Then the keyboard is enquired about if a value has been entered. If so, the value will be processed. If not, the keyboard will be enquired about again until the input has been made. It does not matter if the user has a coffee break, a lunch break or does something else during that time. There must not be any closed loop in a PLC program; only the program cycle itself may be such a loop. A possible cause of an unintended closed loop may be a backward jump. Since this is dangerous, a warning is issued during compilation of the program. In the worst case it is possible that the communication between the PC and the controller is impaired. Log-in is then no longer possible. In this case the downloader tool (Æ page 3-36) will help.

R

1-9

2.

Installation

2.1.

Hardware of the PC

Minimum

PC with Pentium processor MS Windows © from version 98 128 MB RAM Hard disk with 100 MB available Mouse and additional serial interface We recommend to use a current version of the software (operating system) and hardware, e.g. Ethernet interface.

2.2.

Software setup

Set-up

The installation is started as usual. If the autostart function of the CD-ROM drive is active, the ecolog software installer starts. The selection will be described below.

Figure 4: Installer

R

2-1

Software setup

Here we are dealing with CoDeSys 2.3. This is the software for programming the current hardware. Therefore the programming examples below were created using this version.

Figure 5: Version The version you use depends for example on your hardware version, on the version of its operating systems, etc. If you use different versions it may become necessary to also install different software versions. You can, of course, install this and other programs subsequently, for example if you want to work with a PDM or with CAN modules. You may also want to install the documentation on your PC. To be able to see or print the documentation here or on CD you need Acrobat Reader. These installations will not be described in this training manual. The software is installed by clicking on Setup. The individual steps will not be described here. We recommend to adopt the default settings, e.g. the directory name, paths etc. This will save unnecessary work. This will also make it easier to understand the following examples.

2-2

Installation

The following directories are then on the hard disk: C:\Program files\ifm electronic\CoDeSys V2.3

Program file CoDeSys

There are the directories: Compile

temporary auxiliary files 1

Documents

device-specific information

Help1

help files

Library

general libraries of 3S there: PLCConf

device-specific files

For CAN users: here are the EDS files. If other devices are to be connected via CAN, their EDS files have to be copied into the directory PLCConf. Projects2

your projects, examples

The directories with the comment 'Temp' which are created in 'Projects' can be compared with an automatic backup. They can be deleted without any problems. The only file that is absolutely necessary is *.pro . Targets

target systems there ifm

files for ifm devices

there Help

ifm-specific files

and e.g. ifm_CR0020cfg there finally the directories with the configuration data files. If several versions are needed, they have to be in separate directories, e.g. the directory: V030002 Library there: general ifm-specific files, device-specific files in turn are in subdirectories, e.g.: ifm_CR0020 in which there is the operating system and the specific library.

1

There are the versions in German, English and French.

2

For a better overview we recommend to create a subdirectory for each project.

R

2-3

Software setup

If you work with different versions, to be seen from the version number, e.g. V030002, it is important to remember that the versions of the configuration data files and of the operating system match! This structure may seem a bit confusing. In general you are not confronted with it and therefore you do not have to worry about it. This structure is created by CoDeSys during installation. During program creation CoDeSys accesses the required files and searches for them in the defined paths. Therefore we advise against changing the directory structure after installation. If you work on several PCs, you have to remember that it makes the exchange of program files easier if the same directory structure is installed on each of these PCs. What does e.g. V020102 (version number) mean?

V02 is the actual version, 01 stands for the date of the update (release), 02 for the patch number. The current version can be found on the web (Æ 1.3). The new versions are, for example, required for the new hardware versions. We recommend to change this version only if it is necessary. It is a lot easier, if all systems used are of the same version, even if it is not the latest one.

At any rate the downloader should also be installed (Æ page 3-33).

Figure 6: Downloader Setup

2-4

Installation

This is an important tool. Again, not each and every detail can be discussed here. Usually only the function described on page 3-33 et seqq is needed. In the event of frequent programming it is worthwhile to study this tool in detail ( Æ e.g. Notes in Help concerning the downloader). The installation should not present any problem. We recommend to adopt all default settings.

2.3.

Program start CoDeSys is started via the icon in the start menu, for example.

Figure 7: Program start

Info

The information is displayed for a short time. If required, it can be called up under menu item Help, e.g. for checking which software version (in this case 2.3) has been installed.

An example program is loaded.

R

2-5

Program start

Error message

If one or several error messages are displayed, other paths may have been selected during set-up. For the time being they can be ignored. Further below we will describe the adaptations that will have to be made.

The example program may look like this:

Figure 8: Example Program

We will not deal with this any further here. The continuous work on this project is made easier if the one opened last is loaded automatically during program start-up. Therefore the example program will open here. If you do not want this, you can change it via 'Project' 'Options'.

2-6

Installation

Figure 9: Project Options 1

2.4.

Settings New project Before starting with the programming of the controller you would normally have to make some additional settings. This has to be done for a configuration only once at the beginning, compare page 2-19. In the starter set all required settings have already been made. The following descriptions are only for information if you work with it. These settings are part of each project and they are saved with it. This way you can easily work on projects for various hardware configurations with the same user interface. To show how the settings are made we open a new project via 'File' 'new' or a new project.

Target A window to create the target system will open.

Figure 10: Target System Settings

R

2-7

Settings

By clicking on the arrow symbol the selection list will open. There the hardware you want to work with is marked. It can be identified by the article number.

Figure 11: Target System Selection CR0020 is marked and acknowledged with

.

When a concrete target system has been selected, the window is enlarged considerably. Many tabs are for functions that are not supported by this hardware. CoDeSys is a universal programming system. The most important tab is the one for 'Network functionality'. There the parameters for communication are set via CAN. This is not a topic here (Æ Training manual 2: Communication with CAN). But it is easier to prepare us for working with CAN just now. For this reason, please let the options 'Support parameter manager' and 'Support network variables' active. Then we have to append the subelement CANopen Master in the PLC Configuration (Æ Figure 30). Then the topic CAN can be ignored for the moment.

What has to be done, if the article number is not displayed in the selection screen? This will only happen with new hardware. Then the respective file will be ordered from ifm electronic or loaded from the Internet and installed subsequently.

Subsequent installation of the target Since this happens occasionally, the process will be briefly described. If the required target is already in the selection list, this section can be skipped. You will continue with the Section 'Main program', page 2-10. It has to be noted that here files are not simply copied into a directory. To avoid errors due to an unsuitable directory structure, the Help program InstallTarget.exe will be used. It is directly in the CoDeSys V2.3 directory. After starting InstallTarget the following window will open:

2-8

Installation

Figure 12: Start Window InstallTarget By clicking on the 'Open...' button the usual selection screen for files will open. In principle a number of control systems can be programmed using CoDeSys. This does, however, not mean that each target can easily be installed here as described. Which target is programmed in which way can be taken from 3S.

Figure 13: Selection Screen InstallTarget In the example the installation CD was inserted in drive (E). Then the directory E:\CoDeSys_V23\Targets\ifm

R

2-9

Settings

was opened. The files that can be seen there have the extension: TNF (for target information). As an example ifm_CR0020_V030002.TNF is marked and 'Open' is clicked on. At first you cannot see a big difference. There is only a new entry in the left box. By clicking on the '+' next to 'ifm' the structure is shown in detail:

Figure 14: InstallTarget with Systems In Figure 14 you can see that a CR0020... is already present in the right box. The installation may, however, make sense if there are different versions. There is also to be seen that the installation directory on top still has to be adapted, Æ pages 2-1 and Figure 16. Then the new target can be installed. When the target has been successfully installed, the requested one can now be selected. The next step is like in the previous versions: the main program is added.

Main program

Figure 15: New Project

2-10

Installation

The inputs in this start window are of special importance. This will be described in more detail further below. For the time being we select the option FBD and confirm it by OK. A remark beforehand: Do not change the name PLC_PRG!

Directories Search path

Since the same programming surface is used for different hardware configurations, the required files need to be accessible. The device-specific files are listed in different subdirectories. It would be confusing to provide all of them right from the start. First, it has to be stated in which subdirectory they can be found.

This is done via the menu items: 'Project' 'Options'. Select the category Directories in the displayed dialogue box that opens (Æ Figure 16).

Figure 16: Set Directories By selecting the target some entries have already been made. C:\Program files\ifm electronic\CoDeSys V2.3\Library\ etc. A very important entry is still missing, however. In addition it has to be indicated where the configuration files of the project are. This entry is not made automatically to enable working with different version numbers. By clicking on the button open.

to the right of the field the selection screen will

R

2-11

Settings

Figure 17: Project Configuration Directory After acknowledgment with

the entry has been made:

Figure 18: Directories Created Starter set

If you work with different hardware types in other applications or e.g. in the starter set, the entry has to be adapted accordingly. Example:

CR0020 C:\ Program files\ifm electronic\CoDeSys V2.3\targets\ifm\ifm_cr0020cfg\VXXXXXX XXXXXX means: The version number may be different. Settings which are usually not preset were already made in the starter set. This makes it easy to work with the device right away.

2-12

Installation

Libraries Predefined functions

A modern programming software to IEC 61131-3 should allow the administration of self-created program modules. They only have to be created once and can then be used as often as required. Administration in CoDeSys is handled via libraries. Furthermore, a number of standard functions and hardware-specific functions have been predefined. These libraries have to be loaded if necessary. Standard libraries are automatically integrated.

File size

Each added library makes the project file bigger. Therefore no unnecessary libraries should be added. At the beginning it may be difficult to judge which library is necessary and which is not necessary. A hint is given by the name of the library. If, for example the name is ifm_CR0020_V030002.lib, you will only need the library if you work with the unit CR0020. As experience increases, differentiation is getting easier. However, the file size is only critical with very complex programs. A consequence resulting from the keyword file size affects the program modules created. It is unfavourable to combine them all in one library. If they are separated it is easier to focus on those that are actually needed.

No menu active

If no project is open, most menu items are not active which can be seen by the grey colour. To activate them a project has to be opened. This is done via the menu item (you will find an overview of the buttons 'File' 'New'or the respective button in the appendix, Æ page 6-1). The procedure was described above, Æ chapter 2.4. To be sure let us compare: The top line then reads: 'CoDeSys - (Untitled)*' The name can be assigned when saving the file.

Step by step

The menus are context sensitive. In other words: the window 'Library manager' only opens (of course!) when a project is open. Here it becomes clear what is meant by "step by step" in the instructions. Those who are not familiar with the system should strictly follow the instructions. As experience increases more interim steps can be skipped.

CR0020 as an example

Below we will show how to prepare a project for the controller CR0020 as an example.

Entries

The menu items 'Window' 'Library Manager' open a window in which no standard entries can be seen on the top left. We see the standard.lib and some CAN libraries which are linked automaticallay. Again CAN is not the subject now.

R

2-13

Settings

Figure 19: Library Manager with Standard.LIB A glance at the library manager shows what kind of module it is. This also explains the name of the library. Help

If during program creation you are not sure which module is needed or what the inputs and outputs mean you have the possibility to call help via Help in the toolbar. There you will find detailed descriptions and examples. Often it is faster and easier to call the library manager and to mark the respective module there. Then you can often find the information you are looking for in the declaration part (ÆFigure 22 top right). This applies in particular to the device-specific libraries (Æ Figure 22). The help would be much too extensive if all devicespecific modules were explained there. A glance at the library manager can save leafing through the manual.

More entries can be made via 'Insert' 'Additional library'.

Figure 20: Additional Library The available libraries are shown on a mouse click.

2-14

Installation

Figure 21: Selection of Libraries There are device-specific libraries which are in the corresponding subdirectory, e.g. ifm_CR0020 together with other configuration data files. In addition there are mostly device-independent libraries which are needed for the operation of CAN networks, for example. Library

The directory structure must be observed! In CoDeSys V2.3 there is also a directory 'Library'. It includes general libraries of 3S but not the ifm libraries! Now a library is added as an example. As before reference is made to CR0020. After adding the library manager looks like this:

Figure 22: Library Manager 2 Right now the PWM100 module is open. It is used to activate PWM outputs (PWM = Pulse widths modulation, e.g. on proportional valves).

R

2-15

Settings

We are not done yet! Programming not only requires the library files but also e.g. the operating system or predefined system variables. It is therefore not sufficient to only insert the libraries in the manager. In addition the settings have to be verified and possibly adapted during PLC configuration.

PLC configuration CR0020

Here again we refer to the device CR0020. As mentioned above, the respective settings have already been made in the starter set so that we do not have to worry about them. For a new project for the starter set the library ifm_CR2500_VXXXXXX is added again. Since the features of the hardware versions are fixed, various variables have also been declared in advance.

Declarations

As is the case with each efficient software, variables are also declared in CoDeSys. Declarations, presentation, notations etc. are described in detail in the manual for the program development. In our manual we will describe this process briefly in the individual steps (Æe.g. page 3-44).

Below we will describe the hardware configuration in brief. You click on the 'Resources' tab in the navigation bar and double click on 'PLC Configuration' (then you can also check if the libraries have been integrated). At first the respective window is empty. The selection screen indicates _not_found:(Figure 24).

Figure 23: Navigation Bar Resources

2-16

Installation

Figure 24: PLC Configuration Empty If the PLC configuration had been loaded directly together with the target settings, it would be difficult to work with different versions. Therefore the hardware configuration is entered “manually”. To ensure that the next step is successful it is absolutely necessary to enter the path to the configuration data files in the 'Directories' option, Æ Figure 18. Then the 'Extras' menu is opened and there you click on 'Standard configuration'.

Figure 25: Standard Configuration A question is displayed:

Figure 26: Hardware Configuration After acknowledgement with 'Yes' the display should change now:

R

2-17

Settings

Figure 27: PLC Configuration If you now click on '+' next to CR0020 and then double click on '+' next to 'Inputs/Outputs' you can see the precision with which the hardware is represented in the PLC configuration.

Figure 28: PLC Configuration Open Variables can be declared very easily (as global).

Figure 29: Inputs for the Declaration In Figure 29 above is shown that a double-click on 'I00' opens a field into which a variable name can be entered. In the part below the figure a comment has been entered. We have already activated the CAN functions in the target system settings. Then the system expects that a CAN node exists. To do so we will append a

2-18

Installation

subelement. Right-click on the configuration (Figure 27). Select the CANopen master in "Append Subelement". This facilitates working with CAN. Now this appendix need not be considered.

Figure 30: Append Subelement

Figure 31: Subelement appended Ready!

Preparations are now finished and the work can start! Now the actual programming can start. For those who find it a little hard at first to go through the work steps at the beginning of a new project correctly and completely, the procedure is summarised in the appendix, page 6-7, once again without any detailed explanation as above.

Master

For those who process new projects quite often it is worthwhile to save the project as Master_CR0020_V030002, for example. The name says what it is. Working with a master is facilitated by the menu item 'File' 'New from master...'. This opens any project with the name '(Untitled)*'. The * indicates that the project has not been saved yet. The new name is assigned when the file is saved. The menu item can, of course, also be used to create a new version of a completed project. You will get the same result as before with 'File' 'Save as...', see page 3-29.

R

2-19

3.

The start This chapter is a kind of "introductory course for CoDeSys". You will get to know the operation and the handling of the program, i.e. you will get a brief insight into almost every function of CoDeSys. The most important part of this introductory course is the complete creation of a program example directly on your PC.

3.1.

Basics and concepts

What is CoDeSys?

CoDeSys is a complete development environment for the ecomatmobile system. CoDeSys is an easy-to-handle tool for creating control programs to IEC-611313.

What is IEC61131-3?

IEC-61131-3 is an international standard for the creation of PLC programs. It is important to know that only the programming language has been standardised, not the programming surface (window structure, presentation of values in the online mode, data saving, etc.). The programming languages of CoDeSys meet this standard.

What is a project?

In CoDeSys a project is the combination of components. These components solve a given control task (e.g. sequential control of a device, signal preprocessing for a part of a plant, ...).

Which are the main components of a CoDeSys project?

The main components of a CoDeSys project are:

What programming languages are available?

CoDeSys supports the following programming languages:

- POUs (executable program) - structures (data organisation) - visualisations

- LD

(ladder diagram)

- IL

(instruction list)

- FBD (function block diagram) - SFC (sequential function chart ) - ST

(structured text)

- CFC (graphical function block diagram)

R

3-1

Basics and concepts

How is a project defined?

The definition of a project includes: ●

The hardware configuration - definition of inputs and outputs



The creation of components POUs - structures - visualisations

How do I test my project?

The true test of a project is the commissioning of the actual system. On the other hand, the simulation mode of CoDeSys has proven to be a very valuable possibility for testing the program.

What is the simulation mode?

The simulation mode simulates the program run of the controller in the PC. This type of test without using the control system or the plant enables the elimination of errors at the desk, thus saving time and nerves. This effect can be enhanced by displaying the simulated plant by means of corresponding visualisation screens. The use of the simulation in conjunction with the versatile debug functions (troubleshooting functions) in CoDeSys allows a simple and efficient complete program test.

Which debug functions does CoDeSys have?

CoDeSys includes the following debug functions: ●

Forcing (writing) of I/Os and variables



Definition of watch windows for data presentation



Setting of breakpoints in the simulation mode (stop of the program run)



Execution of programs - as single scan - from breakpoint to breakpoint in the simulation mode



Sampling Trace (diagram of variables as a function of time)

And the documentation ?

The complete project can be documented at any time in whole or in parts or can be exported into a text file.

Conclusion

This overview shows that CoDeSys as a complete development environment for your ecomat controller exceeds the functions of a common programming surface. Let's take a small project to show that we are not promising too much.

3-2

The start

3.2.

A small ecolog CoDeSys project as a start Description This chapter will describe a short project demonstrating the basic steps in CoDeSys. The processes are more or less described like a "recipe".

Task

A lamp C is to be ON when two switches A and B are closed. This really simple system can be shown as in Figure 32.

Figure 32: Problem CoDeSys is now to ●

implement and



visualise this system.

The first step The first steps usually are as follows: ●

Start CoDeSys



Open an existing project or start a new one



For a new project: Integrate search path (directories), libraries and hardware configuration

Starting a new project

To start a new project select option 'File' 'New' or alternatively click on the button . This step was already described in 2.4, page 2-7.

Target system and PLC_PRG

Usually a new object is added via the menu. The main POU PLC_PRG is of particular importance. For a new project PLC_PRG should always be added after parameter setting of the target system as the next step. Therefore the windows 'Target system settings' and then 'New POU' with the preset PLC_PRG open automatically when a new project is started. FBD is already set as the language. The setting of the target system is not to be shown here once again. Those who find it difficult should study pages 2-7 et seqq. Below we will describe PLC_PRG in more detail.

R

3-3

A small ecolog CoDeSys project as a start

As shown in Figure 15 and then again in Figure 33 ●

the object is to get the name PLC_PRG ,



the type is to be program and the



language is to be FBD. Check if all these points correspond ●

Name: PLC_PRG



Type: Program



Language: FBD

Figure 33: PLC_PRG as FBD FBD

FBD was chosen because it is the language most frequently used. After clicking on

a presentation similar to Figure 34 is displayed.

Figure 34: PLC_PRG Window We have now added the module PLC_PRG to the project. PLC_PRG is executed cyclically and activates the modules (programs, functions, function blocks; for details see below) called there.

Please observe the following very important instructions:

All projects must have one and only one PLC_PRG. All modules to be directly activated via PLC_PRG, must be activated here, otherwise they will not be executed!

3-4

The start

Point 1 has already been described. To illustrate point 2 we want to add a second program to the project and activate it with PLC_PRG to ensure its cyclical execution. Settings

If you have not yet done so, work through the sections on pages 2-11 to 2-19.

Add Program Adding an P_AND

Add a program with the name P_AND to the project with menu item 'Project' 'Object' 'Add... ' (Figure 35).

The name must not be AND, Æ for details about the term 'key words' see page 3-6.

Figure 35: Project Add Object A window similar to Figure 36 should show.

R

3-5

A small ecolog CoDeSys project as a start

Figure 36: Window POU P_AND

Defining variables In the context of programming, the definition of the characteristics of a variable is called a declaration. Variables can be displayed as a table or a text. Below we will describe the text options.The selection “Declarations as text” is the default setting. It can be changed in 'Project' 'Options' 'Editor' if requested. Defining variables (text form)

Key word

The new variables A and B are to be defined as binary, i.e. boolean. To do so, we proceed as follows: ●

Move the cursor to the end of line 0002 and press the Enter key (Figure 37).



A new empty line has been added as line 0003.



Enter the definition as in Figure 38.

BOOL is a so-called key word. Its meaning is predefined. For example, it cannot be used as a name for a variable. Since CoDeSys knows the key words, the programmer is supported during entry. The notation, whether small or capital letters, is not important. After entering the text is checked and recognised key words are automatically represented correctly and highlighted in colour, Æ Figure 38. Move the cursor to the end of line 0002 and press 'ENTER'. A blank line 0003 shows. You can enlarge the upper part of the window by pulling down the separating line with the mouse. Figure 37: Declarations as Text

3-6

The start

Do not forget the semicolon at the end of the line!

Figure 38: Declaration Entered There is an alternative to the declaration which will be shown shortly (Figure 48). Add ‘AND’operation

Network 0001 with dotted rectangle as cursor Figure 39: Add box Mouse click on the first network (grey field with the number 0001 in the bottom part of the window) as shown in figure 41. The form of the cursor, here shown as a dotted rectangle, can be changed, if requested, via 'Project' 'Options' 'Editor' ‘Mark'. Now add the 'AND' ●

by clicking on



by activating 'Insert' 'Box’ (Æ Figure 40)

(Box) in the symbol bar or

Figure 40: Menu Add Box Independent of the method you use, an AND box should now be added to network 0001 (Figure 41).

R

3-7

A small ecolog CoDeSys project as a start

If windows with such a coloured background appear on the screen, remember F2!

Figure 41: Inserted Operator

F2: The key

Here we want to point out a possibility to help you program more efficiently and avoid typing errors at the same time: the key. When working with CoDeSys you often reach points requesting a selection between several input possibilities. You can see an example in Figure 41. CoDeSys has entered an AND operator here as default setting. The field with the coloured background (Windows standard setting is blue) signals such an option. Press to open a selection screen. Try it, and you will get a list of operators that can be used here or other boxes. You can select the requested operator by means of a double-click. This option saves a lot of typing and prevents typing errors! In our case the default setting AND is okay and you should close this selection screen by pressing (Figure 42).

Move the bar to the requested operator and select it with double click or 'OK'.

Figure 42: Input assistant Forgotten the settings

3-8

A common mistake in the early stages is to open a new project and to forget the libraries and the hardware configuration (pages 2-13 and 2-16) in the heat of the work. You will become aware of it when you use the Input assistant for a particular function block, for example. If you do not find it the reason why is that you probably have not linked any hardware-specific library, for example.

The start

Operands

Add the operands A and B as inputs of the AND operator by replacing ???, Æ Figure 43. You can also use , Æ Figure 44.

Figure 43: Highlighted Input Field

Figure 44: Input assistant for Variables Figure 45 shows the result.

Figure 45: Add Operand The result of the operation has to be assigned to an operand. This is, for example, done by clicking on (Æ Figure 46): A click to the right of the AND operator symbol generates a cursor (dotted rectangle) as shown in Figure 45.

R

3-9

A small ecolog CoDeSys project as a start

Position of the cursor

Here the editor is not very flexible. It happens again and again that you want to add an element which the editor refuses, however. In most cases the reason why is that the cursor is not in the right position. This is meant to prevent incorrect entries. You will usually find the right position of the cursor by trial and error.

Click on the IM - R icon and replace ??? with C (overwriting)

Figure 46: Add Operand

Figure 47: Operand Added When you leave the input field (e.g. by simply clicking into the "free space") the system finds that variable C has not yet been defined and automatically opens a window for the variable declaration (Figure 48).

Figure 48: Window Declare Variable

The entries in this window can be changed individually. In this case they are exact. A comment should be added. You should make it a matter of habit to add many comments. This is taking some time at the moment. However, you will save a lot of time for troubleshooting or modification of the program. After entering the comment you can acknowledge by clicking on . The variable declaration is now entered in the top part of our module window.

3-10

The start

Figure 49: Declared Variables A and B could have been defined in the same simple and comfortable way. We just wanted to demonstrate the different selection possibilities for declarations. In Figure 49 you can also see the syntax for entering comments. They can, of course, also be subsequently added or modified. Should the variable declaration window not open, the 'Autodeclararation' option in 'Project' 'Options' 'Editor' has to be activated.

Figure 50: Autodeclaration

R

3-11

A small ecolog CoDeSys project as a start

Local

In the fields class and type the default settings were simply adopted. We just want to point out that the variables in the example were declared locally. That means that the declaration only applies to the POU in which it is located, here in the program And. If a variable, e.g. an input, is to be used in several POUs it is easier to declare it as a global variable. Using the selection field type helps to avoid invalid declarations. During declaration the 'Autodeclaration' option also helps to prevent syntax errors which may cause confusing error messages in compilation, especially at the beginning. This completes our little POU.

Activating P_AND in PLC_PRG

The program P_AND is to be activated in PLC_PRG. For this purpose activate the window of PLC_PRG (Figure 51) and call menu item 'Insert' 'Box'(Figure 52).

Box 1. Open PLC_PRG by double clicking

2. Enter the program call Figure 51: Enter program call in PLC_PRG At first the default box, the AND operator, is added. By clicking on F2 the Input assistant opens. Select the 'User defined Programs' option on the left (Figure in the box on the right. You activate P_AND 52) . Then select AND and in network 0001 of PLC_PRG.

3-12

The start

Figure 52: Added POU And all this just for an AND?

Of course, an AND operation can also be directly inserted in PLC_PRG. We have selected the way of activating the subroutine in PLC_PRG for an important reason. We wanted to demonstrate that all POUs (in this case POU P_AND) to be activated directly via PLC_PRG need to be listed there. It is therefore not enough to just create the POU. The POUs of a project are not activated automatically. They must be directly or indirectly activated by the PLC_PRG POU. Only the PLC_PRG POU is automatically processed cyclically. That is why all other POUs have to be activated directly or indirectly by PLC_PRG. It is not sufficient for the execution of a module that it is entered in the POU list of the project!.

Saving At first, it will take some time for you to achieve this result. Later you will be able to program an easy link very fast. In each case it should become normal to save the result after each work step. This can be done e.g. via 'File' 'Save' or

:

R

3-13

A small ecolog CoDeSys project as a start

Figure 53: Save File When the project is saved for the first time, the window 'Save file as:...' opens automatically.

Figure 54: Save File as... The directory Projects also opens (default). The file is now stored here. At the beginning it is clearer to save the files here in the default directory. For many projects it makes sense to create a subdirectory for each project (in Projects).

Other languages And what about the other languages?

At this point it would go too far to explain the other languages in more detail. Still, we want to show you our little program example in Instruction List, in Structured Text and in Ladder Diagram (Figure 55).

Figure 55: Examples in Other Languages The CD contains further program examples giving an overview of the individual programming languages. They are described in detail in the manual for the CoDeSys program development saved on the CD as PDF file.

3-14

The start

What have we achieved so far?

So far we have written two programs (PLC_PRG and P_AND). The subroutine P_AND was entered in PLC_PRG so that P_AND is now also activated by PLC_PRG.

Program test How do we continue?

Our project has now reached a stage where we can test if it meets our expectations. The first program test is normally carried out as follows.

'Online' 'Simulation Mode'

Select the option 'Online' and make sure that the simulation mode is active. This is the case when you see a tick (√) before Simulation. Should that not be the case, click on 'Simulation Mode' (Figure 56).

Figure 56: Simulation Mode 'Online' 'Login'

Selecting the option 'Online' 'Login' ( Æ Figure 56) or clicking on compiles the project. If a syntax error is detected, CoDeSys will give you a message in the Messages window and will refuse login. We cannot explain all possible syntax errors in this place. Double clicking on the error message automatically takes you to the faulty line. You can scroll from one error message to the next by pressing the F4 key. Let's assume that the program contains no errors or that all errors have been corrected. In both cases the system should have logged in correctly.

'Online' 'Start'

Activate the program by 'Online' 'Start' (Æ Figure 56) or press the F5 key or click on . The status line (shown below in the program window) should now show .

R

3-15

A small ecolog CoDeSys project as a start

Display the P_And program on the monitor (double click on the program name in the POU list on the left in the program window). The program window should look like Figure 57.

ONLINE, SIM and RUN must now be active.

Figure 57: Program Active If the status line cannot to be seen at all, activate it via the option 'Project' 'Options' 'Operating range'. Just click to activate the tick √.

Change variable values

As shown in Figure 57 the values of the three variables A , B and C are FALSE (OFF). By means of the option 'Online' 'Write Values' the values can be changed as follows: Double click on FALSE at A and B and TRUE appears as shown in Figure 58. This figure shows that the changes are not yet active! They have to be sent to the (simulated) controller first.

3-16

The start

Figure 58: Change Values This is done with option 'Online' 'Write Values' (Figure 59) or alternatively with the key combination + . The values of the variables A and B are now TRUE (= ON). This causes variable C to change from FALSE to TRUE (the colour in the bottom part of the window changes to blue) as a result of the And link (Æ Figure 60). The colour changes may be difficult to see on the (monochrome) printout of this manual. This shows that going through this manual does not replace the practical work with the controller. It is only meant to support you. You will get most benefit by putting the example in practice and trying own ideas.

Figure 59: Write Values You can test other combinations of A and B in the same way, e.g. Figure 60.

R

3-17

A small ecolog CoDeSys project as a start

Figure 60: Vary Values You should make it a matter of habit to use 'Write Values', if possible. The menu item 'Force Values' may be dangerous in practical use, Æ Pages 3-18 and 4-9! If you like to work using the keys you had better use instead of simply ! Those who want to know more about the difference should study the following paragraph.

Forcing

Example

Besides the "manual" preset of input states, e.g. on the simulator box (Æ 3.3), it is also possible to force the states in the controller. This means that e.g. the state of an input is defined without any consideration of the actual state. When playing with the software without any inputs and outputs connected there is, however, no difference to the off-line program test in the simulation mode. In practice this function is more useful to the skilled user for debugging. The user should be skilled because forcing might start unintended processes when the controller is connected to the peripheral equipment. If you use this function you should know exactly the kind of damage that might be caused by a possible avoidance of safety scans in the program. When a new program or a new machine construction is tested, it is possible that a drive stops in an interim position without the end position having been reached. Then the drive has to be driven to the end position "manually". When the limit switch is used as a condition in a program module to stop the drive, the output for the drive can be set to TRUE using 'Write Values'. As soon as the limit switch has been reached, the drive is stopped by the program. Here the program is of higher priority (Æ also page 4-9). E.g.:

If 'Force Values' is used, the drive will no longer be stopped by the limit switch. This means that forcing the outputs should be avoided, if possible. It is only for inputs that forcing cannot be avoided.

3-18

The start

Visualisation Now that we have tested the function of the system let's move on to visualisation which will be explained below. Safety

Visualisation with CoDeSys has to be done offline. To be on the safe side you should try to remember to stop program processing by before logging out. Then log out CoDeSys by activating the option 'Online' 'Logout' or by clicking on . The moment the program has not yet been completed, maybe even still contains errors, dangerous situations may arise. The controller could start e.g. unintended and unexpected processes, drives, movements, etc. if locking has not or not yet been programmed correctly.

Select 'Visualisations' and 'Project' 'Object' 'Add...'

Figure 61: Add Visualisation Do not forget to activate the register card by clicking on the 'Visualisations' index tab, Æ Figure 61. Now the step described below can be executed. The menus are context sensitive!

Add new visualisation screen

Upon activating the option 'Project' 'Object' 'Add...' you will be asked to indicate the name of the new visualisation screen (Figure 62). We have chosen the name AndVis. Once the name has been entered a new empty visualisation screen appears (Æ Figure 63).

R

3-19

A small ecolog CoDeSys project as a start

Figure 62: Name Visualisation

Figure 63: Visualisation Start Window Grid

At first a grid is displayed in the default setting. If you do not need it, you can eliminate it in 'Extras' 'Settings...' .

Drawing a picture

Eighteen different types of elements can be drawn and animated with the visualisation. First, we will use the rectangle. The other elements are created and animated in the same way. Activate the option 'Insert' 'Rectangle' (Figure 64) or click on the button draw a rectangle by ●

placing the cursor on the empty screen



pressing the left mouse key and keeping it pressed



pulling the mouse to the bottom right until a rectangle of the required size appears



releasing the mouse key.

The result should be similar to Figure 65.

3-20

and

The start

Figure 64: Visualisation Insert Object

Figure 65: Inserted Rectangle

Context

To establish a context between picture element and module variable you need to define a context between (visualisation) action and (variable) value. These entries are made in the screen 'Regular Element Configuration'. For entering variables can be used again. But first, the project needs to be rebuilt in order to generate the variable list. For this purpose, call option 'Project' 'Rebuild all'. In this case, however, it is not necessary since we were logged in before (page 3-16 and the project is rebuilt automatically after login.

Configuring element

A double click on your new rectangle opens the window for the configuration of picture elements in the visualisation (Figure 66). For each category there are input fields describing the picture element. It is not necessary to make an entry for each field. First select the category Variables.

R

3-21

A small ecolog CoDeSys project as a start

Figure 66: Variable Configuration To change the colour of the picture element (in this case the rectangle) move the cursor to the field next to Change color: and press to open a screen for selecting variables (Figure 67). A double click on the P_AND module generates a list of the defined variables (Figure 68). Another double click on variable A generates a correct variable entry in the field Change color: in the Regular Element Configuration window. The assignment is now complete.

Here you can select different global variables of the project

Double click on '+' next to 'P_And ' to open a list of the defined variables

Figure 67: List of Variables

3-22

The start

Figure 68: Variables of the POU F2

The Input assistant is particularly helpful in this context because it often happens that only A instead of P_And.A is entered. Then you will not get the result described further below, however. In this context we would like to remind you that A, for example, is a local variable. P_And.A means the variable A in the POU P_And. The assignment is thus clear.

Interaction

Interaction between the user and the variables of the system is to happen via a mouse click on the picture element. The state (TRUE/FALSE) of the assigned variable is to be changed and displayed accordingly (the so-called toggling, see Æ Figure 69).

Change colour

The status of the variables is indicated by the colour of the picture element. This happens after the following assignment between picture element and variable value has been made:

Activate interaction

color



alarm color

→ variable TRUE

variable FALSE

Click on the category Input: To allow the user to change the variable value, click on Toggle variable in the category Input and enter again P_And.A.

R

3-23

A small ecolog CoDeSys project as a start

Figure 69: Input Toggle Variable Colour

Select the screen 'Regular Element Configuration' and click on 'Colors'.

Figure 70: Regular Element Configuration Colors

Click on to open the colour selection screen in the category Colors Figure 71. Select a colour by clicking and confirm with . As this is the colour for the FALSE state of the variable, we have selected grey for our example.

Repeat this process for

and, if requested, for the frame of the

. We have selected the colour green for the Alarm color element Inside (TRUE state). However, as is usually the case with colours, this is, of course, always a matter of taste and discussion!

3-24

The start

Figure 71. Color Selection Text

To give our rectangle a name, enter the letter A in the category Text. This designation is entered in the centre of the element. The window 'Regular Element Configuration' should now look like Figure 72. . If this is the case, close by pressing

Figure 72: Regular Element Configuration: Text

R

3-25

A small ecolog CoDeSys project as a start

Variable B (a simple copy)

We now want to create another picture element for variable B that should look like the one for variable A. The option Copy/Paste will be helpful. To do so: ●

Click on element A



Click on

→ A copy of the element (with settings) is made (in the clipboard). ●

Click on

→ The copy is inserted in the picture above the original. Move the cursor to the new element A, press the left mouse key, drag the element to the requested position and release the mouse key (Æ Figure 73 and Figure 74). When element A is marked, click on the Copy icon and then on the Paste icon. Then click on the copy and drag it to the new position.

Figure 73: Copy Element

Double click to set the new configuration

Figure 74: Element Pasted and Dragged Now configure the second element: ●

call up the element configuration with a double click,



replace A with B for variables, input and text and



acknowledge the entry with

.

The element for variable B has been successfully added.

3-26

The start

Variable C

Copy the element of variable A again for the presentation of variable C. Change the configuration of the new element as follows: Shape

: ellipse

Input

: no input

Color/Alarm Color/Inside

: red

Variables/Change color

: P_AND.C

Text

:C

The display of the elements has been slightly changed as compared to A and B to make clear that they are different variables (inputs and outputs). An entry in the entry field does not make sense here because the presentation of the variables (of the output) is controlled by the program. It is an interesting option to control an output "manually" for test or maintenance purposes, i.e. via visualisation. However, this has to be taken into account to reliably avoid conflicts, Æ Figure 130.

Whichever way you have taken - the configuration window should look like Figure 75.

Figure 75: Configuration Element C The visualisation window should at least resemble Figure 76 (artistic license granted).

R

3-27

A small ecolog CoDeSys project as a start

Figure 76: Finished Visualisation Working with the visualisation

We can now test the newly created visualisation picture. Log in CoDeSys and start the program. Proceed as described before. The following points will serve as a reminder: ●

'Online' 'Simulation' ('√' shows that the simulation is active)



‘Online’ ‘Login'



‘Online’ ‘Start'

First click on rectangle A in the visualisation, then on rectangle B. The colours of the two rectangles should change to green (or to another colour, should you have used your artistic licence). The green colour shows that the variables now have the state TRUE in the program. If you now watch the colour of the ellipse of variable C, you will see the result of the programmed link – the colour of the element changes to red (or to what your artistic license has defined). The red colour corresponds to the value TRUE of variable C as a result of the AND operation (C:=A AND B). By clicking on the rectangles you can set the different plant states and watch the reaction of the program (Æ Figure 77 and Figure 78).

3-28

The start

Figure 77: Visualisation State 1

Figure 78: Visualisation State 2 And now Save

To save your project, use the option 'File' 'Save as...' (Æ Figure 53).

Figure 79: Window Save As... Here you enter the name of the project in the field for the file name as is common in Windows. The file name must have the extension .pro, so replace ' '

*

by e.g. EasyandV01 and acknowledge with

.

R

3-29

A small ecolog CoDeSys project as a start

When the correct option is activated ('Project' 'Options' 'Ask for Project Info') is activated, a dialogue box for project information is shown automatically before saving (Figure 80).

Figure 80: Project Information You can fill it in (or leave it). We strongly recommend to make abundant use of the various possibilities to document the project. Your complete project including the visualisation is now saved in the file Easyand.pro! A simple ‘Save' instead of ‘Save as...' would have been sufficient. We have described the process in detail in case that, in the heat of the work, you have forgotten to save before (see Figure 53). But now it's time for a break and we will leave the programming system for the time being. For this purpose stop the program ('Online' 'Stop') (Æ page 3-19, then log out ('Online' 'Logout'). Then use the option 'File' 'Exit' or the key combination +
3-30

The start

3.3.

Online test We now want to load the same program into the controller and test it there.

Preparations Simulator

We will now work with the physical hardware. You will need to define the input states and watch the reaction of the outputs. That is what we use the EC 2014 simulator for. It can be used directly for testing simple program functions. A different simulator box is used for the starter set.

Starter set

When working with the starter set the following section can be skipped. Familiarise yourself with the accessories of the simulator. It consists of:

EC 2022

a digital box with 6 switches to simulate digital inputs (two pieces).

EC 2023

an analogue box with 6 pots to simulate analogue inputs.

EC 2014

the actual simulator. The plug on its cable is a special version. An additional socket is brought out of it which permits the connection of another CAN component.

Adapter RS 232

an adapter, e.g. to connect the PC.

Adapter

We do not need the second adapter right now. To be connected to the simulator (Æ also the installation instructions of the simulator supplied): ●

Supply voltage

The 24 V power supply is to be ordered separately. It is to be connected to the terminals of the multi-way connector strip marked VBB and GND. ●

Controller ecomat mobile R360, CR0020

The connecting cable is firmly connected with the simulator. On the controller side it has a 55-pin connector used in mobile controllers to ensure the high protection rating. ●

Control box

To test easy program functions it is sufficient to connect the control box designated 0 - 5 to the socket designated 00 - 05. In addition to another control box an analogue box to simulate analogue input signals is also supplied with the simulator. It can only be connected to the first socket. Therefore it is left unassigned, the control box is connected to 08 -13. ●

PC

The connection is made via the supplied cable. It has a 9-pole socket on the side of the PC. If the PC has COM2 as a 25-pole connector, an additional adapter is required. It has a multi-way connector strip on the side of the simulator. The corresponding location on the simulator is marked RS 232/RxD

R

3-31

Online test

and RS 232/TxD. Above it there is the marking CANH and CAN L to point out that the CAN bus can be connected to the unassigned terminals. A power supply is integrated in the control panel used during the trainings. As long as you work with the simulator, the supply voltage can be taken via the CAN connection because the supply voltage is on the same potential in the whole (simulator) system.

Operating system In principle, the steps for loading the operating system must be executed only once. When the system is delivered, no operating system is stored in the controller. It must be loaded only once. The procedure must only be repeated (again only once) when a new version of the operating system is required. This shows how flexible the control system is. For a PC for example the installation of a new BIOS requires the exchange of an EPROM. This is only successful if hardware compatibility was checked thoroughly. This has only changed for the current version. For the ecomat R360 only the software has had to be loaded.

For the controller in the starter kit the operating system (and the first test program) has already been loaded.

If you have to load another operating system version or if you want to load an operating system into a new controller, use the program downloader. This program is on the CD "Software, tools and documentation" and can be installed via the installation platform. Here you will also find the description of the downloader, Æ 2.2. If you have not prepared this step, the downloader will now have to be installed. Start set-up as described in 2.2, Figure 4 to Figure 6. By clicking 'ecolog downloader' , Figure 81 will take the place of Figure 6.

3-32

The start

Figure 81: Downloader Setup For detailed information see the 'Description' tab. Continue

After successful installation the downloader can be started.

Figure 82: Downloader Start A first test of the correct communication is clicking on 'Get Identity'.

R

3-33

Online test

Figure 83: Get Identity If there is already an operating system on the controller, its version number is displayed. This ensures that the communication works reliably. Load Operating System (hex file)

Click on Open File and change to the directory C:\Program Files\ifm electronic\CoDeSys V2.3\Targets\ifm\Library\ifm_CR0020. Mark the file ifm_CR0020_V030002.H86 found there.

Figure 84: Open Downloader File After clicking on Open the name of the file is shown in the title line.

Figure 85: Downloader with Open File Now the operating system can be loaded.

3-34

The start

If you want to continue working right away, skip the following short overview of the downloader. Downloader

For detailed information about the downloader see ‘Documentation’ on the CD. Using the downloader ensures, e.g.: - to load the operating system in the controller (which happens in the next step) - to read the program file from the controller - to write the previously read program file into a new controller - to save data from the controller To be more precise, the program file is read as a hex file. This depends on the fact that the entire file for the project, the source file, with visualisation, assignments, declarations, comments, etc. is stored on the hard disk of the PC. The compiled program file is then loaded into the controller as a hex file. After reading, this file can virtually not be edited. Reading would make sense, e.g., if you want to transfer a program from one controller to another and the source file is not accessible. The other functions are self-explanatory. To save a program file only use the Downloader tool, not the items 'Write file into controller' and 'Load file from controller' in the 'Online' menu of CoDeSys. We will show you briefly how to load the operating system. Here it would not be necessary because one system has already been loaded. The file needed has been opened in the downloader. The only thing that remains to be done is to click 'Load into controller' (Figure 85) and to wait until the process is completed.

Interface

If you receive an error message while the connection between the PC and the controller is being established, (Figure 86 or Figure 83 instead), you should check if: - the controller is switched on or - the correct interface is set up. E.g.:

Figure 86: Transmission Error Click on Interface parameter in the menu bar (Figure 85).

R

3-35

Online test

Figure 87: Downloader Interface Parameter In this case the COM port is set to Com2. Change this setting or the 'Bits per Second' as required. The other settings are usually not changed. The downloader is a powerful tool which, however, requires more experience and background knowledge to make full use of its possibilities.

Figure 88: Interrupt Closed Loop by Boot Command In this context we do not want to describe all possibilities but only give an important example. It is possible that the controller gets into an uncertain state. This hardly ever happens in standard operation but e.g. if a fault occurs while the program is being loaded. The proven measure of resetting, switching off and switching on again can help. If necessary, the operating system will have to be loaded again. In any case the connection to the controller can be made. If, however, a closed loop caused by a fault in the program occurs, this case is more critical. This can also happen to an experienced programmer, if for example a forward skip turns into a backward skip when networks are shifted in the FBD. In this case a reset will not help because the program gets into the loop again after restart. The relevant function of the downloader will solve this problem (Figure 88). Then another reset has to be made, e.g. by switching the operating voltage of the controller off and on. A few seconds should be waited in between. Now the usual process of programming should be continued. The downloader is terminated and we will return to CoDeSys.

3-36

The start

Online program test In the following text we will start to gradually leave out the description of the intermediate steps. When working with CoDeSys a lot will (hopefully) become routine. You can focus on the important points, the process to be controlled, and it will not take a long time to find what you need in the menu items. However, should a problem come up you can find the solution in the step-by-step instructions above. It is clear that the first step is to start CoDeSys again. Copy project

Of course, we have to modify the first project EasyAnd for the online test. For this purpose we will first create a copy with the name ANDOL with 'Save as...' as described above.

Login

First of all the connection to the controller is established via 'Online' 'Login' or ('Simulation Mode' off!). If this does not work more settings will have to be made. The following message may be displayed:

Figure 89: Error Message during Login Setting of the interface parameters of the downloader Æ Figure 87 only refers to the downloader. Once the connection with the downloader has been established, the same parameters have to be set here in CoDeSys. Press for acknowledgement and click on 'Online' 'Communication Parameters'. The following window will be displayed:

R

3-37

Online test

Figure 90: Communication Parameters 1 The serial interface has not yet been activated. To do so, click on Another window will open:

.

Figure 91: Gateway 1 Here you click on the arrow symbol

next to Tcp/Ip.

Figure 92: Gateway 2 Select 'Local' in the opened list and acknowledge with Now, Figure 90.

3-38

.

can be clicked on in the Communication Parameters window

The start

Figure 93: Communication Parameters 2 For example, the name "serial1" is entered here and the respective entry is marked. After acknowledgment with the new channel has been entered.

Figure 94: Communication Parameters 3 A comparison with Figure 87 shows that the baud rates do not correspond.

Figure 95: Communication Parameters 4 A double click on the value activates the selection window. With each other double click the value changes to the next permissible setting. So you will finally get to the correct value.

Figure 96: Communication Parameters 5

R

3-39

Online test

If other error messages are displayed during log-in, it may help to increase the baud rate. The advantage is that the program is loaded faster. It has to be noted that it is not sufficient to increase the baud rate on the PC. The baud rate in the controller must be adapted to these values. To do so, the downloader has to be started in a special "expert mode". Ask your sales specialist. This setting procedure may seem to be somewhat complicated. However, it only has to be followed once at the beginning. Let us assume now that communication runs correctly. After log-in you will get the message to download the program.

Figure 97: Message Download Program Compilation is only started when the program has been changed. As you have already started the Login function before, the program file for the controller is already there and does not need to be generated again.

If no program had been loaded into the controller before, you will receive a message that is slightly different from Figure 97. If, however, there is already a program in the memory of the controller, it will be overwritten by the new one and thus it is lost if the source program is no longer available. Before overwriting the loaded program you can, if required, save it with the independent downloader program (Æ page 3-35). You can, of course, only save the program file of the controller, the source program is not saved in the controller. The program file has been saved, but cannot be edited. If you are not sure if a source file is available, a saving process should be carried out. Otherwise the program in the controller will be overwritten and cannot be restored without the source file. The message can now be acknowledged with Start program

When the program has been loaded in the controller, program processing has to be started. The line at the bottom, the status line, reads (after starting):

Figure 98: Status line When the program runs, it can be tested as before.

3-40

.

The start

Assignment

At first you cannot see any difference to the simulation mode. But the simulator has not even been used yet! The state of the inputs does not influence the state of the variables A, B and C! This would not be possible anyhow since no assignment has been made. In our example it would make sense to assign A and B to inputs and C to an output. But how can the controller start processing the program without this assignment? A, B and C were declared as BOOL. This is a declaration for bits that are not assigned to any input or output. In a PLC such bits are a useful tool. They are flags. That means that the program is only processed in the flag range. It is also possible to assign a defined address to a flag. If this assignment is not made by the programmer, it is done automatically by the program. In many cases it is of no importance which flag address is used. So the project still needs some modification before it can be tested with the simulator.

Declarations

To demonstrate the process again, we will simply delete the declarations. The common editing functions can be used: Mark and Delete. The new declarations are entered automatically so that the blank lines can also be deleted.

Figure 99: Edit Declarations Once again

If variable A is entered again in P_AND (PRG-FBD) of the AND function, the declaration window will open again (if the Autodeclare option is active). A can now be assigned to a physical address.

Figure 100: Declaration of an Input Local or global? The class VAR is left unchanged. Thus the variable is declared to be local, as stated above. If this input is used in several POUs, it may be easier to declare it to be global (class VAR_GLOBAL). The advantage is that it only has to be declared once. The disadvantage is that it does not appear on the list of variables of the POU during the program test (Æ Figure 57). The separate window Global Variables has to be opened. To do so, click on the Resources tab in the navigation bar Æ Figure 23) and then the window opens by double clicking on Global_Variables. Below (or above)

opens:

R

3-41

Online test

Figure 101: Global Variables

For a correct assignment it is necessary to observe the correct spelling very carefully. This will be briefly described below. Refer to the hardware documentation to find out which addresses are available and which of them are binary or analogue inputs or outputs. Syntax of declarations

%IX0.08 Mark for physical address

Type I: Input Q: Output M: Flag

depending on the controller configuration

Length X: 1 bit (BOOL) B: 8 bits (BYTE) W: 16 bits (WORD) D: 32 bits (DOUBLE WORD)

Figure 102: Syntax of Declarations The first input is assigned to address %IX0.08. Finish the input with the other variables will be declared.

3-42

and

The start

Figure 103: Entered Declarations AT

Note the key word AT which stands for the actual assignment. The assignment of the inputs results from the location of the control box (Æ labelling of the simulator). B and C are declared accordingly, C of course as an output (%IX0.09 and %QX0.04). The visualisation also needs to be adapted. Above the window Regular Element Configuration was opened by double clicking the object designated A. In Input the function Toggle Variable was selected. However, this does not make sense any longer. It is the real states that are to be displayed. Therefore the tick is removed in Input for A, B (Æ Figure 69), for C it should not have been possible before to make an entry. The project has now been modified for testing in the controller. Before the online test, you should check if controller and simulator are ready.

Login

The program is then compiled again via menu item 'Online' 'Login' or (compilation is started automatically after a modification) and loaded in the controller 'Online' 'Simulation' not active!).

Figure 104: Error Message The example shows the error message that appears if you have forgotten to declare C. This also results in the warning that a non-declared variable is used in the visualisation. In Figure 104 the window for messages was already enlarged. By double clicking on the error message the POU in which the error has occurred will open, Æ page 3-15. You can scroll from one error message to the next by pressing the F4 key. If the tick is removed from 'Messages' in the menu 'Window' (simply click on it), the window will be closed. After C has been declared, the declaration window should look like in Figure 103. After a new login the message is displayed again if the program has to be loaded (Figure 97). Acknowledge with

and the program is downloaded.

A look at the status line reminds us that the program needs to be started. That's what we are going to do now.

R

3-43

Online test

Online

The declaration part shows the current states. In addition, the function AND simplifies the checking of the state of the variables by showing them in different colours depending on their state. The presentation on the monitor, in AND and in the visualisation, should show no change as compared to the simulation. The difference is that we do not work with flags any longer which change their state via mouse click, but with the physical inputs and outputs. The state of the inputs is defined by switches of the simulator box.

Output

So the program should now be processed as in the simulation. The state of the inputs can now also be verified on the simulator. In doing so it is noticeable that the state of the output changes according to the state of the inputs in AND as well as in the visualisation (see page 3-19 above for the description of how to activate it). However, it does not change on the simulator. Why is that so? In this context we have to remind you of the monitoring concept, Æ system manual. There it is described that the RELAY bit has to be set so that the outputs are not only switched internally like flags but also externally.

RELAY

For the time being, this bit will not be further processed by the program in this simple example. It can be easily used as the first program network. Before the first network a new program network is created by 'Add' 'Network (before)' in the window PLC_PRG . The content reads: TRUE ─── RELAY

Figure 105: Set Relay

The name and the assignment to a flag address are predefined. This information is given in the window PLC Configuration. In the Input assistant (F2) you will find the variable as System variable. Program test

3-44

After login during which the changed program is compiled again the program has to be restarted. The relay should now energise with a perceivable click. Now you can also see on the simulator that the output is switched.

The start

Sampling Trace For a program test it is very useful that the current states of the variables are displayed. But there are limits. If, for example, you want to simultaneously monitor several variables defined in different windows, it is not always possible to change the windows fast enough. For this purpose you can enter different variables in a special window, the Watch Window. This is done via 'Window' 'Watch Variables'. We will not go into any further details here. You can find a detailed description in the Manual for the Program Development. Trace Tool

It is a matter of luck (even in the Watch window) to detect e.g. short input pulses on the monitor. In many cases it would be of advantage if the variables were shown in a timing diagram, like on an oscilloscope. CoDeSys provides this possibility. It is called Sampling Trace. Since it is an important tool we will give you a brief example.

Sampling Trace

The states of A, B and C are to be sampled. To do so click on 'Sampling Trace' in the window 'Resources'.

Figure 106: Sampling Trace The window Sampling Trace opens.

R

3-45

Online test

Figure 107: Sampling Trace New Trace configuration

You find the other functions via the context-sensitive menu Extras. First, we define the variables to be monitored. This is done via 'Extras' 'Trace Configuration...'.

Figure 108: Trace Configuration In this window you enter the variables (maximum 8) the values of which are to be sampled. Before doing so we will briefly explain the fields of the window.

3-46

The start

Figure 109: Window Trace Configuration How does it work?

Let us first explain the background. Max. 500 values of each Trace Variable can be saved. When the memory is full, sampling starts again from the beginning. The oldest values are overwritten. If you want to evaluate the Sampling Trace in peace, for example, you have to stop it so that the values are not overwritten. That can be done "manually”, via the menu, or automatically by means of the Trigger Variable. If you enter A here, for example, the next 50% of the values will be sampled after A has changed its state from 0 to 1. Sampling would then be stopped. In the example the Trigger Variable is not used. The field remains empty.

Sample rate

The scanning frequency can be selected in multiples of 10 ms. The default value 0 means scanning in each cycle. Since the cycle time is in the ms range for the short program, this would be much too fast. Here a scanning frequency (sample rate) of 100 ms has been selected.

Trace variables

To enter the Trace variables in the list, enter them in the bottom field first. Use . Double-click on P_AND. and A, B and C are displayed. They are selected and entered in the list. Since they were defined in the P_AND POU, the POU name, separated by a dot, is used as a prefix. In the Input assistant the variables can only be found, in visualisation as well as in sampling trace, if the project has been compiled once, e.g. with 'Project' 'Rebuild all'.

R

3-47

Online test

Figure 110: Input assistant Trace Variable Click on Assignment

to finish the configuration.

The window Sampling Trace is empty. The variables now have to be assigned the colours with which their state is shown. Click on next to the field below Var 0 and the variables that can be selected are shown. Click on P_AND.A and Var 0 is assigned to variable A. Do the same to enter P_AND.B and P_AND.C.

Figure 111: Assignment Trace Variables Start Trace

To be able to monitor the state of the variables, establish the connection to the controller via 'Online' 'Login' or . The trace is sampled in the controller as communication is too slow to save all values in the PC. The Trace Configuration therefore has to be downloaded to the controller. After the program has been started, the Trace configuration has to be downloaded to the controller and activated with 'Extras' 'Start Trace'.

3-48

The start

At first you see nothing. Sampling is started in the controller but you first have to give the instruction to transfer the contents of the Trace Buffer to the display. For this purpose use menu item 'Extras' 'Read Trace'. A kind of snapshot is loaded. It is more interesting to have a dynamic presentation of the state by means of 'Extras' 'Auto Read Trace'. It is worthwhile to have a quiet look at all the possibilities of the sampling trace. This tool is very powerful. You can say: CoDeSys saves the oscilloscope. And during the normal hectic during set-up you might lose too much time if you are not really familiar with the sampling trace. Buttons

When working with the sampling trace some (context sensitive) buttons appear which help you speed up your work. These buttons are described in the appendix, page 6-1

Examples

Figure 112: Sampling Trace 1

R

3-49

Online test

Figure 113: Sampling Trace 2

Figure 114: Sampling Trace 3

3-50

The start

In this short introduction we cannot describe all functions such as saving sampling trace in detail. We refer you to the manual for program development. Just one quick note on the sampling trace: If the signals have such a high frequency that the sampling trace is difficult to read (e.g. Figure 113), the presentation can be stretched via 'Extras' 'Stretch'

Documentation A complete project, of course, also requires documentation. Again, please refer to our Manual for the Program Development. Below we will only show some examples. Documenting

In the 'Project' menu you will find e.g. the item 'Document...'.

Figure 115: Document Project Click on this item, and a window opens:

R

3-51

Online test

Figure 116: Window Document Project Here you can select what is to be documented. You can also select several components using the standard marking functions.

Figure 117: Selection of Modules for Documentation The following points will only be described briefly, not in detail. Documentation set-up

3-52

If you don't like the form of the documentation, you can click on e.g. 'File' 'Printer Set-up...'.

The start

Figure 118: Documentation Setup You will find that you can load predefined formats.

Figure 119: Selection of Formats for the Documentation In order to modify the file in which the parameters of the frame, as it is called in CoDeSys, are saved, click on 'Edit...'. The settings can be made in the window which opens.

Figure 120: Options for Setting up the Documentation And just to remind you of what we have already mentioned for sampling trace: We recommend that you take your time to familiarise yourself with all these options. To create a documentation under time pressure, when the project should already be finished, will probably not lead to the optimum results.

R

3-53

4.

Exercises

4.1.

Logic functions In the brief introduction of chapter 3 only a simple logic function (AND) was used as an example. Those who have studied this chapter should not have any problems to set up other logic functions or networks from linked logic functions without any help. This will not be described in detail here. Some exercises should help you become more familiar with the subject. For some short hints for the solution see the appendix.

Some brief remarks should help to clearly structure the programs. Experience has shown that even experienced programmers do not understand their own program any more after some weeks. The meaning of a good structure becomes particularly evident if some people work on partial programs or if several people are to make modifications. In such cases it is necessary to make exact agreements and to set up rules how the program is to be structured. Even though this takes quite some time in the beginning and seems to be quite complex, it will become clear during the first search for errors at the latest, that this time was a good investment. Documentation

Besides the item "structure” which will be dealt with in detail below, we also want to remind you that detailed and clear comments are always helpful.

Program structure

There is not THE ideal program structure so that you can simply give an example solution which can serve for orientation. Therefore you will find below tips which should be seen as suggestions.

Networks

It is confusing to create one network for each link. In principle you could assign a flag to the result of a link and to further link this flag in the next network. Then it is pretty tiring to pursue the effects of the change of a bit in the first network via many other networks. Vice versa it is also confusing when there are many links in one network. This is in particular the case if lateral scrolling is necessary because the chain of links is too long. Then the process described above is of advantage.

Conclusion

As is often the case it is a matter of finding a good compromise between these extremes.

S/R

It helps to set up the program in a clear way if you regularly use the self-hold function. This does not have to be done for each auxiliary flag. The author prefers a program structure that has two networks for each output. At the end of one of them you find "SET OUTPUT", at the end of the other one "RESET OUTPUT". This structure has the following advantages:

R

4-1

Logic functions

Division

It is mostly very different conditions with which the output is switched ON or OFF. In complex situations this easily causes conflicts. The division described above divides the problem into two partial problems each of which and when looked at separately can be easily handled.

Troubleshooting

Troubleshooting during program creation or during operation is made easier. Only two cases are possible: one output becomes active although it should not (hopefully a rare case because it is dangerous). one output does not become active although it should. In either case the structure described will help to quickly find the cause.

Priority

The priority is also easily defined. An alarm lamp should for example be protected against unauthorised switching off; a drive, however, should not start running once the limit position has been reached. The sequence of the two networks defines the priority.

Consequence

If you decide for the function block diagram - which is often the case - you should stick to it consistently. You have to bear in mind: The sequence of the networks has nothing to do with the chronological sequence of the process. An example for illustration.

Example conveyor

A conveyor transports a workpiece for processing. After processing the conveyor transports the workpiece further on. Often the program is structured as follows: 1 (or several) network(s) conveyor 1 (or several) network(s) processing 1 (or several) network(s) conveyor This is confusing. This structure can cause many errors when there are several processing stations. This structure is OK for the sequential flow chart. The function block diagram does usually not reflect the chronological sequence of the process. If the conveyor starts twice it does not have to be started in two networks. In the interest of the switching logic this only means that in one of the networks there is an OR function with two conditions for starting the conveyor! Apart from that more interlocks and safety scans are, of course, implemented by other links. You will get a clear program structure if you set up the network ”from the back”, i.e. from the output.

Here other conditions and links for Start1 and Start2 are inserted.

Here other links such as an AND operator for safety scans can be inserted. Figure 121: Example Program Structure

The following example shows an error that occurs frequently.

4-2

Exercises

Example 1! Error! Q and I are meant to stand for output and input. Study the following example:

Figure 122: Example of a Program Error What is the reaction of the output?

R

4-3

Logic functions

Example 2

Material Length

Position Cap

OK

ALARM Reset

Figure 123: Example filling Task 1

Vessels are to be filled. 1. if the lid and the material are present, the green lamp will light (OK) 2. if the vessel is at the wrong height or in the wrong position, the red lamp will light (alarm) The presence of lids and material is indicated by sensors (for the time being one sensor should be sufficient for the material, the example can be extended later on to monitor minimum and maximum level).

Task 2

Modification of 2. (new project): In case of a fault a horn blows until it is reset. To do so another input is required, the reset button.

Implementation

4-4

The correct function of the programs can be tested using a simulator if the hardware is present and ready for operation. It can also be tested without any hardware in the simulation mode. A visualisation is a good choice. If more inputs are needed than there are on the (small) simulator (e.g. maximum level or reset button), you can work with a combination of physical inputs on the simulator box and inputs in a "simulated" inputs visualisation.

Exercises

4.2.

Higher-level functions Timer and counter function There are very many functions. In the following examples, however, we only want to practise the most important and most frequently used functions, to be more precise, function blocks. These are the timers and the counters. Details about these functions will not be treated here any more. We want to remind you only where this information can be found. The library manager is opened in 'Resources' in 'Window' 'Library Manager'. There you click on STANDARD.LIB. By selecting the function block TON or CTU (Æ further below) the meaning of the inputs and outputs and/or types of variables can easily be seen. If you want to get more detailed information, look at Help. It has to be noted, however, that it is easier to find this information if you look for the term “TIMER”.

Task 3

Task 1 above is to be slightly modified according to practical experience in real life. Sometimes the sensor generates a signal for the wrong position when it detects the edge of a correct vessel. This is to be avoided by the signal that is to be present for at least 3 s before an alarm is given (some kind of “debounced” signal). It is best to create a new project, e.g. testtime1.

Task 4

A ventilator starts running when the light is switched on. There is an after-glow of 10 s when the light has been turned off (new project). Now on to the counter:

Task 5

The vessels in the example above (Figure 123) have been filled, closed by means of the lid and they are counted by a photoelectric sensor when they arrive at the packing station. The package consists of 12 vessels. One output (e.g. full: lamp) is set when the preset value 12 has been reached. Implementation using up counter Implementation using down counter What is to happen when the package is full?

R

4-5

More details

Practical application

Start Drive

Figure 124: Example Slide Task 6

A workpiece is put onto a pickup plate (e.g. by a handling robot) and detected by a photoelectric sensor. After activation of the start button the slide moves to the right. It remains in its right end position for 3 s and then it moves back left. It remains in the left end position until the next start. The photoelectric sensor further to the right, at the beginning of the conveyor, does not need to be considered here. When this process is simulated, whether in the simulation mode with visualisation or with the simulator box, in each case it has to be ensured that no "impossible” situations occur. If e.g. the process has been started, the output S_off (slide out) has been switched, then the workpiece should be moved on. That means the slide leaves the left limit switch and the photoelectric sensor at the workpiece pickup is free again.

If these tasks are not very difficult for you, you are ready for practical applications.

4.3.

More details Notes There are different requirements for each project. We could give more tasks here and still there would not be an example for each application. In this manual some more useful functions are given as examples. Other examples will follow. So as not to take them out of their context, they are only mentioned briefly here: Self-defined function block (Æpage 6-21)

4-6

Exercises

Watch list (Æ page 6-17) Call tree (Æ page 6-19)

Cycle time In this chapter a somewhat special subject will be treated. Those to whom it is important to get a deeper understanding of a PLC, should study it. It can be skipped. Then continue on page 4-9. It is assumed that the contents of chapter 1.5 is known. When to skip?

Two concrete conditions are mentioned here when it is recommended to skip this chapter: ●

if the processes in the application are not time-critical (Æ page 1-7 et seqq)



Those who are making their first experience with a PLC should study this chapter later on.

Made on your own

For test purposes it may be interesting to measure the processing time for function blocks, networks, combinations of them or program modules yourself. With some routine it should not be difficult to create such function blocks. Here we only want to mention some points briefly.

Cycle counter

A cycle timer you have created on your own for the number of processed program cycles may look like

Figure 125: Cycle counter This counter is useful if an average value is to be measured from 1,000 cycles. Internal clock

In some hardware versions there is an internal clock generator with a resolution of µs. "Reading" is effected with the module 'TIMER_READ_US' from the hardware-specific library, Æ Figure 22. With hardware versions without clock generator the module is, of course, not available. Using this module, very precise measurements are possible. Depending on the part of the program whose duration is to be determined, the timer command is used. This can happen twice in the program to start and stop the time. The difference between these values can be further evaluated. It corresponds to the individual processing time. It is, for example, possible to calculate the average or the maximum across 1,000 cycles. Further processing is left to the reader.

PLC browser

It is necessary, in particular in time-critical processes, to determine the cycle time. A powerful PLC system such as ecomatmobile supports the user in this respect. Respective routines are implemented in the operating system. They have to be activated in the software for programming, CoDeSys. This is done in the item 'PLC browser' above the tab (of the register card) 'Resources'.

R

4-7

More details

Restriction

Please note, however, that this function is to be used for all targets (that support such a timer). The method described above with the 'TIMER_READ_US' module can be used more precisely and flexibly.

Figure 126: PLC Browser After clicking an empty window opens.

Figure 127: Opened PLC Browser A command is entered in the first line. After acknowledgment with Enter, the result is displayed online. You will get a list with the commands by pressing F2 or clicking on the field .

Figure 128: List of Commands in the PLC Browser Which and how many of these commands appear here depends on the target system. In Figure 128 it is CR0020.

4-8

Exercises

Most commands are only of use to the experienced programmer. Everybody who is at a loss to understand the command is well advised not to play around to find out the purpose. The 'cycle' command is of interest in connection with the cycle time. The result may look as follows:

Figure 129: PLC Browser with Cycle In other systems, e.g. PDM: CR1051, the 'cycle' command is not supported. It is not in the list. Here the 'tsk' command is useful. It means "task overview". The time for processing individual tasks is indicated. These are e.g. program blocks or visualisations. The value is indicated as average and as maximum value like in Figure 129. For more information about the PLC browser see e.g. the Online help.

Visualisation A visualisation is useful to give an overview of the process. This process was described in detail on pages 3-19 et seqq. Manual operation

The many possibilities of visualisation are explained in a short example. The following situation may e.g. be useful: For some reason or another, the slide has stopped between the limit switches. How can it be moved manually into its home position on the left? It is, e.g. possible with the menu item 'Write values', Æ, page 3-16 or 3-18. However, it is easier and more elegant to use a visualisation. 'Forcing values' would be dangerous in this example, see page 3-18. We assume that the output for the drive of the slide for the travel to the left has been designated with the declaration 'DriveSI'. It is set in a network of the corresponding module. An OR operator with another input is added to 'DriveSImanual'.

R

4-9

More details

Figure 130: Manual Operation 1 In the visualisation a button with the text Slide to the left is added under the text field Manual Mode. In the configuration in item 'Input' the variable X.DriveSImanual is assigned to this button in the field 'Tap variable'. The 'Toggle variable' field would be wrong here because then the drive would be started continuously until a new click is made. The X in the variable stands for the name of the module.

Figure 131: Manual Operation 2 This way it is easy, reliable and clear to control manual operation. It is a prerequisite, of course, that the drive is reset in the next network (the one after Figure 130) when the limit switch has been reached. This also ensures that the limit switch cannot be passed. So, e.g.

Figure132 Manual Operation 3 Task 7

How does the program have to be extended for the following function? The slide should only move while the button for manual operation (here the mouse button when the cursor is on the button) is activated. It is to stop once it is released. This was only meant to be a brief example. To test a program you can proceed as follows. If the manual operation should also be possible later on for the maintenance people, another program structure is necessary. The following aspect has to be considered: In practical use it is required that either manual or automatic Mode is possible and the other one is blocked. Below we will mention briefly how this requirement can be met. If the two operating modes are to be independent from each other, a clear structure is

4-10

Exercises

ensured if two POUs are added to PLC_PRG. This will look somehow like in Figure 133:

Figure 133: Operating Modes 1 Examples for the first network each in these modules will be shown in the next two figures.

Figure 134: Operating Modes 2

Figure 135: Operating Modes 3 The signal 'Manual_Mode' is, e.g. generated via a selector switch (keyoperated switch, coding switch...). The 'Return' command means that the POU is exited once the previous condition is met. In Figure 134 the negation of 'Manual_Mode' is used. Only one of either POU can be active. This way the programming file gets bigger but the cycle time hardly increases. The same effect is also possible by jumps in PLC_PRG or more elegantly with IF THEN ...ELSE ... in structured text.

R

4-11

5.

Models

5.1.

Overview

A concrete project

Once the offline and online program creation and program test have become more familiar using the simulator, it is about time to start processing a concrete project.

Model

For training purposes but also to avoid errors and thus costs for setting up a real plant it is useful to work on a functioning model.

Protection

During the trainings of ifm electronic such models are used. There is no reason to be afraid that they can be damaged by programming errors. The end positions of the respective movements are protected by mechanical limit switches. The models are a kind of processing street with various stations. Three parts are distinguished for a better overview: ●

Robot



Drill



Milling system

A workpiece is positioned for drilling by the handling robot. After (symbolic) drilling it can be processed by the milling system (also symbolically).

It facilitates work, in particular at the beginning, to process the parts separately. The sequence should be determined by the degree of difficulty.

R

5-1

Task Drill

5.2.

Task Drill

Start

S aus S ein

Figure 136: Drill Model Workpiece pickup

A workpiece is put onto a pickup plate onto which it was put by a handling robot (Æ next section) where it is detected by a diffuse reflection sensor.

Slide

The slide is in its home position on the left (view from the front onto the model) which is monitored by an inductive sensor. After activation of the start button the slide moves to the right and pushes the workpiece to the conveyor. When the right end position of the slide has been reached, the movement to the right stops. The travel back is not started right away but the slide waits in its end position for approx. 2s. Then it moves to the left until it has reached its home position again. At the beginning it is easiest to start with programming the movement of the slide. It can run completely independently from other processes. Experience is made which helps become more familiar with this system and which makes it easier to program the rest of the process.

Conveyor

5-2

A photoelectric sensor signals that the workpiece approaches the beginning of the conveyor. This starts the conveyor. An inductive sensor is mounted at the drilling position. The moment it detects the workpiece that is being transported from the conveyor to the drill, the conveyor stops. The drilling process is running. Then the conveyor starts again. At the end of the conveyor of the drill there is no sensor which detects if the workpiece has been transported. The conveyor has to be stopped again by a suitable condition.

Models

Drill head

Taking into consideration suitable conditions (e.g. workpiece in drilling position, drill is running), the drill head moves from its upper home position to its lower position. There it remains for approx. 2 s and then it moves back into its upper home position. You can see that this is a typical, frequent process. Apart from the direction of movement the same happens as with the slide. Once this has been realised, the function 'Project' 'Copy object' will save work (Æ also page 6-21).

Drill

It is reasonable that the drill head moves downwards and upwards with the drill running. With a high-power drill you would have to wait for some time so that it reaches its full speed. However, this is not required here. It is important for a correct process to be able to decide if the workpiece has already been drilled or not. It is recommended to use a flag as an indicator. This ensures that the interaction of conveyor, drill head and drill can be controlled easily and clearly.

5.3.

Task: Robot

-y

+y

underneath this arm there is a solenoid holding the workpiece

-x

Start

+x

Figure 137: Robot Model Figure 137 is a schematic illustration. The limit switches for the rotation have been omitted here; however, they have to be taken into consideration. The simple version of an encoder has been replaced by a more professional one.

R

5-3

Task: Robot

Rotation

At the beginning the robot is in its home position on the right which is monitored by an inductive sensor. After the start button has been activated, it starts rotating to the left (counter clockwise as seen from above). In the pickup position the rotation stops and the workpiece is received. Then rotation is continued up to the release position. There it stops and the workpiece is put onto the pickup table in front of the drill. Then the robot turns back into its home position.

Direction of rotation

The direction of rotation, e.g. clockwise, and the position of the limit switch on the robot always refer to the view from above.

How does the robot know which position it is in? An encoder is connected to the drive for the rotational movement. By counting the pulses which are generated during the rotation, the position is determined. This means a counting function for the program. In this case the counter value is compared with two values. To prevent malfunction due to lag, the comparison greater than or greater than or equal to should be made at any rate. If the respective condition is met, the corresponding flags can control the rotational movement. Here it is easiest to first of all estimate the counter values for the pickup and release positions. They can be corrected after a test run. The position switch on the left should not be reached. It acts as limit switch for the safety of the plant. Should it be reached nevertheless, there is an error in position definition. It can be used as an additional condition so that the rotational movement to the left is stopped here at the latest. The counter does not have to be used for the rotational movement to the right (clockwise). The limit switch on the right is sufficient to stop the rotation. It can also be used as a reference point to set the counter to zero. Robot arm

The robot arm goes downwards twice. The first time in the pickup position to pick up the workpiece. The second time in the release position to release the workpiece. It remains again in the lower position for 2s (Æ see the drill head). Then it moves upwards again. The upper and lower end positions are monitored by diffuse reflection sensors. Do not confuse: for "technical reasons" the diffuse reflection sensor for the "upper end position" is mounted on the lower end of the arm and vice versa.

Solenoid

The solenoid can be switched using simple conditions. When the arm is in the lower pickup position, it is to be switched on. When the arm is in the lower release position, it is to be switched off.

Workpiece picked up

Similar to the drill the information whether the workpiece has already been picked up or not is important to correctly control the process. For example, the arm in pickup position should only go downwards if the workpiece has not yet been picked up. It is possible to assign this meaning to a flag. In this example there is an easier way. The state of the solenoid can be used as a condition by means of which the two cases can be distinguished.

5-4

Models

Start

Once the program for the robot and the drill has been created and tested, the condition "start button" for starting the slide has to be deleted or replaced by suitable conditions. Otherwise the user has to delete each partial step manually.

5.4.

Task: Milling system

Start

Figure 138: Milling System Model CAN

The milling system is not wired in parallel to the inputs and outputs of the controller like the robot and the drill. The inputs and outputs of the milling system are connected to the controller via a CAN module. We will only start working with the milling system in connection with CAN. The process is similar to the drill.

Change of tools The considerable difference is that after processing with the first tool, after the milling head has been moved up again, the workpiece is not further transported, yet. The drive of the milling system is stopped. Then the drive of the tool changer is started. The position sensor indicates that the next tool is in its position. Then a processing step is also started by it, the same with the third tool. Finally the photoelectric sensor at the end of the conveyor of the milling system signals that processing is completed and the workpiece can be removed again.

R

5-5

Addressing

Addressing

Addresses with the model

For each new project you can decide if the declaration of the variables especially the assignment of the inputs and outputs to physical addresses is made before or during the actual program creation. Experience shows that it is usually easier to declare the variables during program creation. It is made a lot easier due to 'Project' 'Options' 'Autodeclare'. Usually it shows during programming how the program can be clearly structured by splitting it up into modules. You only have to consider which variable has to be declared locally (default setting) or globally. Should it turn out later on that a variable was declared locally although it is used in several modules, it can be changed easily, e.g. using the edit functions 'Cut' and 'Paste' via the clipboard.

Inputs

5.5.

5-6

Designation

Unit

Address

Start button

K

%IX0.7

Limit switch robot left

I

%IX0.8

Limit switch robot right

I

%IX0.9

Limit switch robot arm up

O

%IX0.10

Limit switch robot arm down

O

%IX0.11

Encoder channel A

R

%IX0.14

Encoder channel B

R

%IX0.15

Diffuse reflection sensor workpiece pickup

O

%IX1.0

Photoelectric sensor workpiece conveyor beginning

O

%IX1.1

Workpiece in drilling position

I

%IX1.2

Limit switch slide left

I

%IX1.3

Limit switch slide right

I

%IX1.4

Limit switch drilling head down

I

%IX1.5

Limit switch drilling head up

I

%IX1.6

Features

up to 50 kHz

Models

Outputs

Designation

Unit

Address

Solenoid

%QX0.8

Drive robot rotation right

%QX0.9

Drive robot rotation left

%QX0.10

Drive robot arm upwards

%QX0.11

Drive robot arm downwards

%QX0.12

Drive slide right

%QX1.0

Drive slide left

%QX1.3

Drive drilling head upwards

%QX1.4

Drive drilling head downwards

%QX1.5

Drive drill

%QX1.6

Drive conveyor drill

%QX1.7

Features

O, I, and K stand for photoelectric, inductive and capacitive sensors and R for encoders. Direction of rotation of the robot

Do not confuse!

5.6.

Other remarks

Declaration

In the table above you do not find names that are assigned to the addresses during declaration. You can chose the names individually. For the names a compromise between two conditions has to be found. The name should show clearly which address is meant. A name such as Input1 would be meaningless. It would also be possible to work with the physical address and to do without a symbolic name. On the other hand the name should not be too long since otherwise the modules will be confusing.

Safety

Only "minimal" conditions for the correct course of the process were indicated above. They should be completed by safety enquiries. For example, the conveyor at the drill should not start unless the drill head is up. The robot should only rotate when the arm is up etc.

The direction of rotation, e.g. clockwise, and the position of the limit switches on the robot always refer to the view from above.

R

5-7

Other remarks

Program structure

There should not be a fixed specification for the program structure. The structure of a program depends partly on the previous knowledge and experience of the programmer. It is only important to have a structure for the program. It would be quite confusing, e.g. to write the program completely in the PLC_PRG POU. This leads to the so-called "spaghetti code" from which nobody, not even the programmer himself, understands later on which belongs to which. On the other hand it is confusing to use many small, nested modules. Some experience will help to find a sensible compromise between these two extreme cases (Æ also page 4-1).

Language

We do not want to specify the programming language. There are different possibilities. Ladder diagram (LD) programming cannot be recommended. Its importance is likely to decrease in the course of time. It is very clear for logical links. In the context of timer or counter functions it is, however, also necessary to work with symbols. Then the program can be written in FBD right from the start. The Sequential Function Chart SFC is a worthwhile alternative because the described process can be easily divided into individual steps. Those who already have some experience with programming a PLC will write the program in IL. Finally ST is an interesting possibility for those who have some experience with higher-level programming languages, e.g. PASCAL. It is hardly possible to indicate a general rule such as: this or that language is the optimum solution for this or that problem. It is more a question of experience and previous knowledge of the programmer. Another aspect is the number of programmers. Since FBD is probably the most common language, such a program can be easily processed by several programmers.

Visualisation

Here we want to recall the example on page 4-9 et seqq. Visualisation belongs to virtually any project. It helps: - with program creation (program test) - with maintenance (trouble shooting)

5-8

6.

Appendix

6.1.

Buttons

Toolbar

This appendix will give you a short overview of the different buttons in the toolbar. The toolbar, the third bar from the top, offers a variety of buttons (if activated via 'Options' 'Toolbar'). Regularly used functions can be started with a single mouse click. They are, of course, also available as menu items. Just like the menus they are context sensitive. That means the buttons can vary depending on the open and active windows. Some can be seen at virtually all times and they will be described first. Later, we will explain those buttons that can e.g. only be found in the FBD editor. For detailed descriptions of the functions please refer to the manual for program development. This short overview will not describe if the function can e.g. be found in the menu 'Extras' or 'Insert'. In most cases that is obvious in the context. To save space we do not state "... at the marked position" for each function. It is self-understood that the position in which e.g. something is to be inserted requires marking. Neither will we state that it might not make sense to insert an element in just any place depending on the function. It does not make sense e.g. to insert an operator following an assignment. Some elements have a default value, e.g. TRUE for Boolean variable. This default value can be overwritten with the requested entry. The F2 key can be useful again.

File functions 'File new' Opens a file named Untitled. If no file is open (e.g. following the instruction File Close) almost all (context sensitive) menus are empty or the menu items are shown in grey, i.e. they are inactive. To do something, a file has to be open. 'Open file...' Opens the window for selecting a file. 'Save file' Saves the open file. It is recommended to click on this button repeatedly during your work.

R

6-1

Buttons

Online functions 'Start' Starts the program processing. 'Stop' Stops the program processing. 'Single step to' Carries out the next instruction (debugging). 'Breakpoint on/off' Stops the program processing at the current instruction (debugging); useful e.g. in combination with Single Step To. 'Login' Establishes the connection to the controller (only if the program is correct). If the program was changed a new compilation is started. In the simulation mode, only the compilation is carried out, if required. Remember: Program processing has to be started additionally.

'Logout' Separates the connection to the controller. E.g. to change the program or to configure the trace.

General editing functions 'Cut' Deletes marked modules or lines and transfers them to the clipboard. 'Copy' Transfers marked modules or lines to the clipboard. 'Paste' Inserts the contents of the clipboard. 'Find...' Opens the window for entering the search criteria. 'Find next' Finds the next match.

6-2

Appendix

Editing functions for SFC 'Step transition (before)' Inserts a step with transition before the marked block. ''Step transition (after)' Inserts a step with transition after the marked block. 'Alternative branch (right)' Inserts a branch on the right of the marked block. 'Alternative branch (left)' Inserts a branch on the left of the marked block. 'Parallel branch (right)' Inserts a parallel branch on the right of the marked block. 'Parallel branch (left)' Inserts a parallel branch on the left of the marked block. 'Jump' Inserts a jump at the end of the alternative branch of the marked block. 'Transition jump' Inserts a transition with jump at the end of the parallel branch of the marked block.

Editing functions for LD 'Contact' Inserts a contact (input) to the network before the marked position. 'Parallel contact' Inserts a contact (input) in the network in parallel to the marked position. 'Coil' Inserts a coil (output) in the marked position or in parallel. 'Negate' Inverts a contact (input).

R

6-3

Buttons

Editing functions for FBD 'Input' Inserts an additional input for an operator, e.g. an AND function. 'Output' Inserts an additional output, e.g. for an operator. 'Box' This means operators, functions, function blocks, programs (standard or selfdefined) and conversions. The default setting AND operator has to be overwritten. 'Assign' Transfers the result of the linked operators of the network to the address to be indicated (output). 'Jump' Inserts a jump. 'Return' Inserts a return to finish the function. 'Negate' Inserts a negation for an input or output. 'Set/reset' The appropriate outputs take on the state TRUE or FALSE (S: 1 click, R: double click) if the preceding link is TRUE. This value is retained even if the condition is no longer fulfilled.

Functions for sampling trace 'Start trace' Loads the trace definition into the controller. Starts the sampling trace. 'Read trace' Transfers the sampling trace to the PC. Enables the graphical presentation of the values. 'Stop trace' Stops the sampling trace. 'Stretch' Stretches the time axis of the graphical presentation for a better overview of fast changing states. 'Compress' The opposite of stretch.

6-4

Appendix

Functions for Visualisation 'Selection' Selects an element. 'Rectangle' Inserts a rectangle. 'Rounded rectangle' Inserts a rounded rectangle. 'Ellipse' Inserts a circle or an ellipse. 'Polygon' Inserts a polygon (closed polyline). 'Polyline' Inserts a polyline. 'Graph' Inserts a free-hand graph. 'Pie' Inserts a pie. 'Bitmap' Inserts a bitmap. Once the size and the position have been defined, a selection screen for the file opens. 'Visualisation' Inserts a visualisation. Once the size and the position have been defined, a selection screen for the file opens. 'Button' Inserts a button, similar to a rectangle with predefined characteristics. 'WMF file' Inserts a WMF graphic file. Once the size and the position have been defined, a selection screen for the file opens. 'Table' Inserts a table for an array. When a wild-card has been inserted, a window for configuration opens. 'Trend' Inserts a trend display for displaying current values as a graph, similar to sampling trace .

R

6-5

Buttons

'Alarm table' Inserts an alarm table for an overview of alarms that are defined as events. When a wild-card has been inserted, a window for configuration opens. 'Pointer instrument' Inserts a pointer instrument to display values as angled position. When a wildcard has been inserted, a window for configuration opens, e.g. for marking ranges. 'Bar graph' Inserts a bar graph, similar to the pointer instrument. When a wild-card has been inserted, a window for configuration opens. 'Histogram' Inserts a histogram, similar to a bar graph for displaying an array with several vertical bars. When a wild-card has been inserted, a window for configuration opens.

6-6

Appendix

6.2.

Quick reference guide New project When a new project has been opened, two windows open automatically.

Target system

First of all the target system is specified. Here the device type is selected that is to be worked with.

Æ Figure 11

PLC_PRG

Then the PLC_PRG POU is added. The window 'Project' 'Add Object...' opens automatically with the fixed name.

Æ Figure 33 Please note: The name of this POU must not be changed!

Click on

to open the window of this POU.

R

6-7

Quick reference guide

Æ Figure 34. If you prefer another language, the module will, of course, look different. Add object

The next step should always be to add a new object in 'Project' 'Object' 'Add'.

Æ Figure 35 In the example in chapter 3 it was the object P_And in FBD. The program becomes very confusing if you write everything in PLC_PRG. There may, of course, be exceptions. One exception is e.g. setting the RELAY, Æ Figure 105.

Libraries and hardware configuration Should you have tried to set the relay right away, you will find that it has not yet been declared. The reason why is that for each new project the libraries and the hardware configuration have to be integrated. We do not want to describe it here again in detail, Æ pages 2-11 to 2-19. We will only recall the necessary steps by means of some screenshots.

6-8

Appendix

Æ Figure 18

Æ Figure 22

R

6-9

Saving work

Æ Figure 27

Æ Figure 31 Relay

When the relay has been set (if applicable), the preparations are completed. Now the actual programming can start.

6.3.

Saving work Under this hopefully interesting headline we will describe briefly how already created programs, modules, networks, etc. can be transferred from one project to another. As usual there are several ways to reach the goal. Not all of them can be shown here; we have to refer to the programming manual. Here we only want to discuss some of the most frequently used methods.

'Save as...' This is the easiest and probably best known way. The following procedure makes sense to program an R360 controller, for example. It is relatively complex to always integrate the hardware configuration etc. for each new project if always the same hardware version, e.g. CR0020, is used. Then it is worthwhile to create an empty project as master in which all settings have already been made. With 'Save as...' you will get a project in which you can work right away, without any other preparation.

6-10

Appendix

'Project' 'Merge...' This function is not often used, perhaps because the name may be misleading. No copy of the project is created. This is simply done by 'File' 'Save as...'. With this function another project or parts of it can be inserted in the currently processed project. In the example above not much work is needed to create the P_AND module. Nevertheless we want to show how it can be copied into another project. If this menu item is clicked on in an open project, a selection screen will open.

Figure 139: Merge Project After selection and click on 'Open' the list of the modules is displayed.

Figure 140: Merge Objects Here the P_AND POU can be marked and acknowledged by clicking on 'OK'. Then it appears in the new project in the list of modules. In Figure 140 you can see that not only program modules but also visualisations can be copied in the same way.

R

6-11

Saving work

'Export project...' 'Import project...' Similar to Figure 140 objects can also be exported and imported. Then they are available as a separate file (or files) for import to other projects.

Library Projects that in this case must not contain a PLC_PRG with one or several objects can be saved as library by means of 'Save as...'. As above they can be integrated in other projects. This is e.g. useful if you do not want the operator of a plant to change certain function blocks, if he has access to CoDeSys. It is not possible to edit in a library; a source code has to be available. Another aspect is that in this way special know-how can be "hidden".

Clipboard Everybody working with Windows is familiar with the clipboard. Therefore we will not go into any further details here.

Templates An already created project can be opened as a template in 'File' 'New from template...'. A copy with the name (Untitled)* is created. If the file is copied with another name, you will virtually get the same result as with 'File 'Save file as...’, Æ page 6-10. It is especially recommended to create a file as template with all configuration settings if new projects for the same hardware are created often, Æ page 2-19. Another possibility is to click on 'Save as template' (right mouse click) in the context menu, e.g. a program module for an object, e.g. a program module. Then all declarations are saved and not only the links.

Other steps Adapt

Irrespective of the method used it must be checked in any case if other adaptations have to be made. If e.g. a network of a function block was copied via the clipboard, the respective declarations of the variables also have to be copied or entered again. Possibly addresses have to be changed etc.

Done?

When the module has been completely edited, you are not done yet.

Remember!

In the heat of the moment it also happens to the experienced programmer that he forgets to integrate the completely edited POU in his project. It is absolutely necessary to take the following step!

Activating P_AND in PLC_PRG

The program P_AND is now to be activated in PLC_PRG. For this purpose activate the window of PLC_PRG (Figure 34) and activate menu item 'Add' Function Block' (Figure 35).

6-12

Appendix

6.4.

Remarks for solutions We pointed out above: There is hardly ever one and the optimum solution. Furthermore it is better at the beginning to find solutions on one's own instead of adopting ready-made patterns. Therefore we will give only some hints as suggestions.

Example 1 (page 4-3)

The second network defines the state of the output. The first one can be left out. It would serve the obviously intended purpose to combine the two networks and to link the results of the AND operation with an OR operator. Here you can see again that an S (set) function is of advantage. If you had an S before the output of networks 1 and 2 there could be no conflicts. You need, however, more networks for resetting.

Task 1 (page 44)

To begin with, simple logic functions are sufficient. Using SET/RESET is somewhat more complex. This could only become necessary for a more precise or changed definition of the task. An example in this context:

Task 2 (page44)

Should be no problem (remember the priority!)

Task 3 (page 45)

It is confusing to program very many links in one network. It is also confusing to have one network for each link. The point is find a happy medium. In the example network 2 does not look too confusing. What can you find in network 1 (remember useful priorities!)?

Figure 141: Example 1 We should briefly comment on the timer function. The preset value PT (preset time) is fixed here. It cannot be changed while the program is running. The only possibility is to change the source program. This may be useful in some cases. If, however, it should be possible to change the value, e.g. by the engine driver via an input device, this value has to be declared to be a symbolic variable which can be changed by other POUs. The actual value ET (elapsed time) does not have to be assigned to a variable in each case. In Figure 141 above you can see when this may be useful, e.g. for displaying this value.

R

6-13

Notes on the models

Other variants are conceivable, e.g.

Task 4 (page 45)



OR operator before the timer function, then both inputs are debounced or



other timer functions between ‘Length' and OR operator so that the second input can be debounced with another timer value, etc.

The easiest solution is to use the function block TOF. A little additional task in this context: The output should only switch after the input (e.g. with 1 s) has been debounced. Here it is easiest to use two function blocks TON in conjunction with S and R.

Task 5 (page 45)

Hopefully, the timer functions CTU or CTD should not be too difficult. Only the case "package full" has to be considered more closely. If you simply use the condition "actual value = preset value" to reset the counter, then the output Q of the counter is on TRUE for just a short time. The signal has to be "retained".

Task 6 (page 46)

Here we want to recall the remarks about the program structure, Æ page 4-1 et seqq and 5-8. At any rate a program module, e.g. name 'Slide' type 'Program' and language 'FBD', should be created with 'Project' 'Object' 'Add...'. Then there are two alternatives: ●

For this relatively easy and clear process all networks for controlling the slide can be integrated in this module.



Those who program separate processes consistently in separate modules will create two more modules, e.g. 'Slide_out' and 'Slide_in'. Then they will be added to the module 'Slide'.

'Slide' has to be added to the main program PLC_PRG in any case. Then 'Slide_out' consists of e.g. two networks. On the right-hand side of the network there is the set ’Drive_slide_out' or in the second network reset 'Drive_slide_out' (set and reset are abbreviated by S and R in programming, in FBD there is a button in the toolbar). Then there are only the tasks left to find meaningful conditions or links so that the process runs as desired. Since in this structure the entire task was divided into small partial tasks, these steps should no longer be difficult. If only the module 'Slide' was created, it should consist of four networks.

6.5.

Notes on the models Some information was already given on the pages 5-1 et seqq . Here we want to give more details about frequent problems. These notes are not only useful for the models.

6-14

Appendix

Declarations In the examples given so far the variables were declared locally. This is, of course, also possible for the models. Below an example will be given how to declare the variables directly during hardware configuration.

Figure 142: Standard PLC Configuration As shown in Figure 28, e.g., the entries are opened by clicking on '+' in 'Resources' 'PLC configuration'. Then the table on page 5-6 can be used to directly edit here. (compare Figure 29). The result then looks like this:

R

6-15

Notes on the models

Figure 143: Declarations in the PLC Configuration As already mentioned, there are several ways to proceed. The advantage of the possibilities shown here is that once declarations have been made the variables are available in the entire project and can easily be added by using F2. The disadvantage is that in an open program module, e.g. 'Slide' (Æ page 4-6, 5-2 or 6-19), they cannot be displayed in the declaration window. Especially online or with poor lighting it may be difficult to recognise a change in colour which indicates the change in state.

6-16

Appendix Consistent

Whichever possibility you may decide for: You should always be consistent and declare in the same way!

Watch list

A method to help is to create a watch list. It is also very useful for maintenance (troubleshooting). You collect all variables that are important for a certain context and save the list as a freely selectable name. This is done in 'Resources' Watch and recipe manager'.

Figure 144: Watch List Slide This watch list was saved as 'Slidew'.

Figure 145: Watch List Online When you have logged in and the module 'Slide' was possibly open, all information you need to check the function of the slide is available.

R

6-17

Notes on the models

Sequence It is confusing to program the conveyor and the drill in only one program module. This easily leads to an unfavourable arrangement of the networks like in the example below (see page 4-2): - network for starting the conveyor - network for stopping the conveyor - various networks for the drilling process - network for another start of the conveyor - network for another stop of the conveyor. The basis is the sequence of the individual processes. This can also produce the desired result. As soon as there is a malfunction of the conveyor, it is twice as difficult to find the cause since the conveyor is found twice. The sequence of the networks described above would be suited for the structure of a module in SFC. However, it does not come up to the idea of the FBD. It would be considerably clearer to use one single POU for the conveyor and one for the drilling process. The process will also be less susceptible to interference if these two POUs are combined with only very few links. The conveyor starts twice. This simply corresponds to the logic OR function. You only have to consider which conditions or links are required for the first and which for the second start. Then the necessary considerations for the stops are made. The sequence of the conditions is absolutely irrelevant for the switching logic. Only the conditions are important for the correct process and not the OR function. Once the program module for the conveyor has been completely programmed, it can be tested, independently of the drill. This leads to the question: How can the conveyor be tested without the drill running? Flag

Using a flag is a good solution. It does not simply have the function "auxiliary flag" but it can rather be called a "control flag". It is simply given the name 'drilled'. It is to have the state TRUE when the drilling process is completed and FALSE when drilling is still performed. For the program test this process can at first be controlled "manually" by changing its value via 'Online' 'Write values'. Once you have ensured that it is used so that the process is running correctly, you can take a next step and consider meaningful conditions changing the state of the flag automatically (see page 6-19).

Recap This effect can e.g. be found with programming of the drill head. You gather conditions, e.g. workpiece in drilling position, conveyor stands still and drill (tool) is running. They are linked with logical AND. With the result the drive is set that moves the drill head downwards. This looks completely right. Let us assume that the further process (stopping the movement downwards, waiting for the drilling process and movement of the drill upwards) has been correctly programmed and then the following happens during the program test:

6-18

Appendix As soon as the drill head has arrived its upper position, these conditions have been met (it is better if the conveyor starts moving when the head is in its upper position so that the tool does not break off and the drill head should leave the workpiece with the tool running). The consequence is that the drill head moves downwards etc. in all eternity. Therefore the model has got its nickname "sewing machine". What is to be done?

The flag 'drilled' that was described above in section Sequence is also very useful in this case. It is also useful for the program test of the module for the conveyor. An edge detection e.g. R_TRIG of a suitable variable is also a good solution.

Flag

Only those who do not have any idea how the flag is controlled by the program should go on reading here. There are several solutions, as usual. Then there will be some notes for an example When a new workpiece has been placed, it has not been drilled yet. When the drill head is in its lower position, drilling has been effected.

Program structure Those who prefer to program on their own should skip this section or compare their own program with the following examples upon completion. A possible program structure will be presented. We do not claim to give a perfect solution here. The example can certainly be improved, e.g. by additional enquiries to increase the safety of the process. In this respect it is not only the list of modules that is shown. The program structure cannot be directly seen from this list in alphabetical order. The structure becomes clear when you select 'Project' 'Show Call Tree'.

Figure 146: Call Tree Various possibilities are shown here. In the first main branch a single subprogram was added for the slide. In the second main branch two subprograms were used as an example for the movement of the arms ('ARMDOWN' and 'ARMUP'). They are called by the subprogram 'ROARM'. It would have been more consistent to use only the program 'ROARM' and to

R

6-19

Notes on the models

program the entire movement of the arm there. Above we already pointed out that the preset structure is nothing but an example. Consistent

The user should see to it that a uniform structure is used. This is in particular important if several people are to work with the program, e.g. also in maintenance (troubleshooting). The numerous CAN functions are implemented automatically. They need not be taken into account here.

POUs with folders

The program structure will become clearer if the subdirectories are inserted via the context menu (right mouse button) (see Figure 147). Please note that this tree is only a view. It does not reflect the actual call hierarchy like the call tree (see Figure 146).

Figure 147: POUs with folders Please note: Be careful when you assign names. In any case you should avoid using the same name for a variable, a box you have defined yourself or a POU.

Below we will give an example how to implement the notes on the program structure on pages 4-1 et seqq for a concrete module.

6-20

Appendix

Figure 148: Example Conveyor Drill Here the hints given in Figure 121 were carried out. You can find more information on the program structure in the comments.

Individually defined function block The slide is not discussed in more detail here. Some information was already given on page 6-14. We use its controller as an example to show how to define a function block on your own. If you compare the movement of the slide with that of the drill head, the robot arm etc. in general, it stands out that the same movement occurs 5 times even in this small model. It is worthwhile to define a function block for such frequently recurring processes which can be used several times in the project. To be more precise, each time it is an instance of the function block. Below we will show briefly how to proceed. In 'Project' 'Object' 'Add...' a new function block is created.

Figure 149: Create Function Block

R

6-21

Notes on the models

It gets e.g. the name To_and_Fro for moving it away from its home position and back. The language used is again FBD.

Figure 150: New Function Block It stands out that there are more variable classes than with a program. It will become clear soon what this is all about. The condition for starting the movement from the home position is declared as the first variable. Class VAR_INPUT is used.

Figure 151: Declaration as VAR_INPUT Some interim steps are skipped. The reader should be able by now to edit this function block on his/her own. The next figure shows the complete function block. The meaning of the individual steps will be explained afterwards or is self-explanatory in the application example in Figure 156.

6-22

Appendix

Figure 152: Function block To_and_Fro At last we will show how this function block can be used for the slide, for example. A new program by the name slide1 is added via 'Project' 'Object' 'Add...'.

Figure 153: New Program Slide1 The function block is now added to the first network. At first a box is added with . Then the function block is selected pressing F2.

R

6-23

Notes on the models

Figure 154: Add Defined Function Block

Figure 155: Added Function Block Now the meaning of the variable classes becomes clear. The variables in the function block are also called internal variables. You can access them from the outside if they were declared as VAR_INPUT or VAR_OUTPUT. If, e.g., time_value had not been declared as VAR_INPUT, then it would not be possible to influence the preset time value. The function block for controlling the slide is used as follows (Figure 156).

Figure 156: Function Block for Slide If the timer operation is not to be observed directly, the output time_display of the function block can be released.

6-24

7.

Index

%IX0.08 .......................................................3-42

Closed loop.................................................... 1-9

.pro ...............................................................3-29

CoDeSys........................................................ 3-1

??? ................................................................. 3-9

'Coil'............................................................... 6-3

‘New project' .................................................. 6-7

Color............................................................. 3-23

3S................................................................... 2-3

Compilation...........................................3-40, 6-2

Adapt............................................................6-12

Compilation.................................................. 3-43

Add object...................................................... 6-8

'Compress' ................................................... 6-4

Address........................................................3-42

Configuring element .................................... 3-21

Addressing..................................................... 5-6

'Contact'........................................................ 6-3

Alarm colour.................................................3-23

Context sensitive ........................................... 6-1

'Alarm table'.................................................. 6-6

Conveyor ...................................... 4-2, 5-2, 6-18

'Alternative branch (left)' ............................ 6-3

Copy....................................................3-37, 6-11

'Alternative branch (right)'.......................... 6-3

'Copy' ............................................................ 6-2

Append Subelement....................................2-19

Copy project................................................. 6-11

'Assign' ......................................................... 6-4

Counting function....................................4-5, 5-4

Assignment ............................... 3-41, 3-42, 3-43

CR0020.......................................................... 1-3

AT.................................................................3-43

CR0505.......................................................... 1-3

Auto load........................................................ 2-6

CR2500.......................................................... 1-3

Auto Read Trace .........................................3-49

Current version .............................................. 1-3

Autodeclaration............................................3-11

'Cut'................................................................ 6-2

'Bar graph' .................................................... 6-6

Cycle frequency............................................. 1-7

'Bitmap' ......................................................... 6-5

Cycle time ...............................................1-7, 4-7

Box ................................................................. 3-7

Cyclical........................................................... 1-5

Breakpoint...................................................... 3-2

Data sheets.................................................... 1-2

'Breakpoint on/off' ....................................... 6-2

Debugging .................................... 3-2, 3-18, 6-2

Bus system .................................................... 1-8

Declaration................. 2-16, 3-6, 3-7, 3-41, 3-42

Button...........................................................4-10

Declarations ............................................... 6-15

'Button'.......................................................... 6-5

Default...................................................3-14, 6-1

Buttons........................................................... 6-1

Defining variables .......................................... 3-6

CAN.........................................................2-3, 5-5

device-specific ............................................... 2-3

Catalogue....................................................... 1-2

Direction of rotation ....................................... 5-4

CFC................................................................ 3-1

Direction of rotation ....................................... 5-7

Change color ......................................3-22, 3-23

Directory........................................ 1-4, 2-3, 2-11

Change of tools.............................................. 5-5

Documentation .....................................1-2, 3-51

Clipboard......................................................6-12

Downloader..........................1-9, 2-4, 3-32, 3-35

R

7-1

Drill.......................................................... 5-1, 5-2

Graphical function block ................................3-1

Drill head ........................................................5-3

Grid...............................................................3-20

Drilled.................................................. 6-18, 6-19

Guarantee ......................................................... II

ecolog software installer ................................2-1 ecomat mobile................................................1-5

Hardware configuration2-16, 3-2, 3-3, 6-8, 610, 6-15

Editing functions for FBD ...............................6-4

Hardware of the PC .......................................2-1

Editing functions for LD..................................6-3

Help ...................................................... 2-14, 4-5

Editing functions for SFC ...............................6-3

Hex file..........................................................3-34

EDS ................................................................2-3

'Histogram'....................................................6-6

Element ....................................................... 3-20

IEC-61131-3...................................................3-1

'Ellipse' ..........................................................6-5

IL ............................................................ 3-1, 5-8

Encoder ..........................................................5-4

Import ...........................................................6-12

Error message...................................... 2-6, 3-35

Import project ...............................................6-12

Error Message............................................. 3-43

Individually defined function block.........6-21

Example 1 ................................................... 6-13

Input..............................................................3-23

Export .......................................................... 6-12

'Input' .............................................................6-4

Export project .............................................. 6-12

Input assistant ..................... 3-8, 3-23, 3-47, 6-1

F2.......................................................... 3-8, 3-22

Installation .............................................. 1-2, 2-1

FBD ........................................................ 3-1, 5-8

InstallTarget....................................................2-8

File ..................................................................2-4

Instruction list ....................................... 3-1, 3-14

File functions ..................................................6-1

Interface parameter......................................3-35

'File new'........................................................6-1

Internal clock ..................................................4-7

File size ....................................................... 2-13

Internal variable............................................6-24

'Find next'......................................................6-2

Internet ................................................... 1-3, 2-4

'Find...' ...........................................................6-2

'Jump' .................................................... 6-3, 6-4

Fixed............................................................ 6-13

Key .................................................................3-8

Flag..................................................... 6-18, 6-19

Key word .............................................. 3-6, 3-43

Forcing......................................................... 3-18

Ladder diagram.................................... 3-1, 3-14

Frequency ......................................................1-7

Language .......................................................5-8

Frequency inputs............................................1-8

LD ........................................................... 3-1, 5-8

Function block ............................................. 6-23

Library..........................................2-14, 6-8, 6-12

Function block ............................................. 6-12

Library manager................................. 2-13, 2-15

Function block diagram..................................3-1

Local .........................3-12, 3-23, 3-41, 5-6, 6-15

Functions for sampling trace .........................6-4

Logging out...................................................3-19

Functions for Visualisation.............................6-5

Login.............................................................3-15

General editing functions ...........................6-2

'Login' ............................................................6-2

Global ................................ 3-12, 3-41, 5-6, 6-15

'Logout'..........................................................6-2

'Graph' ...........................................................6-5

Low-pass filter ................................................1-8 Manual............................................................4-9

7-2

Index

Manual for the program development........... 1-2

'Paste'............................................................ 6-2

Manual mode...............................................4-10

Path................................................................ 2-4

Manual operation..................................4-9, 4-10

Physical address ..................................3-41, 5-6

Mark ............................................................... 3-7

'Pie' ................................................................ 6-5

Mark-to-space ratio........................................ 1-8

PLC ................................................................ 1-5

Milling system .........................................5-1, 5-5

PLC browser.................................................. 4-7

Milling System Model .................................... 5-5

PLC_PRG............. 3-3, 3-4, 3-13, 5-8, 6-7, 6-12

Mobile............................................................. 1-5

'Pointer instrument'..................................... 6-6

Models ........................................................... 5-1

'Polygon' ....................................................... 6-5

Mounting ........................................................ 1-2

'Polyline' ....................................................... 6-5

ms................................................................... 1-7

POUs ......................................................3-1, 3-2

Name ............................................................. 5-7

Previous knowledge ...................................... 1-1

Name ............................................................. 3-6

Priority............................................................ 1-6

'Negate' ..................................................6-3, 6-4

Program start................................................. 2-5

Network.......................................................... 3-7

Program structure.................................5-8, 6-19

New project.............................................2-7, 3-3

Program test .......................................3-15, 3-45

New Visualisation Screen ...........................3-19

Programming languages............................... 5-8

Notes.....................................................1-2, 6-14

Programming Languages.....................3-1, 3-14

Online.................................................3-28, 3-37

Programming system exit ........................... 3-30

Online functions............................................. 6-2

Project.....................................................2-7, 3-1

online help...................................................... 1-3

Protection....................................................... 1-5

Online Test...................................................3-37

Read from the controller.............................. 3-35

Online-Hilfe .................................................... 1-3

Read Trace.................................................. 3-49

'Open file...'................................................... 6-1

'Read trace'................................................... 6-4

Operand ......................................................... 3-9

Rebuild all .................................................... 3-21

Operating modes.........................................4-11

Recap .......................................................... 6-18

Operating system ........................................3-32

Rectangle..................................................... 3-20

Operator......................................................... 3-9

'Rectangle'.................................................... 6-5

'Operator' ...................................................... 6-4

Reference point ............................................. 5-4

Orientation guides

Relay.....................................................3-44, 6-8

Footnotes ...................................................... 1-2

RELAY ........................................................... 6-8

Headers ........................................................ 1-2

Resources ............................... 2-16, 3-41, 3-45

Pictograms .................................................... 1-2

Oscilloscope ................................................3-45 Other languages ..........................................3-14 'Output'.......................................................... 6-4 'Parallel branch (left)' .................................. 6-3 'Parallel branch (right)'................................ 6-3 'Parallel contact' .......................................... 6-3

Response time............................................... 1-7 Result............................................................. 3-9 'Return'.......................................................... 6-4 Robot ......................................................5-1, 5-3 Rotation.......................................................... 5-3 'Rounded rectangle'.................................... 6-5

R

7-3

Sample rate................................................. 3-47

Structured text...................................... 3-1, 3-14

Sampling trace ............................3-2, 3-45, 3-47

Structures ............................................... 3-1, 3-2

Sampling trace ............................................ 3-45

Subdirectory .................................................2-11

Save ................................................... 3-29, 3-30

Subelement ..................................................2-19

'Save file' .......................................................6-1

Subsequent installation of the target.............2-8

Saving................................................. 3-13, 3-35

System manual ..............................................1-2

Saving work................................................. 6-10

System variable..........................................3-44

Search path................................................. 2-11

'Table' ............................................................6-5

'Selection'......................................................6-5

Target information........................................2-10

Sequence .................................................... 6-18

Target system ........................................ 2-7, 6-7

Sequential function chart ...............................3-1

Task 1................................................... 4-4, 6-13

'Set/reset'.......................................................6-4

Task 2................................................... 4-4, 6-13

Settings...........................................................2-7

Task 3................................................... 4-5, 6-13

SFC ........................................................ 3-1, 5-8

Task 4................................................... 4-5, 6-14

Show call tree.............................................. 6-19

Task 5................................................... 4-5, 6-14

Signal shape...................................................1-8

Task 6................................................... 4-6, 6-14

Simulation mode .................................. 3-2, 3-15

Task 7...........................................................4-10

Simulator ..................................................... 3-31

Template ............................................ 6-10, 6-12

'Single step to' ..............................................6-2

Test....................................................... 3-2, 3-45

Slide...............................................4-6, 5-2, 6-21

Text...............................................................3-25

Software setup ...............................................2-1

Time characteristics .......................................1-7

Solutions...................................................... 6-13

Timer function ................................................4-5

Source file.................................................... 3-35

TNF...............................................................2-10

ST ..................................................3-1, 4-11, 5-8

Toggle variable.............................................3-23

Start .................................................... 3-15, 3-40

Toggling........................................................3-23

'Start'..............................................................6-2

Toolbar ...........................................................6-1

Start Trace................................................... 3-48

Trace Buffer..................................................3-49

'Start trace' ....................................................6-4

Trace configuration ......................................3-46

Starter set.......................................................2-7

Training manual .............................................1-2

Starter set.................................................... 2-12

'Transition jump' ..........................................6-3

State ...............................................................1-6

'Trend'............................................................6-5

Status line........................................... 3-15, 3-43

Trigger variable ............................................3-47

Status Line .................................................. 3-40

Unambiguous.................................................1-6

''Step transition (after)' ................................6-3

User-defined Programs ...............................3-12

'Step transition (before)'..............................6-3

VAR_INPUT....................................... 6-22, 6-24

'Stop' ..............................................................6-2

Variable .............................................. 2-16, 3-11

'Stop trace' ....................................................6-4

Variable classes...........................................6-22

'Stretch'..........................................................6-4

Variables ........................................................3-6

7-4

Index

Version..................................................2-4, 3-34

Watch window ......................................3-2, 3-45

Visualisation......3-1, 3-2, 3-19, 3-35, 3-47, 6-11

Watchdog....................................................... 1-9

'Visualisation'............................................... 6-5

'WMF file' ...................................................... 6-5

Watch list .....................................................6-17

Write into the controller................................ 3-35

Watch variables ...........................................3-45

Write Values .......................................3-16, 3-17

R

7-5

Related Documents


More Documents from "Seif Charaf"

January 2021 2
1.umarul
January 2021 1
Proiect Zidarie
January 2021 1