You are on page 1of 453

CoDeSys 2.

Copyright 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006 3S - Smart Software Solutions GmbH
All rights reserved.
Copyright 2003, 2004, 2005, 2006 ( )
. .
.

Trademark
Intel is a registered trademark and 80286, 80386, 80486, Pentium are trademarks of Intel Corporation.
Microsoft, MS and MS-DOS are registered trademarks, Windows is a trademark of Microsoft Corporation.

:
3S - Smart Software Solutions GmbH
Memminger Strae 151
D-87439 Kempten
.:
+49 831 5 40 31 - 0
: +49 831 5 40 31 - 50
:

21400, , . , . , 9
.:
+7 4812 38-29-31
./:
+7 4812 65-81-71
CoDeSys . , .

02.02.2006
RU 2.4, CoDeSys V2.3.6.x

CoDeSys V2.3

1-2

CoDeSys

1-1

1.1 CoDeSys
1.2 CoDeSys
1.3 CoDeSys

, CoDeSys

1-1
1-1
1-3

2-1

2.1
2.2
2.2.1
(IL)
2.2.2
IL
2.2.3
(ST)
2.2.4
(SFC)
2.2.5
(FBD)
2.2.6
(CFC)
2.2.7
(LD)
2.3 online

2-1
2-9
2-10
2-10
2-11
2-18
2-23
2-23
2-24
2-25

3-1

3.1
3.2

CoDeSys

4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8

3-1
3-13

4-1






Online

CoDeSys

4-1
4-3
4-18
4-48
4-56
4-62
4-77
4-78

5-1

5.1
5.2
5.2.1

5.2.2
Online
5.2.3

5.3
5.3.1

5.3.2
IL
5.3.3
ST
5.4
5.4.1

5.4.2
FBD
5.4.3
LD
5.4.4
SFC
5.4.5
CFC

5-1
5-3
5-3
5-11
5-12
5-20
5-20
5-24
5-25
5-25
5-25
5-30
5-36
5-43
5-52

6-1

6.1
6.2 ,
6.2.1

6.2.2

6.2.3

6.3 (Alarm Configuration)

CoDeSys V2.3

6-1
6-2
6-3
6-7
6-8
6-9

1-3

6.3.1

6.3.2

6.3.3

6.3.4

6.3.5

6.3.6
'Extras' : Settings ()
6.4 (Library Manager)
6.5 (Log)
6.6 (PLC Configuration)
6.6.1

6.6.2

6.6.3

6.6.4

6.6.5
/
6.6.6

6.6.7
Profibus
6.6.8
CANOpen-
6.6.9
CANOpen- (CANopen Slave)
6.6.10 DeviceNet
6.6.11 Online
6.6.12 / /
6.7 (Task Configuration)
6.7.1

6.7.2

6.7.3
online
6.8 (Watch and Receipt Manager)
6.8.1

6.8.2
Offline
6.8.3
Online
6.9 (Sampling Trace)
6.9.1

6.9.2

6.9.3

6.9.4

6.9.5
('Extras' 'Save trace values')
6.9.6
('Extras' 'External Trace Configurations')
6.10 (Workspace)
6.11 (Parameter Manager)
6.11.1
6.11.2 .
6.11.3
6.11.4
6.11.5
6.11.6 online
6.11.7 /
6.12 (Target Settings)
6.13 - (PLC-Browser)
6.13.1
6.13.2 -
6.13.3 -
6.13.4 -
6.14 (Tools)
6.14.1 (Object Properties)
6.14.2
6.14.3

6-9
6-10
6-11
6-14
6-16
6-17
6-18
6-20
6-23
6-23
6-25
6-26
6-27
6-28
6-31
6-31
6-39
6-44
6-48
6-53
6-53
6-54
6-54
6-58
6-59
6-61
6-61
6-61
6-63
6-64
6-64
6-65
6-66
6-67
6-69
6-70
6-70
6-71
6-71
6-72
6-73
6-75
6-77
6-78
6-79
6-80
6-81
6-81
6-82
6-83
6-84
6-84
6-85
6-88
6-90

ENI 7-1
7.1 ENI?

CoDeSys V2.3

7-1

1-4

7.2 ENI
7.3 ENI CoDeSys
7.4

7-1
7-2
7-2

8.1 DDE CoDeSys


8.2 DDE GatewayDDE Server

8-1
8-2

9.1
9.2 CoDeSys

9-1
9-1

DDE 8-1

CoDeSys 9-1

10

10-1

A:

10-1

10.1
10.2
10.3
10.4
10.5
10.6
10.7
10.8
10.9

: CoDeSys
10.10
10.11
10.12
10.13

10-1
10-4
10-6
10-9
10-11
10-13
10-16
10-16
10-23

10-30

: CoDeSys

10-30
10-32
10-34
10-35

10-36

10.14
10.15

D: CoDeSys

10-36
10-37

10-44

10.16 Standard.lib
10.16.1

10.16.2

10.16.3

10.16.4

10.16.5

10.17 UTIL.LIB
10.17.1
BCD
10.17.2
/
10.17.3

10.17.4

10.17.5

10.17.6

10.17.7

10.18 AnalyzationNew.lib
10.19 CoDeSys

E: 10-68

10-44
10-44
10-48
10-49
10-51
10-53
10-56
10-56
10-57
10-58
10-60
10-62
10-64
10-66
10-67
10-67

F: / 10-73
10.20
10.21 (cmdfile)

CoDeSys V2.3

10-73
10-73

1-5

G: . 10-82
H: 10-89
10.22
10.23
10.24
10.25
10.26

(Target Platform)
(Memory Layout).
(General)

I:

10-102

J:
10.27
10.28

CoDeSys V2.3

10-89
10-95
10-96
10-98
10-99

10-105
10-105
10-111

1-6

1 CoDeSys
1.1 CoDeSys
CoDeSys - (CoDeSys
Controllers Development System).
CoDeSys
61131-3. , (, Visual C++).

1.2 CoDeSys
?
, .
(POU Program Organization Unit) PLC_PRG. ( main ), (,
).
PLC_PRG,
Task Configuration. , Task
Configuration.
POU, , .
(Object Organizer) .
?
.
, .
.
, ,
.
?
, .
(simulation) . Online.

CoDeSys

(PLC Configuration) . , . ,
. (, ) Watch and Receipt Manager, , .

. , . (single step),
.
Online
,
,
, . (Sampling Trace),
.
, "". , .
CoDeSys
.
CoDeSys DDE .
, OPC DDE .
CoDeSys .

.
ENI:
ENI . CoDeSys ,
. ENI
CoDeSys, .
CoDeSys . , , .
CoDeSys ,
Web. .

CoDeSys V2.3

1-2

CoDeSys

1.3 CoDeSys

CoDeSys

Manual_V23_RU.pdf
First Steps with CoDeSys RU.pdf

CoDeSys ()
Gateway Server

, ,
, (

)

Gateway Manual.pdf

OPC Server

OPC-Server V2.0,

OPC_20_How_to_use.pdf

CoDeSys Visualization

CoDeSys ,
CoDeSys HMI, Target- Web-Visualization

CoDeSys_Visu_RU.pdf

SoftMotion

SoftMotion

SoftMotion_Manual_V23.pdf

Standard.lib Util.lib .

<SysLib-Name>.pdf
UserManual_V23_RU.pdf

CoDeSys

<library
name>.pdf
SoftMotion :
.
ENI Server

SoftMotion-

ENI , , .

EniServerQuickstart.pdf
UserManual_V23_RU.pdf

ENI CoDeSys:
.
ENI Admin, ENI Control ENI Explorer: .
.

CoDeSys V2.3

1-3

2 CoDeSys
2.1

: POU, , , , . .
POU (Program Organization Unit)
(POU) , . POU ().
.
POU (IL, ST, FBD, SFC, LD CFC).
CoDeSys . standard.lib.
POU POU, .

POU, ( , ).
.
.
.
:
FUNCTION Fct: INT;
, .
FUNCTION
END_FUNCTION. , IL, .

, CoDeSys

, IL:

ST .
SFC .
. ,
.
:
IL:
LD 7
Fct 2,4
ST Result
ST:
Result : = Fct (7, 2, 4);
FBD:

: RETAIN . !
: :
CheckBounds, ( . ).
: CheckDivByte, CheckDivWord, CheckDivDWord CheckDivReal
0 (. DIV).
CheckRangeSigned CheckRangeUnsigned (. ).

CoDeSys V2.3

2-2

, CoDeSys


- POU, .
.
FUNCTION_BLOCK
END_FUNCTION_BLOCK.
, IL,
. MULERG
, VERGL .
:


. () .
, ().
( ) , , . ,
.
INSTANCE FUB:
INSTANCE: FUB;
.
,
.
:

CoDeSys V2.3

2-3

, CoDeSys

fb inl INT:
PROGRAM prog
VAR
inst1 : fb;
END_VAR
LD 17
ST
inst1.in1
CAL inst1
END_PROGRAM

. . POU, , .

.
. . , , ,
.
RETAIN, .



, :
< >.< >
:
(IL, ST) .
":=", "=>". , (<F2>) (With arguments).
:
, FBINST - , xx yy. FBINST ST :
FBINST1(xx:= , yy=> );
-:
, - (VAR_IN_OUT) . .
:
VAR
inst: fubo;
var: int;
END_VAR
var1 := 2;

CoDeSys V2.3

2-4

, CoDeSys

inst(instout1 := var1^);
:
inst(instout1:=2); inst.inout1:=2;
FUB:
ERG, QUAD. FUB INSTANZ.
IL:

ST ( , ):

FBD:

CoDeSys V2.3

2-5

, CoDeSys

SFC .

POU, .
. . .
:

.
, ,
,
POU.
, .
PROGRAM
END_PROGRAM.
, , (IL, ST)
.
":=", "=>".
:
IL:
CAL

CoDeSys V2.3

PRGexample2

2-6

, CoDeSys

LD
ST

PRGexample2.out_var
ERG

:
CAL PRGexample2(in_var:=33, out_var=>erg )
ST:
PRGexample2;
Erg := PRGexample2.out_var;
:
PRGexample2(in_var:=33, out_var=>erg );
FBD:

PLC_PRG
PLC_PRG POU, .
.
"Project" "Object Add", POU - PLC_PRG.
.
Task Configuration, PLC_PRG.
: POU PLC_PRG( Task Configuration ).
PLC_PRG .

. -
POU . , , .
, ,
.

CoDeSys V2.3

2-7

, CoDeSys

Counter
"out" "in". Reset
0. "out" .
:
:
<_>.<_> <_>.<_ >.
POU, , , .
:
PROGRAM PLC_PRG
VAR
Inst : Counter;
END_VAR
IL:
CAL Inst.Reset(In : = FALSE)
LD Inst.out
ST ERG
ST:
Inst.Reset(In := FALSE);
Erg := Inst.out;
FBD:

SFC ( SFC).
SFC . CoDeSys.

CoDeSys V2.3

2-8

, CoDeSys

, :

, .
(Library manager)

(Alarm Configuration)
(PLC Configuration) .
(Task Configuration)
(Watch and Receipt Manager)

(Target Settings)

:

Sampling Trace - .
Parameter Manager -
PLC-Browser -
Tools ,
SoftMotion ( ), CNC CAM

, POU, . POU , .
"standard.lib" "util.lib" .
(. )

, .
, .
(. )

.
.
, CoDeSys HMI
Web ( ) . (. CoDeSys )

2.2
CoDeSys :

Instruction List (IL)


Structured Text (ST)

CoDeSys V2.3

Sequential Function Chart (SFC)

2-9

, CoDeSys

Function Block Diagram (FBD)


Ladder Diagram (LD)

, CoDeSys , ,
Continuous Function Chart (CFC).

2.2.1 (IL)
IL (Instruction list) .
, , , .
, (:).
. .
:
LD
ST
GE
JMPC
LD
EQ
STN
next:

17
lint
(* *)
5
next
idword
istruct.sdword
test

2.2.2 IL
IL :
:

JMP, CAL, RET:

, .

JMPC,CALC, RETC:

,
.

IL :

LD

ST

AND

N, (

OR

N, (

XOR

N, (

ADD

SUB

MUL

CoDeSys V2.3

2-10

, CoDeSys

DTV

GT

>

GE

>=

QE

NE

<>

LE

<=

LT

<

JMP

CN

CAL

CN

RET

CN

POU .

.
IL :
LD TRUE
AND
JMPC
LDN
ST ERG

(* *)
BOOL1 (* BOOL1*)
mark
(* ,
" mark"*)
BOOL2 (* BOOL2 *)
(* ERG*)

,
.
:
LD
MUL
ADD
ST

2
2
3
ERG

ERG 7. , :
LD
MUL
ADD
)
ST

2
( 2
3
ERG

ERG 10.
MUL , ")". MUL
5.

2.2.3 (ST)
ST ,
("IFTHENELSE") (WHILEDO).
:
IF value < 7 THEN

CoDeSys V2.3

2-11

, CoDeSys

WHILE value < 8 DO


value:=value+1;
END_WHILE;
END_IF;

, .
. , , .

. , ..,
.
.
ST , .

()


( )

EXPT

NOT

MOD

< , > ,<=, >=

<>

AND

XOR

OR

ST:


FB
CoDeSys V2.3

A: =B; CV: =CV+1; C: =SIN (X);


A: = CMD_TMR.Q

2-12

, CoDeSys

FB
RETURN

RETURN;

IF

D: =B*B;
IF D<0.0 THEN
C: =A;
ELSIF D=0.0 THEN
C: =B;
ELSE
C: =D;
END_IF;

CASE

CASE INT1 OF
1: BOOL1: = TRUE;
2: BOOL2: = TRUE;
ELSE
BOOL1: = FALSE;
BOOL2
END_CASE;
J: =101;
FOR I: =1 TO 100 BY 2 DO
IF ARR [I] = 70 THEN
J: =I;
EXIT;
END_IF;
END_FOR;

FOR

WHILE

EXIT

J: =1;
WHILE J<= 100 AND ARR [J] <> 70
DO
J: =J+2;
END_WHILE;
J: =-1;
REPEAT
J: = J+2;
UNTIL J= 101 OR ARR [J] = 70
END_REPEAT;
EXIT;

REPEART


( ),
, .
:
Var1: = Var2 * 10;
Var1 , Var2.

CoDeSys V2.3

2-13

, CoDeSys

ST

.
IN PT. Q .
, IL,
, , :
CMD_TMR (IN: = %IX5, PT: = 300);
A: =CMD_TMR.Q
RETURN
RETURN POU, , .
IF
IF, , - .
:
IF <Boolean_expression1> THEN
<IF_instructions>
{ELSIF <Boolean_expression2> THEN
<ELSIF_instructions1>
.
.
.ELSIF <Boolean_expression n> THEN
<ELSIF_instructions n-1>
ELSE
<ELSE_instructions>}
END_IF;
.
< <Boolean_expression1> , <IF_Instructions> .
,
. , ELSIF ELSE.
, , ELSE.
:
IF temp < 17
THEN
heating_on: = TRUE;
ELSE
heating_on: = FALSE;
END_IF
(heating) , 17 , .

CoDeSys V2.3

2-14

, CoDeSys

CASE
C CASE
.
:
CASE <Var1> OF
<Value1>:
<Instruction 1>
<Value2>: <Instruction 2>
<Value3, Value4, Value5>:
<Instruction 3>
<Value6 .. Value10>:
<Instruction 4>
...
<Value n>:
<Instruction n>
ELSE
<ELSE instruction>
END_CASE;
CASE :

<Var1> <Value i>, <Instruction i>

<Var1> , <ELSE Instruction>.

<Var1>, .
,
, .
:
CASE INT1 OF
1, 5: BOOL1 : = TRUE;
BOOL3 : = FALSE;
2: OL2 : = FALSE;
BOOL3 : = TRUE;
10. 20: BOOL1: = TRUE;
BOOL3:= TRUE;
ELSE
BOOL1 := NOT BOOL1;
BOOL2 := BOOL1 OR BOOL2;
END_CASE;
FOR
FOR .
:
INT_Var :INT;
FOR <INT_Var> := <INIT_VALUE> TO <END_VALUE> {BY <Step size>} DO
<Instructions>
END_FOR
, , .

CoDeSys V2.3

2-15

, CoDeSys

<Instructions> , <INT_Var> <END_VALUE>. <Instructions>, <Instructions> ,


<INIT_VALUE> <END_VALUE>.
, <Instructions>, <INIT_VALUE>, <Step_
size>.
<Step_ size> . 1.
:
FOR Counter: =1 TO 5 BY 1 DO
Var1: =Var1*2;
END_FOR;
Erg:=Var1;
, Var1 1. 32.
: <END_VALUE>: <INT_VAR>. ,
SINT <END_VALUE> 127, .

WHILE
WHILE , FOR, , . , , .
:
WHILE <Boolean expression>
<Instructions>
END_WHILE
<Instructions> , <Boolean_expression> TRUE.
<Boolean_expression> FALSE , <Instructions> . <Boolean_expression> FALSE, <Instructions>
.
: , .
. ,
.

:
WHILE counter<>0 DO
Var1: = Var1*2;
ounter := ounter-1;
END_WHILE
REPEAT
REPEAT WHILE , , 1 . , .
:
REPEAT
<Instructions>

CoDeSys V2.3

2-16

, CoDeSys

UNTIL <Boolean expression>


END_REPEAT
<Instructions> , <Boolean_expression> TRUE.
<Boolean_expression> FALSE , <Instructions> . <Boolean_expression> FALSE, <Instructions>
.
: , .
. ,
.

EXIT
EXIT FOR, WHILE, REPEAT,
.

CoDeSys V2.3

2-17

, CoDeSys

2.2.4 (SFC)
SFC , . (),
.
SFC :

SFC POU , . 2 :
( SFC) . ( ) , .
( SFC) .
.

IL ST, FBD LD,


SFC.
. , , .
"Extras" "ZoomAction/Transition". ,
.
, POU.
<Enter>.

CoDeSys V2.3

2-18

, CoDeSys

"Project" "Add Action". 9


.

.
, . ,
, "" ,
"" .
.
, .
:

/
. , , . , , ST (..
(i<= 100) AND b) . ,
!
SFC
(. 5.4.4,'Extras' 'Zoom Action/Transition').
!
: , ; . SFCtip
SFCtipmode.


SFC POU (, ) . ,
, . , , . online
. ,
.
, .
, , , ,
.
: , ,
.


SFC .
POU,
"Extras" "Associate action".

CoDeSys V2.3

2-19

, CoDeSys

, .

, , . : ,
; S ()
..
, , .
, , , . , , , .
:

online , . .
: , . ,
(. ).

, .
, "Extras" "Use
IEC-Steps" Iecsfc.lib.
SFC POUs, .
"Project" "Add Action".
SFC POU :

CoDeSys V2.3

2-20

, CoDeSys

,
P

SD

DS

,
,

SL

L, D, SD, DS, SL TIME.


: . P!

SFC
SFC , .
, . <StepName>.x <StepName> . , , , .
SFC.
, <ActionName>.x, , . <StepName>.t .
. : boolvar1:=sfc1.step1.x;
step1.x - , step1 POU sfc1.
SFC
SFC .
.
: SFC POU , , (. ), , "SFCError" (SFCError
TRUE ).
-:
SFCEnableLimit: BOOL. , SFCError. .
SFCInit: BOOL. , Init SFC . Init , , . SFCInit , .
SFCReset: BOOL. SFCInit.
Init. SFCReset FALSE
Init.

CoDeSys V2.3

2-21

, CoDeSys

SFCQuitError: BOOL. SFC ,


. .
, .
SFCPause: BOOL. SFC , .
SFCError: , . , , SFCError . : SFCErrorStep, SFCErrorPOU,
SFCQuitError, SFCErrorAnalyzation.
SFCTrans: BOOL. , .
SFCErrorStep: STRING. , ( ).
SFCErrorPOU: STRING. ,
( ).
SFCCurrentStep: STRING. .
SFC .
SFCErrorAnalyzationTable: ARRAY [0..n] OF ExpressionResult p . ,
FALSE , , ,
, .
16 (), 0
15.
ExpressionResult AnalyzationNew.lib. POU,
SFC.
. . SFCError (. ).
SFCTip, SFCTipMode: BOOL
SFC. SFCTipMode=TRUE,
SFCTip, TRUE. SFCTip FALSE, , .

SFC .
. . ( ),
( )
(jump). , , , .
, , .

CoDeSys V2.3

2-22

, CoDeSys


SFC .
. .
( ) (
) (jump).
, , .
. , , ,
.
(Jump)
- , jump.
, .

2.2.5 (FBD)
FBD . ,
, ,
.
FBD CoDeSys:

FBD 5.4.2.

2.2.6 (CFC)
FBD , , , .
CFC:

CFC 5.4.5.

CoDeSys V2.3

2-23

, CoDeSys

2.2.7

(LD)
- () ,
.
LD ,
- FBD. , LD
POU.
LD .
- . , , .
, "ON"
"OFF", . . ,
. ("OFF").
LD :

(. " CoDeSys")

"ON" "OFF".
.
. , .
, "ON",
"ON".
, , "ON", , "ON". .
. |/| "ON", .

CoDeSys V2.3

2-24

, CoDeSys

(),
(). . .
(ON), (OFF).
(/).
( - %QX3.0). (
(/)), .
LD
, LD .
, .
SET RESET
SET RESET. SET
"S" (S).
, ( R) .
RESET R.
, ( S) .
LD FBD
, LD POU.
-, ,
. , LD.
POU , , ,
, EN. EN , POU ,
EN=. POU , EN
. POU LD FBD .
LD EN POU:

2.3 online
.
Sampling Trace , , , . Sampling

CoDeSys V2.3

2-25

, CoDeSys

Trace 20 .
500 .

CoDeSys , . "Project" "Options" "Debugging".



, , . . , FBD LD - SFC - .

:

IL: CAL, LD or JMP.

ST: .

FBD, LD: .

SFC: .

.

(Single Cycle) .
Online.
online, ( ) (
).
.
, , , (Write Variable).

online CoDeSys . , (watch and receipt manager) . .


, , .
.

CoDeSys V2.3

2-26

, CoDeSys

,
:
anarray[1] = 5
anarray[i] = 1
,
( [i + j] [I*2]).
: ,
: "Too many monitoring variables".

, ,
CoDeSys. online, , .
: .

(log) , ,
online.
.

CoDeSys V2.3

2-27

3
3.1
-. -
, . ,
. , : -.
.
,
61131-3, CoDeSys CoDeSys.
POU
: CoDeSys "File" "New".
POU. PLC_PRG. . POU, , - . . POU
Continuous Function Chart (CFC).
. "Project" "Object Add"
( Object Organizer) . :
Sequential Function Chart (SFC) SEQUENCE, Function
Block Diagram (FBD) TRAFFICSIGNAL - WAIT,
(IL).
TRAFFICSIGNAL?
POU TRAFFICSIGNAL .
, - ,
- ..
WAIT?
WAIT ,
.
SEQUENCE?
SEQUENCE , .
PL_PRG?
PLC_PRG , '
.
"TRAFFICSIGNAL"
POU TRAFFICSIGNAL.
( VAR_INPUT END_VAR) STATUS INT. STATUS

, - , , .
TRAFFICSIGNAL , RED,
YELLOW GREEN. TRAFFICSIGNAL :
TRAFFICSIGNAL, :

"TRAFFICSIGNAL"
, STATUS .
POU (body). ( 1). . "Insert" "Operator".
AND :

AND EQ.
STATUS.
1.
:

EQ. EQ.
"Insert" "Assignment".
??? GREEN. :

CoDeSys V2.3

3-2

STATUS 1, GREEN. , GREEN ,


STATUS 1.
TRAFFICSIGNAL . "Insert"
"Network (after)". POU :
TRAFFICSIGNAL:

, ,
( ). "Insert" "Operator".
POU . , TRAFFICSIGNAL , STATUS.
standard.lib
POU WAIT POU . ,
"Window" "Library Manager". "Insert" "Additional library".
. standard.lib .

CoDeSys V2.3

3-3

"WAIT"
POU WAIT. , POU , TRAFFICSIGNAL. POU TIME
TIME (Boolean) , OK. TRUE, .
FALSE (
, ) " := FALSE ".
POU TP. (IN, PT) (Q, ET). TP
:
IN FALSE, ET 0 Q FALSE. IN TRUE, ET . ET PT,
. Q TRUE, ET PT. ET
PT, Q FALSE.
POU .
TP POU WAIT, . ZAB ( ) TP ( VAR,
END_VAR).
WAIT :

CoDeSys V2.3

3-4

"WAIT"
:

, Q TRUE (, ),
ZAB, ZAB - , .
IN ZAB FALSE ET 0 Q FALSE. , .
TIME PT ZAB IN:=TRUE. ZAB
, TIME Q FALSE.
Q OK WAIT.
Q FALSE, OK TRUE.
. WAIT TRAFFICSIGNAL
PLC_PRG.
"SEQUENCE" 1
. START BOOL, TRAFFICSIGNAL1 TRAFFICSIGNAL2 INT WAIT (DELAY , ). SEQUENCE :

CoDeSys V2.3

3-5

SEQUENCE 1, :

SFC
SFC "Init" "Trans0" Init, , .
, .
TRAFFICSIGNAL. , Trans0 "Insert" "Step transition (after)". .
.
Init "START", "DELAY.OK".
, START TRUE, - DELAY
OK TRUE, .. .
( ) Switch1, Green2, Switch2, Green1, Init, ,
. "Switch" , Green1 TRAFFICSIGNAL1 , Green2
TRAFFICSIGNAL2 . , Init Switch1. , :

CoDeSys V2.3

3-6

SEQUENCE 1, :

. , . IL ( ).

Init , START . , . ,
TRAFFICSIGNAL1 TRAFFICSIGNAL2 5.

CoDeSys V2.3

3-7

Init:

Green1 TRAFFICSIGNAL1 (STATUS:=1), TRAFFICSIGNAL2


(STATUS:=3), 5000 .
Green1:

Switch1 TRAFFICSIGNAL1 2 () , , TRAFFICSIGNAL2


4 (-). , 2000 .
:
Switch1:

Green2 TRAFFICSIGNAL1 (STATUS:=3) TRAFFICSIGNAL2


(STATUS:=1). 5000 .
Green2:

Switch2 STATUS TRAFFICSIGNAL1 4 (-), ,


TRAFFICSIGNAL2 2 (). 2000 .

CoDeSys V2.3

3-8

Switch2:

.
, :
POU PLC_PRG. PLC_PRG.
AND SEQUENCE. .
('Project' 'Build') . : "0 Errors, 0 Warnings".
'Online' 'Simulation' 'Online' 'Login'.
'Online' 'Run'.
SEQUENCE. , , START
TRUE. PLC_PRG,
. .
TRUE. ('Online' 'Write values').
. .
'Online' 'Logout'.
"SEQUENCE"
. .
, TRAFFICSIGNAL
.
COUNTER INT. SEQUENCE.
Switch1 .
.
. (jump) Init.
: "Count" "Off". ( ) EXIT, TRUE DELAY.OK.
, .

CoDeSys V2.3

3-9

"SEQUENCE", :

.
Count - COUNTER 1:
Count:

EXIT1 , 7:
EXIT:

CoDeSys V2.3

3-10

Off 5 ( ), COUNTER 0 10 .
Off:

TRAFFICSIGNAL.
, .
, .
PLC_PRG
SEQUENCE. .
PLC_PRG. IN
(2 )
SEQUENCE. Boolean
, IEC ..
- LIGHT1 LIGHT2 TRAFFICSIGNAL
.
LIGHT1 LIGHT2:

6 Boolean.
PLC_PRG,
(Global Variables) (Resources). IN, START SEQUENCE TRUE, .
Resources Global Variables.

CoDeSys V2.3

3-11

PLC_PRG. . Continuous
Function Chart, , .
Box. AND
SEQUENCE. SEQUENCE
.
TRAFFICSIGNAL. TRAFFICSIGNAL -
, , , , LIGHT1 LIGHT2.
Input, IN Output, : L1_green, L1_yellow, L1_red, L2_green, L2_yellow, L2_red.
, . / ( ) /
.
, .
PLC_PRG:

.
TRAFFICSIGNAL
. , CoDeSys.

CoDeSys V2.3

3-12

3.2
. 8. , .

, Visualizations . 'Project' 'Object Add'.
:

, Lights. Ok, ,
.

:
'Insert' 'Ellipse' 2 .
, ,
.
. .
Variables Change color .L1_red.
Input Assistant ( <F2>). L1_red
.

Color. Color Inside


, , .
Inside Alarm Color .

CoDeSys V2.3

3-13

, , ,
.
, .
.
'Edit' 'Copy' (<Ctrl>+<C>)
'Edit' 'Paste'(<Ctrl>+<V>). .
. ,
.
. Change Color
:
: .L1_yellow
: .L1_green
Color Alarm color ( ).
.
Insert Rectangle ,
.
Extras Send to back, .
.
, Online Simulation( ,
Online Simulation ).
Online Login Online Run ,
.
.
. , Edit Copy Edit Paste.
, (, .L1_red .L2_red), .
ON.
, , .ON
Change Color Variables. Content Text ON.

CoDeSys V2.3

3-14

ON , Toggle
variable Input .ON. / .
, .
Change Color.

.
. Color (frame) . Contents( Text)
Light1 Light2.

CoDeSys V2.3

3-15

Traffic Signal:

CoDeSys V2.3

3-16

4 CoDeSys
4.1

CoDeSys:

CoDeSys ( ):

.
. .
, POU, Data types, Visualizations Resources.
CoDeSys.
, .
.
, .

, .

. CoDeSys.

CoDeSys


.
.
, .
,
.
CoDeSys. .
(. 'Project' 'Options' Desktop)


CoDeSys.

POUs,

Data types ( ),

Visualizations (-

)
Resources ().
. .
:

.
. CoDeSys
: , POU, .
, .
.
, , .
.
CoDeSys. ,
. .

CoDeSys V2.3

4-2

CoDeSys

.
. , .
<Enter > ,
.
Edit Next error Edit Previous error
.
Window Message.

CoDeSys
.
.
online, Online .
.
online , : SIM , RUN , BP- ,
FORCE .
,
(, Line:5, Col.:11). OV . <Ins> .
X Y, .
- , . (, Rectangle).
, .
(. 'Project' 'Options' Desktop)

: <Shift>+<F10>
, , . , , .

4.2
CoDeSys Project Options .
. ,
.

CoDeSys V2.3

4-3

CoDeSys

'Workspace' Resources.
CoDeSys.ini
CoDeSys.
. -
, .
(Load&Save)
Load&Save:

Create Backup CoDeSys .bak . .asd (. ) .


.
AutoSave CoDeSys
.asd, . ,
Auto Save Interval. CoDeSys . - (, ), . :

Open auto save file .


, .asl.
Auto save before compile .

CoDeSys V2.3

4-4

CoDeSys

Ask for project info, .


Project Project info.
Auto Load CoDeSys. , CoDeSys ,
.
Remind of boot project on exit: , , : " . ? " (No boot project created since
last download. Exit anyway ?).
Save ENI credentials ( ): Login
ENI .
(User information)
User information:

(Name) (Initials),
(Company). .
, .

CoDeSys V2.3

4-5

CoDeSys

(Editor).
Editor:

Autodeclaration:
.
Autoformat: CoDeSys IL . :
1. .
2. .
List components: (Intellisense). :
, . . ,
. Intellisense , , .
Declarations as tables: . , ,
- (in_out). : (Name), (Address),
(Type), (Initial) (Commment).
Tab-Width . 4 .
.
Font . , CoDeSys.

CoDeSys V2.3

4-6

CoDeSys

Mark , . Dotted, , Line, , Filled .


Bitvalues ( ) (Byte, Word Dword): (Binary), (Hexadecimal) (Decimal).
(DeskTop)
DeskTop:

Tool bar ( ).
Status bar .
Online in Security mode 'Run',
'Stop', 'Reset', 'Toggle Breakpoint', 'Single cycle', 'Write values', 'Force values'. , , .

CoDeSys V2.3

4-7

CoDeSys

Query communication parameters before login: 'Online' 'Login'


. online
OK.
Do not save communication parameters in project:
('Online' 'Communication Parameters') .
Show print area margins: , .
F4 ignores warnings: F4 , .
MDI representation: MDI CoDeSys, . SDI .
Communications timeout [ms]: .
, , . : 1-10000000 .
Communications timeout for download [ms]: ( , , ): , , (Download Wait Time). : 1-10000000 .
XML-Encoding: XML . "ISO 8859-1".
ENI, Message Interface COM Automation Interface,
CoDeSys XML. Licensing Manager.
Language: .
: Windows 98!

(Colors)
Colors:

CoDeSys.
(Line numbers), (Current position), (Breakpoint positions),

CoDeSys V2.3

4-8

CoDeSys

(Set breakpoint), (Reached Positions), (Monitoring of Bool).


:

-
-
-
-
-

.
:

(Directories)
Directories:

CoDeSys V2.3

4-9

CoDeSys

, (Libraries),
(Configurations files) (Visualisation files).
, (Compile files) (, map- list) , (Upload files).
, <>,
.
, ;.
: , .

.
,
".\libs"

'C:\programs\projects\libs', 'C:\programs\projects'.
: , "_" .
, Project,
. , Common, ini CoDeSys
.
Target , ( .TNF). , ( ).
CoDeSys Project, Target Common. , ,
.
(Log)
Log:

(*.log ),
, CoDeSys Online.
Activate logging .
, .
, , Directory

CoDeSys V2.3

4-10

CoDeSys

for project logs . ,


<>.
.log. Online, , Online sessions. . , .
Filter , : , , . , , (. ).
Window Log.
(Build)
Build:

Debugging . (, ). .
. .
Replace constant . Online
. , .
,
(, , ).
Nested comments . :
(*
a := inst.out; (* *)
b := b+1;
*)
Create binary file of application , ( ). <_>.bin.

CoDeSys V2.3

4-11

CoDeSys

Actions hide programs: . :


, ,
: , ,
.
: , , . : , , , .

Treat LREAL as REAL: REAL LREAL . , .


.
Number of Data , .
. Out of global data memory... , .
Exclude objects (Exclude objects from
build). (POU) Exclude. POU .
, Exclude unused. , , 'Exclude from build' .
Compiler Version: . V2.3.3 (, , ) CoDeSys, , . ,
Use latest, .
.
, , . , Fix.
, , :

Macro before compile


Macro after compile

, : file new, file open, file close, file


save as, file quit, online, project compile, project check, project build, debug, watchlist.
Check automatically :

Unused variables: ,
Overlapping memory areas:
Concurrent access:
Multiple write access on output:

. 'Check' 'Project'.
, .
, , .

CoDeSys V2.3

4-12

CoDeSys

(Passwords).
Passwords:


.
Password.
Confirm Password. Ok.
"The password does not agree with the confirmation"( ), , ,
. .
, ,
. , . "The password is not correct"( ).
. Write Protection Password .
, , . , CoDeSys , Cancel. , , , .
.

.

CoDeSys V2.3

4-13

CoDeSys

(Source download)
Source Download:

Extent , .
Sourcecode only . All files, ,
, , ..
Timing . Inplicit at load
"Online" "Download". Notice at load . On demand
, "Online" "Sourcecode
download".
, , , "File" "Open" "Open project
from PLC". .
(Symbol Configuration).
( *.sym
*.sdb).
, OPC DDE .
Dumb symbol entries, .
Dump XML symbol table,
XML , . < >.SYM_XML.
: (target settings) Symbol
config from INI file, CoDeSys.ini ,
INI ( Configure symbol file ).
Symbol config from INI file ,
Set object attribute,
Configure symbol file.

CoDeSys V2.3

4-14

CoDeSys

Set object attributes:

, . POU ( Global Variables) . . :


Export variables of object: POU . , .
Export data entries:
.
Export structure components:
.
Export array entries: .
Write Access: OPC .
POU, . , .

CoDeSys V2.3

4-15

CoDeSys

(Project source control)


Project source control:

ENI .
Use source control (ENI): , ENI. ENI
. ENI Server
. .
. 'ENI'.
(Check in, Get last version
..) . , . 'Project' 'Data Base Link'
. 'Data base-connection'
(Properties), .
Connect new Objects with the following data base:
: ('Project' 'Object' 'Add'),
.
('Project' 'Object' 'Properties') .
:

Project: POU , ENI configuration/Project

Shared Objects: POU , ENI configuration/Shared

Local: POU ENI.

'Project objects' 'Shared objects', 'Compile files', , . .


Ask for type of new objects: 'Object' 'Properties'
. ,
.

CoDeSys V2.3

4-16

CoDeSys

configure ENI ENI:


, ENI,
: 'Project objects', 'Shared objects' 'Compile files'. () .
( Next
Wizard). ,
. , Login .
(Macros).
Macros:

(),
CoDeSys. Edit Macros.
:
1.

Name. New Macro. .


. (. ) ,
.

2.

Menu ,
Edit Macros. . &. : Ma&cro 1,
Macro 1.

3. Commands , .
CoDeSys. ,
Help . <Ctrl><Enter>.
( )
.
4.

1-3 OK.

, <Del>. ,
Rename.

CoDeSys V2.3

4-17

CoDeSys

Edit Macros , .
Edit Macros.
:
.
: Create. Merge
project . OK. Save Macro library Save. <library name>.mac.
: Include. Open Macrolibrary, *.mac Open.
.
: ('Project' 'Export' ).

4.3
File Project.
.
File New
Untitled. .
File New from template
. Untitled.
File Open
. -
, CoDeSys ,
.
( .pro) ( .lib). , Open
.

PLC, .
, Communication parameters . , CoDeSys , , . , Load
the project from the controller, , . (
, 'Online' 'Load source code'. . 'Create Boot project'!)
: , , ,
. Untitled .

CoDeSys V2.3

4-18

CoDeSys

: , 'Title' Project info


. , .

, .
CoDeSys:

ENI
. ENI,
'Project objects' ENI . (TCP/IP-, , , , ) (Project name), . Next. , , 'Shared objects'. Finish, CoDeSys. , .
codesys.ini , - 'Save ENI credentials'.

'File' 'Exit'.
, CoDeSys .
File Close
. , CoDeSys , .
Untitled, File Save as.
File Save
: <Ctrl>+<S>
. Untitled,
File Save as.

CoDeSys V2.3

4-19

CoDeSys

File Save as
. .
. .
Save as:

1.5 (Project Version 1.5 (*.pro)) , 2.0 (Project Version 2.0


(*.pro)), (Project Version 2.1 (*.pro)) 2.2 (Project Version 2.2 (*.pro)). , 2.3, . CoDeSys 1.5, 2.0, 2.1 2.2.
, .
POU CoDeSys, Internal library (*.lib).
, ,
External library (*.lib). , , ,
.h. ,
POU, . POU, CoDeSys.
, .
:

'Edit Licensing Information', Edit license info....
. ' CoDeSys'.
OK. , CoDeSys , .
. , ,
.
File Save/Mail Archive
. , CoDeSys, zip . .
, .

CoDeSys V2.3

4-20

CoDeSys

, .
, , , . , , Details.
, :

Select All Select None . .


Save.
"Save archive", ,
.
, , , :
Project File

< >.pro ( CoDeSys)

Referenced Libraries
Symbol Files

*.lib, *.obj, *.hex ( hex-)

CoDeSys V2.3

*.sdb, *.sym (, )

4-21

CoDeSys

Compile Information

*.ci (, )
*.ri ( )
<temp>.*( )

Log File

*.log ( )

INI File

CoDeSys.ini

Configuration files

, PLC (
, , .): *.cfg, *.con, *.eds, *.dib,*.ico

Target Files

*.tgr ( )
*.txt ( )

Registry Entries

Registry.reg ( , CoDeSys, Gateway PS).


:
HKEY_LOCAL_MACHINE\SOFTWARE\3S-Smart Software Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\AutomationAlliance

Bitmap Files

*.bmp ( POU )

Local Gateway

Gateway.exe, GatewayDDE.exe, GClient.dll,


GDrvBase.dll, GDrvStd.dll, GHandle.dll, GSymbol.dll,
GUtil.dll, DLL Gateway.

Language Files

, (*.vis, *.xml)

, Other Files.
Other files, :

Add , .
. , . , Remove. Ok, .
, Comment. , . OK, readme.txt. , CoDeSys.
, :
Save . ,
.

CoDeSys V2.3

4-22

CoDeSys

< >.zip. , .
Mail . , MAPI (Messaging Application Programming Interface).
. , , Save ,
E-mail, , .
, .

Cancel , .

: zip
!

File Print
:<Ctrl>+<P>
.
. , OK. . .
:

.
Printer Setup, . , . ,
.
Project Document.
, Extras Make docuframe file .
File Printer setup
.

CoDeSys V2.3

4-23

CoDeSys

File .dfr,
. DEFAULT.DFR. ,
Browse.
, ( new page for each object) ( new page for each subobject). Printer Setup
.
Edit, , .
, , POU,
.
:

Insert Placeholder 5 : Page, POU name, File


name, Date and Content . :

CoDeSys V2.3

Page

{Page}

POU name

{POU name}

POU

File name

{File name}

Date

{Date}

Contents

{Contents}

POU

4-24

CoDeSys

C Insert Bitmap , . , . . (. ).
, CoDeSys , .
: 'Show print area margins' Desktop . , .

File Exit
: <Alt>+<F4>
CoDeSys. ,
, (File Save).
Project Build
: <F11>
. POU, . , Project Clean all.
, Online, POU,
, .
, Online Login
. ,
.
.
(<F1>).

CoDeSys V2.3

4-25

CoDeSys

Save before compilation Load & Save, .


, (Object Organizer), . 'Exclude from build', . ('Exclude objects')
(. 4.2 , Build).
: . , 'Show Call Tree', 'Show Cross Reference' ,
'Unused Variables', 'Overlapping memory areas', 'Concurrent Access', 'Multiple Write Access on output' 'Project' 'Check' , .

Project Rebuild all


Project Build all ,
. , , Clear All.
. 4.2 ( , Build).
Project Clean all.
.
, , Online
. .
: , *.ri,

CoDeSys V2.3

4-26

CoDeSys

. *.ri Load Download-Information.

Project Load Download-Information


,
, . .
<project
name><target identifier>.ri . , , . , , , POU . , Online, POU.
Project Clean all *.ri . Project Load Download-Information,
.
Project Translate into another language.
. , CoDeSys
.
:

Create translation file ( )


Translate project ( )
Show project translated ( )

. : ' '
(Create translation file)
:

Translation file .
.tlt. *.txt EXCEL WORD,
.

CoDeSys V2.3

4-27

CoDeSys

, Search.
: (Names), , POU,
(Identifiers), (Strings), (Comments), (Visualization texts). , (Position
information) .
, . , , ,
.
Text Tooltip-Text.
: ( Text Tooltip-Text)
, # (,
#text# ). .
Extras Settings.. Online . (.
).

Position information . ,
POU , . 3 :
None

First

All

, , , .
: All, 64- .

Overwrite existing :
.
Target languages: ,
.
Exclude Exclude libraries. ,
, .
Included libraries,
, Add. Excluded liberalities.
, Remove. Ok , .

CoDeSys V2.3

4-28

CoDeSys

Add Add target Language.


:

.
. Ok,
. Remove
.
Ok.
, . . ? No , Yes. Backup_of_<translation file>.xlt.
:

##TODO.

, ,
.
.
. ##. ##TODO . ,
##NAME_ITEM,

##END_NAME_ITEM ( ##COMMENT_ITEM ..).
, POU ST_Visualisierung. (English) (French) .
.
:
##NAME_ITEM
[D:\CoDeSys\projects\Bspdt_22.pro::ST_Visualisierung::0]

CoDeSys V2.3

4-29

CoDeSys

ST_Visualisierung
##English :: ##TODO
##French :: ##TODO
##END_NAME_ITEM
:
##NAME_ITEM
[D:\CoDeSys\projects\Bspdt_22.pro::ST_Visualisierung::0]
ST_Visualisierung
##English :: ST_Visualization
##French :: ST_Visu
##END_NAME_ITEM
##TODO .
,
.
: .
. .
: Language, Flag, , (, ) .

(Translate project)
, :
Translation file.
:

: ,
, .. .

Target language , ,
.
, OK. ,
, .
, , .
Cancel .
, OK
: , , , .
: [C:\Programs\CoDeSys\projects\visu.tlt (78)]; Translation text expected.

CoDeSys V2.3

4-30

CoDeSys

(Show project translated)


, , . ( 'Translate
Project' !)
:

Translation file.
, Browse.
Target language . "<Native language>" . OK.
! 'Switch translation'.
(Switch translation)
(. 'Show project translated'),
. 'Switch
translation' 'Project' 'Translate'.

Project Document
, :

POU

: , , , PLC,
, .
POU.
.

, .

CoDeSys V2.3

4-31

CoDeSys

, .
, .
, . ,
, . , , . . <Shift> , <Ctrl> - .
, OK. . File Printer setup .
Project Export
CoDeSys .
.
IL, ST SFC (Common Elements format ).
POU LD FBD CoDeSys ,
. ASCII .
POU, , .
( ).
: POU FBD LD ,
(), .
, Project Document. One file for each object
, . Ok,
. , .

CoDeSys V2.3

4-32

CoDeSys

< .exp>.
.
Project Import.
.
. , ,
, , : Do you want
to replace it?( ?). Yes, ,
. No, ("_0", "_1", ..). Yes, all No, all
.
, . , ,
. , ,
, * (,
standart.lib*30.3.99 11:20:14). , :
Cannot find library {<path>\}<name> <date> <time>( { \ \ \ }).
Project Siemens Imports
POU Siemens-STEP5 STEP7.
.
Project Compare
.
:
:

,
,
Compare. COMPARE.
. ( ST IL) ( FBD LD) /POU ( CFC SFC).

,
. POU, , .
POU .
, , (, ) . , , .
, !
:
Project Compare Project Comparison.

CoDeSys V2.3

4-33

CoDeSys

Project to compare.

, .
, .
ENI ,
, . Compare
with ENI-Project.
:
Ignore whitespaces: .
Ignore comments: .
Ignore properties: .
Compare differences ( ): , POU , ( ).
, , - (/, ). ,
.
:
0005 ( ).

CoDeSys V2.3

4-34

CoDeSys

( Oppose difference , )

OK.

:

1. :
:
Project comparison < > - < >.
, - . . POU, , , :
: ; .
: ;
.

CoDeSys V2.3

4-35

CoDeSys

: ;
.
: .
POU (Properties changed), . (Access right changed) , .
2. POU
POU, ,
POU. POU . -
( , ST,IL), (FBD, LD) (CFC, SFC). ,
.
POU :

..,
, .
.

, POU,
Extras :

Next difference
Previous difference

CoDeSys V2.3

<F7>

<Shift><F7>

4-36

CoDeSys

Accept change:

Accept change item

<Space>

<Ctrl>
<Spacebar>

Accept properties
Accept access right

(, ), ,
. . , .
, ,
.


.
( ):

.

Project Merge.
. . , .
Project Document.
,
_1 _2 ..
Project Project info
. , .
:

(File)
(Directory)
(Change date)

. :

CoDeSys V2.3

4-37

CoDeSys

(Title)
(Author)
(Version)
(Description)

.
Statistics, .
POU, , .
:

License info , CoDeSys ,


'File' 'Save as...'. (. CoDeSys').
Ask for project info Load & Save ,
.
Project Global Search
POU, . (. .Project .Document).
.

Global Search .
. , , Search for.
, .
, Edit Search.
In message window, . , , .
:

CoDeSys V2.3


: (Decl) (Impl).

4-38

CoDeSys

.
.

, POU , .
<F4> <Shift>+<F4>, .
Project Global replace
POU, .
Project Global Search Edit Replace. , , .
.
Project Check
.
, . .
.
:

Unused Variables ( )
Overlapping memory areas ( )
Concurrent Access ( )
Multiple writes to output ( )

.
: .

Unused Variables
. , , . POU , . : PLC_PRG(4) var1. , , .
Overlapping memory areas
. , ,
AT. , var1 AT %QB21: INT var2 AT %QD5:
DWORD , 21- .
:
%QB21 is referenced by the following variables:

CoDeSys V2.3

4-39

CoDeSys

PLC_PRG (3): var1 AT %QB21


PLC_PRG (7): var2 AT %QD5
Concurrent Access
. , ,
. :
%MB28 is referenced in the following tasks :
Task1 PLC_PRG (6): %MB28 [read-only access]
Task2 POU1.ACTION (1) %MB28 [write access]
Multiple writes to output
. ,
. :
%QB24 is written to at the following locations:
PLC_PRG (3): %QB24
PLC_PRG.POU1 (8): %QB24

CoDeSys . . . .
0 7. 0 , .. .
. 0 , 0- .
0 , .
.
:

User group , , Password. , :


"The password is not correct."( )
, .
Passwords for user group, Object Access rights.
Project Passwords for user group
. 0.

CoDeSys V2.3

4-40

CoDeSys

User group
Password. *. Confirm password
. OK "The password does
not agree with the confirmation", , .
.
, .
: , !

Project Data Base Link


, 'Use source control (ENI)'
'Project source control'.
ENI:
1.

Login ( ENI )

Data Base
Link ( , ),
:
2.
3.
4.
5.
6.
7.
8.

Define
Get Latest Version
Check Out
Check In
Undo Check Out
Show differences
Show Version History

, 'Data base Login' .


Data Base Link Project' ,
, :
9.
10.
11.
12.
13.
14.
15.
16.
17.

CoDeSys V2.3

Multiple Define
Get All Latest Versions
Multiple Check Out
Multiple Check In
Multiple Undo Check Out
Project Version History
Label Version
Add Shared Objects
Refresh Status

4-41

CoDeSys

:

:
.
x :
.
<R> :
.
:
(Task configuration, Sampling Trace, PLC
Configuration, Target Settings, Watch- and
Receipt Manager) <R>
,
.
, 'Check out' .

Login ()
'Login',
ENI . . ENI (ENI Admin, User Management).

CoDeSys V2.3

4-42

CoDeSys

'Login':

Project objects :
Host: ENI Server ( 'TCP/IP address' 'Project source control').
Project: ( 'Project name' 'Project source
control' / 'Project Objects').
(Credentials):
User name Password.
Use as default,
.
OK . 'Shared objects'. OK.
'Compile files'.
Login ,
.
: , 'Save ENI credentials' , 'Load & Save'.

Define ()
: 'Project' 'Data Base Link' 'Define'.
,
. 'Project' (
) 'Shared objects' ( ) 'Local' ( ).
( ) .
Get Latest Version ( )
: 'Project' 'Data Base Link' 'Get Latest Version'
, .
Check Out .

CoDeSys V2.3

4-43

CoDeSys

Check Out ()
: 'Project' 'Data Base Link' 'Check Out'
.
'Check out object'. ,
.
<Ctrl>+<Enter>.
, , .
. , .
Check In ()
: 'Project' 'Data Base Link' 'Check In'
. , .
'Check in object'. ,
.
<Ctrl>+<Enter>.
.
Undo Check Out ( )
: 'Project' 'Data Base Link' 'Undo Check Out'
. . ( )
.
Show Differences ( )
: 'Project' 'Data Base Link' 'Show Differences'
() , . CoDeSys , ,
(. 'Project' 'Compare').
Show Version History ( )
: 'Project' 'Data Base Link' Show Version History'
, .
, , :

CoDeSys V2.3

4-44

CoDeSys

:
Version: . . (label) , .
User: ,
Date:
Action: . : 'created' ( ),
'checked in' ( , ) 'labeled with <label>' (
).
:
Close: .
Display: CoDeSys. : "ENI: < >/< >
Details: 'Details of Version History':
File ( ), Version (. ), Date (. ), User (. ),
Comment (, ).
Next Previous 'Version history of ..'.
Get latest version: CoDeSys .
Show Differences: ,
() . , . , .
Reset version: (). , , ! .
Labels only: , .
Selection box 'Labels only': ,
.
'All'.

CoDeSys V2.3

4-45

CoDeSys

Multiple Define ( )
: 'Project' 'Data Base Link' 'Multiple Define'
"Define 'Properties'
. , 'ENISelection', POU.
, . POU OK.
Get All Latest Versions ( )
: 'Project' 'Data Base Link' 'Get All Latest Versions'
.
:
,
CoDeSys.
,
, .
Multiple Check Out ( )
: 'Project' 'Data Base Link' 'Multiple Check Out'
. 'ENISelection' OK. . 'Check Out'.
Multiple Check In ( )
: 'Project' 'Data Base Link' 'Multiple Check In'
. 'ENISelection' OK. . 'Check In'.
Multiple Undo Check Out ( )
: 'Project' 'Data Base Link' Undo Multiple Check Out'
. 'ENI-Selection' OK. . 'Undo
Check Out'.
Project Version History ( )
: 'Project' 'Data Base Link' 'Project Version History
, .
'History of <data base project name>'. (, , ) . Version history.
'Show Version History'. :
1) 'Reset Version' .

CoDeSys V2.3

4-46

CoDeSys

2) 'Get latest version' , ! , CoDeSys . :


, , ! , , , .
Label Version ( )
: 'Project' 'Data Base Link' 'Label Version'
"" (label) ,
. 'Label <data base project name>'
(Label) (, "Release Version") , , Comment. OK. . .
'Version'. 'Labels only'
.
'Label project <data base project name>'

Add Shared Objects ( )


: 'Project' 'Data Base Link' 'Add Shared Objects'
'Shared Objects' .
'Project Objects' , 'Get (all) latest version(s)' ,
. 'Shared Objects' , .
'Add Shared Objects' 'Browse ENI'. OK .

CoDeSys V2.3

4-47

CoDeSys

'Browse ENI'

Refresh Status ( )
: 'Project' 'Data Base Link' 'Refresh Status'
,
.

4.4
.

, (POU),
, (visualizations), (global)
(variable configuration), (Sampling trace), (PLC configuration),
(Task Configuration) (Watch and Receipt Manager). . .
POU ,
(, ). (VAR_GLOBAL VAR_CONFIG).
(drug&drop).
, (,
Object_1).

POU, ,
. .
,
. , "" "" . Expand node( ) Collapse node ( ).
New Folder.

CoDeSys V2.3

4-48

CoDeSys

: ,
.

New Folder
. ,
. .
, , .
, , , <Shift>+<F10> .
New Folder. :

. .
, - .

New Folder ,
, New Folder 1. , .
Expand nodes Collapse nodes.
Expand nodes . Collapse nodes .
.
, , , <Shift>+<F10> .
Project Object Delete
: <Delete>
.
. 'Edit' 'Undo'.
, .
Edit Cut .
Project Object Add.
:<Insert>

CoDeSys V2.3

4-49

CoDeSys

. . 'Global Variables', 'Data types', 'Function', 'Function Block' 'Program'


, . 'Save as template'.
POU Name of the new POU . ,
.
:


POU POU .
POU .


POU.
.

. , , , POU, . ,
POU.
POU POU (,
) , POU . POU Type
of the POU, Language of the POU. POU , Return Type. (, , ). Input assistance, <F2>.
POU:

POU , OK , ,
. .
Edit Insert .
,
(, Righ_1).
ENI, , (
'Project source control'), ,
. .
'Properties' .
Save as template
'Global Variables', 'Data types', 'Function', 'Function Block' 'Program'
. 'Save as template' ( ). -

CoDeSys V2.3

4-50

CoDeSys

. .
Project Object Rename
: <>
. . , .
POU

Project Object Convert


POU. POU
IL, FBD LD.
.
POU . , . OK,
POU POU.
, .
POU.

: .
: POU, FBD, LD (. 'Extras' 'View').

Project Object Copy


. POU
. , .
Edit Copy, .

CoDeSys V2.3

4-51

CoDeSys

POU

Project Object Open


: <Enter>
POU .
, ( ).
:

.
. ,
, .
Open. .

Project Object Properties


'Properties', . :
Global variable list.
, ,
. . Add Object,
Global Variables .
'Visualization' (.
CoDeSys).

CoDeSys V2.3

4-52

CoDeSys

Use as: Web visualization Target visualization Target Settings,


Web Target .
Used as: ,
(Master layouts):

Visualization: .

Visualization without Master layout: , .

Master layout: .
, as background.

ENI (. 'Project' 'Options' 'Project source control'), 'Database-connection'. 'Local'. ( . ENI?.


Project Object Access rights
. :

0.
:

CoDeSys V2.3

4-53

CoDeSys

No Access: .
Read Access: .
Full Access: .

, Apply to all ,
POU, , .
0.
.
Project Add Action
, .
, .
.
"". , ""
"" . Expand node(
) Collapse node ( ).
Project View Instance
. .

, (Implementation). OK.
: Online. (
.)

Project Show Call Tree


, .
.
POU .

CoDeSys V2.3

4-54

CoDeSys

Project Show ross Reference.


, , (POU, ) . .
, "Not up
to date". ,
.
Variable(), Address() POU Name
. *. Name.
:

Cross References, , .
POU, , , ,
. Scope , ; Access .
Go To , , . .

CoDeSys V2.3

4-55

CoDeSys

, Send to message window, .

4.5
CoDeSys, . Edit .
, CoDeSys
. , <Ctrl>
.
Edit Undo
:<Ctrl>+<Z>
, . , , .
, POU, , , .
Edit Redo .
: Undo Redo . .
- , .
, .

Edit Redo
:<Ctrl>+<Y>
.
Undo, Redo.
: Undo Redo . .
- , .
, .

Edit Cut
:

: <Ctrl>+<X> <Shift>+<Delete>

. .
, , , PLC Configuration.
, .
.
IL ST, .

CoDeSys V2.3

4-56

CoDeSys

FBD LD , .
SFC .
, Edit Paste. SFC Extras Insert parallel branch (right) Extras Paste after.
, Edit Copy.
Edit Delete .

Edit Copy
:

: <Ctrl>+<C>

, .
, , , PLC Configuration.
, .
, Edit
Cut.
Edit Paste
:

: <Ctrl>+<V>

, .
,
.
, .
, . .
FBD LD , Edit Paste .
SFC , ( ).
Edit Delete
: <Del>
, .
, ,
, PLC Configuration.

CoDeSys V2.3

4-57

CoDeSys

, . , Edit Cut.
.
Edit Find
:
. . , Cancel.
Find what .
, ( Match whole word only) , (Up) (Down).
Find next . . , . , .
, .
CFC . . , FBD !

Edit Find Next


:

: <F3>

, .
Edit Replace
.
.
Replace Replace with.
Replace all .
.

CoDeSys V2.3

4-58

CoDeSys

Edit Input Assistant


: <F2>
: , .
,
OK. .
: .

, ,
, .. , (, ,
, POU ..).
With arguments, . , pr1, var_in.
: pr1(var1_in:=);
func1 var1 var2 :
func1(var1,var2).
. Structured Display.

CoDeSys V2.3

4-59

CoDeSys

POU, .
O.
, . (, Watch and Receipt Manager) ,

, POU,
. ,
, , , , , , . , .
, ,
Standard.
,
, Global Variables Local Variables -

CoDeSys V2.3

4-60

CoDeSys

. , .
, With arguments. IL ST .
,
Inst(IN:=,PT:=)

Inst TON. :

With arguments , . .
,
enumerations . . : , , ,
POU.
(
, . ),
.
Watch and Receipt Manager , .
<Shift>, , <Ctrl> - .
, (,
POU), . ,
.
Watch and Receipt Manager
, .
, O.
Watch and Receipt Manager
. ,
.
20, A maximum of 20 variables is allowed 20 .
: (, Global Variables) .

Edit Declare Variable


: <Shift>+<F2>
.
, 'Project' 'Options' 'Editor' 'Autodeclaration'.

CoDeSys V2.3

4-61

CoDeSys

Edit Next error


: <F4>
, . , . .
Edit Previous error
: <Shift>+<<F4>
, .
, . .
Edit Macros
(. 'Project' 'Options' 'Macros'). Process Macro, . Cancel, .
. :
"<Macro>: Execution interrupted by user.
Online Offline, , .

4.6 Online
Online Online. .
Online ,
.
Online Login
:

: <Alt>+<F8>

CoDeSys ( ) Online.
, ( Project Build). , CoDeSys Login.
, CoDeSys, ,
Project Clear All, Login
The program has been modified! Should the new program be loaded? ( .
?) Yes, . No ,
Online. Cancel .

CoDeSys V2.3

4-62

CoDeSys

Login

Desktop 'Online in security mode' , Details. , , .


: .
: Online
PLC, 'Project' 'Clean all' (. ). Online , ,
Retain . 'Online' 'Download'.

Online.
.
Online Logout Online.
:
"The selected controller profile does not match that of the target system..." (
.)
Target settings ( Resources)
( 'Online' 'Communications parameters').

Communication error. Log-out has occurred ( . ).

, , 'Online'
'Communications parameters', ( (baud rate)).
Gateway server, .

CoDeSys V2.3

4-63

CoDeSys

The program has been modified! Should the new program be loaded? ( . ?)
, CoDeSys, , .
. Yes, .
No, Online .
The program has been changed. Load changes? (ONLINE CHANGE) ( . ?)".
. Online ,
. , . ,
Load all.
Online Change:
(
Online Login), .
:
Online Change ,
.
( <projectname><targetidentifier>.ri),
, ( 'Project' 'Clean all'), Online Change
. ri- ,
'Project' 'Load download information'.
Online Change . !
Retain Online Change (. 'Online' 'Download').
:
, proj.pro PLC1 PLC2 ( ) . :
(1) PLC1 :
1. CoDeSys PLC1 (. Online/Communication parameters) proj.pro
(Online/Login, Download). proj00000001.ri, .
2. proj00000001.ri, proj00000001_PLC1.ri.
proj.pro .
3. PLC1 ('Online' 'Start', 'Online' 'Logout').
(2) PLC2 :
1. CoDeSys PLC2 ( ) proj.pro.
proj00000001.ri, .

CoDeSys V2.3

4-64

CoDeSys

2. proj00000001.ri, proj00000001_PLC2.ri.
3. PLC2 ('Online' 'Start', 'Online' 'Logout').
(3) CoDeSys:
proj.pro CoDeSys, .
(4) PLC1, PLC1:
1. PLC2, proj00000001.ri . , proj00000001_PLC1.ri.
2 :
(a) proj00000001_PLC1.ri proj00000001.ri.
PLC1 , Online
Change.
(b) proj00000001_PLC1.ri login 'Project' 'Load Download Information'. .
(5) PLC2, PLC2:
, proj00000001_PLC2.ri (3)
(4).
Online Logout
:

: <Ctrl>+<F8>

, ,
. Offline.
, Online Login.
Online Download
.
< >0000000ar.ri, ,
Online Change ( Online).
Project Clear all.
*.ri .
persistent .
Online Run
:

: <F5>

CoDeSys V2.3

4-65

CoDeSys

, Online Stop,
Online Single Cycle.
Online Stop
:

:<Shift>+<F8>

.
.
, Online Run.
Online Reset.
. , VAR RETAIN.
, ( VAR PERSISTENT). (, 0 ).
, .
. . 'Online' 'Reset (original)' 'Online' 'Reset (cold)'.
Online Run.
Online Reset (cold).
. , Online Reset, RETAIN.
Online Run.
Online Reset (original).
. Reset Cold. PERSISTENT
. , , .
: Reset
. . .

Online Toggle Breakpoint


:

<F9>

.
, .
, , .
IL ST , .
, - .
, .
FBD LD . , .

CoDeSys V2.3

4-66

CoDeSys

SFC .
, <Shift>.
, , .
, .
, Online' 'Run', 'Online' 'Step
in', 'Online' 'Step Over'.
Breakpoints ( Online
Breakpoint Dialog Box ).
Online Breakpoint Dialog
. .
, POU POU
Location. Add, . .
Delete.
Delete All .
: Go
to.
Online Toggle Breakpoint.
Breakpoints

Online Step over


:

<F10>

. POU, POU . POU ( POU), Online Step in.

CoDeSys V2.3

4-67

CoDeSys

POU, .
Step over SFC .
Online Step in
<F8>
. POU .
,
.
, Online Step over.
Online Single Cycle
: <Ctrl> +<F5>
.
.
, Online Run
Online Write values
: <Ctrl> +<F7>
( , Online Force values).
, .
, .
,
. : <Enter>. Write variable <x>, .

, . .

CoDeSys V2.3

4-68

CoDeSys

, a = 0<:=34>
: FBD LD, .

.
, .
Online Write/Force dialog(. ).
, (Writelist), ,
(Forcelist), Force values.
Write Values :

Online

Editing the writelist and the forcelist.

Writelist
, Writelist ( Force values Forcelist Writelist ).
: SFC , , , Write values, , . , : "a AND b"

TRUE, TRUE.
FBD, , , , ,
. Write values .
Online Force values
: <F7>
.
:1.
. 2. . 3. . 4. . 5.
.
, Online Release force.
Writelist, (.
Online Write values). Writelist , .
Force Writelist Forcelist.
Writelist , . Forcelist .
: Forcelist Force Values
Writelist.

CoDeSys V2.3

Online

4-69

CoDeSys

Editing the writelist and the forcelist'.

: SFC , , ,
Write values, , .

FBD, , , ,
. Write values .
Online Release force
: <Shift>+<F7>
.
.
,
. .
, :
Release Force Online
Release Force Editing the writelist and the forcelist
Remove Write-/Forcelist(. )
, .
<Release Force> . :
Write variable <x> <Release Force for this variable>.
<Release Force>
Online Write/Force-Dialog Forced value.
"<Release Force>" , 'Force values' .
Release Force Writelist ,
Remove Write-/Forcelist. , - Writelist (Remove
writelist), Forcelist (Release force). .
Writelist Forcelist

Online Write/Force Dialog


: <Ctrl>+<Shift>+<F7>

CoDeSys V2.3

4-70

CoDeSys

, (Writelist) (Forcelist).
, - .
watchlist 'Online' 'Write Values' forcelist 'Online' 'Force Values'.
Writelist Forcelist

Writelist Write
Values. Forcelist, Force
Values. Prepared Value Forced Value
Writelist Forcelist, . , . ,
, Cancel.
Online :
Force Values: Writelist Forcelist. .
, <Release Force>, . .
Write Values: Writelist . .
Release Force: Forcelist. Writelist , Remove Write-/Forcelist, , .
.

CoDeSys V2.3

4-71

CoDeSys

Online Show Call Stack


Online, .
POU:

POU PLC_PRG, .
POU, .
POU Go to, POU .
Online Display Flow control
Display Flow
control. ,
, ,
.
. IL, , . FBD LD
, , . , . , TRUE , .
Online Simulation
. , Simulation
.
. .
Windows
, .
.
(/) .

CoDeSys V2.3

4-72

CoDeSys

: POU .
( , ) .

Online Communication Parameters


. ( OPC DDE , ).
:

(gateway)






(gateway). , .

. . , , . Login. ,
. CoDeSys
Windows. , .
. Exit
( ).
, .

PC_local , PC_x ,
PC_ gateway. PC_PLC1 PC_PLC4 - .
, .

CoDeSys V2.3

4-73

CoDeSys

: TCP/IP. ,
.

, , (TCP/IP,
..).

1.
"Communication Parameters
Gateway". "Gateway" .

Connection - . ,
(local) TCP/IP.
TCP/IP.

Address IP - , . Localhost, IP
127.0.0.1. .
Password , . , .
Change password.
.
Port
- , . .

OK. , ,
Channels .
2. :
. ( "not
connected"), , .
OK. .

,
.

CoDeSys V2.3

4-74

CoDeSys

New.
.

Name .
, (, localhost).
. .
Device . . OK, Channels "Communication Parameters".
.
, (login). , .
.
, , (, COM1) . , .
, , .
, .
. .
Remove.


. ,
, , .
Update.
.

CoDeSys V2.3

4-75

CoDeSys

, :

Channels .

. IP . localhost, . IP 127.0.0.1.
, IP , , .
PC_PCL1 PC_PCL3 .
.
, , -.
PC_PCL1 PC_PCL4. ,
. . , PC_PCL1 .
. PC_PCL4.

.
, 3 : Name,Value Comment (, ).

Value. <>. <Enter> .
<Tab> <Shift+Tab> .
.
<Up>, <Down>, <PgUp>, <PgDn >, <Ctrl+Home> () <Ctrl+End> ()
.

, "not connected" .
:

. ( CoDeSys) .

IP ( "ping" ).

TCP/IP , .

CoDeSys V2.3

4-76

CoDeSys

Online Sourcecode download


. , . Soucedownload.
Online Create bootproject
, .
. . , 386 3 : default.prg,
, default.chk, , default.sts, .
Offline, .
: < > .prg, , < > .chk . .
offline *.ri- (
). , .
: Implicit at create boot project ( Sourcedownload),
'Online' 'Create boot project'.

Online Write file to controller


.
.
Open
. , .
Load file from controller
.
.

Online Load file from controller


. Load file from controller. , . ,
Save.

4.7
Windows.
, .
, .
, . .

CoDeSys V2.3

4-77

CoDeSys

Window Tile Horizontal


,
.
Window Tile Vertical
, .
Window Cascade
.
Window Arrange Symbols
.
Window Close All
.
Window Messages
: <Shift>+<Esc>
, ,
. ,
.

4.8
'Help' 'Contents' 'Search'
CoDeSys ,
.
Contents Search Help .
HTML Help Viewer (Internet Explorer V4.1 ).
Contents . .
Search . .

. ,
.
-
: <F1>
<F1> , .
, -

CoDeSys V2.3

4-78

CoDeSys

. , (,
) .

CoDeSys V2.3

4-79

5 CoDeSys
5.1

POU (Program Organization Units)
. ; - . ,
.

CoDeSys , , . - . 'Show print range'
'Workspace'. , . , (Default.DFR). 'New page for each object' 'New page for
each sub-object' 'Documentation settings'. .
: 100%.

(* *). : (* .*). , . , IL ST .
FBD LD . 'Insert' 'Comment'.
, 'Extras' 'Options'.
CFC (Comment), .
SFC , .
, (Nested comments)
'Project' 'Options' 'Build Options'.
Online, ,
.
Zoom to POU
: <Alt>+<Enter>
. POU.
'Extras', POU POU .
POU,
POU.

CoDeSys

Open instance
. 'Project' 'Open instance' .
(<F2>) 'Extras',
.

(List components) 'Editor' ,
,
:
"." ,
.
'Return' .
,
.
'Return' .
:
"struvar." -> struct1 :

<Ctrl> + <Space Bar>, POU


, .
<Enter>.
Offline
offline, , (,
VAR_GLOBAL), , (, RETAIN), .

CoDeSys V2.3

5-2

CoDeSys

5.2
5.2.1
POU, , , . Windows .
<Ins>.
OV .
,
.
,
<Ctrl>+<F10>.

POU .
, , , , .
, , ,
.

, , 61131-3.
.


POU VAR_INPUT END_VAR. POU, .
:
VAR_INPUT
in1:INT

CoDeSys V2.3

(* *)

5-3

CoDeSys

END_VAR

POU VAR_OUTPUT END_VAR.
POU , ,
POU.
:
VAR_OUTPUT
out1:INT
END_VAR

(* *)


VAR_IN_OUT END_VAR. .
: , .
: < >.<in/out >.

:
VAR_IN_OUT
inout1:INT; (* *)
END_VAR

VAR END_VAR.
POU, . POU .
:
VAR
loc1:INT; (* *)
END_VAR

. .
RETAIN.
, ( ) , (''Online' 'Reset''). RETAIN .
(Retain) 'Online' 'Reset (cold)' 'Online'
'Reset (original), (Persistent) .
PERSISTENT. ,
.
.
PERSISTENT RETAIN .

CoDeSys V2.3

5-4

CoDeSys

- = , x =
Online

VAR

VAR RETAIN

VAR PERSISTENT

VAR RETAIN PERSISTENT


VAR PERSISTENT
RETAIN

Reset

Reset cold

Reset origin

Download

Online Change

:
VAR RETAIN
rem1:INT;
END_VAR

(* *)

:
VAR RETAIN, .
VAR RETAIN,
, VAR RETAIN
.
VAR RETAIN, .
! PERSISTENT
!

,
CONSTANT. .
:
VAR CONSTANT
<>:<>:=< >
END_VAR
:
VAR CONSTANT
con1:INT:=12; (* *)
END_VAR
B.

CoDeSys V2.3

5-5

CoDeSys


, POU, EXTERNAL. Online.
POU ,
"Declaration of '<var>' does not match global declaration!"
, "Unkown global variable: '<var>'!"
:
VAR_EXTERNAL
var_ext1:INT:=12;
END_VAR

(* *)


.
. : VAR, VAR_CONSTANT, IF, NOT, INT.

:
<> {AT <>}:<> {:=< >};
, , .
,
. , .. Var1, VAR1 var1 .
. A_BCD AB_CD .
. , .
. :=. . .
:
var1:INT:=12; (* INT, 12*)
,
AT.
.
, . , Variable configuration.
.

CoDeSys V2.3

5-6

CoDeSys

AT
,
AT. , (, ).
, , , . , AT ,
POU.
:
counter_heat7 AT %QX0.0: BOOL;
lightcabinetimpulse AT %IX7.2: BOOL;
download AT %MX2.2: BOOL;
Byte, Word Dword, , !

Insert Declaration keywords


, POU. ,
.
, Input Assistant <F2> Declaration.
Insert Type
.
Input Assistant <F2>.
:

Standard types ( )

Defined types (, : , ..)

BOOL, BYTE ..

CoDeSys 1131-3.

.
. , , .
:

(, TRUE/FALSE, T#3s,%IX0.0)

CoDeSys V2.3

5-7

CoDeSys

(, , ,
)

, , .


. , <Ctrl>+<Enter>.
:

, .

B Bool

BOOL

I Int

INT

R Real

REAL

S String

STRING

( ) BOOL (. 1). .
, ,
( 2 3).

AT ( 4).

( 4).

( 5).

:
:

A: BOOL;

AB I2

A, B: INT := 2;

ST S 2; A string

ST:STRING(2); (* A string *)

X %MD12 R 5 Real Number

X AT %MD12: REAL := 5.0;(* Real Number*)

B!

B: BOOL;


Autodeclaration Editor Options, .
.

CoDeSys V2.3

5-8

CoDeSys

Class : (VAR), (VAR_INPUT), (VAR_OUTPUT), /


(VAR_IN_OUT), (VAR_GLOBAL).
CONSTANT, RETAIN PERSISTENT, .
Name. BOOL
( Type).
.

Input Assistant,

.
ARRAY, .

( Dim.) (Start)
(End) .
Field. Input Assistant,

Type.
: ARRAY [1..5, 1..3] OF INT.
Initial Value .
, ,

<F2>.

;
:= .

CoDeSys V2.3

5-9

CoDeSys

. . :=
. , , , "" . .

Initial value .
: x:=5,field:=2,3,struct2:=(a:=2,b:=3)
Address ( AT)
. <Ctrl>+<Enter>.
OK .
: 'Edit' 'Declare Variable'. Online , Autodeclare <Shift><F2>
.

.
Offline, , .
Online, , ,
, .

Declarations as tables Editor , . , (, ..), .
:
Name:

Address:

( AT), .

Type:

. (
)

Initial:

( :=)

Comment:

. Online
.

CoDeSys V2.3

5-10

CoDeSys

Insert New declaration


.
- ,
, . ,
, TAB .
Name, Name,
Bool Type.
, . ,
.

5.2.2 Online
Online . =. ,
= 3 .
( "Project" "Open instance").
. <Enter>
, , . .

<Enter> . ,
. , , .
.
, Insert Write values . .
Online Force values Release force.
.

CoDeSys V2.3

5-11

CoDeSys

5.2.3
, . .
, :{< >}
, . : Ignore compiler directive <Instruction text>!
, ,
, . ,
.
,
.
CoDeSys :

{flag} ,

{bitaccess...}

{parameter..}, {template...}, {instance...}

{nonpersistent} PERSISTENT

,
:
{flag [<flags>] [off|on]}
<flag> - :
Noinit

Nowatch

Noread

Nowrite

noread, nowrite

on
off {flag off}.
.
:
:
a . b :
VAR
a : INT {flag noinit, nowatch};
b : INT {flag noinit };

CoDeSys V2.3

5-12

CoDeSys

END_VAR
VAR
{flag noinit, nowatch on}
a : INT;
{flag noinit on}
b : INT;
{flag off}
END_VAR

:
{flag noinit on}
VAR
a : INT;
b : INT;
END_VAR
{flag off}
VAR
{flag noinit on}
a : INT;
b : INT;
{flag off}
END_VAR

:
noread nowrite .
, POU, . , , .
:
POU , a
, b :
VAR
a : INT {flag noread};
b : INT {flag noread, nowrite};
END_VAR
VAR
{ flag noread on}
a : INT;
{ flag noread, nowrite on}
b : INT;
{flag off}
END_VAR

a, b :
{ flag noread, nowrite on }
VAR
a : INT;
b : INT;
END_VAR
{flag off}
VAR
{ flag noread, nowrite on}
a : INT;
b : INT;
{flag off}
END_VAR

CoDeSys V2.3

5-13

CoDeSys

:
: ( POU )
a : afb;
...
FUNCTION_BLOCK afB
VAR
b : bfb {flag nowrite};
c : INT;
END_VAR
...
FUNCTION_BLOCK bfB
VAR
d : INT {flag noread};
e : INT {flag nowrite};
END_VAR

a, c .
b, e .
d .
{bitaccess...}
, . ,
. POU. .
.
.
:
{bitaccess <Global Constant> <Bitnumber> '<comment>'}
<Global
Constant>:

,
.

<Bitnumber>:

<comment>

: 'Replace constants' ( Build) !

. : CoDeSys , .

(Parameter Manager). CoDeSys .

CoDeSys V2.3

5-14

CoDeSys

Networkfunctionality .
:
, : { <>}.
, .
, VAR_CONFIG, ,
.

, .

<name>: . , .

<key>: , .. ("Name", "Value",


"Accesslevel" ..). . ,
. , (. 3, ).
<value>: , <key>. <value> , . : accessright="read only".
: , , .
.

:
1. 'Variables'
(a) :
'Variables' PROGRAM VAR_GLOBAL :
{parameter list=<name> [ <key>=<value> <key>=<value> ... ] }
: bvar . parlist1
( 'Variables') bvar1, 102, 16#1200 16#2l.
VAR
bvar:INT{parameter list=parlist1 [name=bvar1 value=102 index=16#1200
subindex=16#1 ] };
END_VAR
() VAR_CONFIG:
'Variables' VAR_CONFIG ( ) :
{parameter list=<name> path=<path> [ <key>=<value> <key>=<value> ... ] }
<path> , , "PLC_PRG.act1.var_x"
: var_x an "varlist1", "xvar".
VAR_CONFIG

CoDeSys V2.3

5-15

CoDeSys

{parameter list=varlist1 path=PLC_PRG.act1.var_x [ name=xvar ] }


END_VAR
2. 'Template'
: 'Template':
{template list=<name> [ <key>=<value> <key>=<value> ... ] }
: strvar, "stru1",
"templ1" 'Template'; "struvar1", "low":
TYPE stru :
STRUCT
ivar:INT;
strvar:STRING{template list=vorl1 [member=struvar1 accesslevel=low]
};
END_STRUCT
END_TYPE
3. ' Instance'(
)
(a) :
,
'Instance':
{instance list=<name> template=<template> baseindex=<index>
basesubindex=<subindex>
[
<key>=< > <key>=< >
... ] | [ <key>=< > <key>=< > ..
] | [ ]}<key>=<value> <key>=<value>
... ] }
"template" "ARRAY".

.
, . :
"name" [name=<_>]
.
( ) , . .
, , ( "name" )! (. 1b).
"name" :

,
:
< POU>_< >_< >.
: ARRVAR [1..8] INT PLC_PRG
pragma. "name" , "PLC_PRG_arrvar_1" "PLC_PRG_arrvar_8".

CoDeSys V2.3

5-16

CoDeSys

"<>_< >"
,
<>_< >.
: ARRVAR [1..8] INT pragma. [name=xyz_1] . "xyz_2" "xyz_8".

: "Member"; ,
.

:
1:
"arr_1" "arrinst" 'Instance';
"xname_<index number>" ( ), , 0. Accesslevel=low
.
arr_1: ARRAY [1..8] OF INT{instance list=arrinst template=ARRAY baseindex=16#0
basesubindex=16#0 [name=xname_1 accesslevel=low ] };

1:
arr_1 1 4 , 5 8
4, "xname_5" ..
"xname_8".
,
, :
arr_1: ARRAY [1..8] OF INT{instance list=arrinst template=ARRAY baseindex=16#0 basesubindex=16#0 [name=aname accesslevel=high] [name=bname]
[name=cname] [name=xname accesslevel=medium]};
1: instance

CoDeSys V2.3

5-17

CoDeSys

2:
"stru1" ( a,b,c)
'Instance', "strulist_temp"; a,b,c,
, "high" ,
2. , :
struvar:stru1{instance list=strulist template=strulist_templ baseindex=16#2
basesubindex=16#0 [accesslevel=high] };

2: Template

() VAR_CONFIG:

CoDeSys V2.3

5-18

CoDeSys

Instance' VAR_CONFIG ( ).
, :
{instance list=<name> path=<path> template=<template> baseindex=<index>
basesubindex=<subindex>[ <key>=<value> <key>=<value> ...further keys ] }
<path> , "PLC_PRG. fb1", fb1
: VAR_CONFIG
"fb1" "varinst1" "fb1_templ".
2 (baseindex),
(basesubindex). "fb1var",
:
VAR_CONFIG
{instance list=varinst1 path=PLC_PRG.fb1 template=fb1_templ baseindex=16#2
basesubindex=16#0 [ name=fb1var ]}
END_VAR

PERSISTENT

PERSISTENT, persist.dat. :
{nonpersistent} . ,
PERSISTENT .
:
local fblevel3
.
FUNCTION_BLOCK FB_Level_2
{nonpersistent}
VAR_INPUT
bvar_in : BOOL;
END_VAR
VAR_OUTPUT
bvar_out : BOOL;
END_VAR
VAR
ivar2 : INT;
END_VAR
VAR PERSISTENT
local : INT := 33;
fblevel3 : FB_Level_3;
END_VAR

CoDeSys V2.3

5-19

CoDeSys

5.3
5.3.1
( IL ST) CoDeSys Windows.
. .
OV . <Ins>,
.
ST IL

,
<Ctrl> +<F10>.
:
Insert Operator
.
OK, .
Insert Operand
. (, , ), .
OK,
( Input Assistant).

CoDeSys V2.3

5-20

CoDeSys

Insert Function
, .
OK.

.

With Argument,

Insert Function Block


. , : , .
OK.
With Arguments, .
POU c
ST IL POU -
POU.
: out1 a.
IL:
ST:

CAL afbinst(in1:=1, out1=>a)


afbinst(in1:=1, out1=>a);

POU (<F2>) 'With arguments', ST


IL .
.
Online
CoDeSys .
Online-, .
Online .
, . , .
, .
, :
. : a AND b :=TRUE, a b .
(, a.2 ":=TRUE, a 4).
, , .

CoDeSys V2.3

5-21

CoDeSys

Extras Monitoring Options


, .
. , .
Width Distance
. , 1 .
, , .


.. CoDeSys IL , . ,
, . . . , , , . . , .
IL :

POU.

LD,LDN

JMP, JMPC, JMPCN

CAL, CALC, CALCN

RET, RETC, RETCN

POU

ST :

RETURN EXIT.

, (WHILE, IF,REPEAT)

POU

, , .

CoDeSys V2.3

5-22

CoDeSys

IL c ( -)

?
, ,
. - , PLC.
.
, .
(Online Toggle Breakpoint), <F9> .
.
, .
PLC.
, Online Run.
, Online Step over Step in
. Step over,
, POU. Step in POU.
.
POU.
Offline .
Online , .
:
-: , .
:

CoDeSys V2.3

5-23

CoDeSys

Online .

5.3.2 IL
, IL CoDeSys:
IL

POU ,
.
IL Windows.
CoDeSys POU :
:
CAL CTU_inst(
CU:=%IX10,
PV:=(
LD A
ADD 5
)
)
, , 2.2.1. Instruction List (IL).
IL Online.
Online Flow control, , . IL Online
Online.

CoDeSys V2.3

5-24

CoDeSys

5.3.3 ST
, ST CoDeSys
ST

POU ,
.
ST Windows.
ST Online
Online.
, , 2.2.2. Structured Text (ST).

5.4
5.4.1
SFC, LD, FBD CFC, . LD, FBD, CFC SFC.
(Zoom)
SFC, LD, FBD, CFC .
, ,
.

CoDeSys V2.3

5-25

CoDeSys

100%.
.
100%.
, 25% 400%. 10%
500%.
, .
.
, , , ,
. Online ; Online .
,
<Ctrl> .

LD FBD .
: , , , , ,
.

, . , , . , .
, Extras Options
() . Extras Options
.
maximum comment size ( 4). minimum comment size
, . , , 2, , , .
0, .
, ,
. : Insert Comment. .

CoDeSys V2.3

5-26

CoDeSys

LD FBD:

Alternative Look & Feel: .



. Comments per Contact Lines for
Contact Comment , .
Lines for Variable text , ,
.
.
:

Networks with Linebreaks


, .

CoDeSys V2.3

5-27

CoDeSys

Replace with Symbol after entering Address: ( ): ,


( "%QB4").
, . , .
Set Contact Comment to Symbol Comment: , . (. :
) ,
'Comments per Contact'. ,
, , !
Show Address of Symbol: ( ): , . (. :
).
Show Variable Comments per Rung in Printout: ,
, , ,
. .
:

:
OK: , POU .
Apply options: , .
. .
Insert Network(after) Insert Network(before)
Network(after): <Shift> +<T>
FBD LD, Insert
Network(after) Insert Network(before) . , . . <Shift>, , .
Online
Online FBD LD .
, , .
, . Step in
Step out, .

CoDeSys V2.3

5-28

CoDeSys

, . : a
AND b :=TRUE, a b . (, a.2 :=TRUE, a
4).
Online Display Flow Control. , , .
,
. , , .
TRUE, .
Online, , ,
( ).

CoDeSys V2.3

5-29

CoDeSys

5.4.2 FBD
FBD

FBD - . ,
, , ,
.
,
<Ctrl>+<F10>.
,
5.4.1 , Extras Options.

FBD
FBD , .
.
.
:
1) ( ):

2) :

CoDeSys V2.3

5-30

CoDeSys

3) , .

4) , .

5) , :

6) ( ;
)

7) :


.

. ,
. .
"???". ,
.
Insert Assign
:

:<Ctrl>+<A>

.
(. FBD)
( 2), ( 4)
( 6). ,
, .
(F2).
(. 5.4.1 , Extras Options).

CoDeSys V2.3

5-31

CoDeSys

, Insert Output.
Insert Jump
:

:<Ctrl>+<L>

.
(. FBD)
( 2), (
4) ( 6).
, ,
.
Insert Return
:

:<Ctrl>+<R>

Return.
(. FBD)
( 2), (
4), 5 ( 6).
Insert Box
:

:<Ctrl>+<B>

C , ,
. AND. , AND, (,
, , ), . , Input Assistant (<F2>). , AND,
.
.
, . ( ), , . , <F2> Input Assistant.
POU :

( 2). POU . POU , . POU .

( 4), POU .
POU . POU , .

POU ( 3) , .
, , .
, , . .

CoDeSys V2.3

5-32

CoDeSys

, POU .
POU , . POU , .

( 6). POU
.

POU, , .
.
POU ,
POU.
Insert Input
:

:<Ctrl>+<U>

. (,
ADD ).
, ( 1), Insert Input. :
( 3) Insert Input,
.
???. , Input Assistant.
(. 5.4.1 , Extras Options).
Insert Output
:
. .
( 5, .
FBD) ( 4), .
, ( 4),
.
???.
, Input Assistant.
(. 5.4.1 , Extras Options).

CoDeSys V2.3

5-33

CoDeSys

Extras Negate
:

:<Ctrl>+<N>

C , , .
.
( 2), .
.
, ,
, FALSE.
.
Extras Set/Reset
:
Set- Reset-. Set-
S, Reset- R.
Set/Reset FBD

Set- TRUE, Reset- FALSE, , , TRUE. FALSE, .


Set-, Reset- .
ExtrasView
, LD FBD
(POU) FBD . Offline Online .
Open instance
'Project' 'Open instance' . (<F2>)
'Extras' ,
.
(Cut), (Copy), (Paste) (Delete) FBD
Edit.
( 5), ,
, , , .

CoDeSys V2.3

5-34

CoDeSys

POU ( 5),
, .
, , , ,
.
, . .
POU ( , , ,
), .
( POU), , , .
, .
: C : ; , , , . Edit Cut.
, Edit Paste.
.

FBD Online
Online FBD .
, . , . .
Step in Step over, ,
.
. ,
.
.
. , ,
. Online
Write values. .
Online Display Flow Control. , , .
,
. , , . TRUE, . .
Online, , ,
.

CoDeSys V2.3

5-35

CoDeSys

5.4.3 LD
POU LD

POU POU. .
LD . ,
<Ctrl>+<F10>.
,
5.4.1 , Extras Options.
2.2.6 Ladder Diagram(LD).
LD
,
. POU, EN, FBD.
FBD.
( )

CoDeSys V2.3

5-36

CoDeSys

, .

LD :
LD
(drag&drop) (,
) LD .
(, ) , . . . .

,
. ,
. (), .

'Insert' 'Network (before)'


:

CoDeSys V2.3

5-37

CoDeSys

, LD.
'Insert' 'Network (after)'
:
, LD.
Insert Contact
:

: <Ctrl>+<K>

.
( 3) , (
4), .
. . Input Assistant.
(. 5.4.1 , Extras Options).
'Insert' 'Contact (negated)'
:

: <Ctrl> + <G>

.
'Insert' 'Contact' 'Extras' 'Negate'.
Insert Parallel Contact
:

: <Ctrl>+<R>

, .
( 3) , (
4), ,
.
.
. Input Assistant.
'Insert' 'Parallel Contact (negated)'
:

: <Ctrl> + <O>

.
'Insert' 'Parallel Contact' 'Extras' 'Negate'.
Insert Coil
:

CoDeSys V2.3

: <Ctrl>+<L>

5-38

CoDeSys

, .
( 3) , ( 4), .
. , .
, , ???,
, . Input Assistant.
.
(. , "Extras"
'Options').
'Insert' ''Set' coil'
:

: <Ctrl> + <I>

Set , . 'Insert' 'Coil' 'Extras' 'Set/Reset'.


'Insert' 'Reset' coil'
:
Reset , . 'Insert' 'Coil' 'Extras' 'Set/Reset'.
Insert Function Block
:

: <Ctrl>+<B>

, , .
( 3) , ( 4), . AND.
. Input Assistant,
POU.
POU ,
BOOL. POU , , .
Input Assistant.
(.
, "Extras" 'Options').
POU c EN.
POU , POU
EN.
POU EN- Insert Box with EN. , , EN- , FBD. EN , . POU , , EN-, TRUE.

CoDeSys V2.3

5-39

CoDeSys

EN POU . ,
POU .
, FBD ,
EN- . FBD.
FBD.
Insert Box with EN
:
, ,
EN- LD.
( 3) ,
( 4). POU
AND. . Input Assistant.
Insert Insert at blocks
POU.
, , , FBD (. 5.7).
Input POU.
Output POU.
POU POU .
Assign .
.
'Insert' 'Rising edge detection'
:
R_TRIG, (FALSE -> TRUE) .
'Insert' 'Falling edge detection'
:
F_TRIG, (TRUE -> FALSE) .
'Insert' 'Timer (TON)'
:
TON,
.

CoDeSys V2.3

5-40

CoDeSys

Insert Jump
,
, . , , On, .
( 3) ,
( 4).
???.
.
Insert Return
LD , , . , , On, POU.
( 3) ,
( 4).
'Extras' 'Paste after'
. , , .
Extras Paste below
.
, , .
.
Extras Paste above
.
, , .
.
Extras Negate
:

: <Ctrl>+<N>

, ,
, POU ( 2 3). ((/) |/|). ,
POU , FBD.
, . ,
False.
, ,
Off.
, .

CoDeSys V2.3

5-41

CoDeSys

Extras Set/Reset
:
, Set-. True,
On, , Off.
S.
, Reset-. False, On,
, Off.
R.
, Set-, Reset- .
LD Online
Online , On, .
, , On, .
.
Online .
, , .

CoDeSys V2.3

5-42

CoDeSys

5.4.4 SFC
SFC

POU POU. .
SFC . ,
<Ctrl>+<F10>. , , , , , , Online Offline.
Sequential Function Chart (SFC).
SFC SFC. :
SFC
SFC,
.
(, , )
. , , <Shift> . .
: , !

CoDeSys V2.3

5-43

CoDeSys

Insert Step Transition (before)

: : <Ctrl>+<T>

, , .
Insert Step Transition (after)
:

: <Ctrl>+<E>

, , .

, .
'Edit' 'Delete'
<Del>.
Insert Alternative Branch (right)
:

: <Ctrl>+<A>

. .
.
Insert Alternative Branch (left)
:
. .
.
Insert Parallel Branch(right)
:

: <Ctrl>+<L>

. .
. (jump) .
Add Label To Parallel Branch.
Insert Parallel Branch(left)
:

<Ctrl>+<U>

. .
. (jump) . Add Label To Parallel Branch.

CoDeSys V2.3

5-44

CoDeSys

Insert Jump
:
(jump) , . Step.
, .
Insert Transition-Jump
:
(jump)
.
Step.
, .
Insert Add Entry-Actions
.
.
E .
Insert Add Exit-Actions
.
.
X .
Extras Paste Parallel Branch (right)
.
.
, SFC, .
Extras Add label to parallel Branch
,
Add label to parallel Branch. ,
Parallel . .
Parallel Par_1_2 Ende
.

CoDeSys V2.3

5-45

CoDeSys


, .
Extras Paste after
SFC . , SFC.
Extras Zoom Action/Transition
: <Alt>+<Enter>
, . , , .
, , , , . : i>100 , FALSE, , TRUE!

Extras Clear Action/Transition


.
( , , ),
. , , , .
, - , , .
, , .
, .

CoDeSys V2.3

5-46

CoDeSys

Extras Step Attributes


.

. Minimum Time . Maximum Time . , Time (, T#3s), Time.


Comment . Sequential function chart options, Extras Options, ,
SFC.
.
, , SFC, .
2 10
. Online, , .

Extras Time Overview


SFC.

CoDeSys V2.3

5-47

CoDeSys

SFC POU

POU. , ( , ). ,
Minimal Time Maximal Time . , OK,
.
, 2 6 . 2 2 , 10 . 6 7 8 .
Extras Options
SFC .
SFC

6 SFC. Height of Step (


4). Width of Step ( 6).
Display at Step , : (Nothing),
(Comment) (Time Limits)
Extras Associate Action
.
, , .

CoDeSys V2.3

5-48

CoDeSys

N Action_1.
. Input Assistant.
Object Organizer, POU Project Add Action.
Extras Use IEC-Steps
:
( ), -.
, SFC POU, Init .
CoDeSys.ini CoDeSys.
SFC Online
Online . Time Limits
Extras Options,
.
, 8 410 . , 7 .

Online Toggle Breakpoint


, , . . ,
, .
, .
Online .

CoDeSys V2.3

5-49

CoDeSys

SFC Online

Switch , Step10.
Online Step over . - :

POU, , POU,
, POU. POU PLC_PRG,
;

,
;

, , POU. ;

, .
Online Step in ,
. , ,
-, . .
, , .

CoDeSys V2.3

5-50

CoDeSys

: (Online Change)
, !


1. -, -( , ).
2. , , , , .
3. , , , , .
4. :

, .

-, SFC-.

-, .

5. , -, .
, .
.
6. :
True ( , ),
.
:
, (, SFC , SFC,
. , ).

. , , CoDeSys.
: (, Bool1 AND Bool2) .

CoDeSys V2.3

5-51

CoDeSys

5.4.5 CFC
CFC

, .
CFC , , , , , .
, .
. ,
, , ,
,
.
CFC FBD , .
.

CFC . .
. .
1.

CoDeSys V2.3

, , , , .

5-52

CoDeSys

2.

3.

: , , , .

4.

: .

Insert Box
:

: <Ctrl> + <B>.

, , . AND.
, , ,
. Input Assistant.
, .
, , .
Insert Input
:

: <Ctrl> + <E>.

. , . Input Assistant.

CoDeSys V2.3

5-53

CoDeSys

Insert Output
:

: <Ctrl> + <A>.

. ,
. Input Assistant.
.
Insert Jump
:

: <Ctrl> + <J>.

. ,
. Insert Label.
Insert Label
:

: <Ctrl> + <L>.

. ,
. Online POU Return.
, Insert Jump.
Insert Return
:

: <Ctrl> + <R>.

RETURN. , Online
RETURN , POU, .
Insert Comment
:

: <Ctrl> + <K>.

. , <Ctrl>+<Enter>.
Insert Input of box
: <Ctrl> + <U>.
. (, ADD
).
, ( 1).
Insert In-Pin, Insert Out-Pin
:
.
, POU .

CoDeSys V2.3

5-54

CoDeSys

Extras Negate
:

: <Ctrl>+<N>.

, , .
.
, .
Extras Set/Reset
:

: <Ctrl>+<T>.

, .
Set S, Reset - R.

VarOut1 TRUE, VarIn1 , ,


VarIn1 .
VarOut2 FALSE, VarIn2 , ,
VarIn1 .
Set, Reset .
Extras EN/ENO
:

: <Ctrl>+<0>.

( 3) EN ENO.

VarOut TRUE ADD. condition FALSE,


ADD ( , ) . ,
! VarOut AND TRUE.
, ENO.

CoDeSys V2.3

5-55

CoDeSys

X , Y . , .
X , 10. LT (0)
FALSE SUB(3) ADD(5). X
, Y , LT(0) , X 10. Y , 1 10.
Extras Properties
, (VAR_INPUT CONSTANTS) . ,
( 1) . CFC
.
Edit Parameters

(VAR_INPUT CONSTANT) . Value.


<Enter>, - <Esc>.
OK .

CoDeSys V2.3

5-56

CoDeSys

"VAR_INPUT
CONSTANT" CFC. FBD INPUT VAR_INPUT
VAR_INPUT CONSTANT. .


, ( 1).
, <Shift>
, , .
Extras Select all .

,
<Shift>. : ,
. ,
. ,
.

Edit Copy Edit Paste.

.
.
E2 E1.

E1 ( 4),
, , E2 ( 3)
. .
: E2,
, , E1. .
, () () . , .
E2 , , E1 E2,
. , . , E2
, , .
( ).
.
, . ,

CoDeSys V2.3

5-57

CoDeSys

- .
, .

, E1 E2:
E1 E2 ( 4) <Delete> Edit Delete. E1 ,
.
E2 , ,
. , .

E1 E2
E1 E3. E2 ( 3),
, E3 .
Extras Connectionmark
, .
, .

.
( 3) Extras Connectionmark . , .
, . ,
.
1. :
, .
, . .
2. :
, 1.
, ( 4) Extras Connection marker .
/
- . , ,
, .

CoDeSys V2.3

5-58

CoDeSys


, .

: . .
.
, .
Extras Order Show order
, . ( ). .
Extras Order Order topologically
. . ,
.
, . , .
:

1, 2 3. Order topologically
. Var3, , 2, AND
4, 5.

CoDeSys V2.3

5-59

CoDeSys

, , .
Extras Order Order one up

.
Extras Order Order one down

.
Extras Order Order first
.
.
Extras Order Order last
.
.
Extras Order Everything ordered by data flow
. ,
. .

CoDeSys V2.3

5-60

CoDeSys

Everything ordered by data flow

.
, CoDeSys
. , AND ,
(1 2), SUB , ADD.
.

CoDeSys V2.3

5-61

CoDeSys

, Output , ,
. , ,
.
Extras Create macro
:
POU ,
. /,
. , ,
. In<n>, Out<n>. ,
.
Macro, .
.
.
:

Extras Jump into Macro


:

CoDeSys V2.3

5-62

CoDeSys

POU. .
.
POU. ,
. , - .

,
, . . .
.
.
.
Extras Expand Macro
Create Macro.
.
- , ,
.
: 2.1 , . CFC,
.

Extras Back one macro level, Back all macro level


:
, . ,
.
CFC
CFC. ,
, .
. , , 1 SINT. ,
, .
, . x y INT.

:
y , .
SINT, INT. x y 129 .
x INT, -127, .
y 129 .

CoDeSys V2.3

5-63

CoDeSys

CFC Online
:
.
. ,
. , TRUE, , FALSE.
, TRUE,
.
.

, , ,
.
:
, , ,
.
:
, .
. Breakpoints.
<F9> Online Toggle breakpoint. ,
. , .

Return:

CoDeSys V2.3

5-64

CoDeSys

Online Return. POU, , POU, . Return .


:
Step over . POU, Step in.

CoDeSys V2.3

5-65

6
6.1
Resources ,
:

Global Variables - , .
, .

Alarm configuration CoDeSys .

Library Manager , .

Log online .

PLC Configuration - .

Watch and Receipt Manager .

Task Configuration .

Target settings

Workspace .

Parameter Manager , .

PLC Browser .

Sampling Trace .

Tools CoDeSys.

SoftMotion ( ): CNC CAM (.


SoftMotion).

(Docuframe file) (, ..),


.

6.2 ,

Global Variables Resources (. . 6.1) (
):

(Global Variables).

(Variable Configuration).

, , .
Global Variables ( "+"), "Object Open". Global Variables ,
.
, .

,
.
, Global Variables "Project" "Object Add".
. VAR_
GLOBAL. ,
VAR_CONFIG.

CoDeSys V2.3

6-2

6.2.1
?
, , , . , (Network variables)
.
: ,
, !

. , , "var1" PLC Configuration, , .



: ( Network functionality).

( -
)
(CoDeSys ) . . ,
. ,
.
! online . !


( Global Variables).
, .
. 'Project' 'Object' 'Add'. (. . ) .
'Project' 'Object' 'Properties',
.
Name of the global variable list:
(Link to file):
(*.esp) DCF (*.dcf), , .
Filename. Browse . DCF
.
Import before compile . Export before compile
.

CoDeSys V2.3

6-3

OK .
. ,

'Project' 'Object' 'Properties'.


'Support network variables' , <Add network>. , , . , .
Connection <n> (<Network type>):
. . .
, UDP
'Connection 1 (UDP)'. 'Add network'
Connection.
Network type: .
: CAN" UDP".
Settings: :

CoDeSys V2.3

6-4

UDP:

Use standard (Port 1202) . Broadcast/Multicast "255 . 255 . 255 . 255",


: .
Port: . , ! UDP
, .
Broadcast/Multicast address: , (, "197 . 200 . 100 . 255", IP- 197 . 200 . 100 . x).
Win32 , Broadcast/Multicast TCP/IP PC.

UDP

CAN:
Controller Index: CAN, .
:
Pack variables: (), . ,
.
Variable telegram number: (
1). .
Include Checksum: .
. , , (. 'Use acknowledge transfer'), .
Use acknowledged transfer: .
, .
Read: ; ,
.
Request at Bootup: ( 'Read' ),
(, ), . : 'Answer Bootup
requests' ! (. ).

CoDeSys V2.3

6-5

Write: ; :
Answer Bootup requests: ( 'Write'
), (. Request on Bootup). ,
(, ).
Cyclic transmission: ,
Interval ( , T#70ms).
Transmit on change: , . Minimum .
Transmit on event: , Variable
TRUE.

: , , . ,
, . .

. .

.
, .
, .
:
VAR_GLOBAL
(* *)
END_VAR
, .
, UDP.EXP :

CoDeSys V2.3

6-6

Retain variables, 'Online' 'Reset'


CoDeSys. Persistent variables , (, ).

PERSISTENT.

RETAIN

:
VAR_GLOBAL RETAIN
(* *)
END_VAR
VAR_GLOBAL PERSISTENT
(* *)
END_VAR
Persistent Retain ! :
VAR_GLOBAL RETAIN PERSISTENT VAR_GLOBAL PERSISTENT RETAIN

CONSTANT.
:
VAR_GLOBAL CONSTANT
(* *)
END_VAR

6.2.2

. , "", .
locio %I %Q. "*".
:
FUNCTION_BLOCK locio
VAR
loci AT %I*: BOOL := TRUE;
loco AT %Q*: BOOL;
END_VAR
Hugo tto , , :
.
PROGRAM PLC_PRG
VAR
Hugo: locio;
Otto: locio;
END_VAR
Variable
Configuration:
VAR_CONFIG

CoDeSys V2.3

6-7

PLC_PRG. Hugo.loci AT %IX1.0 : BOOL;


PLC_PRG. Hugo.loco AT %QX0.0 : BOOL;
PLC_PRG. Otto.loci AT %IX1.0 : BOOL;
PLC_PRG.Otto.loco AT %QX0.3 : BOOL;
END_VAR
( ) . , .
, . "*"
Variable Configuration. , , .
"All Instance Paths" Insert.
"Insert" "All Instance Paths"
VAR_CONFIG, .
.
, . ("Project", "Rebuild All").

6.2.3
, (, ), ,
, ,
. : "Extras" "Make Docuframe
File". . DOCUFILE. . 3 :
VAR, , , , , , , . .
, , .
, .

CoDeSys V2.3

6-8

, "Extras""Link File".
, , . .
"Extras" "Make Docuframe File"
, .
. *.txt. , .
"Extras" "Link Docu File"
. , . . .
"Extras" "Make Docuframe File".

6.3 (Alarm Configuration)


6.3.1
, CoDeSys, ,
. CoDeSys .
'' .
'Alarm configuration' 'Resources'.
(alarm classes) (alarm groups). , . ( ), . , .
,
'System' .
CoDeSys Alarm table. , .
(History), (Alarm-Events), log- .
'Alarm configuration' Resources, 'Alarm configuration'.
, PLC Configuration Task configuration. , - .

CoDeSys V2.3

6-9

"" 'Alarm configuration'. , 'Alarm classes' 'System'.

6.3.2
CoDeSys :
(Alarm): - , ( ).
(Priority): . "0". - "255".
(Alarm state): / , : NORM - , INTO - , ACK - , OUTOF - "" ( !).
(Sub-State): (Lo , Hi
) "" (LoLo, HiHi). :
HI, HI-. , , HI- HIHI- ( , ). HI- .
(Acknowledgement of alarms): , . , ( ).
, .
(Alarm Event): .
. - , . CoDeSys (INTO, ACK, OUTOF).

CoDeSys V2.3

6-10

CoDeSys :

, .

'Alarm table'

6.3.3
, , , , , , .
.
:
'Alarm classes' ,
.
'Alarm classes'

Add .

CoDeSys V2.3

6-11

, "NOACK"
( ) Acknowledgement ().
Name ( ).
, Acknowledgement.
:
NO_ACK: .
ACK_INTO: "" ( "INTO") .
ACK_OUTOF: "" ( "OUTOF") .
ACK_ALL: "" "" .
Comment.
. Delete .
<class name>:
, , ,
.
(Possible actions) ">",
(Assigned actions).
, . ">>" . "<" . "<<" . " ... " : , , , ,
.
(Possible actions):

Save:

Print:


log .
!

,
Alarm saving.

Printer: ;
Outputtext: (. ),
.
.

Message:

E-Mail:

CoDeSys V2.3

Message: ,
.

e-mail .

From: ; To: ;
Subject: ; Message: (.
); Server: smtp .

6-12

Variable:

CoDeSys .

Execute:

Variable: :

(<F2>):
: NORM =0 INTO=1.
: NORM
=0, INTO =1, ACK =2, OUTOF =4; Message (. ).
Executable file: (, notepad.exe),
"..."
; Parameter: ,
exe).

:
'Message', 'Print', 'Email' 'Variable' , .
<Ctrl>+<Enter>.
(placeholders):
MESSAGE

,
.

DATE

(INTO).

TIME

EXPRESSION

( ), .

PRIORITY

( ).

VALUE

(. ).

TYPE

( ).

CLASS

( ).

TARGETVALUE

DEV+ DEV- (
) .

DEADBAND

( ).

ALLDEFAULT

, log
(History).

:
, :

CoDeSys V2.3

6-13

(Message): "Temperature too high!".


:

:
, ,
*.vis- *.tlt. : "#" (: "#Temperature critical !#" "TIME /EXPRESSION:
MESSAGE #current#: VALUE"). ALARMTEXT_ITEM .

Alarm Events for actions ( ):


, :
INTO

(Status = INTO).

ACK

(Status = ACK).

OUTOF (Status = OUT OF).


Colors/Bitmaps for class <class name> ( )
,
. Foreground, Background color INTO, ACK OUTOF (. ).
. (bitmap).

6.3.4
.
.
.
, .
. Alarm group .

CoDeSys V2.3

6-14

Description.
Deactivation variable .
( ) .
.
Add . . :
Expression: , (, "a + b"), . <F2>
.
Type: . .
DIG=0 , FALSE.
DIG=1 , TRUE.
LOLO , Alarm type LOLO.
(Deadband).
, ,
LOLO.
LO LOLO.
HI , Alarm type HI. (Deadband). , , HI.
HIHI HI.

CoDeSys V2.3

6-15

DEV- - ;
, Alarm type DEV-. = (target value) * (deviation in %) / 100.
DEV+ + ; ,
, Alarm type DEV+. =
(target value) * (deviation in %) / 100.
ROC ; , .
(Rate of changes) : , (units per).
Class: . . , , .
Priority: 0-152. 0 - .
.
Message: . . OK . (acknowledge) . log
( ).
Deactivation: .
, 'Deactivation variable'! (. ).

6.3.5
, ,
'Save'.
'Alarm saving':
'Alarm saving'

:
Filepath: () , Filename; "..."
.
'Alarmhandling on PLC', , .
Filename: , .
, , ".alm". ,
log-. "0";
( , File change event)
: 1, 2 .. (: "alarmlog0.alm", "alarmlog1.alm).

CoDeSys V2.3

6-16

File change event: , . : Never , Hour , Day , Week , Month , , Triggervariable,


Number of records .
Triggervariable Number of records: File change event.
Delete old files after .. Hours: , log- .
(log-file) .
, :
Date/Time
DWORD
1046963332

6.3.03

16:08:52

INTO

PLC_PRG.b

LO

1046963333

6.3.03

16:08:53

ACK

PLC_PRG.n

HIHI

:
.
-30

.
-31

35

Alarm_high

Temperature !

Warnng

Rising Temp. !

log-:
1046963332,6.3.03 16:08:52,INTO,PLC_PRG.ivar5,HIHI,,,,

9.00,a_class2,0,

1046963333,6.3.03 16:08:53,INTO,PLC_PRG.ivar4,ROC,2,,,

6.00,a_class2,2,

1046963333,6.3.03 16:08:53,INTO,PLC_PRG.ivar3,DEV-,,,,

-6.00,a_class2,5,

1046963334,6.3.03 16:08:54,INTO,PLC_PRG.ivar2,LOLO,-35,,3,
1046963334,6.3.03 16:08:54,INTO,PLC_PRG.ivar1,HI,20,,5,

-47.00,warning,10,warning: low temperature !

47.00,a_class1,2,temperature to high! Acknowldge!

6.3.6 'Extras' : Settings ()


Alarm configuration settings 'Extras' 'Settings'
(Alarm Configuration):
Categorie Date/Time:
.
. :
: dd'-'MM'-'yyyy -> : "12.Jan-1993"
: hh':'mm':'ss -> : "11:10:34"
Language:

CoDeSys V2.3

6-17

, CoDeSys.
.
CoDeSys.
Project Translate into another language, .

6.4 (Library Manager)


, . U, , U .
,
'Informations about external library'. 'Extras' 'Properties'.
"Window" "Library Manager".


3 4 . , ,
. , ,
U, .
<Enter>. , .
U, U, .
.

"standard.lib" . , 61131-3. -

CoDeSys V2.3

6-18

, , U
(standard.lib).
POU - CoDeSys.
,
, .
. , .
, CoDeSys, Internal Library.
, ,
( ), (External Library).
"*.h". . POU, ,
. ,
, CoDeSys. C .
, Edit license
info... 'Edit Licensing Informationen'. . 'File' 'Save as...'
CoDeSys.
"Insert" "Additional Library"
.
"*.lib". , .
, . ,
.
:

standard.lib

"D:\codesys\libraries\standard".
, :
"standard.lib < >".
"D:\codesys\libraries",
: "standard\standard.lib < >".
, :
"D:\codesys\libraries\standard\standard.lib < >".

. , , , .
,
, ,
.
. . 'License information'.

CoDeSys V2.3

6-19


"Edit" "Delete".
'Extras' 'Properties'
'Informations about internal ( external) library'. , Project Info (
). .

6.5 (Log)
- , Online . (*.log).
- .
Offline Online .
Window Log
. 'Log' .
Log .
, (Internal).

CoDeSys V2.3

6-20

.
. , , Field Log.
, , :
Category: , . 4 :
User actions: Online (
Online)
Internal actions: Online (, (Delete
Buffers) (Init Debugging)).
Status change: (, ).

Exception: , , .

Description: . ,
Online. ,
OnlineXXX().
Info: , .
, .
System time: .
Relative time: Online- .
Duration: .
Log
, Log, :
Load. (*.log).
. ,
Online , .
Save. . Online , .

CoDeSys V2.3

6-21

,
.
Display Project Log. ,
. .

, (.
), < >.log. Log. ,
.
Online- Log.
, .

CoDeSys V2.3

6-22

6.6 (PLC Configuration)


6.6.1
PLC Configuration
( )
. . / , . CoDeSys ,
, .
() *. cfg (. ) (, *.gsd, *.eds). , (. Target Settings),
CoDeSys. .
*.cfg , .
, .
: *.cfg , CoDeSys !
: CoDeSys V2.2 .
*.cfg.
*.con. : (old)
. .
*.con . , . , *.cfg
(. 'Extras' 'Convert').

CoDeSys /,
CAN Profibus.
, : 1) PLC Configuration, 2)
CoDeSys, 3) PLC Configuration.
.

CoDeSys V2.3

6-23

CAN:

. .
/ , (, CAN-bus
8 ).
.
.

(PLC Configuration): CoDeSys, -.
: . -.
, .
.
: -. , . . ,
.
.
: .
: , .
- . 'Calculate addresses',
. . , ( ) . : %QB0, %IB26,
%MW4.
: , , . :
%QW2.4.6
%QX2.4.6.10

CoDeSys V2.3

: CAN bus VME Slot 2, CAN- Id 4 6.


:10 .

6-24

: . . .

6.6.2
. . ,
CoDeSys.
.
, 'Extras' 'Properties'.
,
.
: (CAN, Profibus, I/O,
.).

. .
, "", .
<Enter>.
( ""), .
, 'Insert' 'Insert element', 'Insert' 'Append subelement'
() , , , . ,
. .
o

'Insert' 'Insert element' ,


.

'Insert' 'Append subelement' . .

(
<Ctrl>+<F10>).
: , CoDeSys PLC Configuration.
/ , 'Extras' 'Replace element''
.
.
'Extras' 'Replace element'.

CoDeSys V2.3

6-25


.

(AT). .

'AT'.
.
.
/
(*.cfg) ,
'Export module' 'Import module'.
, .
'Export module' .
. ,
XML.
'Import module', .

.

6.6.3
.
'Settings'. :
Calculate addresses: , . . 'Extras' 'Compute addresses'.
Check for overlapping addresses:
, .
Save configuration files in project: *.cfg
, , .
, . , .
, .

CoDeSys V2.3

6-26

( ),
, .
'Extras' 'Compute addresses'
"Calculate addresses" 'Settings' , 'Extras' 'Compute addresses' . , .
'Add configuration file'
'Extras' . () : 'Directories', 'Configuration files'.
Select configuration file ,
: CAN- (*.eds,*.dcf), Profibus- (*.gsd), (*.cfg ) (*.*).

. , .
, Select configuration directory. . ,
. OK. .
'Extras' 'Standard configuration'
'Extras' 'Standard configuration' , *.cfg .
: *.cfg , . , , !

'Extras' 'Convert'
'Convert' , , ,
CoDeSys V2. 2. ,
'Convert' .
: "Convert the configuration to the new format? Attention: Undo is not
possible !" ( ? : !).
Yes, . , !

6.6.4
.
'Hook'-DLL,
. , 'Module parameters' , DLL.

CoDeSys V2.3

6-27

(Custom Parameters):

6.6.5 /
/
/

/ ,
:
Module id: . .
.
Node number: .

CoDeSys V2.3

6-28

Input address, Output address, Diagnostic address: , .


. , .
Do not adapt address automatically: , . , . ( : .)
Comment: .
Load module description: ,
. . *.cfg.
:
(M) .
/ . , , CAN Profibus DP, :
GetBusState, (, BusDiag.lib 3S - Smart Software Solutions).
, ,
. ,
DiagGetState. . (masters), CoDeSys!
,
DiagGetState CoDeSys .
DiagGetState:
ENABLE: BOOL;
DRIVERNAME: POINTER TO
STRING;
DEVICENUMBER:INT;

BUSMEMBERID:DWORD ;

ENABLE.
( ),
. 0,
.
, . ,
Hilscher 5 .
0.
(, CANopen - NodeID, PB-DP -
..).

DiagGetState:
READY:BOOL ;

TRUE:

STATE:INT;

READY = TRUE, STATE ,


:
-1:
(NDSTATE_INVALID_INPUTPARAM:INT;)
0:
(NDSTATE_NOTENABLED:INT;)

CoDeSys V2.3

6-29

EXTENDEDINFO:ARRAY[0..129] OF BYTE;

1:
(NDSTATE_GETDIAG_INFO:INT;)
2:
(NDSTATE_DIAGINFO_AVAILABLE:INT;)
3:
(NDSTATE_DIAGINFO_NOTAVAILABLE:INT;)
100 . , 0 2 :
Bit 0: .
Bit 1: .
Bit 2: .

/ /

, . 'value'.
Index: .
Name: .
Value: ().
. ( ) .
'Read Only', .
( ). - , 'Open file'
.
Default: .
Min.: ( ).
Max.: ( ).
.
. (Hook-DLL), .

CoDeSys V2.3

6-30

6.6.6

Channel-Id: .
Class: (I), (Q), (I&Q), (I|Q). ,
'Extras' 'Replace element'.
Size: [Byte].
Default identifier: .
. , .
Comment: , .
Address: , .
.

: Index, Name,
Value, Default, Min., Max. 'Custom Parameters'.

,
CreateBitChannels=TRUE.
Comment.

6.6.7 Profibus
CoDeSys Profibus DP. profibus (master) (slave). .
PROFIBUS DP .
, .

CoDeSys V2.3

6-31

. / .
CoDeSys gsd , . gsd- .
, gsd , . .
DP , : Base parameters, DP Parameter, Bus parameters, Module parameters.
DP DP , : ( ): Base parameters, DP Parameter, Input/Output,
User parameters, Groups, Module parameters.
"DP Parameter" .
DP , , : Base parameters, DP parameters, Input/Output, Module parameters.

(Base parameters) DP : Module ID,
Node number, Input, Output .
Do not adapt address automatically: , . , .

(Module parameters) DP
: ,
DP, , . , /.
DP
(DP parameters) , ( , ):

CoDeSys V2.3

6-32

6.6.7..1.1.1

Info Manufacturer (), GSD Revision, ID ( ), HW


Release SW Release ( ), GSD-

Module name

Addresses

Station address: 0 126. ,


(: DP 126 ).
.
Highest station address: (HSA), .
, GAP ( , ).

GSD GSD File.


(. ' DP' ')
.
Freeze " . Sync Synch ,
.
Freeze Sync (
).
DP /


(Bus parameters) .
Optimize, ,
Baudrate, , , GSD .
: !

CoDeSys V2.3

6-33

DP

.
Baud rate

GSD . , .

Optimize

, . , .

Slot Time

Min.Station Delay min. TSDR (in tbit): , (min. 11 tBit)


Max.Station Delay max. TSDR (in tbit): , .
Quiet Time

TQUI (in tbit): (idle), .

Target Rotation
Time

TTR (in tbit): ; ,


. .

Gap Update Factor GAP: ,


(
).
Max. Retry Limit

, , .

Min. Slave Interval , . GSD .


Poll Timeout

(Class 2 DP master) ( 1 ms).

Data Control Time . Data_Transfer_List.

CoDeSys V2.3

6-34

Data_Transfer_List.
Watchdog Time

(watchdog).
( 400 ms).

DP
(DP-Slaves) : Module
id, Node number, Input-, Output- Diagnostic address.
Do not adapt address automatically: , . , .
DP

DP
, (
, ):
DP

Info

CoDeSys V2.3

Manufacturer (), GSD Revision, ID ( ), HW Release SW Release ( ), GSD- ,

6-35

Standard parameter

Identnumber: , PNO .
DP GSD .
TSDR (Tbit*): Time Station Delay Responder: , ,
. (min. 11 TBit)
* TBit: PROFIBUS; ;
1 TBit 12MBaud=1/12.000.000 / = 83
Lock/Unlock: :
0: min.TSDR
1: ,
2: , ;
3:

Identification

Station address ( ' DP'), Station name - ,


.

Activation

: .
, , .

Watchdog

Watchdog Control , ( , 10 ms). ,


.

GSD GSD File.


/ DP
/

DP
.

CoDeSys V2.3

6-36

- Select,
. Delete. . ,
Profibus Modul, , . , Profibus
Channel, . ,
.
(Max. length of input data, Max. length of output data, Max. length of
in-/output data) (Max. number of modules) GSD-.
.
, . .
( GSD ),
-.
-
Delete.
Properties - 'Module properties',
. Name, Config (
PROFIBUS) . GSD , .
Symbolic names , .
/ DP

CoDeSys V2.3

6-37

DP
DP

, GSD-.
Parameters . Value.
. Value range.
GSD- . Symbolic
names, . Length of user parameters.

.
, (Sync. - Freeze)

CoDeSys V2.3

6-38

(. ' DP). Global Group Properties.


(), , "". / Group Membership 'Add slave to group'
() / 'Remove slave from group' () ( ).
, . A
slave device can only be assigned to those groups whose properties it supports.
(Sync. Mode / Freeze Mode). ,
.
DP
DP (. 6.6.5).
.
DP Profibus
Profibus , . ( ) : , DP , /.

6.6.8 CANopen-
CoDeSys CANOpen Draft Standart 301. , - .
EDS (Electronic Data Sheet) DCF (Device Configuration File) , ( PLCCONF), CoDeSys, PLC Configuration. EDS CAN, . , DCF,
-, .
CAN-
, Modul-Id, input-/output addresses, Diagnostic address, 6.6.5.
CAN- CAN-
CAN
Extras Properties.

CoDeSys V2.3

6-39

Baud rate.
PDO (Process Data Object) . , Sync. COB-ID (Communication Object Identifier), , Communication Cycle Period. PDO Sync. Window Length . . , Communication Cycle Period Sync. Window Length 0.
activate: .
Node-Id: CAN- (). 1 127. . (
Node-Id Node number.)
CAN , Automatic start. , .
Support DSP301, V3.01 and DSP306, CANSlave , , DSP301, V3.01
DSP306, Heartbeat. CAN , , , , Heartbeat Master[ms].
Heartbeat () Nodeguarding, , Master, Slave-. CAN-.
CAN-
CAN , (. 6.6.5). CAN-, , , .
CAN
, Modul id, Input/Output addresses, Diagnostic address,
6.6.5.

CoDeSys V2.3

6-40

-, PDO , output address input


address , PDO.
diagnostic address - (M).
.
CAN- CAN-
CAN CAN-

General
Node-Id: CAN- (). 1 127. .
Write DCF, DCF,
EDS , .
Create All SDOs, SDO , , .
Reset node, .
Optional device ( ) ,
. ,
.
No initialization SDO. ( SDO .)

CoDeSys V2.3

6-41

Node guard ( Heartbeat):


NodeGuarding, Guard Time ( ). Guard COBID (Communication Object Identifier). , timeout.
Life Time Factor , not OK.
, . , Guard Time Life Time Factor 0.
Heartbeat Settings ( Nodeguarding):
Active Heartbeat Producer , heartbeat-
Heartbeat Producer Time ( ).
Active Heartbeat Consumer, heartbeat-,
. , /.
Emergency Telegram:
COB-Id,
. , , .
Info, EDS DCF .
3 : FILE INFO, DEVICE INFO PDO INFO.
CAN-
(Available modules) .
Add (Selected Modules). Remove
. PDO SDO .
PDO CAN-
Receive PDO mapping Send PDO mapping
PDO (PDO mapping), EDS-.
PDO (Process
Data Object) >> PDO Remove. StandardDataTypes PDO.

CoDeSys V2.3

6-42

CAN-, PDO-

Insert PDO PDO. PDO . /


, . , . PDO , Properties.
PDO Properties

PDO COB-Id (Communication Object Identifier).


PDO, , .
Inhibit Time PDO. , PDO . , , PDO, , , .
CMS Priority Group - PDO . 0 7,
0.
Transmission Type- PDO. :

CoDeSys V2.3

acyclic-synchronous: PDO ,

6-43

acyclic-synchronous: PDO , Number of Sync .

synchronous-RTR only: PDO ,


(Remote Transmission Request)

asynchronous-RTR only: PDO (Remote Transmission Request)

asynchronous-device profile specific asynchronous-manufacturer specific: PDO


.

Number of Sync: PDO


.

Event-Time: .
Service Data Object (SDO)
Service Data Object , EDS DCF ,
0x2000 0x9FFF. .
SDO

Index, Name, Value Default. .


<>.
<Enter>, - <Esc>. SDO (Service Data Object) .
: , CANopen, -61131-3,
.

6.6.9 CANopen- (CANopen Slave)


, CoDeSys, CANopen Slave-
. CANopen Slave CanDevice.
EDS-. EDS-
CANopen .
CanDevice:
1.

a.

CoDeSys V2.3

3S_CanDrv.lib

6-44

b.
c.

3S_CanOpenManeger.lib
3S_CanOpenDevice.lib

. ,
CAN.
2.

*.cfg, ,
. PLC Configuration
CanDevice. 3 : Base settings, CAN settings, Default PDO mapping.

CanDevice
Base settings

Bus identifier:
Name of updatetask: , CanDevice.
.
EDS file generation: ,
EDS-, CAN-. Name
of EDS file . EDS
Template of EDS file. , , EDS, EDS_template.txt Template of EDS file. ,
EDS- device_xy.eds , , ,
device_xy.eds ( .eds). , .
, Browse

CoDeSys V2.3

6-45

CAN- CanDevice
CAN settings

Node id Baud rate. Node id ,


CANopen.
Nodeguarding Emergency Telegram (
). Heartbeat .

CoDeSys V2.3

6-46

PDO CanDevice
Default PDO mapping

PDO,
CanDevice. PDO-
, CanDevice .
, ,
/.
: 0 , ,
. 0 . ,
.

List of mappable objects: , PDO CanDevice. , Mapping, PDO CanDevice.


PDO . Variables Instance.
Objects. PDOs PDO. PDO Insert receive PDO Insert send PDO. PDO, , PDO >>. PDO ,
Properties.
Delete PDO .

CoDeSys V2.3

6-47

:
: PDO(COB-Id = 512+NodeId)
PLC_PRG.a

/
PLC_PRG.a. Network
functionality . .
Default PDO-Mapping PDO.

6.6.10 DeviceNet
CoDeSys , DeviceNet (EN50325). DeviceNet , Plug & Play ( , .).
DeviceNet CAN (Controller Area Network).
.
DeviceNet CoDeSys DeviceNet-, .
(DeviceNet-Slave) . DeviceNet-
"UCMM" (Unconnected Message Manager ) .
DeviceNet CoDeSys .
EDS (Electronic Data Sheet) , DeviceNet . CAN
".EDS", DeviceNet !
DeviceNet- , : , DeviceNet, .
(DeviceNet-Slave), , : ,
DeviceNet, -, .
DeviceNet-Master
DeviceNet Module id, Node number, Input address, Output address Diagnosis address.
(. 6.6.5, -).
DeviceNet DeviceNet-Master
Address . ID "Node-ID" CAN . ( Node number !) , : 0-63, :
0.
Baudrate [Baud] . : 125000 (
), 250000, 500000.

CoDeSys V2.3

6-48

DeviceNet DeviceNet-Master

DeviceNet-Master
(. 6.6.5. -). , .
DeviceNet-Slave
DeviceNet-Slave Input address
Output address. (. 6.6.5. -). ( ) .
DeviceNet DeviceNet-Slave
DeviceNet DeviceNet-Slave

:
Address: DeviceNet-Slave . ID
"Node-ID" CAN . ( Node number !) , : 0-63, : 0.

CoDeSys V2.3

6-49

Device active in configuration: , .


Info...: , EDS . ,
CAN ".EDS",
DeviceNet !
Expert...: Extended settings.
:

UCMM: (Unconnected Message Manager ). ( ), UCMM .


: Group1, Group2 Group3 ( ).
. Start
. , EDS
: Check vendor id, Check device type, Check product code, Check product version.
- DeviceNet-Slave
, ( ). , .
Selected I/O connection: , -:
Poll: (Master-Slave-)
Bit Strobe: DeviceNet , . , .
Change of State: . .
Cyclic: ,
( ).
Multicast Poll: .
I/O complete: Inputbytes Outputbytes.
'Inputs' 'Output'.

CoDeSys V2.3

6-50

- DeviceNet Slave

Extended: More settings,


:
'More settings', 'Cyclic'

CoDeSys V2.3

6-51

Expected Packet Rate: : 75 - ( )


.
Fragmentation timeout: []: 1600 . 8 , , .
. 'Action on timeout error'.
Action on timeout error: :
Transition to time out: ( ) .
Auto delete: - .
Auto reset: , ,
.
'Change of state':
Lock time for sending: ( :1) ( ) , .
. "0" ,
, .
Timeout[ms]: ( : 16) ,
.
Heartbeatrate[ms]: ( 250) ,
, .
'Bit Strobe':
Use output bit: ,
.
'Cyclic':
Interval [ms]: , ().
Timeout [ms]: ,
.
Inputs ():
Available connections Configured input connections >> . << .
. Length of
connection Length in Bytes.
.
.
.
Outputs ():

CoDeSys V2.3

6-52

, .
DeviceNet-Slave
EDS . .
Obj.: (
). EDS
( [Params], "Param<number>").
Typ: .
Acc.: : rw= , ro= .
Min., Max.: , .
Default:
Value: , EDS . . .
DeviceNet- Slave
(. 6.6.5. -).

6.6.11 Online
Online .
TRUE, , .
(, "=12").
.
. OK.
, (.
).

6.6.12 / /
(*.cfg ), ,
CoDeSys:

, Scan module configuration.
offline.

CoDeSys V2.3

6-53

. .

, Load module state.
online. ()
:
:

, .

.

, Show diagnosis messages.
online. , CoDeSys.

6.7 (Task Configuration)


6.7.1
PLC_PRG,
.
- . , . . (
freewheeling ) , (, ).
, . , , (
).
.
.
( ).
.
Online . ,
System events (.. , ,
) POU .

(Task Configuration) (Resources)
. 2 .

CoDeSys V2.3

6-54

Task Configuration .
'Task configuration'. , .
. .
, .
(Task properties), (Program call), (System events).
. . , 'Parameter' .
: ,
(. standard.lib).

6.7.2

( ).

"Task Configuration".
"", .
<Enter>. "".
, .

.
.

" Insert " "Insert Task" .

"Insert" "Append Task" .

CoDeSys V2.3

6-55

"Insert " "Insert Program Call".

. /, .
'Taskattributes' (. 'Insert Task'), 'Program Call' (. 'Insert Program Call')
'System events'. . (
).

, <>
.


(, ).

"Insert""Insert Task" "Insert" "Append Task"


.
'System events', "Insert Task".
, . "Task Configuration",
"Append Task" . (. . ).
. , PLC Configuration (
cfg-).
:
Name: . .
<>.
Priority (0-31): (Priority) ( 0 31 : 0 - ,
31 )
:
cyclic

: 'Interval' (. ).

freewheeling
: ,
- .
triggered by event
: , Event.
triggered by external event : , Event .
.
:
Interval ( 'cyclic'): ,
. .
[ms] [s].

CoDeSys V2.3

6-56

TIME (, "t#200ms").
(, "300").
Event ( 'triggered by event' 'triggered by external event'):
. ...
<F2>. Singleton Events. , , . , . : %MX1.1 %IB4 Singleton-Events, 2
(a b , c d, ):
VAR_GLOBAL
a AT %MX1.1: BOOL;
b AT %MX1.1: BOOL;
c AT %MB4: BOOL;
d AT %MD1: BOOL;
END_VAR

'Interval' 'Event' ,
. , CoDeSys SP NT V2.2 10 ms.
(Watchdog):
(-). -,
, . .
Activate watchdog: ,
, , 'Time' (. ).
Time (.: t#200ms): ; , .
. "%".
Sensitivity: , .
:
, . "Parameters".
.
"Insert" "Insert Program Call" "Insert" "Append Program Call"
.

"Insert Call" ,
"Append Program Call" .

CoDeSys V2.3

6-57

Program Call , ,
Select . , (, prg(invar:=17)).
( ).

6.7.3
"", " " POU . . . , : , , Online .
POU . 'Events' "System-events" :

POU:

( ) ,
Name Description (). POU
(called POU).
(<F2>) POU,
(, "PLC_PRG" "PRG.ACT1"). POU, -

CoDeSys V2.3

6-58

Create POU. POU .


, .
POU
/ .

6.7.4 online
online
. . : SysTaskInfo.lib SysLibTime.lib
. , ,
.
:
online . , .
:
Idle

;
.

Running

Stop

Stop on BP

Stop on Error

, : .

Stop Watchdog

'Stop on Error' 'Stop Watchdog' .



'Taskconfiguration' .

CoDeSys V2.3

6-59

online

. .
:
Min:

Akt:

Max:

Cycle:

Jitter:

(jitter) s (
).

Reset , 0.
( ) Scaling [s/Pixel].
?
:

, , .. .

, .

, ,
.

, .

CoDeSys V2.3

6-60

PLC_PRG free-wheeling .

online 'Extras':
"Extras" "Set Debug Task"
Online . [DEBUG]. .
, , .
'Extras' 'Enable / disable task'
.
.
'Extras' 'Callstack'
Extras .
, .
. 'Callstack of task <task
name>'. POU (: "prog_x (2)"
prog_x) . . 'Go To' POU.

6.8 (Watch and Receipt Manager)


6.8.1
, : "Write Receipt".
, ( "Read
Receipt"). , , .

Watch and Receipt Manager Resource
.
.
. .

6.8.2 Offline
Offline ,
"Insert" "New Watch List". :
<POUName>.<Variable Name> [:= <Const>]

CoDeSys V2.3

6-61

POU Name ( ) . . . .
:
PLC_PRG.Instance1.Instance2.Structure.Componentname
:

.global1.component1

Offline

: =.
online Write
Receipt.
:
PLC_PRG.TIMER:= 50
PLC_PRG.TIMER 50.
"Extras" "Write Receipt" PLC.
:
. : a, b, c struvar
PLC_PRG.
a,b,c :
PLC_PRG.struvar.a:=<value>
PLC_PRG.struvar.b:=<value>
PLC_PRG.struvar.c:=<value>
. , ARRAY[0...6]:
PLC_PRG.arr_var[0]:=<value>
PLC_PRG.arr_var[1]:=<value>
...
fb, x,y fb_inst, PLC_PRG, :
PLC_PRG.fb_inst.x:=<value>
PLC_PRG.fb_inst.y:=<value>

CoDeSys V2.3

6-62

"Insert""New Watch List"


, .
"Extras" "Rename Watch List"
.
"Extras" "Save Watch List"
"*.wtc".
"Extras" "Load Watch List"
, "Save Watch List".

6.8.3 Online
Online .
(, , ) "" .
<Enter>. 'Zoom' 'Open instance'.
"Extra" "Active
Monitoring". .
Online

Online "Extras" "Write Receipt".


"Extras" "Read Receipt" .
. , Watch and Receipt Manager.

"Extras" "Monitoring Active"


Online .
, .

CoDeSys V2.3

6-63

(. Offline)
.
"Extras" "Write Receipt"
.
"Extras" "Read Receipt"
Online , Offline,
.
. , Watch and Receipt Manager


Watch and Receipt Manager ,
. "Write
values" "Force values". .

6.9 (Sampling Trace)


6.9.1

. ( ). , . 20 . 500.
,
(, DWORD), . ,
10 WORD, 5000 ,
250 .

.

Sampling Trace -

"Extras" "Trace
Configuration" (, .). "Start Trace" , , "Read
Trace". .
( ) ( *.trc XML *.mon) . *.tcf . , .
: , (debug task).

CoDeSys V2.3

6-64

6.9.2
Trace Configuration.
Sampling Trace :
"Extras" "Trace Configuration"
Trace Configuration

Trace Name.
:
Variables . Input of trace variable ( Insert <Enter>). ,
Help Manager. , Delete.
:
""
: Trigger Variable.
Trigger Variable (
Variables). . .
. Trigger edge: positive,

CoDeSys V2.3

6-65

Trigger Level . Trigger edge: negative


. Bouth . None .
- ,
"Stop Trace".
Trigger Position , . ,
25, 25% , 75% - . .
Sample Rate .
. 0. .
:
Single Number of samples . Continuous
. , , Number of samples 35, 35 , 35 . Manual
.
Save .
"File save as".
Load.
File open.
. Save Load , .

6.9.3
,
. Extras.
"Extras""Start Trace"
:
,
.
"Extras" "Read Trace"
:
.
"Extras" "Auto Read"
, .

CoDeSys V2.3

6-66

"Extras" "Stop Trace"


:
.

6.9.4

Sampling Trace. : Var0, Var1 .. , .
. ( PLC_PRG.a
). , . 8 .

('Extras' 'Start Trace') ('Extras' 'Read Trace' 'Extras' 'Auto Read'), .


CoDeSys (State:) . ('Extras' 'Stop Trace') .
, ,
.
Y . .
,
. Var 0 20 +120.
, , , ,
(. ).
CoDeSys .

CoDeSys V2.3

6-67

"Extras" "Cursor Mode"


.
. . - .
, Var N, , .
"Extras" "Cursor Mode". . . ,
. <Control>, 10 . Shift
. (dy).
"Extras""Multi Channel"
. "Multi Channel" .
. 8 , .
.
.
"Extras" "Show grid"
, . , .
"Extras""Y Scaling"
Y .
( Channel) ( maximum y scale minimum y scale). Automatic
, .
.

"Extras""Stretch"
:

CoDeSys V2.3

6-68

. . .
"Extras" "Compress".
"Extras""Compress"
:
.
, .
.
"Extras" "Stretch".

6.9.5 ('Extras' 'Save trace values')


"*.trc".
"trace configuration" .
. : 'Extras' 'External Trace Configurations'
"Save Values"
"*.trc" . , "Extras" "Load Values".
"Load Values"
"*.trc". . "Save Values".
"Trace in""ASCII -file"
SCII .
. .txt .
:
CoDeSys Trace
D: \CODESYS\PROJECTS\TRAFFICSIGNAL.PRO -
Cycle PLC_PRG.COUNTER PLC_PRG.LIGHT1
-
021
-
121

221
.....
, , .
. . , , .

CoDeSys V2.3

6-69

6.9.6 ('Extras' 'External Trace Configurations')



XML, .
"Save to file"
XML . : *.mon.
*.mon- 'Load from file'.
"Load from file"

(*.mon) XML. .
, 'Set as project
configuration'.
*.mon 'Save to file'.
: 'Extras' 'Save values'.

'Load from controller'


, . .
'Save to target'
online XML
(*.mon). .
*.mon 'Save to file'.
'Set as project configuration'
, 'Trace' (. ),
. 'Trace' , 'Load from file' *.mon ( ).

6.10 (Workspace)
Workspace
'Ressources' (. 4.2, Project Options). Workspace, 'Options', .

CoDeSys V2.3

6-70

6.11 (Parameter Manager)


6.11.1
, Network functionality (. 6.12).
-,
, , CoDeSys.
, fieldbus.
.
: (. 5.2.3)

?
:

, .

, , , , default value
( ), access rights ( ),
index, subindex, name (, , ), .
. .
?
. , -,
. .
.
- . ,
.
, , , , , . , ,
.
,
. .
. , .

CoDeSys V2.3

6-71

-, , , ,
-.
CoDeSys

:
.


Network functionality:

Support Parameter Manager Parameter Variable, , , Index ranges for mappings ( PDO CAN ).

6.11.2 .
Parameter Manager Resources . , , online .

CoDeSys V2.3

6-72

: .

CoDeSys

. , . ( ) , , .
, (Variables, Constant Parameters, Template, Instance, System Parameters).
. . .
.
<F6>
online .
. . offline .

6.11.3
:
Variables: .
Parameters: .
System parameters: , . .
Template: Template () , . .
Instance.
Instance: .
,
.

CoDeSys V2.3

6-73

Mappings: ,
. , PDO CAN. Variables, . Network functionality. PDO CAN, Variable Instance PDO
Default PDO mapping PLC Configuration.
XML .
, .

Instance()
, . , . ,
, .
Template() ,
. ,
, . Instance .
: Base POU ,
. .
Apply, POU . . Instance.
Insert missing entries,
Extras, . ,
POU .
.
ARRAY() .
Synchronous actions / POU, , .
Instance(): Template.
, ARRAY,
, . Apply, POU .
Base variable ,
. .
( Base index) ( Base subindex).
POU , / ( 0) / . ,
, 3, ,
3000. , 3003.

CoDeSys V2.3

6-74

Insert missing entries,


Extras, . ,
.
:
fudo a, b, c. PLC-PRG inst1_fudo inst2_fudo.
inst1_fudo.a, inst1_fudo.b, inst1_fudo.c inst2_fudo.a, inst2_fudo.b,
inst2_fudo.c, . Template c
fudo_template. POU fudo. Apply
a, b, c: (Index-offset): a:16#2,
b:16#1, c:16#3. (Subindex-offset): a:16#2, b:16#3,
c:16#4.

Instance.
fudo_template, inst1_fudo, 16#2300,
30 ( ). Apply a, b, c (a:16#2302, b: 16#2301, c: 16#2303) (a:16#20, b: 16#21, c: 16#22).

6.11.4

: <Ins>

CoDeSys V2.3

6-75

, List Insert
Insert new list . ,
.
:
Insert list

( ) :
Variables

Parameters

System parameters

Template

Instance

Mappings

,
.
, PDO CAN.

OK, . . , . . , .
(. 6.11.4. ).

, Rename list Extras .
.

CoDeSys V2.3

6-76

/ /
:<Ctrl>+<X>, <Ctrl>+<C>, <Ctrl>+<V>.
(Cut Edit Cut list )
, (Paste Edit Paste list ).
, .
(Copy Edit Copy list ) .

:<Del>
(Delete Edit Delete list )
.
: online .

6.11.5
()
,
.
, ,
.
(fade out).
, .
.
Standard column width , . Maximize width , .

, Insert Extras:
/ ( )
Insert line, New line

Line after, New line after

:<Ctrl>+<Enter>
Delete line

:<Shift>+<Del>
Cut, Copy, Paste line

CoDeSys V2.3

, ,

6-77

:
.
, . , . ,
<F2>.
<Enter>
.
<Del>.
, .
Format Dec/Hex Extras.
<F6>.
:
:
Download with program: .
Synchronous actions: .

- , .
online offline. ,
. , .

6.11.6 online

, online , . ,
. 'Variable' 'Parameters'
.
:
Login, Load with project.

Online :

CoDeSys V2.3

6-78

Index Subindex
RefID Offset.
, Extras:
Delete list

Write list

, ,
. OK.
.

Read list

Parameter . 'Variables' , .

Write values

Value
. , . Write value.

Write default values

, Default.

Take over values


Value

Format Dec/Hex.


.

6.11.7 /
'Extras' 'Export'
, XML-.
. *. prm.
(Project Export).
'Extras' 'Import'
XML-.
.
XML- , ,
, .

CoDeSys V2.3

6-79

6.12 (Target Settings)


"Target Settings" (Resources) .
, () , . ( 'Project' 'New')
. (Target Support Packages: TSP). . Target settings.
: TSP , : 'None'. . .

TSP
TSP .
InstallTarget, CoDeSys. .
TSP , CoDeSys ,
. , , , -. , TSP , , ini- -.
TSP (Target files). , . *.trg. , .
Target settings CoDeSys.
TSP
. .
*.tnf . . , .
CoDeSys.
CoDeSys .
: , CoDeSys .


(Target Settings)
. , 'Target Settings'
('Resources) .
, Configuration. ,
, CoDeSys .
. .
(Hide Settings). :
1. (Target Platform).

CoDeSys V2.3

6-80

2. (Memory Layout).
3. (General).
4. (Networkfunctionality).
5. (Visualization).
: , !

<Default>, .

6.13 - (PLC-Browser)
6.13.1
- - (). . . . CoDeSys , .
ini , .
PLC-Browser (Resources) , ( General).
CoDeSys PLC Browser

- .
.
. .

CoDeSys V2.3

6-81

<Enter> . Online , , . Online


.

6.13.2 -
- 3S, . . ini , .

ini .
- ini .

Insert standard command"
<F2>. 'Insert' 'Standard commands'. , .
:
<><><>
.
.
: (Id) "pid":
pid.....
:
pid
Project-ID: 16#0025CFDA
: : ?<><>. ini . .

3S PLC-Browser:

. , .

mem

Hex
1: mem <start address> <end address>
2: mem <start address>-<end address>
, ( 16#) .

memc

Hex ; mem,

memd

Hex ; mem,

CoDeSys V2.3

6-82

reflect

( )

dpt

ppt

POU

pid

Id

pinf

tsk

IEC

startprg

stopprg

resetprg

. .

resetprgcold

resetprgorg

. ..

reload

getprgprop

getprgstat

filedir

"dir"

filecopy

[from] [to]

filerename

[old] [new]

filedelete

[filename]

saveretain

(retain)

restoreretain

(retain)

setpwd


: setpwd <password> [level]
<level> "0" ( ) "1"

delpwd

(<KEYWORD>).

,
'Keyword not found'.
( ? mem"),
ini-. .

6.13.3 -
,
. .

CoDeSys V2.3

6-83

s: <><>
::
%P<NAME> NAME POU, <POU-Index>,

%V<NAME> NAME , #<INDEX>:<OFFSET>, ( #<INDEX>:<OFFSET> )
%T<NAME> NAME , <VARIABLENTYP>,

%S<NAME> NAME , <SIZEOF(VAR)>,

\ % . , : \\.
:
( .testit):
mem %V.testit
:
mem #4:52
03BAAA24 00 00 00 00 CD CD CD CD ....

6.13.4 -
'Extras' PLC-Browser
:
(History forward )
(History backward)
.
.
Cancel

*.bhl.
Save history list
(Browser History List). Print last command .
.

6.14 (Tools)
'Tools' () (Resources) ,
. ( )

CoDeSys V2.3

6-84

(shortcuts), CoDeSys .
,
(, Acrobat Reader notepad.exe)
. - .
'Tools' .
Tools

4 . CoDeSys. .
PDF-. , "<R>"
CoDeSys. , ,
PDF-.
, .

6.14.1 (Object Properties)


(Tools), , "". ,
.
CoDeSys.
, .
1. (Tool Properties):
'Tools' ,
'Object Properties'. (Tool Properties).
. :
Id , Name of the shortcut () , Name of the executable file
. Advanced .

CoDeSys V2.3

6-85

, . Directory ,
.
Apply, .
:
FixedCount:


Tools. "0",
.
: , "fix"
, CoDeSys. "<R>"
.

Exe-Name:

.
: "[ ] <, exe->".
, Windows .
.
: "C:\program\notapad.exe", "345.pdf"

DefaultDisplayName:

Parameter Template:

.
$(INSTANCE NUMBER) (. see 'Parameter Template').
, :
$(PROJECT_NAME) ( *.pro").
$(PROJECT_PATH) ( ).
$(PROJECT_DRIVE) .
$(COMPILE_DIR) ( ).

CoDeSys V2.3

6-86

$(TOOL_EXE_NAME) exe- .
$(DISPLAY_NAME) , 'Tools'.
$(INSTANCE_NUMBER) ( "1")
$(CODESYS_EXE_DIR) , Codesys
exe- ( ).
Shortcut Properties
(. )
:
"$(PROJECT_NAME)_$(INSTANCE_NUMBER).cfg"
cfg-, <
CoDeSys>_< >.cfg.

DownloadFile
Templates:

, , . Editable,
. ,
, codesys-exe .
:
"a.up;$(PROJECT_NAME).zaw;$(INSTANCE_NUMBER).upp"
: a.up, <current CoDeSys Projekt>.pro <shortcut number>.upp
.

2. (Shortcut Properties):
'Tools' 'Object
Properties' 'Project' 'Object'. (Shortcut
Properties) :
Command

Parameter
Files to be
downloaded

; ( ) ( 'Parameter
Template', . )
..: C:\programs\notepad.exe D:\listings\textfile.txt
(, ). , 'Editable'.
, (target)
DownloadFileTemplate (. ). 'Editable',
(. ) . New. 'Filename'.
, ,
codesys-exe . Delete .

Standard , .. , .
Apply , .
Advanced 'Advanced Properties', :

CoDeSys V2.3

6-87

'Advanced Properties':

, 1. . ,
. : $(INSTANCE_NUMBER) (. 'Parameter Template').
,
Tool ID:
.
.
Default Number of
"FixedCount" (. Tool Properties).
Shortcuts:
Shortcut Number:

Editable:

, .

OK .

6.14.2

'Tools' () 'Add Object' 'Project' 'Object'. 'Create Shortcut', .
, .
: ID , Name of
the shortcut , Name of the executable file.

CoDeSys V2.3

6-88

, (ID). ,
(Name of the shortcut). .
'Create Shortcut'

OK. . , ,
.
, .

'Delete' 'Project'
'Object'. . .

( ) 'Open Object' (
).
,
. , exe- .
exe- , . OK CoDeSys .

CoDeSys 'Tools' .
: 'Save as' , ,
$(PROJECT_NAME) . .

CoDeSys V2.3

6-89

6.14.3
'Tools' ?
, .
, CoDeSys?
'Tools' 'Resources' .
"". , . ,
, . . , 'Add Object'. , , .
?
'Tools' () 'Object Properties'
( ). , 'Advanced'.
. (ID), , , (shortcuts) ( 'Fixed Count') .
. (. ).
?

'Tools' ()
'Object Properties' ( ).
'Advanced'. . ( ), , .
?

'Tools' () 'Add Object' ( ). , ,


. OK. 'Tools' .
, . , Toolxy "Toolxy_1", "Toolxy_2" ..
?

( ) 'Object Properties' .
. 'Standard' .
?

( )
'Open Object' .

CoDeSys V2.3

6-90

7 ENI
7.1 ENI?
ENI (Engineering Interface) CoDeSys . ,
. , , . , CoDeSys, :

: CoDeSys ( ).
, () ,
() .
. . .

: , POU , . ,
, " " . ,
.

: CoDeSys, , ENI, .
, ECAD , ( . ENI Server).

ENI : . ,
, .
CoDeSys , .
ENI 'Visual SourceSafe 6.0', 'MKS Source Intergrity',
'PVCS Version Manager' V7.5 ,
. ( ) .
. ,
, , .

7.2 ENI
: ENI , 3S Smart Software
Solutions GmbH, .
. , ENI Explorer, .

ENI CoDeSys ,
, :
CoDeSys ENI TCP/IP, ENI
HTTP.

ENI

ENI (ENI Server Suite) .


.
.
ENI (ENI Control) (Data base). ,
ENI Control.
( ) .
, ENI . . .

ENI . 'Visual SourceSafe' . .
CoDeSys ENI ( 'Project' 'Options' 'Project data base'). , ENI, , . , , ,
.
CoDeSys .
( 'Project' 'Options' 'Project source control').
(log in to the ENI Server) . Login 'Project' 'Data Base Link' 'Login' .

7.3 ENI CoDeSys


(. ENI
), : Get Latest Version, Check Out, Check
In, Version History, Label Version .. 'Data Base Link' , .
(Object Properties)
.
( , )
('Project' 'Options' 'Project Source Control').

7.4
4 CoDeSys :
ENI (" ENI"): (Project objects), (Shared objects), (Compile files).
, 'Local', . , , .

CoDeSys V2.3

7-2

ENI

, CoDeSys : 'Project objects', 'Shared objects' 'Local'. , 'Compile files'


. ,
, 'Project source control', 'Project'
'Data Base Link' 'Define' 'Multiple Define'. (Object Properties).
ENI 'Project source control' ('Project' 'Options'). , (, , .)
. .
( ) . -
, .
ENI :
Project Objects:

, () , POU,
. 'Get all latest versions' , , .

Shared Objects:

, , POU, .
: 'Get all Latest Versions'

.

Compile files:

(.. ) CoDeSys
, .
:
, , .

CoDeSys 'Local'. , , , ENI.

CoDeSys V2.3

7-3

8 DDE
CoDeSys DDE
CoDeSys Windows ,
(DDE).
GatewayDDEServer, , CoDeSys .
: DDE . ,
.
DDE Word 97 Excel 97 Windows NT 4.0. DDE
, 3S- Smart Software Solutions
.

8.1 DDE CoDeSys


DDE
DDE ,
.

DDE 3 :
1. (CoDeSys).
2. .
3. .
: CoDeSys.
: (c:\example\example.pro).
: , , Watch and Receipt Manager .
?
. :
%IX1.4.1
PLC_PRG.TEST
.GlobVar1

(* 1.4.1*)
(* TEST PLC_PRG*)
(* GlobVar1 *)

WORD
TEST POU PLC_PRG DDE Microsoft WORD,
("", ",,,").
:

DDE

{DDEAUTO CODESYS "C:\\CODESYS\\PROJECT\\IFMBSP.PRO" "PLC_PRG.TEST"}


Online. , Word " ".
: Word , 6,0 DDEAUTO. ,
DDE . (, DATE).
(
"/ "). {} , .
.

EXCEL
EXCEL, ,
=CODESYS|'C:\CODESYS\PROJECT\IFMBSP.PRO'!PLC_PRG.TEST'
"", "" :
: C:\CODESYS\PROJECT\IFMBSP.PRO:
:

PLC_PRG.TEST

CODESYS

.
Intouch
DDE Access Name <AccessName>, CoDeSys DDE
(topic name) C:\CODESYS\PROJECT\IFMBSP.PRO
DDE <AccessName>. Item
Name (, PLC_PRG.TEST).

8.2 DDE GatewayDDE Server


GatewayDDE
GatewayDDE , CoDeSys (. 'Project' 'Options' 'Symbolconfiguration').
GatewayDDE , . .

CoDeSys V2.3

8-2

DDE

GatewayDDE Server

'File' 'Open' . .cfg.


.
'File' 'Autoload' , , .
,
.
'File' 'Settings' 'Server settings', :
GatewayDDE Server

Motorola byteorder: Motorola


Check identity: (ID) .
Updaterate [ms]: .
Timeout [ms]: .
Tries: ( !)
'Communication Parameters' 'Online' 'Parameters'. , CoDeSys.
'File' 'Save'

CoDeSys V2.3

8-3

DDE

'Online' 'Login'. ,
DDE . CoDeSys..
'Online' 'Login' .
DDE
DDE CoDeSys.
: GATEWAYDDESERVER
Word , , :
{DDEAUTO GATEWAYDDESERVER "BSP.PRO" "PLC_PRG.TEST"}
EXCEL TEST :
=GATEWAYDDESERVER|'bsp.pro'!'PLC_PRG.TEST'
GatewayDDE Server
GatewayDDE :
/n
/s

/c
/o



/s=h
/s=i
/s=m
/s=n
/c=<config-file>
online ( 1)

:
GATEWAYDDE /s=i /c="D:\DDE\conf_1.cfg"
, conf_1.cfg.

CoDeSys V2.3

8-4

CoDeSys

9.1
3S 3S,
, . CoDeSys . 3S, .
. : 3S Licensing Manager .

9.2 CoDeSys
CoDeSys . , , (license information).
'File'Save as...', 'Internal Library' 'External Library' Edit license info.... Edit Licensing Information
, . (Project Info).
CoDeSys, .
: Edit Licensing Information

General information ( ):

Name: , . .
Vendor-ID: ,
.

CoDeSys

License free mode: ,


, . (days), . (10, 20, 30 ...). , unlimited,
.
Targets: (ID) , . .

Contact ( ):

Licensing via phone: / Licensing per via mail: e-mail . .

Optional information ( ):

, ,
: Description (), Manufacturer (), Vendor (), Pricing information
().
: , .
3S , . XML . . 3S License Manager.

CoDeSys V2.3

9-2

10
A:
CoDeSys . (. D,
) .
CoDeSys ,
: INDEXOF SIZEOF (. ), ADR BITADR (. ).
, . (ADD)
ST +.
: .

10.1
ADD
: BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL
LREAL.
TIME (. t#45s + t#50s = t#1m35s).
TIME.
IL:
LD

ADD 2,4,7
ST

Var 1

ST:
var1 := 7+2+4+7;
FBD:

A:

MUL
: BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT,
UDINT, REAL LREAL.
IL:
LD

MUL 2,4,7
ST

Var 1

ST:
var1 := 7*2*4*7;
FBD:

SUB
: BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT,
UDINT, REAL LREAL.
TIME TIME. .
IL:
LD

SUB

ST

Var 1

ST:
var1 := 7-2;
FBD:

DIV
: BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT,
UDINT, REAL LREAL.
IL:
LD

DIV

ST

Var 1

(* 4 *)

ST:
var1 := 7-2;
FBD:

CoDeSys V2.3

10-2

A:

: CheckDivByte, CheckDivWord, CheckDivDWord


CheckDivReal , , 0.
: 0 .

CheckDivReal.
CheckDivReal:
FUNCTION CheckDivReal : REAL
VAR_INPUT
divisor:REAL;
END_VAR

IF divisor = 0 THEN
CheckDivReal := 1;
ELSE
CheckDivReal:=divisor;
END_IF;

DIV CheckDivReal .
0, (d) 0 1. 799.
PROGRAM PLC_PRG
VAR
erg:REAL;
v1:REAL := 799;
d:REAL;
END_VAR

erg:= v1 / d;
: CheckDiv-, Check.Lib, . , , ,
, .

MOD
: BYTE, WORD, DWORD, SINT, USINT, INT, UINT,
DINT, UDINT. .
IL:
LD

CoDeSys V2.3

10-3

A:

MOD 2
ST

Var 1 (* 1 *)

ST:
var1 := 9 MOD 2;
FBD:

MOVE
.
CFC LD (
) EN/EN0. FBD .
EN/EN0 CFC:
en_i TRUE, var1 var2.

IL:
LD ivar1
MOVE ivar2
ST ivar2
(! :
LD ivar1
ST ivar2 )
ST:
ivar2 := MOVE(ivar1);
( ! : ivar2 := ivar1; )

10.2
AND
. BOOL, BYTE, WORD DWORD.
IL:
Var1 BYTE
LD

2#1001_0011

AND 2#1000_1010
ST

Var 1

(* 2#1000_0010 *)

ST:
var1 := 2#1001_0011 AND 2#1000_1010
FBD:

CoDeSys V2.3

10-4

A:

: . ,
SFS :

, z . . x y FALSE, .

OR
. BOOL, BYTE, WORD DWORD.
IL:
var1 :BYTE;
LD

2#1001_0011

OR

2#1000_1010

ST

var1

(* 2#1001_1011 *)

ST:
Var1 := 2#1001_0011 OR 2#1000_1010
FBD:

: . AND.

XOR
. BOOL, BYTE, WORD DWORD.
IL:
Var1 :BYTE;
LD

2#1001_0011

XOR

2#1000_1010

ST

Var1

(* 2#0001_1001 *)

ST:
Var1 := 2#1001_0011 XOR 2#1000_1010
FBD:

CoDeSys V2.3

10-5

A:

: , .. XOR . , XOR. .

NOT
. BOOL, BYTE, WORD DWORD.
IL:
Var1 :BYTE;
LD

2#1001_0011

NOT
ST

Var1

(* 2#0110_1100 *)

ST:
Var1 := NOT 2#1001_0011
FBD:

10.3
: , , !
. (. ST ). , .

SHL
res:=SHL(in,n) in n .
BYTE, WORD DWORD.
res_byte res_word
(BYTE WORD), .
ST:
PROGRAM shl_st
VAR
in_byte:BYTE:=16#45;
in_word:WORD:=16#45;
res_byte:BYTE;
res_word:WORD;
n:BYTE:=2;
END_VAR

CoDeSys V2.3

10-6

A:

res_byte:=SHL(in_byte,n);

(* 16#14 *)

res_word:=SHL(in_word,n);

(* 16#0114 *)

FBD:

IL:
LD

16#45

SHL

ST

res_byte

SHR
res:= SHR(in,n) in n .
BYTE, WORD DWORD.
(. ):
ST:
PROGRAM shr_st
VAR
in_byte:BYTE:=16#45;
in_word:WORD:=16#45;
res_byte:BYTE;
res_word:WORD;
n:BYTE:=2;
END_VAR
res_byte:=SHR(in_byte,n);

(* 16#11 *)

res_word:=SHR(in_word,n);

(* 16#0011 *)

FBD:

IL:
LD

16#45

SHR

ST

res_byte

ROL
res:=ROL(in,n) in n , . BYTE, WORD DWORD.

CoDeSys V2.3

10-7

A:

res_byte res_word
(BYTE WORD), .
ST:
PROGRAM rol_st
VAR
in_byte:BYTE:=16#45;
in_word:WORD:=16#45;
res_byte:BYTE;
res_word:WORD;
n:BYTE:=2;
END_VAR
res_byte:=ROL(in_byte,n);

(* 16#15 *)

res_word:=ROL(in_word,n);

(* 16#0114 *)

FBD:

IL:
LD

16#45

ROL

ST

res_byte

ROR
res:=ROR(in,n) in n ,
. BYTE, WORD DWORD.
(.
):
ST:
PROGRAM ror_st
VAR
in_byte:BYTE:=16#45;
in_word:WORD:=16#45;
res_byte:BYTE;
res_word:WORD;
n:BYTE:=2;
END_VAR
res_byte:=ROR(in_byte,n);

(* 16#51 *)

res_word:=ROR(in_word,n);

(* 16#4011 *)

FBD:

CoDeSys V2.3

10-8

A:

IL:
LD

16#45

ROR

ST

res_byte

10.4
. .

SEL
.
OUT:= SEL(G, IN0, IN1)
OUT:= IN0 G=FALSE;
OUT:= IN1 G=TRUE.
IN0, IN1 OUT , G BOOL.
: IN0, G , IN1, G .
IL:
LD

FALSE

SEL

3,4

ST

Var1

(* - 3 *)

FBD:

: , IN0 IN1 , ,
G.

MAX
.
OUT := MAX(IN0, IN1)
IN0, IN1 OUT .
IL:
LD

90

MAX 30
MAX 40

CoDeSys V2.3

10-9

A:

MAX 77
ST

Var1

(* - 90 *)

FBD:

MIN
.
OUT := MIN(IN0, IN1)
IN0, IN1 OUT .
IL:
LD

90

MIN

30

MIN

40

MIN

77

ST

Var1

(* 30 *)

FBD:

LIMIT

OUT := LIMIT(Min, IN, Max) :


OUT := MIN (MAX (IN, Min), Max)
Max Min . IN
, Max Min.
IN OUT .
IL:
LD

90

LIMIT 30,80
ST

Var 1

(* - 80 *)

MUX
. K- .
OUT := MUX(K, IN0,...,INn) :
OUT := INK.

CoDeSys V2.3

10-10

A:

IN0, ...,INn OUT . K BYTE, WORD, DWORD, SINT,


USINT, INT, UINT, DINT UDINT.
IL:
LD

MUX 30,40,50,60,70,80
ST

Var 1

(* - 30 *)

: , , , . .

10.5
GT

TRUE, .
BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME STRING.
IL:
LD

20

GT

30

ST

Var 1

(* - *)

ST:
VAR1 := 20 > 30 > 40 > 50 > 60 > 70;
FBD:

LT

TRUE, .
BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME STRING.
IL:
LD

20

LT

30

ST

Var 1

(* - *)

ST:
VAR1 := 20 < 30;
FBD:

CoDeSys V2.3

10-11

A:

LE

TRUE, .
BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME STRING.
IL:
LD

20

LE

30

ST

Var 1

(* - *)

ST:
VAR1 := 20 <= 30;
FBD:

GE

TRUE, .
BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME STRING.
IL:
LD

60

GE

40

ST

Var 1

(* - *)

ST:
VAR1 := 60 >= 40;
FBD:

EQ

TRUE, .

CoDeSys V2.3

10-12

A:

BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME STRING.
IL:
LD

40

EQ

40

ST

Var 1

(* - *)

ST:
VAR1 := 40 = 40;
FBD:

NE

TRUE, .
BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME STRING.
IL:
LD

40

NE

40

ST

Var 1

(* - FALSE*)

ST:
VAR1 := 40 <> 40;
FBD:

10.6
: , . ,
.
.

ADR

ADR DWORD.
.

CoDeSys V2.3

10-13

A:

IL:
LD

Var 1

ADR
ST

Var 2

man_fun1
ADRINST
ADRINST
DWORD. ,
.
ST ( ):
dvar:=ADRINST(); (* dvar *)
fun(a:=ADRINST()); (* *)
IL:
ADRINST
ST dvar
ADRINST
fun
BITADR
BITADR DWORD .
, .
VAR
var1 AT %IX2.3:BOOL;
bitoffset: DWORD;
END_VAR
ST:
Bitoffset := BITADR(var1); (* 19, byte addressing=TRUE, 35,
byte addressing=FALSE*)
IL:
LD Var1
BITADR
ST Var2

(content)
"^"
.
ST:

CoDeSys V2.3

10-14

A:

pt:POINTER TO INT;
var_int1:INT;
var_int2:INT;
pt := ADR(var_int1);
var_int2:=pt^;

INDEXOF
POU.
ST:
var1 := INDEXOF(POU2);
SIZEOF
.
IL:
arr1:ARRAY[0..4] OF INT;
Var1 INT
LD

arr1

SIZEOF
ST

Var 1

(* 10 *)

ST:
var1 := SIZEOF(arr1);

TIME
TIME TIME.
IL:
TIME
ST systime (*, .: T#35m11s342ms *)
ST:
systime:=TIME();
FBD:

CoDeSys V2.3

10-15

A:

INI
INI retain , .
: <bool-Variable> := INI(<FB-instance, TRUE|FALSE)
TRUE, , FB, .
ST: fbinst fb, retain retvar.
:
fbinst:fb;
b:bool;
:
b := INI(fbinst, TRUE);
ivar:=fbinst.retvar (* => retvar *)
IL:
LD fbinst
INI TRUE
ST b
FBD:

10.7
CAL
.
IL ,
.
: Inst, Par1 Par2 0
TRUE .
CAL INST(PAR1 := 0, PAR2 := TRUE)

10.8
(,
INT BYTE DINT WORD). ,
.
.
:

CoDeSys V2.3

10-16

A:

<.1>_TO_<..2>
_TO_STRING .
, .
BOOL_TO
BOOL :
1, TRUE, 0, FALSE.
STRING - TRUE FALSE.
IL:
LD

TRUE

BOOL_TO_INT
ST

LD

TRUE

(*: 1 *)

BOOL_TO_STRING
ST

str

LD

TRUE

(*: 'TRUE' *)

BOOL_TO_TIME
ST

LD

TRUE

(*: T#1ms *)

BOOL_TO_TOD
ST

LD

(*: TOD#00:00:00.001 *)

FALSE

BOOL_TO_DATE
ST

dat

LD

TRUE

(*: D#1970-01-01 *)

BOOL_TO_DT
ST

dandt

(*:DT#1970-01-01-00:00:01 *)

ST:

CoDeSys V2.3

i:=BOOL_TO_INT(TRUE);

(* :1 *)

str:=BOOL_TO_STRING(TRUE);

(* :"TRUE" *)

t:=BOOL_TO_TIME(TRUE);

(* :T#1ms *)

tof:=BOOL_TO_TOD(TRUE);

(* :TOD#00:00:00.001 *)

dat:=BOOL_TO_DATE(FALSE);

(* :D#1970 *)

10-17

A:

dandt:=BOOL_TO_DT(TRUE);

(* :DT#1970-01-01-00:00:01 *)

FBD:

(*: 1 *)

(*: 'TRUE' *)

(*: T#1ms *)

(*: TOD#00:00:00.001 *)

(*: D#1970-01-01 *)

(*: DT#1970-01-01-00:00:01 *)
TO_BOOL
BOOL:
TRUE, , FALSE.
STRING, "TRUE", TRUE, FALSE.
IL:
LD

213

BYTE_TO_BOOL
ST

LD

(*: TRUE *)

INT_TO_BOOL
ST

LD

T#5ms

(*: FALSE *)

TIME_TO_BOOL
ST

LD

'TRUE'

(*: TRUE *)

STRING_TO_BOOL
ST

(*: TRUE *)

ST:

CoDeSys V2.3

10-18

A:

b := BYTE_TO_BOOL(2#11010101);

(* : TRUE *)

b := INT_TO_BOOL(0);

(* : FALSE *)

b := TIME_TO_BOOL(T#5ms);

(* : TRUE *)

b := STRING_TO_BOOL('TRUE');

(* : TRUE *)

FBD:

(*: TRUE *)

(*: FALSE *)

(*: TRUE *)

(*: TRUE *)

:
, .
, .
ST:
si := INT_TO_SINT(4223);

(* : 127 *)

4223 (16#107F ) SINT,


, 127 (16#7F ).
IL:
LD

INT_TO_REAL
MUL 3.5
FBD:

REAL_TO-/ LREAL_TO
REAL LREAL :
.
STRING, BOOL, REAL LREAL. ,
.
STRING 16 . ,
.
ST:
i := REAL_TO_INT(1.5);

CoDeSys V2.3

(* : 2 *)

10-19

A:

j := REAL_TO_INT(1.4);

(* : 1 *)

i := REAL_TO_INT(-1.5);

(* : -2 *)

j := REAL_TO_INT(-1.4);

(* : -1 *)

IL:
LD

2.7

REAL_TO_INT
GE

%MW8

FBD:

TIME_TO/TIME_OF_DAY
TIME TIME_OF_DAY :
DWORD,
( 0 TIME_OF_DAY). .
, .
STRING .
IL:
LD

T#12ms

TIME_TO_STRING
ST

str

LD

T#300000ms

(*: 'T#12ms' *)

TIME_TO_DWORD
ST

dw

LD

TOD#00:00:00.012

(*: 300000 *)

TOD_TO_SINT
ST

si

(*: 12 *)

ST:
str :=TIME_TO_STRING(T#12ms);

(* : T#12ms *)

dw:=TIME_TO_DWORD(T#5m);

(* : 300000 *)

si:=TOD_TO_SINT(TOD#00:00:00.012); (* : 12 *)
FBD:

CoDeSys V2.3

10-20

A:

DATE_TO/DT_TO
DATE DATE_AND_TIME :
DWORD,
1 1970 . .
.
STRING .
IL:

LD D#1970-01-01

(* FALSE *)

DATE_TO_BOOL
ST b

LD D#1970-01-15

(* 29952 *)

DATE_TO_INT
ST i

LD DT#1970-01-15-05:05:05

(* 129 *)

DT_TO_BYTE
ST byt

LD DT#1998-02-13-14:20

(* 'DT#1998-02-13-14:20' *)

DT_TO STRING
ST str

ST:
b :=DATE_TO_BOOL(D#1970-01-01);

(* : FALSE *)

i :=DATE_TO_INT(D#1970-01-15);

(* : 29952 *)

byt :=DT_TO_BYTE(DT#1970-01-15-05:05:05); (* : 129 *)


str:=DT_TO_STRING(DT#1998-02-13-14:20);

(*:'DT#1998-02-13-14:20' *)

FBD:

CoDeSys V2.3

10-21

A:

STRING_TO
STRING :
,
0.
IL:
LD 'TRUE'

(*: TRUE *)

STRING_TO_BOOL
ST b

LD 'abc34'

(*: 0 *)

STRING_TO_WORD
ST w
LD 't#127ms'

(*: T#127ms *)

STRING_TO_TIME
ST t
ST:
b :=STRING_TO_BOOL('TRUE');

(* : TRUE *)

w :=STRING_TO_WORD('abc34');

(* : 0 *)

t :=STRING_TO_TIME('T#127ms');

(* : T#127ms *)

FBD:

CoDeSys V2.3

10-22

A:

TRUNC
REAL INT. .
.
ST:
i:=TRUNC(1.9);

(* : 1 *)

i:=TRUNC(-1.4);

(* : 1 *)

LD

2.7

TRUNC
GE

%MW8

10.9
ABS
. , ABS(-2) 2.
:

INT

INT, REAL, WORD, DWORD, DINT

REAL

REAL

BYTE

INT, REAL, BYTE, WORD, DWORD, DINT

WORD

INT, REAL, WORD, DWORD, DINT

DWORD

REAL, DWORD, DINT

SINT

REAL

USINT

REAL

UINT

INT, REAL, WORD, DWORD, DINT, UDINT, UINT

DINT

REAL, DWORD, DINT

UDINT

REAL, DWORD, DINT, UDINT

IL:
LD

CoDeSys V2.3

10-23

A:

ABS
ST

(*: 2 *)

ST:
i:=ABS(-2);
FBD:

SQRT
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

16

SQRT
ST

(*: 4 *)

ST:
q:=SQRT(16);
FBD:

LN
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

45

LN
ST

(*: 3.80666 *)

ST:
q:=LN(45);
FBD:

LOG
.

CoDeSys V2.3

10-24

A:

BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

314.5

LOG
ST

(*: 2.49762 *)

ST:
q:=LOG(314.5);
FBD:

EXP
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

EXP
ST

(*: 9.7448e+009 *)

ST:
q:=EXP(2);
FBD:

SIN
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL. .
IL:
LD

0.5

SIN
ST

(*: 0.479426 *)

ST:
q:=SIN(0.5);
FBD:

CoDeSys V2.3

10-25

A:

COS
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL. .
IL:
LD

0.5

COS
ST

(*: 0.877583 *)

ST:
q:=COS(0.5);
FBD:

TAN
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL. .
IL:
LD

0.5

TAN
ST

(*: 0.546302 *)

ST:
q:=TAN(0.5);
FBD:

ASIN
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

0.5

ASIN
ST

(*: 0.523599 *)

ST:
q:=ASIN(0.5);
FBD:

CoDeSys V2.3

10-26

A:

ACOS
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

0.5

ABS
ST

q (*: 1.0472 *)

ST:
q:=ACOS(0.5);
FBD:

ATAN
.
BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
REAL.
IL:
LD

0.5

ABS
ST

q (*: 0.463648 *)

ST:
q:=ATAN(0.5);
FBD:

EXPT
:
OUT = IN1IN2.
IN1 IN2 BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT,
OUT REAL.
IL:
LD

EXPT 2

CoDeSys V2.3

10-27

A:

ST

var1 (*: 49 *)

ST:
var1 := (7,2);
FBD:

CoDeSys V2.3

10-28

: CoDeSys

: CoDeSys
, .

10.10
BOOL
BOOL TRUE FALSE.
TIME
TIME CoDeSys "t" "T" ( "time"
"TIME") "#". , "d",
"h", "m", "s" "ms".
, (d,
h, m, s, m, ms).
TIME ST:
TIME1 := T#14ms;
TIME1 := T#100S12ms; (* *)
TIME1 := t#12h34m15s;
:
TIME1 := t#5m68s;

(* *)

TIME1 := 15ms;

(*T# *)

TIME1 := t#4ms13d;

(* *)

DATE
DATE "d", "D", "DATE" "date" "#".
--.
:
DATE#1996-05-06
d#1972-03-29
. 10.14 DATE
TIME_OF_DAY
A TIME_OF_DAY "tod#", "TOD#", "TIME_OF_DAY#"
"time_of_day#" : ::.
.
:
TIME_OF_DAY#15:36:30.123
tod#00:00:00
DATE_AND_TIME
DATE_AND_TIME "dt#", "DT#", "DATE_AND_TIME#"
"date_and_time#". .

CoDeSys V2.3

10-30

: CoDeSys
:
DATE_AND_TIME#1996-05-06-15:36:30
dt#1972-03-29-00:00:00

, , .
, # .
10-15 A-F.
.
:
(* *)

14

2#1001_0011 (* *)
8#67

(* *)

16#A

(* *)

BYTE, WORD, DWORD, SINT, USINT, INT, UINT,


DINT, UDINT, REAL LREAL. "" ""
. , DINT INT , (. ).
REAL/LREAL
REAL LREAL
. .
:
7.4 7,4
1.64e+009 1,64e+009
STRING
STRING , . (, ). ,
, , ($). ,
, :
$$

$'

$L $l

Line feed

$N or $n

New line

$P or $p

Page feed

$R or $r

Line break

$T or $t

Tab

:
' '
CoDeSys V2.3

10-31

: CoDeSys
' Abby and Craig '
':-)'

. , : <Type>#<Literal>
<Type> . : BOOL, SINT, USINT, BYTE, INT, UINT,
WORD, DINT, UDINT, DWORD, REAL, LREAL. .
<Literal> .
:
var1:=DINT#34;
, CoDeSys .

10.11
POU, - .
: . POU, , . (,
).

() , . , , VAR1, Var1 var1 - .


, .. "A_BCD" "AB_CD" - .
. .
. CoDeSys
(Input Assistant).

- , PLC.
"Insert" "Operand". (Input Assistant) System Variable.
, POU
:
<>[1, 2]
:
<>.<>
:
<>.<>

CoDeSys V2.3

10-32

: CoDeSys

.
, 0 .
a : INT;
b : BOOL;
...
a.2 := b;
a b.
, : Index
'<n>' outside the valid range for variable '<var>'
:SINT, INT, DINT, USINT, UINT, UDINT, BYTE, WORD,
DWORD.
, CoDeSys :
Invalid data type '<type>' for direct indexing
VAR_IN_OUT!

, . , :

VAR_CONSTANT GLOBAL
enable:int := 1;
END_VAR
1, :
POU:
VAR
xxx:int;
END_VAR
:
xxx.enable := true; (* xxx *)
2, :
stru1:
TYPE stru1 :
STRUCT
bvar: BOOL;
rvar: REAL;
wvar: WORD;
{bitaccess: 'enable' 42 'Start drive'}
CoDeSys V2.3

10-33

: CoDeSys
END_STRUCT
END_TYPE
POU:
VAR
x:stru1;
END_VAR
:
x.enable := true;
42 x. bvar 8 , rvar 32 , wvar, 4.
: , ,
pragma {bitaccess}. , , :

10.12
.
"%", , , .
:
I

CoDeSys V2.3

(8 )

10-34

: CoDeSys
W

(16 )

(32 )

:
%QX7.5 %Q7.5

7.5

%IW215

215

%QB7

%MD48

48

%IW2.5.7.1

PLC

,
PLC.
: ,
. . A.


.
, , %MD48 48 192, 193, 194
195 (48 * 4 = 192). 0.
%MX5.0 ( ) .

10.13
ST .
:
Result := Fct(7) + 3;

CoDeSys V2.3

10-35

! . - ! .

: CoDeSys
, . () () .

10.14
(BOOL)
BOOL . 2 (TRUE)
(FALSE). 8 , (. 10.12 ).

BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT - .


, ,
. :

BYTE

255

WORD

65535

16

DWORD

4294967295

32

-128

127

255

-32768

32767

16

UINT

65535

16

DINT

-2147483648

2147483647

32

4294967295

32

SINT
USINT
INT

UDINT

, .

REAL LREAL ,
. REAL 32 64 LREAL.
REAL : 1.175494351e-38F 3.402823466e+38F
LREAL : 2.2250738585072014e-308 1.7976931348623158e+308

STRING . .
. , 80 .
CoDeSys, 1
255 !
35 :
str:STRING(35):=' ';

CoDeSys V2.3

10-36

! . - ! .

CoDeSys , 1
255 .

TIME .
TIME : 49d17h2m47s295ms (4194967295 ms).
TOD , 0 . TOD : 00:00:00 23:59:59.999.
DATE , 1 1970 . : 1970-00-00
2106-02-06.
DT , 0 1 1970 . : 1970-00-0000:00:00 2106-02-06-06:28:15.
TIME, TIME_OF_DAY (. TOD), DATE DATE_AND_TIME (. DT) DWORD.
10.10 .

10.15

-, -, .
POU . , 9 ( "ARRAY[0..2] OF ARRAY[0..3]
OF " ).
:
<_>:ARRAY [<ll1>..<ul1>,<ll2>..<ul2>,<ll3>..<ul3>] OF < >
ll1, ll2, ll3 ; ul1, ul2 ul3 .
. .
:
Card_game: ARRAY [1..13, 1..4] OF INT;
:
arr1 : ARRAY [1..5] OF INT := 1,2,3,4,5;
arr2 : ARRAY [1..2,3..4] OF INT := 1,3(7);

(* 3 7: 1,7,7,7 *)

arr3 : ARRAY [1..2,2..3,3..4] OF INT := 2(0),4(4),2,3; (* 0,0,4,4,4,4,2,3 *)


:
TYPE STRUCT1
STRUCT
p1:int;
p2:int;
p3:dword;
END_STRUCT

ARRAY[1..3] OF STRUCT1:= (p1:=1,p2:=10,p3:=4723),(p1:=2,p2:=0,p3:=299),


(p1:=14,p2:=5,p3:=112);

CoDeSys V2.3

10-37

! . - ! .

:
arr1 : ARRAY [1..10] OF INT := 1,2;
. , 0.

:
:
<_>[1,2]
:
Card_game [9,2]
: CheckBounds,
.

CheckBounds
CheckBounds, . , .
CheckBounds:
FUNCTION CheckBounds : DINT
VAR_INPUT
index, lower, upper: DINT;
END_VAR

IF index < lower THEN


CheckBounds := lower;
ELSIF index > upper THEN
CheckBounds := upper;
ELSE CheckBounds := index;
END_IF
CheckBounds .
, , CheckBounds .
CheckBounds:
PROGRAM PLC_PRG
VAR
a: ARRAY[0..7] OF BOOL;
b: INT:=10;
END_VAR
a[b] := TRUE;

CoDeSys V2.3

10-38

! . - ! .

: CheckBounds, Check.Lib, .
, , ,
, .

.
:
<_>: POINTER TO < / >;
, .

ADR. "^" (content)
.
: ! , C, p=p+SIZEOF(p^);.

:
pt:POINTER TO INT;
var_int1:INT := 5;
var_int2:INT;
pt := ADR(var_int1);
var_int2 := pt^;

(* var_int2 5 *)

CheckPointer:
.
CheckPointer,
. ( ).
(CheckPointer) . :
32- :
FUNCTION CheckPointer : DWORD
VAR_INPUT
dwAddress : DWORD;
iSize : INT;
bWrite: BOOL;
END_VAR

16- :
FUNCTION CheckPointer : WORD
VAR_INPUT
dwAddress : WORD;
iSize : INT;
bWrite: BOOL;
END_VAR

CoDeSys V2.3

10-39

: CoDeSys
, . , dwAddress.

- , . ,
POU.
(Data types)
(Object Organizer).
TYPE END_TYPE.
:
TYPE <_>:(<_0> ,< _1>, ...< _n>);
END_TYPE
<_> . . , , 0.
- INT .
.
:
TYPE TRAFFIC_SIGNAL: (Red, Yellow, Green:=10);

(*

, red - 0, yellow - 1 green - 10 *)


END_TYPE
TRAFFIC_SIGNAL1 : TRAFFIC_SIGNAL;
TRAFFIC_SIGNAL1:=0;

(* red*)

FOR i:= Red TO Green DO


i := i + 1;
END_FOR
, , .
:
TRAFFIC_SIGNAL: (red, yellow, green);
COLOR: (blue, white, red);
: TRAFFIC_SIGNAL red COLOR.

(Data types)
(Object Organizer). TYPE STRUCT
END_STRUCT END_TYPE.
:
TYPE < _>:
STRUCT
< 1>
.
.
CoDeSys V2.3

10-40

: CoDeSys
< n>
END_STRUCT
END_TYPE
< _> , .
.
(AT !).
Polygonline:
TYPE Polygonline:
STRUCT
Start:ARRAY [1..2] OF INT;
Point1:ARRAY [1..2] OF INT;
Point2:ARRAY [1..2] OF INT;
Point3:ARRAY [1..2] OF INT;
Point4:ARRAY [1..2] OF INT;
End:ARRAY [1..2] OF INT;
END_STRUCT
END_TYPE
:
Poly_1:polygonline := ( Start:=3,3, Point1 =5,2, Point2:=7,3, Point3:=8,5,
Point4:=5,7, End := 3,5);
:
<_>.<_>
, "Week" "Monday",
:
Week.Monday

. ,
.
(Data types)
(Object Organizer). TYPE
END_TYPE.
:
TYPE < >: < >;
END_TYPE
:
TYPE message: STRING[50];
END_TYPE;
CoDeSys V2.3

10-41

: CoDeSys

, . .
:
TYPE < > : < > (<>..<>) END_TYPE;
< > ,
< > SINT, USINT, INT, UINT, DINT, UDINT, BYTE, WORD,
DWORD (LINT, ULINT, LWORD).
< > , .
< > , .
:
TYPE
SubInt : INT (-4095..4095);
END_TYPE
:
VAR
i : INT (-4095..4095);
ui : UINT (0..10000);
END_VAR
, ( i := 5000;), CoDeSys .

CheckRangeSigned CheckRangeUnsigned.
. , .
, (unsigned).
.
:
CheckRangeSigned, (, , i). .
FUNCTION CheckRangeSigned : DINT
VAR_INPUT
value, lower, upper: DINT;
END_VAR

IF (value < lower) THEN


CheckRangeSigned := lower;
ELSIF(value > upper) THEN
CoDeSys V2.3

10-42

: CoDeSys
CheckRangeSigned := upper;
ELSE
CheckRangeSigned := value;
END_IF

.
: (value) (lower, upper).
CheckRangeSigned .
, i:=10*y :
i := CheckRangeSigned(10*y, -4095, 4095);
, y > 1000, i 4095.
CheckRangeUnsigned:
FUNCTION CheckRangeUnsigned : UDINT
VAR_INPUT
value, lower, upper: UDINT;
END_VAR
: CheckRangeSigned CheckRangeUnsigned ,
.
: ,
. , !
. ui 10000, FOR :
VAR
ui : UINT (0..10000);
END_VAR
FOR ui:=0 TO 10000 DO
...
END_FOR

: CheckRange, Check.Lib, . , , ,
, .

CoDeSys V2.3

10-43

D: CoDeSys

D: CoDeSys
10.16 Standard.lib
10.16.1
: .

( ).

LEN
.
STR STRING, INT.
IL:
LD

'SUSI'

LEN
ST

VarINT1 (* : 4 *)

FBD:

ST:
VarSTRING1 := LEN (SUSI);
LEFT
.
STR STRING, SIZE INT, STRING.
LEFT (STR, SIZE) : SIZE STR.
IL:
LD

'SUSI'

LEFT

ST

VarSTRING1

(* SUS *)

FBD:

ST:
VarSTRING1 := LEFT (SUSI,3);

CoDeSys V2.3

10-44

D: CoDeSys
RIGHT
.
STR STRING, SIZE INT, STRING.
RIGHT (STR, SIZE) : SIZE STR
IL:
LD

'SUSI'

RIGHT

ST

VarSTRING1

(*: USI *)

FBD:

ST:
VarSTRING1 := RIGHT (SUSI,3);
MID
.
STR STRING, LEN POS INT, STRING.
MID (STR, LEN, POS) : LEN STR , POS.
IL:
LD

'SUSI'

RIGHT

2,2

ST

VarSTRING1

(* : US *)

FBD:

ST:
VarSTRING1 := MID (SUSI,2,2);
CONCAT
() .
STR1 STR2 STRING.
IL:

CoDeSys V2.3

LD

'SUSI'

CONCAT

WILLI

ST

VarSTRING1

(* : SUSIWILLI *)
10-45

D: CoDeSys
FBD:

ST:
VarSTRING1 := CONCAT (SUSI,WILLI);
: CONCAT 5 .

INSERT
INSERT .
STR1 STR2 - STRING, POS - INT, -
STRING.
INSERT(STR1, STR2, POS) : STR2 STR1 POS.
IL:
LD

'SUSI'

INSERT

XY,2

ST

VarSTRING1

(* : SUXYSI *)

FBD:

ST:
VarSTRING1 := INSERT (SUSI,XY,2);

DELETE
DELETE .
STR STRING, LEN POS INT,
STRING.
DELETE(STR, L, P) : L STR, P.
IL:
LD

'SUXYSI'

DELETE

2,23

ST

Var1

(* : SUSI *)

FBD:

CoDeSys V2.3

10-46

D: CoDeSys

ST:
Var1 := DELETE (SUXYSI,2,3);
REPLACE
REPLACE .
STR1 STR2 STRING, LEN POS INT, STRING.
REPLACE(STR1, STR2, L, P) : L STR1 STR2
P.
IL:
LD

'SUXYSI'

REPLACE

'K', 2,2

ST

VarSTRING1

(* : SKYSI *)

FBD:

ST:
VarSTRING1 := REPLACE (SUXYSI,K,2,2);
FIND
FIND .
STR1 STR2 STRING, INT.
FIND(STR1, STR2) : STR1, STR2.
1. STR2 , STR1 0.
IL:
LD

'SUXYSI'

FIND 'XY'
ST

VarINT1

(* : 3 *)

FBD:

ST:
CoDeSys V2.3

10-47

D: CoDeSys
VarINT1 := FIND (SUXYSI,XY);

10.16.2
SR
:
Q1 = SR (SET1, RESET) :
Q1 = (NOT RESET AND Q1) OR SET1
SET1 RESET - Q1 BOOL.
:
SRInst : SR ;
IL:
CAL

SRInst(SET1 := VarBOOL1, RESET := VarBOOL2)

LD

SRInst.Q1

ST

VarBOOL3

FBD:

ST:
SRInst(SET1:= VarBOOL1 , RESET:=VarBOOL2 );
VarBOOL3 := SRInst.Q1 ;

RS
:
Q1 = RS (SET, RESET1) :
Q1 = NOT RESET1 AND (Q1 OR SET)
SET RESET1 - Q1 BOOL.
:
RSInst : RS ;
IL:
CAL

RSInst(SET := VarBOOL1, RESET1 := VarBOOL2)

LD

RSInst.Q1

ST

VarBOOL3

FBD:
CoDeSys V2.3

10-48

D: CoDeSys

ST:
RSInst(SET:= VarBOOL1 , RESET1:=VarBOOL2 );
VarBOOL3 := RSInst.Q1 ;
SEMA
.
BUSY = SEMA(CLAIM, RELEASE) :
BUSY := X;
IF CLAIM THEN X:=TRUE;
ELSE IF RELEASE THEN BUSY := FALSE; X:= FALSE;
END_IF
X - BOOL , FALSE.
CLAIM RELEASE - BUSY BOOL. (CLAIM
, RELEASE - )
.
CLAIM = TRUE BUSY = FALSE,
( RELEASE = TRUE).
BUSY = FALSE, , .
:
SEMAInst : SEMA ;
IL:
CAL

SEMAInst(CLAIM := VarBOOL1, RELEASE := VarBOOL2)

LD

SEMAInst.BUSY

ST

VarBOOL3

FBD:

ST:
SEMAInst(CLAIM:= VarBOOL1 , RELEASE:=VarBOOL2 );
VarBOOL3 := SEMAInst.BUSY;

10.16.3
R_TRIG
R_TRIG .
CoDeSys V2.3

10-49

D: CoDeSys
FUNCTION_BLOCK R_TRIG
VAR_INPUT
CLK : BOOL;
END_VAR
VAR_OUTPUT
Q : BOOL;
END_VAR
VAR
M : BOOL := FALSE;
END_VAR
Q := CLK AND NOT M;
M := CLK;
END_FUNCTION_BLOCK
Q FALSE , CLK FALSE. CLK
TRUE, Q TRUE. FALSE. , CLK FALSE
TRUE.
:
RTRIGInst : R_TRIG ;
IL:
CAL

RTRIGInst(CLK := VarBOOL1)

LD

RTRIGInst.Q

ST

VarBOOL2

FBD:

ST:
RTRIGInst(CLK:= VarBOOL1);
VarBOOL2 := RTRIGInst.Q;
F_TRIG
F_TRIG .
FUNCTION_BLOCK F_TRIG
VAR_INPUT
CLK: BOOL;
END_VAR
VAR_OUTPUT
Q: BOOL;
END_VAR
CoDeSys V2.3

10-50

D: CoDeSys
VAR
M: BOOL := FALSE;
END_VAR
Q := NOT CLK AND NOT M;
M := NOT CLK;
END_FUNCTION_BLOCK

Q FALSE , CLK TRUE. CLK


FALSE, Q TRUE. FALSE. , CLK TRUE
FALSE.
:
FTRIGInst : F_TRIG ;
IL:
CAL

FTRIGInst(CLK := VarBOOL1)

LD

FTRIGInst.Q

ST

VarBOOL2

FBD:

ST:
FTRIGInst(CLK:= VarBOOL1);
VarBOOL2 := FTRIGInst.Q;

10.16.4
CTU
.
CU, RESET Q BOOL, PV CV WORD.
CU ( FALSE TRUE) CV 1. Q
TRUE, PV. CV
0 RESET = TRUE.
:
CTUInst : CTU ;
IL:

CoDeSys V2.3

CAL

CTUInst(CU := VarBOOL1, RESET := VarBOOL2, PV := VarINT1)

LD

CTUInst.Q

ST

VarBOOL3

LD

CTUInst.CV
10-51

D: CoDeSys
ST

VarINT2

FBD:

ST:
CTUInst(CU:= VarBOOL1, RESET:=VarBOOL2 , PV:= VarINT1);
VarBOOL3 := CTUInst.Q ;
VarINT2 := CTUInst.CV;
CTD
.
CD, LOAD Q BOOL, PV CV WORD.
CD ( FALSE TRUE) CV 1.
0, , Q TRUE. CV
, PV LOAD = TRUE.
:
CTDInst : CTD ;
IL:
CAL

CTDInst(CD := VarBOOL1, LOAD := VarBOOL2, PV := VarINT1)

LD

CTDInst.Q

ST

VarBOOL3

LD

CTDInst.CV

ST

VarINT2

FBD:

ST:
CTDInst(CD:= VarBOOL1, LOAD:=VarBOOL2 , PV:= VarINT1);
VarBOOL3 := CTDInst.Q ;
VarINT2 := CTDInst.CV;
CTUD
/ .
CU, CD, RESET, LOAD QU QD BOOL, PV CV WORD.
RESET CV 0, LOAD PV.
CoDeSys V2.3

10-52

D: CoDeSys
CU 1. CD 1
( 0).
QU TRUE, CV PV.
QD TRUE, CV 0.
:
CTUDInst : CUTD ;
IL:
CAL

CTUDInst(CU := VarBOOL2, RESET := VarBOOL3, LOAD :=


VarBOOL4, PV := VarINT1)

LD

CTUDInst.QU

ST

VarBOOL5

LD

CTUDInst.QD

ST

VarBOOL6

LD

CTUDInst.CV

ST

VarINT2

FBD:

ST:
CTUDInst(CU := VarBOOL1, CU:= VarBOOL2, RESET := VarBOOL3,
LOAD:=VarBOOL4 , PV:= VarINT1);
VarBOOL5 := CTUDInst.QU ;
VarBOOL6 := CTUDInst.QD ;
VarINT2 := CTUDInst.CV;

10.16.5
TP
.
TP(IN, PT, Q, ET) IN PT BOOL TIME . Q ET
BOOL TIME.
IN FALSE, Q = FALSE, ET = 0. IN TRUE Q TRUE ( ) ET
, PT. . , Q PT IN.
TP:

CoDeSys V2.3

10-53

D: CoDeSys

:
TPInst : TP;
IL:
CAL

TPInst(IN := VarBOOL1, PT := T#5s)

LD

TPInst.Q

ST

VarBOOL2

FBD:

ST:
TPInst(IN := VarBOOL1, PT:= T#5s);
VarBOOL2 :=TPInst.Q;

TON
.
TON(IN, PT, Q, ET) IN PT BOOL TIME . Q ET
BOOL TIME.
IN FALSE, Q = FALSE, ET = 0. IN TRUE,
( ) ET , PT. . Q TRUE, IN TRUE ET PT, FALSE. , Q
PT IN.
TON:

:
TONInst : TON ;
IL:
CoDeSys V2.3

10-54

D: CoDeSys
CAL TONInst(IN := VarBOOL1, PT := T#5s)
LD TONInst.Q
ST VarBOOL2
FBD:

ST:
TONInst(IN := VarBOOL1, PT:= T#5s);
TOF
.
TOF(IN, PT, Q, ET) IN PT BOOL TIME . Q ET
BOOL TIME.
IN TRUE, Q = TRUE ET = 0. IN FALSE, ( ) ET.
. Q FALSE, IN FALSE ET PT, - TRUE.
, Q PT IN.
TOF:

:
TOFInst : TOF ;
IL:
CAL

TOFInst(IN := VarBOOL1, PT := T#5s)

LD

TOFInst.Q

ST

VarBOOL2

FBD:

ST:
TOFInst(IN := VarBOOL1, PT:= T#5s);
VarBOOL2 :=TOFInst.Q;

CoDeSys V2.3

10-55

D: CoDeSys
RTC
. , RTC
.

RTC(EN, PDT, Q, CDT) EN PDT, Q CDT BOOL DATE_AND_TIME .


EN FALSE, Q FALSE CDT DT#1970-01-01-00-00:00:00.
EN = TRUE PD .
CDT. EN FALSE, CDT DT#1970-01-01-00-00:00:00.
, PDT .

10.17 UTIL.LIB
,
BCD / , , , .
UTIL_NO_REAL , REAL.

10.17.1 BCD
, BCD, 0 99.
4 . 4-7 . BCD 0..99 0.. FF.
: 51 BCD . 5 - 0101, 1 - 0001. 0101_0001.

BCD_TO_INT
BCD INT.
BYTE INT.
BCD, -1.
ST:
i:=BCD_TO_INT(73);

(* 49 *)

k:=BCD_TO_INT(151); (* 97 *)
l:=BCD_TO_INT(15);

(* -1, F0 BCD *)

INT_TO_BCD
INTEGER BCD.
INT BYTE.
CoDeSys V2.3

10-56

D: CoDeSys
INTEGER BCD ,
255.
ST:
i:= INT_TO_BCD(49); (* 73 *)
k:=INT_TO_BCD (97); (* 151 *)
l:= INT_TO_BCD (100); (* ! : 255 *)

10.17.2 /
EXTRACT
: DWORD X BYTE N. BOOL, N X.
0.
ST:
FLAG:=EXTRACT(X:=81,N:=4); (* : TRUE, 81 1010001, 4 1 *)
FLAG:=EXTRACT(X:=33, N:=0); (* : TRUE, 33 100001, 0 1 *)
PACK
B0, B1, ..., B7 BOOL BYTE.
UNPACK .
PUTBIT
: DWORD X, BYTE N BOOL B.
PUTBIT N- X , B. 0.
ST:
A:=38;

(* 100110 *)

B:=PUTBIT(A,4,TRUE);

(* : 54 = 2#110110 *)

C:=PUTBIT(A,1,FALSE);

(* : 36 = 2#100100 *)

UNPACK
UNPACK B BYTE 8 B0,...,B7 BOOL.
PACK.
FBD:

CoDeSys V2.3

10-57

D: CoDeSys

10.17.3
DERIVATIVE
.
IN OUT REAL. TM ( , ) DWORD. (RESET = TRUE) OUT
.
DERIVATIVE , .
FBD:

INTEGRAL
.
IN REAL. TM DWORD (
, ). RESET BOOL
TRUE. OUT REAL.
.
FBD: :

LIN_TRAFO
(util.lib) REAL, , . . :
(IN - IN_MIN) : (IN_MAX - IN) = (OUT - OUT_MIN) : (OUT_MAX - OUT)
CoDeSys V2.3

10-58

D: CoDeSys

IN

REAL

IN_MIN

REAL

IN_MAX

REAL

OUT_MIN

REAL

OUT_MAX

REAL

OUT

REAL

ERROR

BOOL

: TRUE, IN_MIN = IN_MAX


IN

:
, ( IN).
( OUT). ( ) IN_MIN=0 IN_MAX=10. ( ) OUT_MIN=-20 OUT_MAX=40.
, 5 , 10 .

STATISTICS_INT
, .
IN INT. RESET BOOL . MN , MX AVG
IN. INT.
FBD:

CoDeSys V2.3

10-59

D: CoDeSys

STATISTICS_REAL
, STATISTICS_INT. IN MN, MX, AVG
REAL.
VARIANCE
.
IN REAL, RESET BOOL OUT REAL. RESET=TRUE.
VARIANCE.

10.17.4
PD
:

de(t )

Y = Y _ OFFSET + KP e (t ) + TV

dt

Y_OFFSET , KP , TV (ms), e(t) - (SET_POINT-ACTUAL).


ACTUAL, SET_POINT, KP, Y_OFFSET, Y_MIN Y_MAX REAL. TV DWORD,
RESET MANUAL BOOL.
Y REAL, LIMITS_ACTVE BOOL.
Y Y_MIN Y_MAX. Y ,
LIMITS_ACTVE, (BOOL) TRUE. , Y_MIN
Y_MAX 0.
MANUAL TRUE, , Y .
MANUAL FALSE .
P- PD TV 0.
FBD:

CoDeSys V2.3

10-60

D: CoDeSys

PID
:

1 TN
de(t )

Y = Y _ OFFSET + KP e(t ) +
e(t ) + TV

TN
dt

0
Y_OFFSET , KP , TN (ms), TV (ms), e(t) - (SET_POINT-ACTUAL).
ACTUAL, SET_POINT, KP, Y_OFFSET, Y_MIN Y_MAX REAL. TN TV
DWORD, RESET MANUAL BOOL.
Y REAL, LIMITS_ACTVE OVERFLOW BOOL.
PID PD .
. OVERFLOW. TRUE, . .
FBD:

PID_FIXCYCLE
PID_FIXCYCLE.

CoDeSys V2.3

10-61

D: CoDeSys

PID , , CYCLE, .

10.17.5

BLINK

: ENABLE BOOL, TIMELOW TIMEHIGH TIME. OUT BOOL.
ENABLE = TRUE. TIMEHIGH, TIMELOW.
CFC:

FREQ_MEASURE
() ( )
BOOL. . .

CoDeSys V2.3

10-62

D: CoDeSys
:

IN

BOOL

PERIODS

INT

. 1
10.

RESET

BOOL

OUT

REAL

VALID

BOOL

FALSE , >
3*OUT ( )

GEN

: MODE GEN_MODE, BASE BOOL, PERIOD
TIME, CYCLES AMPLITUDE INT RESET BOOL. OUT INT.
MODE . : TRIANGLE TRIANGLE_POS - , SAWTOOTH_RISE SAWTOOTH_FALL , RECTANGLE , SINE COSINE :

TRIANGLE:

TRIANGLE_POS:

SAWTOOTH_RISE:

SAWTOOTH_FALL:

RECTANGLE:

SINUS:

COSINUS:

CoDeSys V2.3

10-63

D: CoDeSys

BASE (BASE=TRUE) , ..
(BASE=FALSE).
PERIOD CYCLES . AMPLITUDE .
RESET=TRUE.
FBD:

10.17.6
CHARCURVE
- - .

IN INT . N BYTE . ARRAY P[0..10],


P - , POINT, INT X Y.
OUT INT, . ERR BYTE, .
P[0]..P[N-1] ARRAY X , ERR 1. IN P[0].X P[N-1].X, ERR=2 OUT P[0].X
P[N-1].X.
N 2 11, ERR=4.
ST:
ARRAY P:
VAR
...

CoDeSys V2.3

10-64

D: CoDeSys
CHARACTERISTIC_LINE:CHARCURVE;
KL:ARRAY[0..10] OF POINT:= (X:=0,Y:=0), (X:=250,Y:=50), (X:=500,Y:=150),
(X:=750,Y:=400), 7((X:=1000,Y:=1000));
COUNTER:INT;
...
END_VAR
CHARCURVE :
COUNTER:=COUNTER+10;
CHARACTERISTIC_LINE(IN:=COUNTER,N:=5,P:=KL);
:

RAMP_INT
RAMP_INT .
INT: IN, , ASCEND DESCEND,
, TIMEBASE TIME. RESET TRUE RAMP_INT .
OUT INT, .
TIMEBASE t#0s, ASCEND DESCEND ( ) .
FBD:

RAMP_REAL
RAMP_REAL RAMP_INT, , IN, ASCEND, DESCEND
OUT REAL.

CoDeSys V2.3

10-65

D: CoDeSys

10.17.7

HYSTERESIS
.
IN, HIGH LOW INT. OUT BOOL.

IN , LOW, OUT TRUE. IN


, HIGH, FALSE. LOW HIGH
.
:

LIMITALARM
, IN . LOW HIGH ..
IN, HIGH LOW INT, O, U IL BOOL.
IN:
HIGH

O = TRUE

LOW

U = TRUE

LOW HIGH ()

IL = TRUE

FBD:

CoDeSys V2.3

10-66

D: CoDeSys

10.18 AnalyzationNew.lib
SFC.
FALSE, , . SFCErrorAnalyzationTable, .
:
b OR NOT(y < x) OR NOT (NOT d AND e)
:
InputExpr: BOOL,
DoAnalyze: BOOL, TRUE
ExpResult: BOOL,
:
AnalyzeExpression , , FALSE. AppendErrorString , "|".
OutString ( STRING) (: y < x | d).
AnalyseExpressionTable ,
FALSE, . ExpressionResult, , , .
OutTable: ARRAY [0..15] OF ExpressionResult;
:

AnalyseExpressionCombined AnalyzeExpression AnalyseExpressionTable.

10.19 CoDeSys
. SysLibs_Overview.pdf.

CoDeSys V2.3

10-67

E:

E:
CoDeSys Standard.lib Util.lib. ST IL. IL .
, IL (,
LD). IL (
) .
. IL :
C
N
N
(

, TRUE.
JMPC, CALC, RETC: ,
FALSE.
: ( )
: , , ,
.

.
CoDeSys:
ST
'
.. [ ]
:

IL

;
^
:=

LD var1
ST var1
S boolvar
R boolvar

<Program name>
<Instance name>
<Fctname>(vx, vy,..)

AND
OR
XOR
NOT
+
*
/
CoDeSys V2.3

JMP label
CAL prog1
CAL inst1
<Fctname> vx, vy
(
)
AND
OR
XOR
NOT
ADD
SUB
MUL
DIV

.
(.. 'string1')
(.. ARRAY[0..3] OF INT)
(.. var1 :
INT;)
(.. a:=var1;)
(.. pointer1^)
N
var1
N
var1
boolvar TRUE,
TRUE
boolvar FALSE,
TRUE
CN label
CN prog1
CN inst1
CN fctname vx, vy
.
.
N,(
AND
N,(
OR
N,(
OR
NOT
(

10-68

E:
>
>=
=
<>
<=
<
MOD(in)
INDEXOF(in)
SIZEOF(in)
SHL(K,in)
SHR(K,in)
ROL(K,in)
ROR(K,in)
SEL(G,in0,in1)

GT
GE
EQ
NE
LE
LT
MOD
INDEXOF
SIZEOF
SHL
SHR
ROL
ROR
SEL

MAX(in0,in1)
MIN(in0,in1)
LIMIT(MIN,in,Max)
MUX(K,in0,...in_n)

MAX
MIN
LIMIT
MUX

ADR(in)
ADRINST()

ADR
ADRINST

BITADR(in)
BOOL_TO_<type>(in)
<type>_TO_BOOL(in)
INT_TO_<type>(in)

BITADR
BOOL_TO_<type>
<type>_TO_BOOL
INT_TO_<type>

REAL_TO_<type>(in)

REAL_TO_<type>

LREAL_TO_<type>(in)

LREAL_TO_<type>

TIME_TO_<type>(in)

TIME_TO_<type>

TOD_TO_<type>(in)

TOD_TO__<type>

DATE_TO_<type>(in)

DATE_TO_<type>

DT_TO_<type>(in)

DT_TO_<type>

STRING_TO_<type>(in)

STRING_TO_<type>

TRUNC(in)
ABS(in)
SQRT(in)
LN(in)
LOG(in)
EXP(in)

TRUNC
ABS
SQRT
LN
LOG
EXP

CoDeSys V2.3

(
(
(
(
(
(


,

POU in; [INT]
, in
K
K
K
K
2 in0 ( G FALSE) in1
( G TRUE)
2 in0 in1
2 in0 in1
in MIN MAX
K- (
in0 In_n)
[DWORD]
,
ADRINST.
[DWORD]


INT

REAL
LREAL
TIME

TOD

DATE
DT

.

REAL INT
in
in
in
in
E in
10-69

E:
SIN(in)
COS(in)
TAN(in)
ASIN(in)
ACOS(in)
ATAN(in)
EXPT(in,expt)

SIN
COS
TAN
ASIN
ACOS
ATAN
EXPT expt

in
in
in
in
in
in
expt

Standard.lib:
ST
LEN(in)
LEFT(str,size)
RIGHT(str,size)
MID(str,size,pos)
CONCAT('str1','str2')
INSERT('str1','str2',pos)
DELETE('str1',len,pos)
REPLACE('str1','str2',len,pos)
FIND('str1','str2')
SR
RS
SEMA
R_TRIG
F_TRIG
CTU
CTD
CTUD
TP
TON
TOF
RTC

IL
LEN
LEFT
RIGHT
MID
CONCAT 'str2'
INSERT 'str2',p
DELETE len,pos
REPLACE
'str2',len,pos
FIND 'str2'
SR
RS
SEMA
R_TRIG
F_TRIG
CTU
CTD
CTUD
TP
TON
TOF
RTC

in
str size
str size
str pos size
() 2
str1 str2 pos
, len , pos
str1 pos len
str2
str2 str1
FB:
FB:
FB: (interruptable)
FB:
FB:
FB:
FB:
FB:
FB:
FB:
FB:
FB:

Util.lib:

BCD_TO_INT
INT_TO_BCD
EXTRACT(in,n)
PACK
PUTBIT
UNPACK
DERIVATIVE
INTEGRAL
LIN_TRAFO
STATISTICS_INT
CoDeSys V2.3

BCD INT
INT BCD
n- DWORD, BOOL
8
DWORD
8

REAL
., ., INT
10-70

E:
STATISTICS_REAL
VARIANCE
PD
PID
BLINK
FREQ_MEASURE
GEN
CHARCURVE
RAMP_INT
RAMP_REAL
HYSTERESIS
LIMITALARM

CoDeSys V2.3

., ., REAL

(INT)
(REAL)

10-71

F: /

F: /
10.20
, CoDeSys, . /. . .

/online

CoDeSys online
.

/run

.
/online

/show ...

CoDeSys

/show hide

/show icon

/show max

/show normal

, .

/out <outfile>

<outfile>.

/noinfo

/userlevel
<group>

(, "/userlevel 0"

/password
<password>
/openfromplc

(, "/password abc")

/visudownload

CoDeSys HMI , -

0)

.
, .

/notargetchange

(. "target...").

/cmd <cmdfile>

<cmdfile>

:
"< CoDeSys-exe>" "< >" /<1> /<c 2> ....

"D:\dir1\codesys" "C:\projects\ampel.pro" /show hide /cmd command.cmd

ampel.pro, . ,
command.cmd. !

10.21 (cmdfile)
, (. ). .

CoDeSys V2.3

10-73

F: /
(
, @). (;) .
:
onerror continue

,
.

onerror break

, .

Online:
online login

('Online Login')

online logout

('Online' 'Logout')

online run

('Online' 'Run')

online stop

('Online' 'Stop')

online bootproject

('Online' 'Create boot project')

online sourcecodedownload

('Online' 'Sourcecode download')

online sim

('Online' 'Simulation')

online sim off

('Online' 'Simulation')

File:
file new

('File' 'New')

file open <projectfile>

<projectfile> ('File' 'Open')

/readpwd:<readpassword>

, .

/writepwd:<writepassword>

, .

file close

('File' 'Close')

file save

('File' 'Save')

file saveas <projectfile>


: <type><version>

<projectfile> ('File' 'Save as')


: CoDeSys
<projectfile>. , :
"internallib" :
"externallib" :
"pro" :
<Version>: 15, 20, 21, 22 ( 1.5, 2.0, 2.1, 2.2)
: "file save as lib_xy internallib22" -> "project xy.pro", "lib_xy.lib" V2.2.

file printersetup <filename>.dfr


:
pageperobject
pagepersubject
file archive <filename>.zip
file quit

CoDeSys V2.3

dfr ('File' Printer setup') 'New page per object' 'New page per subobject' (.
)
zip- ('File' Save/Mail Archive')
CoDeSys ('File' 'Exit')

10-74

F: /
Project:
project build

('Project' 'Build')

project rebuild or
project compile
project clean

('Project' ''Rebuild all'')


('Project'
'Clean Project')

project check

('Project' 'Check all')

project import <file1> ...


<fileN>

<file1> ... <fileN> ('Project'


'Import'). : , , "project
import C:\projects\*.exp.

project export <expfile>

<expfile> ('Project' 'Export')

project expmul

,
.

project documentation

(. )

:
out open <msgfile>

<msgfile>. .

out close

out clear

:
echo on

echo off

echo <text>

<text>.

( import, export, copy):


replace yesall

( , )

replace noall

( , )

replace query

'replace yesall' 'replace


noall'

, CoDeSys :
query on

query off ok

'OK'

query off no

'No'

query off cancel

'Cancel'

:
call <parameter1> ... <parame- . 10 :$0 - $9.
ter10>

CoDeSys V2.3

10-75

F: /
CoDeSys:
( , 'Directories', 'General'):
,
. . :
dir lib "D:\codesys\Libraries\Standard; D:\codesys\Libraries\NetVar"

dir lib <libdir>

<libdir>

dir compile <compiledir>

<compiledir>

dir config <configdir>

<configdir>

dir upload <uploaddir>

<uploaddir>

CMDFILE:
delay 5000

Watch and Receipt Manager:


watchlist load <file>

(Watchlist) <file> ('Extras' 'Load Watchlist')

watchlist save <file>

<file> ('Extras' 'Save Watchlist')

watchlist set <text>

<text> ('Extras' 'Rename Watchlist')

watchlist read

('Extras' 'Read receipt')

watchlist write


('Extras' 'Write receipt')

:
library add <library file1> <library file2> .. <library fileN>

. , , .

library delete [<library1> <library2> .. <libraryN>]

( ) .

:
object copy <source project
file> <source path> <target
path>

(source path) (target path) .


(source path) - . , . .
(target path) , .

:
object setreadonly
.
<TRUE|FALSE> <object type> ,
| <object name>
.

CoDeSys V2.3

: pou, dut (data type), gvl (global variables list), vis


(visualization), cnc (CNC object), liblist (Libraries), targetsettings, toolinstanceobject (particular Tools instance), toolmanagerobject (all instances in
the Tools tree), customplconfig (PLC configuration), projectinfo (Project
information), taskconfig (task configuration), trace, watchentrylist (Watchand Recipe Manager), alarmconfig (Alarm configuration)
10-76

F: /
and Recipe Manager), alarmconfig (Alarm configuration)
: "object setreadonly TRUE pou plc_prg" PLC_PRG
.
(gateway, device):
gateway local

(gateway) .

gateway tcpip <Address>


<Port>

.
<Address>: TCP/IP .
<Port>: TCP/IP .
: , !

device guid <guid>

GUID .
GUID (): {01234567-0123-0123-0123-0123456789ABC}
.

device instance <Instance


.
name>
device parameter <Id> <Value> (ID) .
:
system <command>

:
target <Id>

. CoDeSys
( . ) "/notargetchange",
.

ENI:
:
<category>: "project" "shared" "compile" : Project Objects, Shared Objects, Compile Files
<POUname>: , CoDeSys.
<Objecttype>: POU , (
, . ENI ).
: "GLOBAL_1.GVL" -> POU "GLOBAL_1", "GVL" (global variables list)
<comment>: ( ), .
ENI :
eni on
eni off

'Use source control (ENI)' , . ('Project' 'Options' 'Project source control')

eni project readonly on


eni project readonly off

'Read only' 'Project objects' , . ('Project' 'Options' 'Project objects')

eni shared readonly on


eni shared readonly off
CoDeSys V2.3

'Read only' 'Shard objects'


, .
('Project' 'Options' 'Shared objects')
10-77

F: /
eni shared readonly off

, .
('Project' 'Options' 'Shared objects')

eni set local <POUname>

'Local', ..

('Project' 'Object' 'Properties' 'Data base-connection')

eni set shared <POUname> 'Shared objects'


('Project' 'Object' 'Properties' 'Data base-connection')
eni set project <POUname> 'Project objects'
('Project' 'Object' 'Properties' 'Data base-connection')
eni <category> server
ENI Server 'Project objects'
<TCP/IP_Address> <Port> ('Project' 'Options' 'Project data base');
<Projectname> <Username>
:
<Password>
eni project server localhost 80 batchtest\project EniBatch Batch
(TCP/IP-Address = localhost, Port = 80, Project name = batchtest\project, User
name = EniBatch, Password = Batch)
eni compile sym on
eni compile sym off

('Create ASCII symbol information


(.sym)') /
('Project' 'Options' 'Project source control' 'ENI settings' for 'Compile files')

eni compile sdb on


eni compile sdb off

'Create binary symbol information (.sym)' 'Compile files'


, /
('Project' 'Options' 'Project source control' 'ENI settings' for 'Compile files')

eni compile prg on


eni compile prg off

'Create boot project' 'Compile files' ,


/
('Project' 'Options' 'Project source control' 'ENI settings' for 'Compile files')

'Project' 'Data Base Link' :


eni set <category>

('Define')

'eni set <category>set <Ob- jecttype>:<POUname>


. ('Multiple Define')
<Objecttype>:<POUname>
:
"eni set project pou:as_fub pou:st_prg"
-> (pou) as_fub st_prg get 'Project objects'
eni <category> getall

. ('Get All Latest


Versions')

'eni <category>get <Ob . ('Muljecttype>:<POUname>


tiple Define'). ('Get latest version')
<Objecttype>:<POUname>
:
"eni project get pou:as_fub gvl:global_1"
-> (POU) as_fub.pou
global_1.gvl .
eni <category> checkoutall . "<comment>"
.
eni <category> checkout
(Objecttype:POUname), , "<comment>" <Ob . jecttype>:<POUname>
.
<Objecttype>:<POUname>
CoDeSys V2.3
10-78

F: /
<Objecttype>:<POUname> .
:
"eni project checkout "for working on xy" pou:as_fub gvl:global_1"
-> (POU) as_fub global_1 , "for working on xy" .
eni <category>checkinall
"<comment>"

, , .
.

eni <category> checkin


(Objecttype:POUname), , "<comment>" <Ob . jecttype>:<POUname>
.
<Objecttype>:<POUname>

CoDeSys V2.3

10-79

F: /
:
, "$":
$PROJECT_NAME$ CoDeSys ( ".pro")
$PROJECT_PATH$

CoDeSys (
, .. "projects\sub1").

$PROJECT_DRIVE$ ( , ..
"D:")
$COMPILE_DIR$

( , ..
"D:\codesys\compile")

$EXE_DIR$

codesys.exe ( ,
..D:\codesys)

:
file open C:\projects\CoDeSys_test\ampel.pro
query off ok
watchlist load c:\work\w.wtc
online login
online run
delay 1000
watchlist read
watchlist save $PROJECT_DRIVE$\$PROJECT_PATH$\w_update.wtc
online logout
file close
file ampel.pro,
(watch list) w.wtc, . 1
watch.wtc (
"C:\projects\CoDeSys_test"). .
, , :
"<path of codesys.exe>" /cmd "<path of cmd file>"

CoDeSys V2.3

10-80

G: .

G: .
"Project" "Siemens Import" , (POU) Siemens STEP5/7. "Import from a SEQ symbol file"
STEP5. "Import from a S5 project file" .
STEP5 CoDeSys. STEP5 IL
.
CoDeSys. standard.lib, .
SEQ
SEQ - STEP5.
*. seq. S5 (, ,
, ..), , . , . .
.
SEQ 61131-3,
, ( ).
61131-3 ( ..). S5 ,
, . . ,
(, "0"). ,
. SEQ .
. 64 .
SEQ Siemens STEP5-PG Siemens STEP7300/400 ACCON-PG DELTALOGIC. STEP7-SEQ 3.x
. STEP7 2.x .
.
SEQ Windows . . ,
STEP5/7 . ,
STEP5 A! A? A_.
: A_". .
. , Siemens , ,
, . .
, , x
(, "%MX4.0"), , SEQ . 61131-3, , , . , . , ,
.
SEQ
STEP5/7. - ,
, .

CoDeSys V2.3

10-82

G: .
S5
(POU) Siemens S5 (*.s5d). MC5 ,
S5 SPS. MC5 STEP5
IL ( ). , S5D STEP5. S5D , CoDeSys , . ,
. SEQ S5
.
S5D Windows.
POU .
. STEP5 IL
IL, LD FBD.
, , CoDeSys . ,
"U M12.0" , M12.0. . , "UName" "U M12.0".
. ,
R_TRIG
.
S5 C 61131-3
STEP5 ,
. ,
61131-3, , STEP5 IL POU. . , CPU. STEP5
, .
, 61131-3, , LD FBD STEP5, , STEP5-PB. , S5 CPU
(, , , ..).
STEP5,
61131-3.
:
U, UN, O, ON, S, R, = : I (), O (), M (), S (S ), D (
)
U, UN, O, ON : T (), C ()
S, R : C
SU, RU, P, PN : E, A, M, D
O, O(, U(, )
L, T : E, A, M, D, T, C, P (Periphery) : B
(byte), W (word), D (double word), L (left byte), R (right byte)
L : DH, KB, KF, KH, KM, KT, KZ, KY, KG, KC
SI, SE, SA : T
ZV, ZR : C
CoDeSys V2.3

10-83

G: .
+, -, X, : : F (. ), G (. )
+, - : D (32 . )
!=, ><, >, <, >=, <= : F, D, G
ADD : BF, KF, DH
SPA, SPB : PB, FB ( ), SB
A, AX : DB, DX
BE, BEA, BEB
BLD, NOP, ***
UW, OW, XOW
KEW, KZW, KZD
SLW, SRW, SLD, RRD, RLD
SPA=, SPB=
SPZ=, SPN=, SPP=, SPM=
TAK
D, I

:
U, UN, O, ON, S, R, = : T0.0, C0.0 ( )
L, T : Q ( )
LC : T, C
SV, SS, R, FR : T
FR : C

BA, BB, BS, BT ( ).
SPA, SPB : OB
BA, BAB : FX
E, EX : DB, DX
STP, STS, STW
DEF, DED, DUF, DUD
SVW, SVD
SPO=, SPS=, SPR
AS, AF, AFS, AFF, BAS, BAF
ENT
SES, SEF
B : DW, MW, BS
LIR, TIR, LDI, TDI, TNW, TXB, TXW
MAS, MAB, MSA, MSB, MBA, MBS
MBR, ABR
LRW, LRD, TRW, TRD
CoDeSys V2.3

10-84

G: .
TSG
LB, TB, LW, TW : GB, GW, GD, CB, CW, CD
ACR, TSC
BI
SIM, LIM
, , , CPU. :
BCD (LC T, LC C), SV SS .
:
STEP5 POU, , .

STEP5, :
1. word
STEP5 (word) .
61131-3, TIME WORD . .
"Incompatible Types: Cannot convert WORD to TIME." "Incompatible Types: Cannot convert TIME to
WORD." WORD TIME.
2.
61131-3 (DB) . STEP5 DB
( , ), (B
DW), (B MW100 A DB 0) ( , ).
STEP5 DB , . , , ( A DB , =
). , POU A DB . A DB , ,
POU . "No open data block (insert an A DB)". , "ErrorDW0".
DB ( "ErrorDW0" "DB10.DW0"). ,
STEP5 POU A DB.
A BD , DB.
3.
STEP5 ( ) :
L KF +5
T MW 44
B MW 44
A DB 0

CoDeSys V2.3

10-85

G: .
DB5 ( DB, %MW44). .
:
DB ( DB5, DB6 .)
IL, LD FBD ( ) POU. POU . ( DBType) POU.
:
VAR_GLOBAL
DB5, DB6 : DBType;
END_VAR
POU ( DBs).
DB VAR_INPUT DBType.

.
4. S5 . , STEP5 ( MC5) .
POU, .

5. , (OB) (805xx
). (OB251),
. ,
.
.
6. (, DB1 [S5-95U], DX0, DX2), S5 CPU,
. , CPU. S5.
, , .. ,
Siemens SPS.
. :
(*Warning! Unconvertible STEP5/7 code shown as comment:*)
.
. Siemens , :
: -.-
: -
. %MW32 %MW33
%MB33 ( Siemens SPS). CoDeSys %MW32 %MW33 .

, "%MW10.0.0.
. CoDeSys V2.3

10-86

G: .
! Siemens - ,
- . CoDeSys
WORD . .
.
(M) -.
%MX33.3, %MB33, %MW32 %MD30, .
, , .
, .

CoDeSys V2.3

10-87

H:

H:
10.22 (Target Platform)
Intel 386

Platform

Support float processor

: FPU
.

Debugging in multitasking
environment

: ,
.

Optimized jumps

: ;
+ ( 386/486); ,
,
.

Optimized operations with


constants

(A = A + 1, A < 500 etc.); +


( 386/486); .

Optimized Loadoperations
/; +

Motorola 68K

CoDeSys V2.3

10-89

H:

Platform

CPU

68k CPU: 68000 CPU32 .

Support Float Processor

: FPU
.

Use 16 bit jump offsets

:
16 ( , ).
: 8 .

allow byte-aligned structures

: .
: .

Reserved Register 1

A2,A4,A5,A6:
:

Reserved Register 2

Base register for library


data

C (
, ).
"None", A5.

Output-Mode

Nothing =
Assembler = "code68k.hex" (.
"Project/Options/Directories").
Disassembler =

Infineon C16x

CoDeSys V2.3

10-90

H:

Platform

Code / Compiler:

, RTS ( C )

Code / Stack size

()

Code / Data

Code / Functions

Init. functions

Optimize

: ,

Output HEX-File

: HEX

Output BIN-File

Output MAP

: map-

Output LST

Output LST , of addresses

DPPs /
DPP0..DPP2
In Instances

DPP
DPP0, DPP1, DPP2
DPP

Libraries /
Code
Tables
Data
Data length
POUs
References

CoDeSys V2.3

10-91

H:

ARM Power PC
.

Platform

Support float processor

: FPU

First parameter Register


(integer)

,
C-

Last parameter Register


(Integer)

, C-

Register for return values , C-


(Integer)
First parameter Register , (Float):
C-
Last parameter Register
(Float):

,
C-

Register for return value


(Float):

, C

Intel byte order

: Intel

CoDeSys V2.3

10-92

H:

MIPS

Platform

First parameter Register


(integer)

,
C-

Last parameter Register


(Integer)

, C-

Register for return values , C-


(Integer)
Max. space on the stack
: . ( ) ,
for arguments (Byte):

'Hitachi SH'

CoDeSys V2.3

10-93

H:

Platform

Support float processor

: FPU

First parameter Register


(integer)

,
C-

Last parameter Register


(Integer)

, C-

Register for return values , C-


(Integer)
Max. space on the stack
: ( ),
for arguments (Byte)
.
First parameter Register
(Float):

, C-

Last parameter Register


(Float):

,
C-

Register for return value


(Float):

, C

Intel byte order

: Intel

8051

Platform

Maximum Stack-Size:(in Bytes)

( )

CoDeSys V2.3

10-94

H:

10.23 (Memory Layout).


.

Base (Code)

Automatic:
:

Base (Global)

Automatic: (global data)


:

Base (Memory)

Automatic: (M)
:

Base (Input)

Automatic: (I)
:

Base (Output)

Automatic: (O)
:

Base (Retain)

Automatic: Retain
:

Area (Code)

Area (Global)

(global data)

Area (Memory)

Area (Input)

Area (Output)

Area (Retain)

Retain

Size (Code)

CoDeSys V2.3

10-95

H:

Size pro Segment (Global)

Size (Memory)

Size (Input)

Size (Output)

Size (Retain)

Retain

Total size of data memory

Own retain segment

: Retain

Maximum number of global


data segments
Maximum number of POUs

. (global data)
. POU

10.24 (General)
.

Configurable

: I/O

Support CANopen configura- : CANopen


tion

Support Profibus configuration

: Profibus

Support preemptive multitasking


Download as file

:
: I/O

No address checking

Online Change

CoDeSys V2.3

10-96

H:

Update unused I/Os

: CoDeSys ,
, . , / PLC Configuration.

Singletask in multitasking

Byte-addressing mode

:
(.. var1 AT %QD4 %QB4)

Initialize zero

Download Symbol File

: ,

Symbol config from INI file

: (
) codesys.ini ,
codesys.ini

PLC-Browser

: PLC Browser

Trace

VAR_IN_OUT as reference

: VAR_IN_OUT . /
.

Initialize Inputs

: (
AT %IX !)

Automatic boot project load

: .

Softmotion

: SoftMotion
(CNC CAM)

Retain forcing

: , .
,
( CoDeSys SP
32F V2.4).

Save

: . , 'Retain forcing'.

Cycle independent forcing

: , .

CoDeSys V2.3

10-97

H:

10.25
.

Support parameter manager

: 'Parameter-Manager' . Object Dictionary


,

Support network variables

Names of supported network- , ...: CAN; UDP; DP


interfaces
Index ranges for parameters 'Parameters'
Index-ranges for variables

'Variables'

Index-ranges for Mappings

'Mappings'

Subindex range

-
Object Dictionar

CoDeSys V2.3

10-98

H:

10.26
.

Display width in pixel


Display height in pixel


. , , .

Use 8.3 file format

8.3 .

Alarmhandling in the PLC

ALARM_TASK
. ST-, ( ). ST- SysLibAlarmTrend.lib. . (
SysLibSockets.lib, SysLibMem.lib,SysLibTime.lib, SysLibFile.lib.
!)
: ''Alarm handling in the PLC' Target Web-.

CoDeSys V2.3

10-99

H:

Store trend data in the PLC .


TREND_TASK, ST- .
ST- SysLibAlarmTrend.lib. ( SysLibSockets.lib,
SysLibMem.lib,SysLibTime.lib, SysLibFile.lib.
!)
: 'Store Trend data....' Target-
Web-.
Activate system variable
'CurrentVisu

CurrentVisu .

Supported fonts in the target , .


Simplified input handling

: online:
<Tab> <>
. <Return>.
<Tab> .
: <Tab> <>
.

Web visualisation

: Web
.

Target visualisation

:
Target .

Use VISU_INPUT_TASK

( Target-Visualisation)
: (Target) (VISU_INPUT_TASK, VISU_TASK),
VISU_TASK,
VISU_INPUT_TASK.

Deactivate task generation ( Target-Visualisation)


: VISU_INPUT_TASK VISU_TASK (. )
. POU MAINTARGETVISU_PAINT_CODE
. . - CoDeSys Visualization.
Keyboard usage for tables

( Target visualization, . )
, VK_TAB ()
VK_SPACE () , . ,
.

CoDeSys V2.3

10-100

I:

I:
CoDeSys
.

<F6> -

<Alt>+<F6> Object Organizer -

(Message window). <Alt>+<F6> Object Organizer .

<Control>+<F6>

<Control>+<Shift>+<F6> .

<Tab> .

Object Organizer Library Manager.

.
, , <Shift>+<F10>
.

Object Organizer







Object Organizer Library Manager

-

'File' 'Save'
'File' 'Print'
'File' 'Exit'
'Project' 'Check'
'Project' 'Build'
'Project' 'Rebuild all'
'Project' 'Delete Object'
'Project' 'Add Object'
'Project' 'Rename Object'
CoDeSys V2.3

<F6>
<Alt>+<F6>
<Shift>+<F10>
<Ctrl>+<Enter>
<Enter>
<Control>+<F6>
<Control>+<Shift>+<F6>
<Enter>
<Enter>
<>
<Tab>
<F1>

<Ctrl>+<S>
<Ctrl>+<P>
<Alt>+<F4>
<Control>+<F11>
<Shift>+<F11>
<F11>
<Del>
<Ins>
<Spacebar>
10-102

I:
'Project' 'Open Object'
'Edit' 'Undo'
'Edit' 'Redo'
'Edit' 'Cut'
'Edit' 'Copy'
'Edit' 'Paste'
'Edit' 'Delete'
'Edit' 'Find next'
'Edit' 'Input Assistant'
'Edit' 'Auto Declare'
'Edit' 'Next Error'
'Edit' 'Previous Error'
'Online' 'Log-in'
'Online' 'Logout'
'Online' 'Run'
'Online' 'Toggle Breakpoint'
'Online' 'Step over'
'Online' 'Step in'
'Online' 'Single Cycle'
'Online' 'Write Values'
'Online' 'Force Values'
'Online' 'Release Force'
'Online' ''Write/Force dialog'
'Window' 'Messages'

<Enter>
<Ctrl>+<Z>
<Ctrl>+<Y>
<Ctrl>+<X>
<Shift>+<Del>
<Ctrl>+<C>
<Ctrl>+<V>
<Del>
<F3>
<F2>
<Shift>+<F2>
<F4>
<Shift>+<F4>
<Alt><F8>
<Ctrl>+<F8>
<F5>
<F9>
<F10>
<F8>
<Ctrl>+<F5>
<Ctrl>+<F7>
<F7>
<Shift>+<F7>
<Shift>+<F7>
<Shift>+<Esc>

FBD
'Insert' 'Network (after)'
'Insert' 'Assignment'
'Insert' 'Jump'
'Insert' 'Return'
'Insert' 'Operator'
'Insert' 'Function'
'Insert' 'Function Block'
'Insert' 'Input'
'Extras' 'Negate'
'Extras' 'Zoom'

<Shift>+<T>
<Ctrl>+<A>
<Ctrl>+<L>
<Ctrl>+<R>
<Ctrl>+<O>
<Ctrl>+<F>
<Ctrl>+<B>
<Ctrl>+<U>
<Ctrl>+<N>
<Alt>+<Enter>

CFC
'Insert' 'POU'
'Insert' 'Input'
'Insert' 'Output'
'Insert' 'Jump'
'Insert' 'Label'
'Insert' 'Return'
'Insert' 'Comment'
'Insert' 'POU input'
'Extras' 'Negate'
'Extras' 'Set/Reset'
'Extras' 'Connection'

<Ctrl>+<B>
<Ctrl>+<E>
<Ctrl>+<A>
<Ctrl>+<G>
<Ctrl>+<L>
<Ctrl>+<R>
<Ctrl>+<K>
<Ctrl>+<U>
<Ctrl>+<N>
<Ctrl>+<T>
<Ctrl>+<M>

CoDeSys V2.3

10-103

I:
'Extras' 'EN/ENO'
'Extras' 'Zoom'

<Ctrl>+<E>
<Alt>+<Enter>

LD
'Insert' 'Network (after)'
'Insert' 'Contact'
'Insert' 'Parallel Contact'
'Insert' 'Function Block'
'Insert' 'Coil'
'Extras' 'Paste below'
'Extras' 'Negate'
'Extras' 'Zoom'

<Shift>+<T>
<Ctrl>+<K>
<Ctrl>+<R>
<Ctrl>+<B>
<Ctrl>+<L>
<Ctrl>+<U>
<Ctrl>+<N>
<Alt>+<Enter>

SFC
'Insert' 'Step-Transition (before)'
'Insert' 'Step-Transition (after)'
'Insert' 'Alternative Branch (right)'
'Insert' 'Parallel Branch (right)'
'Insert' 'Jump'
'Extras' 'Zoom Action/Transition'

<Ctrl>+<T>
<Ctrl>+<E>
<Ctrl>+<A>
<Ctrl>+<L>
<Ctrl>+<U>
<Alt>+<Enter>

'Extras' 'Edit Entry'

<Enter>
<Spacebar>
<Enter>

CoDeSys V2.3

<F6>
<Ctrl>+<Del>
<Shift>+<Del>
<Del>

10-104

J:

J:
, . <F4>
. POU. . <F1> .

10.27
1100
"Unknown function '<name>' in library."
. , , .hex file, .lib file.
1101
"Unresolved symbol '<Symbol>'."
POU <Symbol>, . / .
1102
"Invalid interface for symbol '<Symbol>'."
<Symbol>
<Symbol> .
1103
"The constant '<name>' at code address '<address>' overwrites a 16K page boundary!"
16K . . .
1200
"Task '<name>', call of '<name>' Access variables in the parameter list are not updated"
, ,
.
1300
"File not found '<name>'"
, , .
.
1301
"Analyze-Library not found! Code for analyzation will not be generated."
CoDeSys V2.3

10-105

J:
, analyzation.lib . .
1302
"New externally referenced functions inserted. Online Change is therefore no longer possible!"
, ,
. .
1400
"Unknown Pragma '<Name>' is ignored!"
pragma . . " ".
1401
"The struct '<name>' does not contain any elements."
, 1 .
1410
"'RETAIN' and 'PERSISTENT' do not have any effect in functions"
RETAIN PERSISTENT .
1411
"Variable '<name>' in the variable configuration isn't updated in any task"
, .
:
Variable Configuration:
VAR_CONFIG
plc_prg.aprg.ainst.in AT %IB0 : INT;
END_VAR
plc_prg:
index := INDEXOF(aprg);
aprg , . plc_prg.aprg.ainst. %IB0.
1412
"Unexpected token '<Name>' in pragma {pragma name}"

'pragma'.
1413
"'<Name>' is not a valid key for list '<Name>'. The key will be ignored"

CoDeSys V2.3

10-106

J:
.
1500
"Expression contains no assignment. No code was generated."
.
1501
"String constant passed as 'VAR_IN_OUT': '<Name>' must not be overwritten!"
POU, .
1502
"Variable '<Name>' has the same name as a POU. The POU will not be called!"
POU .
:
PROGRAM a
...
VAR_GLOBAL
a: INT;
END_VAR
...
a; (* POU . *)
1503
"The POU <name> has no outputs. Box result is set to 'TRUE'."
POU, , FBD. TRUE.
1504
"<name> (<number>): Statement may not be executed due to the evaluation of the logical expression"
, .
:
IF a AND funct(TRUE) THEN ....
FALSE, funct .
1505
"Side effect in '<Name>'! Branch is probably not executed !"
POU FALSE, .
CoDeSys V2.3

10-107

J:
1506
"Variable '<name>' has the same name as a local action. The action will not be called!"
, . .
.
1507
"Instance '<name>' has the same name as a function. The instance will not be called."
ST , . . .
1550
"Multiple calls of the POU '<Name>' in one network may lead to undesired side effects"
POU
1600
"Open DB unclear (generated code may be erroneous)."
Siemens DB.
1700
"Input not connected."
CFC . .
1750
"Step '<Name>': the minimal time is greater than the maximal time!"
'Step attributes' . . .
1800
"<name>(element #<element number>): Invalid watchexpression '<name>'"
, . .
1801
"'<name> (number): No Input on Expression '<name>' possible"
. .
1802
"<Visualization object>(Element number): Bitmap '<name>' was not found"
, .
CoDeSys V2.3

10-108

J:
1803
"'<name>'('<number>'): "The print action would not supported for web- and target visualisation"
.
.

Web-

Target-

1804
"'<name>'('<number>'): The font '<name>' is not supported by the target."
, . .

1805
"'<name>'('<number>'): 'Store trend data in PLC' should be set."
, .
1806
"'<name>'('<number>'): The target setting 'Alarm handling in the PLC' should be set."
"" ,
.
1807
"<name> (<number>): No message window for alarms for target visualization"
, "" !
1850
"Input variable at %IB<number> is used in task '<name>' but updated in another task"
, , ,
. ,
.
1851
"Output variable at %IQ<number> is used in task '<name>' but updated in another task"
, , ,
. ,
.
1852
"CanOpenMaster might not be called cyclically in event task '<name>'! Set modul parameter UpdateTask!"
CanOpen Master , .
, UpdateTask
dialog 'Module parameters' .
CoDeSys V2.3

10-109

J:
1853
"A PDO (index: '<number>') might not be updated cyclically in event task '<name>'"
PDO , .
, PDO , -.
1900
"POU '<name>' (main routine) is not available in the library"
POU (.. PLC_PRG) , .
1901
"Access Variables and Variable Configurations are not saved in a library!"
.
1902
"'<Name>': is no Library for the current machine type!"
.obj
1903
"<Name>: is no valid Library"

1904
"The constant '<Name>' hides a constant of the same name in a library"
, , .
!
1970
"Parameter manager: List '<Name>' , Column '<Name>', Value '<Name>' could not be imported!"
*.prm,
.
1980
Global network variables '<Name>' '<Name>': simultaneous reading and writing may result in loss of
data!"
('Global variables list' 'Properties')
'Read' and 'Write'. .
1990
"No 'VAR_CONFIG' for '<name>'"
CoDeSys V2.3

10-110

J:
Variable_Configuration (VAR_CONFIG).
Variable_Configuration (Resources) ( 'Insert 'All instance paths').
2500
"Task '<task name>': no cycle time specified for cyclic task"
Task configuration , . 'Taskattributes' "Interval".

10.28
3100
"Code too large. Maximum size: '<number>' Byte (<number>K)"
. .
3101
"Total data too large. Maximum size: '<number>' Byte (<number>K)"
. .
3110
"Error in Library '<Name>'."
.hex INTEL Hex.
3111
"Library '<Name>' is too large. Maximum size: 64K"
.hex .
3112
"Nonrelocatable instruction in library."
.hex . .
3113
"Library code overwrites function tables."
.
3114
"Library uses more than one segment."
.hex .

CoDeSys V2.3

10-111

J:
3115
"Unable to assign constant to VAR_IN_OUT. Incompatible data types."
VAR_IN_OUT, "near", " huge" "far". , .
3116
"Function tables overwrite library code or a segment boundary."
166x: .
3117
"<Name> (<Zahl>): Expression too complex. No more registers available"
.
, .
3120
"Current code-segment exceeds 64K."
, 64K. , .
3121
"POU too large."
POU 64K.
3122
"Initialisation too large. Maximum size: 64K"
64K.
3123
"Data segment too large: segment '<Number>%s', size <size> bytes (maximum <number> bytes)"
.
3124
"String-constante too long: <namel> (Maximum 253)"
.
3130
"User-Stack too small: '<number>' DWORD needed, '<number>' DWORD available."

CoDeSys V2.3

10-112

J:
.
Debug (Project Options Build).
3131
"User-Stack too small: '<number>' WORD needed, '<number>' WORD available."
.
3132
"System-Stack too small: '<number>' WORD needed, '<number>' WORD available."
.
3150
"Parameter <number> of function '<name>': Cannot pass the result of a IEC-function as string parameter to a C-function."
, .
3160
"Can't open library file '<name>'."
<name> , .
3161
"Library '<name>' contains no codesegment"
.obj C . .obj,
.lib .
3162
"Could not resolve reference in Library '<name>'(Symbol '<name>', Class '<name>', Type '<name>')"
.obj (symbol). .
3163
"Unknown reference type in Library '<name>' (Symbol '<name>' , Class '<name>' , Type '<name>')"
.obj , . .
3200
"<name>: Boolean expression to complex"
. .

CoDeSys V2.3

10-113

J:
3201
"<name> (<network>): A network must not result in more than 512 bytes of code"
. "Use 16 bit jump offsets" 68k.
3202
"Stack overrun with nested string/array/structure function calls"
CONCAT(x, f(i)). .
3203
"Expression too complex (too many used address registers)."
.
3204
"A jump exceeds 32k Bytes"
, 32767 .
3205
"Internal Error: Too many constant strings"
POU 3000 .
3206
"Function block data exceeds maximal size"
32767 .
3207
"Array optimization"
,
.
3208
"Conversion not implemented yet"
, .
3209
"Operator not implemented"
, .

CoDeSys V2.3

10-114

J:
3210
"Function '<Name>' not found"
, .
3211
"Max string usage exceeded"
10 .
3212
"Wrong library order at POU <POU name>"
POU cslib.hex . ( r
68K).
3250
"Real not supported for 8 Bit Controller"
Real.
3251
"date of day types are not supported for 8 Bit Controller"
.
3252
"size of stack exeeds <number> bytes"
.
3253
"Could not find hex file: '<Name>' "
hex .
3254
"Call to external library function could not be resolved."
.
3255
"Pointers are not supported for 8 bit controllers."
8- .

CoDeSys V2.3

10-115

J:

3260
"Function <name> has too many arguments: Increase the size of the argument stack in the target settings."
. ,
Target Platform, Target Settings. , .
3400
"An error ocurred during import of Access variables"
.exp Access variables.
3401
"An error ocurred during import of variable configuration"
.exp variables configuration.
3402
"An error occured during import of global variables"
.exp global variables.
3403
"Could not import <name>"
.exp <name>.
3404
"An error occured during import of task configuration"
.exp .
3405
"An error occured during import of PLC configuration"
.exp .
3406
"Two steps with the name '<name'. Second step not imported."
SFC exp . .
3407
"Predecessor step '<name>' not found"

CoDeSys V2.3

10-116

J:
<name> .exp .
3408
"Successor step '<name>' not found"
<name> .exp .
3409
"No successing transition for step '<name>' "
<name>. .exp .
3410
"No successing step for transition '<name>'"
<name>. .exp .
3411
"Step '<name>' not reachable from initial step"
.exp <name> .
3412
"Macro '<name>' not imported"
.
3413
"Error during import of the CAMs."
(*.exp) CAM. .exp .
3414
"Error during import of the CNC program list"
(*.exp) CNC .
3415
Error during import of the Alarm configuration"
(*.exp), (Alarm
Configuration). .
3450
"PDO'<PDO-name>': Missing COB-Id!"
Properties COB ID <PDO Name>.

CoDeSys V2.3

10-117

J:
3451
"Error during load: EDS-File '<name>' could not be found, but is referenced in hardware configuration!"
,

(Project''Options' 'Directories').

EDS

3452
"The module '<name>' couldn't be created!"
<name> . , CoDeSys .
3453
"The channel '<name>' couldn't be created!"
. ,
CoDeSys .
3454
"The address '<name>' points to an used memory!"
'Check for overlapping addresses' .
, , 'size'
.
3455
"Error during load: GSD-File '<name>' could not be found, but is referenced in hardware configuration!"
, Profibus .
(Project' 'Options' 'Directories').
3456
"The profibus device '<name>' couldn't be created!"
<name> . , CoDeSys .
3457
"Error in module description!"
.
3458
"The PLC-Configuration couldn't be created! Check the configuration files."
, .
.
CoDeSys V2.3

10-118

J:
3459
"The selected baudrate is not supported."
CAN ,
GSD .
3460
3S_CanDrv.lib has the wrong version.
, 3S_CanDrv.lib, , .
3461
"3S_CanOpenMaster.lib has the wrong version."
, 3S_CanOpenMaster.lib, , .
3462
"3S_CanOpenDevice.lib has the wrong version."
, 3S_CanOpenDevice.lib, , .
3463
"3S_CanOpenManager.lib has the wrong version."
, 3S_ CanOpenManager.lib, , .
3464
"3S_CanNetVar.lib has the wrong version."
, 3S_ CanNetVar.lib, , .
3465
"CanDevice: Sub indices have to be numerated sequentially"
CanDevice . .
3466
"CAN network variables: No CAN controller found in the PLC configuration"
CAN (Resources, Global Variables),
CAN .
3468
"CanDevice: Update task not available in the task configuration."
, (Base Settings) CANdevice, (Task Configuration).
CoDeSys V2.3

10-119

J:
3469
"The CanOpenMaster can not be called. Please assign a task manually."
, Master UpdateTask
PLC Configuration.
3470
"Invalid name in parameter UpdateTask"
CanMasters Module PLC Configuration. UpdateTask.
. , UpdateTask .
3500
"No 'VAR_CONFIG' for '<Name>'"
'Variable_Configuration'.
3501
"No address in 'VAR_CONFIG' for '<name>'"
'Variable_Configuration'.
3502
"Wrong data type for '<name>' in 'VAR_CONFIG"
Variable_Configuration
POU.
3503
"Wrong data type for '<name>' in 'VAR_CONFIG'"
Variable_Configuration POU
.
3504
"Initial values are not supported for 'VAR_CONFIG"
Variable_Configuration . .
3505
"<name>is no valid instance path"
Variable_Configuration .
3506
"Access path expected"
CoDeSys V2.3

10-120

J:

Access
Variables
:<Identifier>:'<Access path>':<Type> <Access mode>.

3507
"No address specification for 'VAR_ACCESS'-variables"
Access Variables .
.
: <Identifier>:'<Access path>':<Type> <Access mode>
3550
"Duplicate definition of identifier '<name>'"
, .
3551
"The task '<name>' must contain at least one program call"
.
3552
"Event variable '<name>' in task '<name>' not defined"
- Single ,
. .
3553
"Event variable '<name>' in task '<name>' must be of type 'BOOL'"
BOOL - Single .
3554
"Task entry '<name>' must be a program or global function block instance"
Program call POU. .
3555
"The task entry '<name>' contains invalid parameters"
Append program call , POU.
3556
"Tasks are not supported by the currently selected target"
. .

CoDeSys V2.3

10-121

J:
3557
"Maximum number of Tasks ('<number>') exceeded"
. .
: XML .
3558
"Priority of task '<name>' is out of valid range between '<lower limit>' and '<upper limit>'"
. .
3559
"Task '<name>': Interval-Tasks are not supported by the current target"
,
. .
3560
"Task '<name>': free wheeling tasks are not supported by the current target"
(free wheeling) ,
. .
3561
"Task '<name>': event tasks are not supported by the current target"
- , . .
3562
"Task '<name>': external event tasks are not supported by the current target"
,
. .
3563
"The interval of task '<name>' is out of valid range between '<lower limit>' and '<upper limit>'"
.
3564
"The external event '<name>' of task '<name>' is not supported by the current target"
. .
3565
"Maximum number of event tasks ('<number>') exceeded"
CoDeSys V2.3

10-122

J:
, . .
3566
"Maximum number of interval tasks ('<number>') exceeded"
, . .
3567
"Maximum number of free wheeling tasks ('<number>') exceeded"
(free wheeling) ,
. .
3568
"Maximum number of external interval tasks ('<number>') exceeded"
, . .
3569
"POU '<name>' for system event '<name>' not defined"
POU, '<name>', .
3570
"The tasks '<name>' and '<name>' share the same priority"
, .
3571
"The library 'SysLibCallback' is not included in the project! System events cannot be generated."
SysLibCallback.lib.
.
3575
"Task <'name>': the cycle time has to be a multiple of <number> s."
Taskattributes.
.
3600
"Implicit variables not found!"
Rebuild all. ,

CoDeSys V2.3

10-123

J:
3601
"<name> is a reserved variable name"
, .
3610
" '<Name>' is not supported"
.
3611
"The given compile directory '<name>' is invalid"
Project Options Directories .
3612
"Maximum number of POUs (<number>) exceeded! Compile is aborted."
POU. POU Target Settings / Memory
Layout.
3613
"Build canceled"
.
3614
"Project must contain a POU named '<name>' (main routine) or a taskconfiguration"
POU (.. PLC_PRG) .
3615
"<Name> (main routine) must be of type program"
POU (.. PLC_PRG) .
3616
"Programs musn't be implemented in external libraries"
, ? .
.
3617
"Out of memory"
.

CoDeSys V2.3

10-124

J:
3618
"BitAccess not supported in current code generator!"
.
3619
"Object file '<name>' and library '<name>' have different versions!"
, *.lib *.obj resp. *.hex . .
3620
"The POU '<name>' must not be present inside a library"
2.1. PLC_PRG, .
3621
"Cannot write compile file '<name>'"
, , , , " ". .
3622
"The symbol file '<name>' could not be created"
, , ( ),
, " ".
.
3623
"Cannot write boot project file '<name>'"
, , ( ), , " ".
.
3624
"Target setting <targetsetting1>=<set value> not compatible with <targetsetting2>=<set value>"
Targetsettings dialogs ( Resources).
, .
3700
" POU with name <name>' is already in library '<name>'"
POU , .

CoDeSys V2.3

10-125

J:
3701
"Name used in interface is not identical with POU Name"
Project Rename object POU
POU. POU : PROGRAM, FUNCTION FUNCTIONBLOCK.
3702
"Overflow of identifier list"
100 .
3703
"Duplicate definition of identifier '<Name>'"
, '<Name>' POU.
3704
"data recursion: "<POU 0> -> <POU 1> -> .. -> <POU 0>""
.
3705
"<Name>: VAR_IN_OUT in Top-Level-POU not allowed, if there is no Task-Configuration"
, VAR_IN_OUT
PLC_PRG.
3720
"Address expected after 'AT'"
AT .
3721
"Only 'VAR' and 'VAR_GLOBAL' can be located to addresses"
VAR VAR_GLOBAL.
3722
"Only 'BOOL' variables allowed on bit addresses"
BOOL . .
3726
"Constants can not be laid on direct addresses"
.

CoDeSys V2.3

10-126

J:
3727
"No array declaration allowed on this address"
. .
3728
"Invalid address: '<address>'"
.
.
3729
"Invalid type '<name>' at address: '<Name>' "
. : AT
%IB1:WORD; , .
.
3740
"Invalid type: '<Name>' "
.
3741
"Expecting type specification"

3742
"Enumeration value expected"
.
3743
"Integer number expected"
(INT).
3744
"Enum constant '<name>' already defined"
:

CoDeSys V2.3

10-127

J:
3745
"Subranges are only allowed on Integers!"
.
3746
"Subrange '<name>' is not compatible with Type '<name>'"
.
3747
"unknown string length: '<name>'"
.
3748
"More than three dimensions are not allowed for arrays"
. ARRAY OF ARRAY .
3749
"lower bound '<name>' not defined"
, .
3750
"upper bound '<name>' not defined"
, .
3751
"Invalid string length '<number of characters>'"
.
3752
More than 9 dimensions are not allowed for nested arrays"
1- 2- 3-.
(, "arr: ARRAY [0..2,0..2,0..2] OF ARRAY [0..2,0..2,0..2] OF ARRAY [0..2,0..2,0..2, 0..2] OF
DINT". 9.
. .
3760
"Error in initial value"

CoDeSys V2.3

10-128

J:
, . ,
(Shift/F2 'Edit''Autodeclare').
3761
"'VAR_IN_OUT' variables must not have an initial value."
VAR_IN_OUT.
3780
"'VAR', 'VAR_INPUT', 'VAR_OUTPUT' or 'VAR_IN_OUT' expected"
POU
.
3781
"'END_VAR' or identifier expected"
END_VAR .
3782
"Unexpected end"
: END_VAR .
: , (, END_IF).
3783
"END_STRUCT' or identifier expected"
.
3784
"The current target doesn't support attribute <attribute name>"
(, RETAIN, PERSISTENT)
3800
"The global variables need too much memory. Increase the available memory in the project options."
Project Options Build.
3801
"The variable '<Name>' is too big. (<size> byte)"
,
.
, .

CoDeSys V2.3

10-129

J:
3802
"Out of retain memory. Variable '<name>', <number> bytes."
Retain .
. , ( : Retain,
Retain !)
3803
"Out of global data memory. Variable '<name>', <number> bytes."
. . ,

3820
"'VAR_OUTPUT' and 'VAR_IN_OUT' not allowed in functions"
-.
3821
"At least one input required for functions"
.
3840
"Unknown global variable '<name>'!"
POU VAR_EXTERNAL, .
3841
"Declaration of '<name>' do not match global declaration!"
VAR_EXTERNAL .
3850
"Declaration of an unpacked struct '<name>' inside a packed struct '<name>' is not allowed!"
. .
3900
"Multiple underlines in indentifier"
.

CoDeSys V2.3

10-130

J:
3901
"At most 4 numerical fields allowed in addresses"

%QB0.1.1.0.1).

, 4- (,

3902
"Keywords must be uppercase"
Autoformat in Project Options.
3903
"Invalid duration constant"
61131-3.
3904
"Overflow in duration constant"
. : t#49d17h2m47s295ms.
3905
"Invalid date constant"
61131-3.
3906
"Invalid time of day constant"
61131-3.
3907
"Invalid date and time constant"
61131-3.
3908
"Invalid string constant"
.
4000
"Identifier expected"
.

CoDeSys V2.3

10-131

J:
4001
"Variable '<Name>' not declared"
.
4010
"Type mismatch: Cannot convert '<Name>' to '<Name>'."
, , .
4011
"Type mismatch in parameter '<Name>' of '<Name>': Cannot convert '<Name>' to '<Name>'."
.
.
4012
"Type mismatch in parameter '<Name>' of '<Name>': Cannot convert '<Name>' to '<Name>'."
'<Name>.
.
4013
"Type mismatch in output '<Name>' of '<Name>': Cannot convert '<Name>' to '<Name>'."
'<Name>.
.
4014
"Typed literal: Cannot convert '<name>' to '<name>'"
.
: SINT#255
4015
"Data type <name>' illegal for direct bit access"
,
. , REAL/LREAL <var1>.<bit>, .
4016
"Bit index '<number>' out of range for variable of type '<name>'"
, .

CoDeSys V2.3

10-132

J:
4017
"'MOD' is not defined for 'REAL'"
MOD .
4020
"Variable with write access or direct address required for 'ST', 'STN', 'S', 'R'"
, .
4021
"No write access to variable '<name>' allowed"
, .
4022
"Operand expected"
.
4023
"Number expected after '+' or '-'"
.
4024
"Expecting <Operator 0> or <Operator 1> or ... before '<Name>'"
.
4025
"Expecting ':=' or '=>' before '<Name>'"
.
4026
"'BITADR' expects a bit address or a variable on a bit address"
(.. %IX0.1).
4027
"Integer number or symbolic constant expected"
.
4028
"'INI' operator needs function block instance or data unit type instance"
CoDeSys V2.3

10-133

J:
, 1.
4029
"Nested calls of the same function are not possible."
.
.
4030
"Expressions and constants are not allowed as operands of 'ADR'"
.
4031
"'ADR' is not allowed on bits! Use 'BITADR' instead."
BITADR. , BITADR .
4032
"<number> operands are too few for '<name>'. At least <number> are needed"
.
4033
"<number> operands are too many for '<name>'. At least <number> are needed"
.
4034
"Division by 0"
0 . , .
4035
"ADR must not be applied on 'VAR CONSTANT' if 'replaced constants' is activated"
. , Replace Constants in Project Options Build.
4040
"Label '<name>' is not defined"
<LabelName> .
4041
"Duplicate definition of label '<name>'"
CoDeSys V2.3

10-134

J:
'<Name>' . .
4042
"No more than <number> labels in sequence are allowed"
. .
4043
"Format of label invalid. A label must be a name optionally followed by a colon.
.
4050
"POU '<name>' is not defined"
POU '<Name>' Project Add Object '<Name>' POU.
4051
"'<name>' is no function"
<Name> , .
4052
"'<name>' must be a declared instance of FB '<name>'"
.
4053
"'<name>' is no valid box or operator"
'<Name>' POU , .
4054
"POU name expected as parameter of 'INDEXOF'"
POU.
4060
"'VAR_IN_OUT' parameter '<name>' of '<name>' needs variable with write access as input"
VAR_IN_OUT , POU.
4061
"'VAR_IN_OUT' parameter '<name>' of '<name>' must be used."

CoDeSys V2.3

10-135

J:
VAR_IN_OUT ,
POU.
4062
"No external access to 'VAR_IN_OUT' parameter '<name>' of '<name>'."
VAR_IN_OUT POU, .
4063
"'VAR_IN_OUT' parameter '<name>' of '<name>' must not be used with bit addresses."
. .
4064
"'VAR_IN_OUT' must not be overwritten in local action call!"
VAR_IN_OUT .
4070
"The POU contains a too complex expression"
, . .
4071
"Network too complex"
.
4072
"Inconsistent use of an action identifier in FB type ('<name>') and instance ('<name>')."
fb, a1 a2,
, .
: fb.a1 inst.a1.
4100
"'^' needs a pointer type"
, .
4110
"'[<index>]' needs array variable"
, .

CoDeSys V2.3

10-136

J:
4111
"Index expression of an array must be of type 'INT'"
.
4112
"Too many indexes for array"
(1, 2 3) .
4113
"Too few indexes for array"
(1, 2 3) .
4114
"One of the constant indizes is not within the array range"
, , .
4120
"'.' needs structure variable""
, ,
.
4121
" '<Name>' is not a component of <object name>"
'<Name>' <object name>.
4122
"'<name>' is not an input variable of the called function block"
.
4200
"'LD' expected"
LD jump IL.
4201
"IL Operator expected"
IL .

CoDeSys V2.3

10-137

J:
4202
"Unexpected end of text in brackets"
.
4203
"<Name> in brackets not allowed"
<name> IL.
( 'JMP', 'RET', 'CAL', 'LDN', 'LD', 'TIME')
4204
"Closing bracket with no corresponding opening bracket"
.
4205
"No comma allowed after ')'"
.
4206
"Label in brackets not allowed"
, .
4207
"'N' modifier requires operand of type 'BOOL','BYTE','WORD' or 'DWORD'"
N .
4208
"Conditional Operator requires type 'BOOL'"
, ? .
4209
"Function name not allowed here"
.
4210
"'CAL', 'CALC' and 'CALN' require a function block instance as operand"
, .

CoDeSys V2.3

10-138

J:
4211
"Comments are only allowed at the end of line in IL"
.
4212
"Accumulator is invalid before conditional statement"
. ( 'CAL').
4213
"'S' and 'R' require 'BOOL' operand"
.
4250
"Another 'ST' statement or end of POU expected"
ST .
4251
"Too many parameters in function '<name>'"
, .
4252
"Too few parameters in function '<name>'"
, .
4253
"'IF' or 'ELSIF' require 'BOOL' expression as condition"
IF ELSIF .
4254
"'WHILE' requires 'BOOL' expression as condition"
WHILE .
4255
"'UNTIL' requires 'BOOL' expression as condition"
UNTIL .

CoDeSys V2.3

10-139

J:
4256
"'NOT' requires 'BOOL' operand"
, NOT .
4257
"Variable of 'FOR' statement must be of type 'INT'"
, 'FOR' (.. DINT, DWORD).
4258
"Expression in 'FOR' statement is no variable with write access"
.
4259
"Start value in 'FOR' statement is no variable with write access"
'FOR' .
4260
"End value of 'FOR' statement must be of type 'INT'"
'FOR' .
4261
"Increment value of 'FOR' statement must be of type 'INT'"
'FOR' .
4262
"'EXIT' outside a loop"
'EXIT' 'FOR', 'WHILE' 'UNTIL'.
4263
"Expecting Number, 'ELSE' or 'END_CASE'"
CASE' .
4264
"'CASE' requires selector of an integer type"
, (.. DINT, DWORD).
4265
"Number expected after ','"
CoDeSys V2.3

10-140

J:
CASE .
4266
"At least one statement is required"
.
4267
"Function block call requires function block instance"
.
4268
"Expression expected"
.
4269
"'END_CASE' expected after 'ELSE'-branch"
'CASE' 'ELSE' 'END_CASE'.
4270
"'CASE' constant '<name>' already used"
CASE' CASE' .
4271
"The lower border of the range is greater than the upper border."
, .
4272
"Expecting parameter '<name>' at place <position> in call of '<name>'!"
, .
4273
Parts of the 'CASE'-Range '<range>' already used in Range '<range>'
, CASE .
4274
"Multiple 'ELSE' branch in 'CASE' statement"
CASE 'ELSE'.

CoDeSys V2.3

10-141

J:
4300
"Jump requires 'BOOL' as input type"
, jump - .
4301
"POU '<name>' need exactly <number> inputs"
VAR_INPUT VAR_IN_OUT.
4302
"POU '<name>' need exactly %d outputs".
VAR_ OUTPUT.
4303
"'<name>' is no operator"
'<name>' .
4320
"Non-boolean expression '<name>' used with contact"
.
4321
"Non-boolean expression '<name>' used with coil"
.
4330
"Expression expected at input 'EN' of the box '<name>' "
EN..
4331
"Expression expected at input '<number>' of the box '<Name>' "
<number> .
4332
Expression expected at input '<name>' of the box '<Name>'"
VAR_IN_OUT.
4333
"Identifier in jump expected"
CoDeSys V2.3

10-142

J:
.
4334
"Expression expected at the input of jump"
jump. TRUE.
4335
"Expression expected at the input of the return"
RETURN. TRUE.
4336
"Expression expected at the input of the output"
.
4337
"Identifier for input expected"
.
4338
"Box '<name>' has no inputs"
POU '<Name>' .
4339
"Typemismatch at output: Cannot convert '<name>' to '<name>'.
.
4340
"Jump requires 'BOOL' as input type"
, jump - .
4341
"Return needs a boolean input"
, RETURN - .
4342
"Expression expected at input 'EN' of the box '<name>'"
EN.

CoDeSys V2.3

10-143

J:
4343
"Values of Constants: <name>"
VAR_INPUT CONSTANT. POU 'Edit Parameters'
.
4344
"'S' and 'R' require 'BOOL' operand"
Set Reset.
4345
"Unzulssiger Typ fr Parameter '<Name>' von '<Name>': Kann '<Typ>' nicht in '<Typ>'
konvertieren."
'<Name>' .
4346
"Not allowed to use a constant as an output"
.
4347
"'VAR_IN_OUT' parameter needs variable with write access as input"
VAR_IN_OUT .
4348
"Invalid program name '<name>'. A variable with the same name exists already."
CFC, , ,
. .
4349
Input or output in POU <name> has been deleted: Check all connections to the box. This errormessage disappears only after the CFC was edited
POU. POU CFC.
4350
"An SFC-Action cannot be accessed from outside!"
SFC POU, . SFC POU, ,
iecsfc.lib . .

CoDeSys V2.3

10-144

J:
4351
"Step name is no identifier: '<name>'"
.
4352
"Extra characters following valid step name: '<Name>'"
.
4353
"Step name duplicated: '<Name>'"
.
4354
"Jump to undefined Step: '<Name>'"
.
4355
"A transition must not have any side effects (Assignments, FB-Calls etc.)"
.
4356
"Jump without valid Step Name: '<Name>' "
.
4357
"IEC-Library not found"
iecsfc.lib , Project
Options, .
4358
"Action not declared: '<name>'"
, SFC POU SFC.
4359
"Invalid Qualifier: '<name>'"
.

CoDeSys V2.3

10-145

J:
4360
"Time Constant expected after qualifier '<name>'"
.
4361
"'<name>' is not the name of an action"

4362
"Nonboolean expression used in action: '<name>'"
.
4363
"IEC-Step name already used for variable: '<Name>'"
.
4364
"A transition must be a boolean expression"
BOOL.
4365
"Time Constant expected after qualifier '<name>'"
step attributes '<Name>'
.
4366
"The label of the parallel branch is no valid identifier: '<Name>'"
(jump).
4367
"The label '<name>' is already used"
. .
4368
"Action '<name>' is used in multiple step chains, where one is containing the other!"
'<Name>' POU .

CoDeSys V2.3

10-146

J:
4369
"Exactly one network requried for a transition"
FBD LD . .
4370
"Additional lines found after correct IL-transition"
IL .
4371
"Invalid characters following valid expression: '<name>"
.
4372
"Step '<name>': Time limit needs type 'TIME'"
TIME
(, "t#200ms").
4373
"IEC-actions are only allowed with SFC-POUs"
-SFC-POU (. ), .
.
4374
"Step expected instead of transition '<name>'"
SFC POU , , -.
4375
"Transition expected instead of step '<name>'"
SFC POU , , -.
4376
"Step expected after transition '<name>'"
SFC POU , , -.
4377
"Transition expected after step '<name>'"
SFC POU , , -.

CoDeSys V2.3

10-147

J:
4400
Import / conversion of POU '<name>' contains errors resp. is not complete."
POU 61131-3.
4401
"S5 time constant <number> seconds is too big (max. 9990s)."
BCD .
4402
"Direct access only allowed on I/Os."
, , .
4403
"STEP5/7 instruction invalid or not convertible to IEC 61131-3."
STEP5/7 61131-3, , , ,
MAS.
4404
"STEP5/7 operand invalid or not convertible to IEC 61131-3."
STEP5/7 61131-3.
4405
"Reset of a STEP5/7 timer cannot be converted into IEC 61131-3."
.
4406
"STEP5/7 Counter constant out of range (max. 999)."
BCD .
4407
"STEP5 instruction not convertible to IEC 61131-3."
STEP5/7 61131-3, , DUF.
4408
"Bit access of timer or counter words not convertible into IEC 61131-3."
/ 61131-3.

CoDeSys V2.3

10-148

J:
4409
"Contents of ACCU1 or ACCU2 undefined, not convertible into IEC 61131-3."
, .
4410
"Called POU not in project."
POU.
4411
"Error in global variable list."
SEQ .
4412
"Internal error no.11"
.
4413
"Error in format of line in data block"
.
4414
"FB/FX name missing."
S5D POU .
4415
"Instruction after block end not allowed."
POU .
4416
"Invalid command"
S5/S7
4417
"Comment not closed"
"*)".
4418
"FB/FX-Name too long (max. 8 characters)"
CoDeSys V2.3

10-149

J:
POU .
4419
"Expected format of line ""(* Name: <FB/FX-Name> *)"" "
.
4420
"Name of FB/FX parameter missing"
POU.
4421
"Type of FB/FX parameter invalid"
POU.
4422
"Type of FB/FX parameter missing"
POU.
4423
"Invalid FB/FX call parameter"
POU.
4424
"Warning: FB/FX for call either missing or parameters invalid or has '0' parameters"
POU , ( ).
4425
"Definition of label missing"
.
4426
"POU does not have a valid STEP 5 block name, e.g. PB10"
POU.
4427
"Timer type not declared"
..

CoDeSys V2.3

10-150

J:
4428
"Maximum number of open STEP5 brackets exceeded"
.
4429
"Error in name of formal parameter"
.
4430
"Type of formal parameter not IEC-convertible"
61131-3 , POU .
4431
"Too many 'VAR_OUTPUT' parameters for a call in STEP5 STL"
POU .
4432
"Labels within an expression are not allowed"
61131-3 .
4434
"Too many labels"
POU 100 .
4435
"After jump / call, a new expression must start"
LD Load .
4436
"Bit result undefined, not convertible to IEC 61131-3."
, VKE, , VKE .
4437
"Type of instruction and operand are not compatible"
..

CoDeSys V2.3

10-151

J:
4438
"No data block opened (insert instruction C DB before)"
.
4500
"Unrecognized variable or address"
. <F2>
.
4501
"Extra characters following valid watch expression"
.
4520
"Error in Pragma: Flag expected before '<Name>'!"
. <Name>'
4521
"Error in Pragma: Unexpected element '<Name>'!"
, .
4522
"flag off' pragma expected!"
, .
4523
"Pragma {<Pragmaname>} not allowed in interface of type '<Name>'"
.
.
4550
"Index out of defined range : Variable OD "number>, Line <line number>."
(. Target settings/networkfunctionality).
4551
"Subindex out of defined range : Variable OD "number>, Line <line number>."
, (. Target settings /networkfunctionality).

CoDeSys V2.3

10-152

J:
4552
"Index out of defined range : Parameter OD "number>, Line <line number>."
, (. Target settings/networkfunctionality).
4553
"Subindex out of defined range : Parameter OD "number>, Line <line number>."
, (. Target settings/networkfunctionality).
4554
"Variablename invalid: Variable OD <number>, Line <line number>."
'variable'. <POU name>.<variable
name> .<variable name> .
4555
"Empty table-entry, input not optional: Parameter OD <number>, Line <line number>
.
4556
"Empty table-entry, input not optional: Variable OD <number>, Line <number>"
.
4557
"The required parameter memory is too large"
, (Parameters).
. .
4558
"The required variable memory is too large"
, (Variables).
. .
4560
"Invalid value: Dictionary '<Name>', column '<Name>', line '<line number>'"
. ,
- XML ,
.
4561
"Column not defined: '<Name>'"

CoDeSys V2.3

10-153

J:
, . XML . XML , .
4562
"Index/subindex used already: Dictionary '<Name>', line '<Line Number>'"
/ . .
4563
"Identifier '<Name>' used already: Dictionary '<Name>', line '<Line Number>'"
,
.
4564
"Index '<Name>' is out of range: Dictionary '<Name>', line '<Line Number>' "
,
(Variables, Parameters, Mappings).
4565
"Subindex '<Name>' is out of range: Dictionary '<Name>', line '<Line Number>' "
, 'SubIndex range'.
4566
"An error occurred during import of the parameter manager"
, . *.exp-.
4600
"Networkvariables: '<name>' expression is not from type bool!"
, , 'Transmit on event' ,
BOOL.
4601
"Network variables '<name>': No cyclic or freewheeling task for network variable exchange found"
free-wheeling , CAN UDP
, PLC_PRG ( !). PLC_PRG. , ,
.

CoDeSys V2.3

10-154

J:
4602
"'<name of network variables list>': The object uses UDP port '<port number>' instead of '<port number>'"
, ,
. !
4620
. . 'Project' 'Check' (Unused
Variables).
4621
AT"-. . 'Project'
'Check' ('Overlapping memory areas').
4622
, , . . 'Project' 'Check' ('Concurrent Access').
4623
.
. 'Project' 'Check' ('Multiple writes to output').
4650
"AxisGroup '<Name>': Task '<Name>' does not exist."
PLC Configuration ( 'Module parameters', 'Value') ,
, .
4651
"AxisGroup '<Name>': Cycletime (dwCycle) not set."
'Module parameters' (dwCycle).
4670
"CNC program '<Name>': Global variable '<Name>' not found."
CNC (, $glob_var$),
. .
4671
"CNC program '<Name>': Variable '<Name>' has an incompatible type."
CNC . .

CoDeSys V2.3

10-155

J:
4685
"CAM '<Name>': CAM table type unknown."
, ''Compile options.."

4686
"CAM '<Name>': CAM point exceeds datatype range."
CAM , . . 'Compile
options..' CAM-..
4700
"'<Number>' ('<Name>'): Watch expression '<Name>' is not a numeric variable."
, ,
(, XOffset Angle ..).
4701
"'<Name>' ('<Number>'): Watch expression '<name>' is not of type BOOL."
BOOL ,

4702
"'<Name>' ('<Number>'): Watch expression '<name>' is not of type STRING."
STRING ,
4703
"'<Name>' ('<Number>' ): Invalid watch expression '<Name>'"
.
4704
"'<Name>'('<Number>'): Invalid initial value in watchlist '<Name>'."
, ( INTERN,
. .

Input),

4705
"'<name>' ('<number>'): No valid alarm group assigned to alarm table."
( Alarm table).
4900
"Invalid type for conversion"
CoDeSys V2.3

10-156

J:
, .
4901
"Internal error: Overflow in array access!"
32- . .
5100
"<Name> (<Zahl>): Expression too complex. No more registers available"
.
, .

CoDeSys V2.3

10-157

J:

CoDeSys V2.3

10-158