Sie sind auf Seite 1von 15

WAGO-I/O-PRO CAA

IEC61131-3 Programming Tool

WAGO-I/O-PRO CAA

WAGO-I/O-PRO CAA is part of CoDeSys for Automation


Alliance (CoDeSys stands for Controlled Development System)
formed by 3S Company (Smart Software Solutions GmbH)

CoDeSys is an IEC61131 programming tool for multiple


hardware and software platforms from various Manufactures.
Each Manufacture provides a Target Support Package (TSP) .

The TSP defines drivers and configuration settings for a CoDeSys


programmable device.

DIN IEC 61131-3

What is the IEC 61131-3?


Part 1, general information
Part 2, operational funds and
requirements
Part 3, Programming languages
Part 4, Manual for users
Part 5, PLC-communication

1
DIN IEC 61131-3

The languages of the IEC


• Instruction List (IL)

• Ladder Diagram (LD)

LD SFC • Function Block Diagram (FBD)

• Sequential Function Chart (SFC)

• Structured Text (ST)

CFC ST IL • Continuous Function Chart (CFC)

Structure of a WAGO-I/O-PRO CAA Project

Project

POU‘s Data Types HMI Resources

Global
Declaration Variables

Code Libraries

All project data is saved in one file with a .pro extension (e.g., filename.pro).

WAGO-I/O-PRO CAA

Variable Declaration Editor


POU
Program
Organization
Unit
Text or Graphic Editor
“POU” tab
selected

Message Window

2
Program Organization Units (POUs)

 POUs are similar to sub-routines, with PLC_PRG as the main routine. All
POUs are called directly or indirectly from PLC_PRG**
 A POU consists of a declaration part and a code part.
 The “New POU” dialog box is displayed when a new project is created or
when a new POU is added to the project. The first POU of a new project will
automatically be name PLC_PRG.

** NOTE: If the Task Configuration is enabled, PLC_PRG is no longer the


main routine, and program execution follows the Task Schedule.

POU Type - Functions

 Local variables are initialized each call –


variables do not retain their value from the
previous call
 The function name is also the name of the
output variable.
 Requires one or more input variable(s)
 Requires only one output variable
 Usefully for calculating complex expressions
 Returns the calculated result into the
accumulator
accumulator:
 Can calculate only one data element

Input values: Result

POU Type - Function blocks

 Local variables retain their value from the


previous call
 Need to create an Instance of the function
block - similar to declaring a variable or
structure
 Each instance has its own copy of the local
variables
 Input and output variable(s) optional
 Usefully for creating reusable code like
counters, timers, triggers and other machine TIMER
functions etc.
Start/Stop IN TON Q Output

Preset PT ET Elapsed
time time

3
POU Type - Programs

 Local variables retain their value from the


previous call
 Like a function block, but only one global
instance
 Starting point for a task
 Input and output variable(s) optional
 From main program (PLC_PRG) links to
other POUs are established
function function
block
function
PLC_PRG function
program X
program block
function
function
program Y

function

Calling POU Types

PROGRAM
1

FUNCTION FUNCTION BLOCK


2 3

FUNCTION FUNCTION FUNCTION BLOCK

1) Programs may call functions or function blocks, but not the other way
around
2) Functions may call other functions, but cannot call function blocks
3) Functions blocks may call functions or other function blocks

POU Languages

Language Selection

POUs can be written in the following IEC-61131 languages:


 Instruction List (IL)
 Ladder Diagram (LD)
 Function Block Diagram (FBD)
 Sequential Function Chart (SFC)
 Structured Text (ST)
 Continuous Function Chart (CFC)

4
Languages of IEC 61131-3

Sequential Function Chart


Step 1 N FILL

Instruction List Structured Text Transition 1

LD A Step 2 S Empty

ANDN B C:= A AND NOT B


Transition 2

ST C Step 3

Function Block
Diagram Ladder Diagram Continuous Function Chart

AND A B C
A C -| |--|/|----------------( )
B

Instruction List (IL)

 Textual language
 Assembler code like
 All operations work on a special register (accumulator)
 Hard to understand if the program is large

Structured Text (ST)

 Textual language
 High level language
 PASCAL, C, FORTRAN like
 Best language for programming conditional execution
and loops. (IF, WHILE, FOR, CASE)

5
Function Block Diagram (FBD)

 Graphical language
 Network oriented
 Easy to understand
 Consists of blocks and operands

Continuous Function Chart (CFC)

 Like FBD, but…


… free placement of blocks and connections
… loops and all connections possible

Ladder Diagram (LD)

 Graphical language
 Network oriented
 Available for almost all classical PLCs
 Good for programming Boolean expressions

6
Sequential function chart (SFC)

 Graphical language
 Helps you to structure your software
 Consist of steps and transitions
 The real action of the program is
behind the steps

WAGO-I/O-PRO CAA

Variable Declaration Editor

Variable declarations have the following syntax. The parts


in the red braces {} are optional.
“POU” tab
selected <Identifier > {AT <Address>}:<Type> {:=<initialization>};
Examples:
myVariable1: BOOL;
myVariable2 AT %QX0.0: BOOL:=TRUE;

Standard data types

The IEC 61131-3 defines the following standard data types:


Keyword Range Example
BOOL 0,1 FALSE, TRUE, 0, 1

SINT, INT, DINT -128 .. 127, -32768 .. 32767, 0, 24453


-2147483648 .. 2147483647 -38099887

USINT, UINT, UDINT 0 .. 255, 0 .. 65535, 200, 47453


0 .. 4294967295 138099887

BYTE, WORD, DWORD 0 .. 255, 0 .. 65535, 8450


0 .. 4294967295 16#2102

REAL -1.2x 10-38 .. 3.4x 1038 1.34996


2.8377E-15

TIME, TOD, 0 ms .. 1193h2m47s295ms T#1d8h12m8s125ms


00:00:00 .. 23:59:59 TOD#12:34:17
DATE, DT 01.01.1970 until approx. D#2001-03-15
06.02.2106 DT#2001-03-15-12:17:03

STRING 1 .. 255 chars `Emergency Stop`

7
Retain & Persistent

VAR
myWord: WORD;
END_VAR
VAR RETAIN
myRetainWord: WORD;
END_VAR

VAR PERSISTENT
myPersistentWord: WORD;
END_VAR
VAR RETAIN PERSISTENT
myRetainAndPersistentWord: WORD;
END_VAR
X = value is saved (retained)
Variable Name Software Reset Online Program Hardware
Reset Reset(Cold) Reset(Original) Change Download Reset

myWord X
myRetainWord X X X
myPersistentWord X X X
myRetainAndPersistentWord X X X X X

Reset(Original) – clears the current program from RAM and deletes the boot project.

User Defined Variable Types

User Data Types


Structures,
Enumerations, and
References
“Data Type”
tab selected

Visualizations

“Visualizations”
tab selected

8
Resources - Workspace

“Workspace
selected

Save/load options
User information
Editor options
“Resource” tab
selected Desktop options
Color options L..

Resources – Task Configuration

“Task
Configuration”
item selected

“Resource” tab
selected

Resources - Target

Target Setting Options


“Target • Retain and %M Memory Setup
Settings” item
selected • Enable Online Changes
• Enable Symbol File Download
• Enable Auto Load BootProject
• Enable Web Visualizations
“Resource” tab • Enable PLC Browser
selected
• Enable Trace Variables
• Enable Network Variables L.

9
Resources - Trace

“Sample Trace”
item selected

“Resource” tab
selected
Displays a sample trace of the
specified variables.

Resources – PLC Configuration

“PLC
Configuration”
item selected

“Resource” tab Define I/O modules used in


selected
node.
Assign Global Variable
Names to real-world I/O.

I/O configuration

• Hardware addressing
Addressing of the I/Os as usual:

1. - word addresses
2. - bit addresses

Module Function Data size Hardware


addressing
750-1506 8 DI 8 bit %IX2.0...%IX2.7

8 DO 8 bit %QX2.0...%QX2.7

750-467 2 AI / 0-10 Volt 32 bit %IW0


%IW1

750-550 2 AO / 0-10 Volt 32 bit %QW0


%QW1

750-600 end module nothing -

10
Resources – PLC Browser

“PLC Brower”
item selected

Entered Text based commands.


Examples:
“tsk” – get task list and scan time.
“Resource” tab “?” - lists all commands
selected

Resources – Event Logging

“Log” item
selected

“Resource” tab Displays a log of actions that


selected occurred in chronological order.

Resources – Library Manager

“Library
Manager” item
selected

• Add libraries for additional


“Resource” tab functionality (e.g., PID, CRC16, L)
selected
• View library functions and
variables

11
Resources - Global Variables

“Global
Variables” item
selected

Define Global Variables


“Resource” tab and Constants for use in
selected all POUs
Define Network Variables
to share between multiple
PFCs

Project- Cross Reference

'Project' 'Show cross reference‘


Allows the user to open a dialog box which makes
possible the output of all application points for a
variable, address, or a POU. For this the project
must be compiled.

Choose first the category 'Variable', 'Address', or


'POU' and then enter the name of the desired
element (the input assistant <F2> can be used). By
clicking on the button Cross References you get
the list of all application points.

When you select a line of the cross reference list


and press the button Go To or double-click on the
line, then the POU is shown in its editor at the
corresponding point which allows the user to jump
to all application points without a time-consuming
search.

Project - Global Search

'Project' 'Global Search‘


This command allows you can search for the location of a text in POUs, data types, or in the objects of the
global variables.
When the command is entered, a dialog box opens in which you can choose the desired object. The
selection is made as in the 'Project' 'Document' description.

For each location that is found, the following will be displayed:


•Object name
•Location of the find in the Declaration (Decl) or in the Implementation (Impl) portion of a POU
•Line and network number if any
•The full line in the text editors
•Complete text element in the graphic editors

If you double-click the mouse on a line


in the message window or press
<Enter>, the editor opens with the
object loaded. The line concerned in
the object is marked. You can jump
rapidly between display lines using the
function keys <F4> and <Shift>+<F4>.

12
Project – Show Call Tree

'Project' 'Show Call Tree'

With this command you open


a window which shows the
call tree of the object chosen
in the Object Organizer.

The call tree contains both


calls for POUs and
references to data types.

Edit – Find & Replace

'Edit' 'Replace'
With this command you search for a certain passage
just as with the command 'Edit' 'Find', and replace it
with another. After you have chosen the command the
dialog box for find and replace appears.

In the field behind Find automatically that string will be


inserted which you have marked before in the editor.
You also can enter the search string manually. Pressing
button Replace will replace the current selection with
the string which is given in the field Replace with. Use
the button Find Next to get to the next passage where
the string is found.

The button Replace all replaces every occurrence of the


text in the field Find next after the current position with
the text in the field Replace with. At the end of the
procedure a message announces how many
replacements were made.

Project – Compare

'Project' ‘Compare‘
This command is used to
compare two projects or to
compare the actual version of
one project with that which was
saved last.
Overview:
In compare mode the actual
project and the reference project
will be presented in a split
window. The names of the POUs,
for which differences have been
found, are marked by color.
The version of the reference
project can be accepted for
single differences or for 'all
equally marked' differences. To
accept means that the version of
the reference project is taken
over to the actual project.

13
Load and save programs

Machinecode/ RAM

Machinecode/ Flash

Sourcecode/ Flash

Home Folder on Webserver: PLC

Load and save programs

Machinecode

Sourcecode

Machinecode and
sourcecode can be copied
via FTP without CoDeSys

Sourcecode download options


Implicit at load:
Machinecode RAM
Sourcecode: Flash

Notice at load:
User dependent

Implicit on create boot project


Machinecode: Flash
Sourcecode: Flash

Only on demand:
User dependent
Sourcecode only
No libraries, visualizations etc.

All Files
Project can be restored from controller
completely.

Sourcecode can be saved password protected

14
Keyboard combinations

• The TOP 10
F1 Help
F2 Input assistant
F5 Start
<Ctrl>+F7 Write values
F7 Force values
<Ctrl>+<Shift>+F7 Release force
<Shift>+F2 Auto declare
<Alt>+F8 Login
<Ctrl>+F8 Logout
F4 Next error

WAGO Corporation
P.O. Box 1015
Germantown, WI 53022

E-Mail: info.us@wago.com
Internet: www.wago.com

15

Das könnte Ihnen auch gefallen