0% found this document useful (0 votes)
75 views100 pages

TALARM Function Blocks: 6-56 4/94AWB27-1186-GB Klockner-Moeller

This document provides information about and examples of using various function blocks for timing applications: - The TALARM function block can be used as a signal generator and outputs a signal with a specified time/signal length. It requires a direct hardware connection due to its fast reaction time. - The TF off-delayed timer function block delays its output by a set time after its input becomes inactive. It can continue counting time even if interrupted. - The TGEN generator function block outputs pulses with a specified period for as long as its start input is active. - The TP pulse transmitter function block outputs a pulse with a specified time after its start input becomes active and then becomes inactive. - The TR

Uploaded by

jhonajhona
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views100 pages

TALARM Function Blocks: 6-56 4/94AWB27-1186-GB Klockner-Moeller

This document provides information about and examples of using various function blocks for timing applications: - The TALARM function block can be used as a signal generator and outputs a signal with a specified time/signal length. It requires a direct hardware connection due to its fast reaction time. - The TF off-delayed timer function block delays its output by a set time after its input becomes inactive. It can continue counting time even if interrupted. - The TGEN generator function block outputs pulses with a specified period for as long as its start input is active. - The TP pulse transmitter function block outputs a pulse with a specified time after its start input becomes active and then becomes inactive. - The TR

Uploaded by

jhonajhona
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

TALARM Function Blocks

Time Alarm Function Block


Timer Alarm

Description - Since an Alarm function block requires, due to its fast


reaction, a high-speed peripheral access (direct
output), the QB, QPB peripheral operands available in
the basic unit should be used.
- An alarm function block can be used several times
(multiple instantiation) although this should normally
be avoided since each function block group has the
same event source (hardware input I 0.0.0.0.0) and
only the last function block instance in the program is
valid.
- By multiple instantiation is meant the reservation of
several data ranges for each parameter set of a
particular function block type.

6-56 4/94AWB27-1186-GB Klockner-Moeller


Function Blocks TALARM
Time Alarm Function Block
Timer Alarm

Example The following example shows the call-up of the timer


alarm function block as a signal generator (MOD = 2).
The time/signal length is 1 ms (VT = 1000). The output on
Q 0.0 is shown below (a total of 50 signals are output):

1 ms 1 ms

QO.O 1 ms

Printout of the c:tala.q42 file Dated: 7. 4. 94


00000 BLOCK0 "Incorporate configuration file
001
002 #include "config.k42"
003
00001 BL0CK1 "Call-up the timer alarm function block
001
002 TALARM0
003 [ ] EN: I 0.3 Set function block
004 [b] MOD: KB 2
005 [w] VT:KW1000
006 [w] SOU: KW 100
007 [b] ERR:MB25
008 [w] CNT:MW12
009 [$] AC:
010
00002 END "End of program
001
002 EP

Klockner-Moeller 4/94 AWB 27-1186-GB 6-57


TF Function Blocks
Off-delayed Timer

Syntax Call-up:
TF < Block No. > - R
- R only if retentive operation is required.

As operand:
TF < Block No. > < Input/output >

Time ranges: 1...65 535 ms


10...65535 ms
*
Performance time: 300 ^s
Basic t i m e : - ms milliseconds
- s for s e c o n d s

Representation IL
TF 7-ms-R
[ ] S: Start and set
[ ] R: Reset
[ ] STOP: Interruption for timer
[W] 1: Set time value
[ ] EQ: Control output
[W] Q: Actual time value

(D (2) (3) (4) (5)


S__j—i
STOP
EQr-
W
Description With the rising edge of "S" the delay factor at " I " is
accepted and the "EQ" output is set High. If the "S"
input is Low, the "EQ" output follows, delayed by the
time "T" (1).
T = delay factor x time base

6-58 4/94AWB27-1186-GB Klockner-Moeller


Function Blocks TF
Off-delayed Timer

The set time should always be greater than the cycle


time to ensure that the delay is always detected. The
output "Q" shows the time elapsed in units of the
selected time base.
The time count can be interrupted via an " H " signal at
the "STOP" input; i.e. the delay time "T" is extended by
the time for which the "STOP" input is High (2), (3).
The EQ output only follows the S output if the STOP
input is Low (4), (5), when the set input is High.
The timer is reset into the initial state if the "R" input is
High.

Example The timer 56 is to indicate the dropping-out of input 10.2


- delayed by the time constant T = 50 000 - to the
output Q 0.3 In order to enter values greater than 32 767,
calculate the corresponding HEX or signed value. It
should be possible to stop the measurement of the
delay time via I 0.3 if there is an external event. The
elapsed time is indicated via the marker word MW 10.
The delay time in progress must be continued even after
a power loss, or after switching off the system and
subsequent restarting. The timer therefore has to be
retentive.

The program:
Option 1 Option 2
TF 56-S-l1 TF 56-S-l1
S: 10.2 S: 10.2
R: R:
STOP: 10.3 STOP 10.3
I: KW-1 I: KHW C350
EQ: Q0.3 EQ: Q0.3
0: MW10 Q: MW10

Klockner-Moeller 4/94 AWB 27-1186-GB 6-59


TGEN Function Blocks
Generator Function Block

Syntax Call-up:
TGEN < Block No. >

As operand:
TGEN < Block No. > u < Input/output >
Cycle time: 2 x 1 ...2 x 65535 ms
Performance time: 50 \iS
Time base: ms, no specification required

Representation IL
TGEN 63
[ ] S: Start and set
[W] I: Period T
[ ] P: Pulse output

Description When the "S" input is High, the period in milliseconds, at


the " I " input, is transferred. The "P" output generates
pulses with a pulse/pause ratio of 1:1 for as long as the
"S" input carries a " H " signal.

The time period should always be at least twice the


cycle time so that the High and Low signals can be
recognized clearly.

If the time period at the " I " input is changed, a rising


edge must be generated at the "S" input in order that
the new value can be accepted.

6-60 4/94 AWB 27-1186-GB Klockner-Moeller


Function Blocks TP
Pulse Transmitter

Syntax Call-up:
TP<Block N o . > - R
- R only if retentive operation is required.

As operand:
TP < Block No. > u < Input/output >
Time range: 1 ...65535 ms
Performance time: 300 \is
Basic time: ms, no specification required

Representation IL
TP5-R
S: Start and set
R: Reset
[W] I: Pulse time
[ ] P: Pulse output T
[W] 0: Actual time value

<T

Description When the rising edge is at the "S" input, the "P" o u t p u t -
is set High, and the pulse time at the " I " input (always hV
milliseconds) is transmitted. Irrespective of the status of
the "S" input the "P" output remains High for the
duration of the pulse, and then goes back to Low.
The set time should always be greater than the cycle
time so that the pulse can be recognized clearly.
The Q output indicates the running time in milliseconds.
The timer can be reset to the initial state with a High
signal at the "R" input.

Klockner-Moeller 4/94 AWB 27-1186-GB 6-61


TR Function Blocks
On-Delayed Timer

Syntax Call-up:
TR < Block No. > - R
- R only with retentive operation.

As o p e r a n d :
TR < Block No. > u < Input/output >
Time ranges: 1...65 535 ms
1...65 535 s
Performance time: 300 \is
Basic time: - ms for milliseconds
- s for seconds

Representation IL
TR 7-s-R
[ ] S: Start und set
[ ] R: Reset
[ ] STOP: Interruption of timer
[W] I: Set time value
[ ] EQ: Control output
[W] Q: Actual time value

(1) (2) (3) (4) (5)


S
_j L_ i I I I I I—I I I
R
J L_
STOP !I :: n
EQ : J : :
w
c

TSTOP | |
I I i n
: n
iTi ' T+TSTOP: ; T :

Description The delay factor at " I " is accepted with the rising edge at
the "S" input and the "EQ" output is set to the "H" level,
delayed by the time "T"
T = delay factor x time base
The set time should always be greater than the cycle
time to ensure that the delay is always detected.
The output "Q" indicates the time elapsed in units of the
selected time base.

6-62 4/94 AWB 27-1186-GB Klockner-Moeller


Function Blocks TR
On-Delayed Timer

The time count can be interrupted by setting the "STOP"


input High; i.e. the delay time "T" is extended by the
time for which the "STOP" input is High (2).
The STOP input should only be set in the time between
the setting of the S input and that of the EQ output. If
the STOP input is already High when the S input is reset
(3) or set (4), the EQ output will respond as shown in the
signal diagram.
The timer can be reset to the initial state with a " H "
signal at the R input.
If the R input is set from 0 to 1 while the S input is High,
the EQ output will be set with a delay (5).

Example After a time delay of T ms, the timer 12 is to transmit a


signal received from I 0.3 to the Q 0.3. The time T is
variable and is obtained by adding to the basic time of
200 ms (KW 200), a time determined by the process,
which is contained in MW 28.

The program
TR 12-ms
S: 10.3 Input signal
R:
STOP:
I: LKW200 Constant basic time
ADD MW 28 Variable time ratio
EQ: Q0.3 Output signal
Q:

10.3 S
I
~L_ Il
KW200 X 200
I
200
I
X
MW28 X 48 X x X
I
xi X 150 X
I
x X
KW200 + MW28 I X 248 X x X
[
xi X 350 X
I
x X
Q 0.3 EQ
I
- I —
I
n I
I
I
r
I T = 248 ms I I T = 350 ms i

Klockner-Moeller 4/94 AWB 27-1186-GB 6-63


6-64 4/94 AWB 27-1186-GB Klockner-Moeller
7 SK Function Block

Sequential Control Function Block

Contents

Basic principles of sequential control


programming 7-3
- Applications 7-3
- Graphical symbols 7-4
- Application example 7-7
- Elementary sequence control 7-10

Description of function block 7-13


- Syntax 7-13
- Representation 7-13
- Description 7-14

Program sequence with the sequential


control function block 7-17
- Initialisation 7-17
- Processing 7-19
- Status indication 7-22

Program examples 7-25


- Linear sequence 7-25
- OR sequence 7-28
- AND sequence with synchronisation 7-31

Klockner-Moeller 4/94 AWB 27-1186-GB 7-1


7-2 4/94 AWB 27-1186-GB Klockner-Moeller
SK Function Block

Basic Principles of Sequential Control

Applications Process-dependent or time-dependent sequential


control enables various tasks that are stored in different
programs to be executed in a particular order. These
tasks are executed step by step, according to the logical
structure of the sequence control. The sequential control
function block provides a user-friendly solution for
implementing this structure in the user program.
The program of every step is a self-contained unit. This
means that a self-maintaining function or an interlock do
not need to be programmed as well. The SK (sequential
control) function block handles the management of the
step sequence.
A step sequence ensures that a step is only activated if
the previous step has been deactivated. This allows
complex sequences to be programmed simply and
clearly.

The currently active steps are always indicated, thus


simplifying error diagnostics.
The advantages of the sequential control function block
are:
- clear structuring of complex sequences
- reduced work load; self-maintaining functions and
step interlocks need not be programmed
- simple set and reset features of steps
- modifications to the sequential control function block
are possible without any problems
- simple error diagnostics by program indication of the
active step
- fast step sequence processing, unlike jump
destination list

Klockner-Moeller 4/94 AWB 27-1186-GB 7-3


SK Function Block

Basic Principles of Sequential Control

Applications The sequential control function block furthermore


provides a large number of possibilities for nesting, thus
allowing for the creation of highly flexible step
sequences with a range of functions far beyond the
normal range.

Graphical symbols Sequential control programming allows sequences to be


shown graphically or as a structure.
The symbols used here comply with DIN 40 719 Part 6
(corresponding to IEC 3B (sec) 49).
The start or initial step defines the basic or initial
position, containing the start and reset conditions at the
beginning of the process. The initial step is always
shown in a double frame.
Steps are numbered consecutively, and each step is
assigned one or several actions. Only when the step is
active can the corresponding actions be carried out.
An essential feature of the step sequence is that only
one step is active whilst all the others are ignored. The
program works in the current step until the appropriate
transition (step condition) has been fulfilled. Only then
can the program continue processing in the next step.

7-4 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block

Basic Principles of Sequential Control

Representation Symbol Name


of the SK

» 0 Initial step
1
+ Transition or step condition

1 Step

Alternative branch
L i (OR sequence)

2 3 Action 3 Action Step with action

Simultaneous branch
(AND sequence)

Synchronisation

Klockner-Moeller 4/94 AWB 27-1186-GB 7-5


SK Function Block

Basic Principles of Sequential Control

Graphical symbols

Cyclical
Active step
processing

Transition

Figure 7-1: Cyclical processing of the step sequence

With alternative branches (OR sequences), only one of


the subsequent steps programmed in parallel can be
executed. Alternative branches are indicated by a single
horizontal line.
With simultaneous branches (AND sequences) several
parallel branches can be processed at the same time.
These branches are indicated by a double horizontal
line. A simultaneous branch is synchronised.
The synchronisation ensures that the following transition
is not processed until the last steps of all parallel
branches are active.

7-6 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block

Basic Principles of Sequential Control

Application The following example of a paint filling plant is used to


example illustrate the procedures involved in sequential control
programming.

Figure 7-2: Paint filling plant

Klockner-Moeller 4/94 AWB 27-1186-GB 7-7


SK Function Block

Basic Principles of Sequential Control

Application example The conveyor belt is switched on by pressing a button.


The paint can reaches the light barrier after a period of
time. The conveyor belt then stops and the paint filling
valve is opened. Once the required filling quantity has
been reached, the valve is reclosed. After the
"Flow = 0?" check, the paint can is transported further.
The individual working steps are programmed in the
following order:
- Press start button
- Conveyor belt motor running
- Paint can reaches light barrier
- Switch off conveyor belt
- Open valve
- Measuring filling volume
- Close valve
- Check flow
- Switch on conveyor belt motor

7-8 4/94 AWB 27-1186-GB Klockner-Moeller


SK Function Block

Basic Principles of Sequential Control

This example therefore p r o d u c e s the following step


sequence:

Start button on?

1 Conveyor belt motor on

Light barrier reached 7

2 Conveyor belt off/Valve open

Filling quantity reached?

3 Valve closed

Flow = 0?

4 Conveyor belt on

Figure 7-3: Step sequence for a filling plant

Klockner-Moeller 4/94 AWB 27-1186-GB 7-9


SK Function Block

Basic Principles of Sequential Control

Elementary Linear sequence


sequence control

The sequence passes from step S1 via transition T1 to


step S2 and via transition T2 to step S3.
When T1 is enabled, i.e. when the transition condition for
T1 is fulfilled, step S1 is deactivated whilst step S2 is
activated. After step S2 has been processed, T2 is also
enabled. Step S2 is then deactivated and step S3
activated.

The individual steps are always separated by transitions.

7-10 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block

Basic Principles of Sequential Control

OR step sequence
(Alternative branch)

Branch 1 Branch 2 Branch 3


T1 12 - T3

T4 T5 - T6

After step S1 has been deactivated, either step S2, step


S3 or step S4 is activated, depending on whether T1, T2
or T3 is enabled. If more than one transition condition is
fulfilled, the transition that is located nearest to the left is
enabled first.
Step S5 is activated if one of the preceding transitions
T4, T5 or T6 is enabled.

Klockner-Moeller 4/94 AWB 27-1186-GB 7-11


SK Function Block

Basic Principles of Sequential Control

Elementary A N D step sequence


sequence control (Simultaneous b r a n c h w i t h synchronization)

li

Branch 1 Branch 2

— T2

- T3

W h e n T1 is enabled, step S1 is deactivated. Step S2 and


step S3 are activated at the s a m e t i m e .

W h e n T2 is e n a b l e d , step S3 is deactivated and step S4


is activated. The branches are e x e c u t e d separately.

The convergence of a simultaneous branch is


synchronized.

The validity of T3 is not c h e c k e d until step S2, step S3


and step S4 have been e x e c u t e d . If T3 is enabled, the
preceding steps are deactivated whilst step S5 is
activated.

7-12 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block

Description of Function Block

Syntax Call-up:
SK Function block no.> - (No. of steps) - R
(R only if retentive function is required)
As operand:
SK <Function block no.> <lnput/Output>
Function block nc rhe number of the function block
tie memory size of the PS 4 200 i
Number of steps I...99
Nesting depth: 3
(Cascading)

Execution time:
With Set = Reset = 0 approx. 130 us
With Reset = 1 approx. 240 us
With Set = 1 approx. 250 us
With invalid SINO approx. 150 us

Representation AWL
SK3-14
[] S: S Set
[] R: R Reset
[b] SINO: SINO Step number
[b] ERR: ERR Error output
[b] SQNO: SQNO Step number indication
[] TG: TG Step change indication
[$] INm INIT Step call-up after reset
[$] AC1: AC1 Name of subprogram for Step 1
[$] AC2: AC2 Name of subprogram for Step 2
[S] AC3: AC3 Name of subprogram for Step 3

AC14 AC14 Name of subprogram for Step 3

Klockner-Moeller 4/94 AWB 27-1186-GB 7-13


SK Function Block

Description of Function Block

Description User programs can be structured simply and clearly


through the use of sequential control function blocks.
Each SK function block can activate up to 99 steps. A
step can itself also activate another step sequence. The
maximum nesting depth possible is 8. The individual
steps are created by subprograms which in turn contain
actions to be executed. The necessary transition (step
condition) must be programmed in between the end of
one step and the beginning of another. Steps can be
executed in succession, in parallel or in a particular
order, thus allowing very complex sequences to be
formed according to the requirements of the application
at hand.

The inputs and outputs of the function block have the


following meaning:
S Set
Set activates the sequential control function block

R Reset
Reset deactivates the sequential control function block
and activates the initialisation program at the INIT input

SINO Step Input No.


The SINO input defines the number of the current step

ERR Error
Indication of error states

SQNO Step Output


Number
The SQNO output indicates the number of the current
step

7-14 4/94 AWB 27-1186-GB Klockner-Moeller


SK Function Block

Description of Function Block

TG Toggle
The TG output indicates the change to another step. In
normal operation this output has the signal 1. Only in the
first cycle after a transition does the TG output go to 0.

INIT Initialisation
Name of initialisation subprogram run when Reset is
active.
Example: "$INIT"

AC. Action
Name of the current step subprogram.
Example: "$STEP1"

Klockner-Moeller 4/94 AWB 27-1186-GB 7-15


7-16 4/94 AWB 27-1186-GB Klockner-Moeller
SK Function Block
Program Sequence
with the SK Function Block

The function of the sequential control function block and


the linear sequencing of the steps always consist of the
following elements:
1. Initialization of the SK function block
2. Processing of the SK function block
3. Status indication of the function block

Initialisation The SINO input specifies which step is to be processeq^


Before the step sequence is called up for the first time,
this input must be assigned with the number of the first
step to be processed.
The initialisation is best carried out by the INIT
subprogram which stays active as long as the Reset
input = 1.
The operand INBO.O (flag for identifying the first cycle
after a Reset or Pushbutton reset) can be used to start
an initialisation automatically. The Reset input is set to 1
in the first cycle after the program start.

The INIT program assigns the number of the first step to


the SINO input.

Klockner-Moeller 4/94 AWB 27-1186-GB 7-17


SK Function Block
Program Sequence
with the SK Function Block

Initialisation Program example: Initialisation

SKO 2
S: K1
R: INB 0.0
SINO:
ERR:
SQNO:
TG:
INIT: SINIT
AC1: SSTEP1
AC2: SSTEP2
EP
SINrr "Initialisation of the function block
"Start step 1:
LKB1
= SKO SINO
EM
SSTEP1 "Step 1

EM
SSTEP2 "Step 2

KM

This ensures that the SK function block knows the


number of the first step to be processed directly after
the program is started. The step subprogram of the
SINO input is then changed. The logical sequence of the
PLC user program can therefore be programmed simply.

7-18 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block
Program Sequence
with the SK Function Block

Processing To activate the function block, the Set input must be 1.


This simultaneously activates the step defined at the
SINO input. If both S and R inputs are 1 at the same
time, only the initialisation subprogram is executed.

In the following examples, the S input is permanently set


to 1. The variables T1 and T2 are freely definable
transitions.

Several actions can be carried out in the subprogram.


They remain active until the transition at the end of the
subprogram has been fulfilled. Once the transition is
fulfilled, the SINO input is assigned the number of the
next step to be processed.

In the following cycle the new step is automatically


activated and the old step deactivated.

Klockner-Moeller 4/94 AWB 27-1186-GB 7-19


SK Function Block
Program Sequence
with the SK Function Block

Processing P r o g r a m e x a m p l e : c h e c k transition

SKO- <
S: K1
R: INB 0.0
SINO:
ERR:
SQNO
TG:
INIT: $INIT
AC1: SSTEP1
AC2: SSTEP2

EP
SINIT "Initialisation of the function block

EM
$STEP1 "Step 1
1st action
2nd action

"Check transition
L 'T1 Transition 1
JCN END
"Start step 2
LKB2
= SKO SINO
END
EM
SSTEP2 "Step 2
1st action
2nd action

"Check transition
L T2 Transition 2
JCN END
"Start step 3
LKB3
= SKO SINO
END
CM

7-20 4/94 AWB 27-1186-GB Klockner-Moeller


SK Function Block
Program Sequence
with the SK Function Block

Once a step subprogram has been completed, the user


program directly following the sequential control
function block is continued, irrespective of whether the
transition is fulfilled or not. If the transition is fulfilled, the
resulting step change will be carried out in the next
cycle. If the transition is not fulfilled, the same step will
remain active.

V
I
I
I
I Instructions

Cyclical Sequential $ <INfT>


processsing control Initialisation
A function subprogram must
block be executed once
before the SK
function block can
be processed
IL instructions

$ <name>
Step 1

EP

$ <name>
Step 2

Figure 7-4: Processing of the sequential control function block within the user
program

Klockner-Moeller 4/94 A W B 27-1186-GB 7-21


SK Function Block
Program Sequence
with the SK Function Block

Status indication Various status signals are provided for monitoring the
sequential control function block.
ERR output
This output shows malfunctions in the processing of the
input data.
Table 7-1: Error signals at the ERR output
Error number: Error cause: Error behaviour:

binary: SINO input = 0 SK not active. No step being


00000001 (S=1) processed.
or decimal: 1

binary:
00000010 Step number exceeds Error output set. Function block
or decimal: 2 max. possible step stays in current state.
no.

binary:
00000100 No subprogram on Error output is set. The
or decimal: 4 selected AC output selected step is accepted. No
instructions are executed since
there is also no action
program.

SQNO output
The SQNO output (step output number) indicates the
number of the current step. If this output indicates the
value 3, the 3rd step has been selected. With 5, the 5th
step has been selected.
The value 0 indicates the initialisation subprogram.

7-22 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block
Program Sequence
with the SK Function Block

TG output
The toggle output indicates the change from one step to
the other. The toggle output is 1 for as long as a step is
still active. Only in the first cycle after the change to a
new step is the TG output 0.

1st step 2nd step

TG

1st cycle 1st cycle


Figure 7-5: Step change indication on TG output

The TG output can be used to initialise individual steps.


For example, it can be used to implement a time
monitoring function. If an operation is too long because
either the limit switch has not been reached or there is
an electrical fault, a fault indication signal can be output.

Klockner-Moeller 4/94 AWB 27-1186-GB 7-23


SK Function Block
Program Sequence
with the SK Function Block

Status indication The TG output pulse is used to start a timer.

Step change "Start timer


— • TR 10-S
[ ]S SKOTG
[ ]R
TG [ ]ST0P
[W]l LKW3
[ ]EQ
-> Start timer [WjQ
"Scan timer
L TR 10 EQ
Start timer JC Stoer

Figure 7-56: Program example using the step change indication

If three seconds expire after the timer was set, the timer
monitoring function initiates a troubleshooting function
in the program.

INIT/AC output
The I NIT and AC outputs are 1 if the appropriate
subprograms are active. They cannot be scanned as
operands but only be shown in the Status display menu.

7-24 4/94 AWB 27-1186-GB Klockner-Moeller


SK Function Block

Program Examples

Be sure to use meaningful block labels in your user


program to facilitate programming and the legibility of
the program.
The following program examples show some typical
applications using the sequential control function block.
These examples use the bottling plant as the basic
application.

Linear step Once the plant is switched on, the controller is in the
sequence Wait state. The individual steps are not carried out until
the start button has been pressed. The program returns
to step 2 "Conveyor belt motor On" from step 4 "Close
valve".

Klockner-Moeller 4/94 AWB 27-1186-GB 7-25


SK Function Block

Program Examples

Linear s t e p
1 Wait state
sequence

Start button pressed?

1 • 2 Conveyor belt motor on

Light barrier reached?

3 Conveyor belt motor off/Valve open

Filling quantity reached?

4 Close valve

Flow rate = 0?

Figure 7-7: Linear step sequence

P r o g r a m e x a m p l e : linear step s e q u e n c e

"Linear step sequence


SKO-4
S: K1
R: INB 0.0
SINO:
ERR:
SQNO:
TG:
INIT: $INIT
AC1 SSTART
AC2 $M0T_0N
AC3 $MOT_OFF
AC4 $VALV_0FF
EP

7-26 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block

Program Examples

$INIT "Initialisation of the function block


"Start first step
LKB1
= SKO SINO
EM

$START "Start conditions


"Start button pressed?
L 'START Start button
JCN END
LKB2
= SKO SINO
END
EM

$M0T_0N "Conveyor belt motor


LK1
= 'MOTOR Conveyor belt motor
"Light barrier reached?
L 1IGHTBAR Light barrier
JCN END
LKB3
= SKO SINO

END
EM

$MOT_OFF "Conveyor belt motor off,


valve off
LKO 1st action
= 'MOTOR Conveyor belt motor
LK1 2nd action
= 'VALVE Filling valve
"Filling volume reached?
L 'FILLQUAN Filling quantity
JCN END
LKB4
= SKO SINO

END
EM

Klockner-Moeller 4/94 AWB 27-1186-GB 7-27


SK Function Block

Program Examples

Linear step $VAW_0FF "Valve off


sequences LKO
= 'VALVE Filling valve
"Flow = 0?
L 'FLOW Flow
JCN END
LKB2
= SKO SINO

END
F.M

OR step s e q u e n c e T h e paint filling plant is p r o g r a m m e d to fill either red or


blue paint. A toggle s w i t c h selects either the red or blue
paint containers.

1 Stop conveyor belt

Tl Red paint? T3 — Blue paint?

2 Toggle switch to red 3 Toggle switch to blue

T? Faint container red T4 Paint container blue


selected? selected?

4 Open valve

Figure 7-8: OR step sequence

7-28 4/94 AWB 27-1186-GB Klockner-Moeller


SK Function Block

Program Examples

Only one SK function block is required for the OR step


sequence since only one sequence can be run.
As soon as one of the two transitions (T1 or T3) is
fulfilled, the sequence moves to the appropriate branch.
This branch can then no longer be changed, even if the
other transition was also fulfilled.
The transitions T1 and T3 are programmed at the end of
the first step ($MOT^OFF). A jump destination list is
created for this purpose.

The SINO input is then loaded with the constants 2 or 4.

Program example: OR step sequence

SKO-x
[]S: K1
[]R: INB 0.0
[b] SINC):
.[b] ERR
[b] SQNO:
[]TG:
[$] INIT $INIT
[$]AC1 $M0T_0FF
[$]AC2 $U_RED
[$]AC3 $U_BLUE
[$]AC4 $VALV_0N

EP
$INIT "Initialisation of the function block
LKB1
= SKO SINO Step sequence 0
EM

Klockner-Moeller 4/94 AWB 27-1186-GB 7-29


SK Function Block

Program Examples

OR step sequence $M0T_0FF "Motor off


LKO
= 'MOTOR Conveyor belt motor
L'RED Red paint?
JCN CONTINUE
LKB2
= SKO SINO Step sequence 0
JPEND

CONTINUE "
L 'BLUE Blue paint?
JCN END
LKB3
= SKO SINO Step sequence 0
END
EM
$U_RED "Toggle to red
LKB1
= 'TOGG Paint toggle
L 'C0NT_RED Red paint container
JCN END
LKB4
= SKO SINO Step sequence 0
END
EM
$U_BLUE "Toggle to blue
LKB2
= 'TOGG Colour toggle
L 'C0NT_BLUE Blue paint container
JCN END
LKB4
= SKO SINO Step sequence 0
END
EM
$VALV_0N "Valve open
LK1
= 'VALV Filling valve

LM

7-30 4/94AWB27-1186-GB Klockner-Moeller


SK Function Block

Program Examples

AND step A paint mixing system is to be implemented in which


sequence with both paints are to be filled simultaneously through two
synchronisation different valves. The metering is variable according to
the colour mix required.

1 Stop conveyor belt

T1 Conveyor belt stopped?

2 Open red valve 4 Open blue valve

T2 Red paint proportion T3 - Blue paint proportion


reached? reached?

3 Close red valve 5 Close blue valve

M Flow=0?

6 Switch on conveyor belt

Figure 7-9: AND step sequence

The entire AND step sequence is divided into several


parallel sequences. Each individual branch requires its
own step sequence control function block which is
called up by the main step sequence.
The convergence of the parallel branches is
synchronised.

Klockner-Moeller 4/94 AWB 27-1186-GB 7-31


SK Function Block

Program Examples

AND step sequence A check is made whether the two parallel branches are
with synchronisation in their last step, before the transition to the next step of
the central step sequence is made.

r ~i

SKI SK2

SK1 and SK2 form


Step two of SK 0

Figure 7-10: Example of a nested AND step sequence

7-32 4/94 AWE* 27-1186-GB Klockner-Moeller


SK Function Block

Program Examples

Program e x a m p l e : A N D step s e q u e n c e

SKO -x Step sequence 0


[ ] S: K 1
[]R: INBO.O
[b] SINO:
[b] ERR:
[b] SQNO:
[]TG:
[$] INIT: SINIT
[$]AC1: $M0T_0FF
[$] AC2: $MIX
[$] AC3: $M0T_0N

LP
SINIT "Initialisation of SK 0
"Start step 1 of SK 0
LKB1
= SKO SINO Step sequence 0
EM
$MOT_OFF "Belt motor off
LKO
= 'MOTOR
L 'SPEED Belt speed
BNZ END
"Move to step 2 of step sequence 0
LKB2
= SKO SINO Step sequence 0
END
EM

Klockner-Moeller 4/94 AWB 27-1186-GB 7-33


SK Function Block

Program Examples

AND step sequence ;MIX "Mix colours


w i t h synchronisation SK1 -2 Step sequence 1
MS: K1
[]R: N SKO TG Step sequence 0
[b] SINO:
[b] ERR:
[b] SQNO
[]TG:
[$] INIT: SINIT1
[$]AC1: $RED_0N
[$] AC2: $RED_0FF
SK2-2 Step sequence 2
[]S: K1
[I ft N SKO TG Step sequence 0
[b] SINO:
[b] ERR:
[b] SQNO
[]TG:
[S] INIT: SINIT2
[$]AC1: $BL_0N
[$] AC2: SBLOFF

"Synchronisation
"Step sequence 1 already finished?
L SK1 SQNO Step sequence 1
CPKB2
BNE END
"Step sequence 2 already finished?
L SK2 SQNO Step sequence 2
CPKB2
BNE END

"Volume flow=0?
L 'FLOW Volume flow
JCN END

"Start step sequence 0 step 3


LKB3
=SK0 SINO Sequence 0
END

7-34 4/94 AWB 27-1186-GB Klockner-Moeller


SK Function Block

Program Examples

$M0T_0N "Motor on
LK1
= 'MOTOR Coneveyor belt motor

EM
SINIT1 "Initialisation of function block 1
"Start step 1 of step sequence 1
LKB1
= SK1 SINO Step sequence 1
EM
SREDJDN "Open valve for red paint
LK1
= 'V_RED Valve for red paint
L 'R_PR0P Red proportion
JCN END
"Start step sequence 1, step 2
LKB2
= SK1 SINO Step sequence 1
END
EM
$RED_0FF "Close valve for red paint
LKO
= 'V_RED Valve for red paint
EM
SINIT2 "Initialisation of function block 2
"Start step 1 of sequence 2
LKB1
= SK2 SINO Step sequence 2
EM
$BL ON "Open valve for blue paint
LK1
= 'V_BLUE Valve for blue paint
L 'R_PR0P Blue proportion
JCN END
"Start step sequence 2, step 2
LKB2
= SK2 SINO Step sequence 2
END
LM
$BL0FF "Close valve for blue paint
LKO
= 'V_BLUE Close valve for blue paint
EM

Klockner-Moeller 4/94 A W B 27-1186-GB 7-35


7-36 4/94 AWB 27-1186-GB Klockner-Moeller
8 Indirect Addressing

Contents
General 8-3
- Areas of application 8-3
- Basic principles 8-3
- Definition: indirect addressing 8-4
- Operands 8-6
Block transfer and block comparison 8-7
- Block transfer copy mode 8-7
- Block transfer initialize mode 8-8
- Block comparison compare mode 8-9
- Block comparison search mode 8-10
Working with ICPY and ICP 8-11
- Block transfer 8-13
- Block comparison 8-16
Working with the "&" address operator 8-21
Application examples 8-23
Test functions 8-27
- Status indication 8-27

Klockner-Moeller 4/94 AWB 27-1186-GB 8-1


I

8-2 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

General

Areas of This manual describes the indirect addressing of


application operands and the functions Block transfer and Block
comparison. These functions are realized by the function
blocks ICPY (transfer) and ICP (comparison) which are
described in detail on the following pages.
The block transfer and block comparison function
blocks are used for indirect addressing and enable copy,
compare and search functions to be carried out. The
programming advantages over direct addressing
provided by these function blocks are:
- Reduction in memory requirements in the user
memory
- Reduction in write operations
- Greater program transparency
The indirect addressing principle can also be used for
the function blocks RDAT, SDAT and SCK.
The number of the function blocks to be used is not
limited. A limit is only given by the capacity of the user
memory. Theoretically, the upper limit of function blocks
is 65535.

Basic principles Direct addressing is the most frequently used


addressing method with programmable controllers. With
this method, the address of the required data is
specified directly so that, for example, the instruction
L MW 234 causes the data that is to be loaded to be
accessed directly from address MW 234. In comparison
to indirect addressing, this method ensures greater data
handling safety in all operations.
With indirect addressing, data contained in the defined
address is interpreted as the address of the data
required for the operation concerned rather than the
actual data itself. Memory locations are therefore
processed which are not actually defined until the
program is running.

Klockner-Moeller 4/94 AWB 27-1186-GB 8-3


Indirect Addressing

General

Definition: indirect With direct addressing, the operand is given in addition


addressing to the operation concerned, this operand containing the
address of the data required.

Program memory e. g. Data memory


Instruction
Operation + Operand

Data

Figure 8-1: Direct addressing

If indirect addressing is used, the address of the data


required is first stored in a cell in the memory (see
Figure 8-2).
This cell can be set, raised or lowered while the program
is running. Indirect Read or Write instructions that
access this data cell take the data stored in it as the
address of the data with which the operation is to be
carried out.

8-4 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

General

Program memory Data memory

Indirect addressing
Instruction
Operation + Operand

Data address

Data

Figure 8-2: Indirect addressing

The c o n t e n t s of the o p e r a n d s in this case serve as a


pointer to the addresses actually required in the d a t a
memory. This means that several different m e m o r y
locations can be a c c e s s e d w i t h one single instruction.
Only the pointer (operand containing the d a t a address)
needs to be c h a n g e d with further instructions.

Indirect addressing enables c h a n g e s to be m a d e in the


operand addresses written in t h e user p r o g r a m . This
enables operations that have to be carried out
repetitively with different o p e r a n d s to be i m p l e m e n t e d
w i t h less p r o g r a m m e m o r y required.

Klockner-Moeller 4/94 AWB 27-1186-GB 8-5


Indirect Addressing

General

Operands The following operands can be used as address


operands:
- M Markers
- SD Communication data
- RD Communication data
- Address inputs of other function blocks

8-6 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Block Transfer and Block Comparison

Two function blocks are used for the indirect addressing


function. These are the ICPY (indirect copy) function
block for block data transfers and the ICP function block
(indirect compare) for comparing data blocks.

Block transfer The block transfer function block features two modes
for:
- Copying data fields (see Figure 8-3)
- Initializing data fields (see Figure 8-4)

Block transfer Source Destination


Data ran e
Copy mode 9 ' Data range II

Copy
56h
C7h
53h
56h
C7h
53h

Figure 8-3: Copy function of the block transfer function block

In the copy mode, the function block makes a copy of a


data field (in Figure 8-3 data field I) with a specified
source address and transfers it to a destination address
in the same data range or to a destination in a different
data range (in Figure 8-3 data range II). The size of the
field to be copied is optional. Between one and 255 data
values can be copied. The data format must be byte.

Klockner-Moeller 4/94 AWB 27-1186-GB 8-7


Indirect Addressing

Block Transfer and Block Comparison

Block transfer Source Destination


Data ran e
Initialize mode 9' Data range II

56h Initialize

56h
56h
56h

Figure 8-4: Initialize function of the block transfer function block

When the function block is in the initialize mode, the


source is one data cell containing values that are copied
to a data field. The destination data field can contain
between one and 255 data values which must be in byte
format.
This special type of copying function is termed
initializing since one entire data field can be written with
the same data value in one operation of the function
block.
The zeroing of outputs or marker ranges, for example,
can be carried out with the initialize function.

Block comparison The block comparison function block features t w o


modes for:
- Comparing data fields (see Figure 8-5)
- Searching for data values (see Figure 8-6)

8-8 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Block Transfer and Block Comparison

Block c o m p a r i s o n 1st case: Equal


Compare mode Source Destination
Data range I Data range II

Compare
56h
C7h
53h
4Ah

56h
C7h
53h
4Ah

Result:
Data fields are equal

2 n d c a s e : N o t Equal

Compare
56h
C7h
53h
4Ah
56h
C7h
54h
4Ah

Result:
Data fields not equal:
Abort compare operation
- 3rd value not equal
- Source > Destination

Figure 8-5: Compare function of the block comparison function block

Klockner-Moeller 4/94 AWB 27-1186-GB 8-9


Indirect Addressing

Block Transfer and Block Comparison

Block comparison When used in compare mode the function block checks
Compare mode two data fields in order to determine differences. The
terms source and destination are used also here in the
same way as with the block transfer function block. The
source and destination data field can contain between
one and 255 data values which must be in byte format.
If a difference between the two fields is determined, the
compare operation is aborted and the function block
states whether the destination field is greater or smaller
than the source field for the first unequal value.
If, for example, a data field needs to be monitored for
any changes in its content, this function can be used to
compare the current data with that of the previous cycle.

Block comparison Source Destination


Data range 1 Data range II
Search mode

Search
56h

C3h
54h
56h
56h

Result:
Found at 3rd value

Figure 8-6: Data value search using the block comparison function block

The block comparison module also enables a specified


data value to be searched for in a data field. The result is
given as the offset address for where the value can be
found. The destination data field can contain between
one and 255 data values which must be in byte format.
If a particular article, for example, needs to be searched
for in a stock management program, this function can be
used as the core of the evaluation program.

8-10 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Working with ICP and ICPY

Only marker and communication data ranges can be


accessed by indirect addressing. The access to address
inputs of other function blocks is also permitted. The
system-internal data is protected from unintentional
accesses when the program is running.

This chapter describes how to operate the block transfer


and block comparison function block in the SUCOsoft
package.
The following brief definition of terms is given prior to
the operating instructions for the function block so as to
provide greater clarity and ease of comprehension.
The address operator "&" is used exclusively with these
indirect addressing function blocks and is placed in front
of the operand. It signifies that the operation is related to
the operand address inside the system and not to the
data of the operand as is otherwise the case.
Two data ranges have to be defined in order to use the
indirect addressing function blocks. The source range
(S) and the destination range (D) are marked, each of
these ranges being defined by two variables (see
Figure 8-7):

Klockner-Moeller 4/94 AWB 27-1186-GB 8-11


Indirect Addressing

Working with ICP and ICPY

1. The operand address SADR or DADR;


Data type: Address
in the example [&] SADR: MB 230
2. Number of elements NO:
Data type: Byte
in the example [B] NO: KB 4
MB 229
Content of the data field
[&] SADR -* (8 bits = 1 byte) MB 230
Address of the data field
(16 bits = 1 word) MB 231
MB 232
MB 233

[B] NO

MB 237

Figure 8-7: Definition of a data block

The data type of the operand given under SADR must


be byte. The data type of NO is also byte.

8-12 4/94AWB27-1186-GB Klockner-Moeller


Indirect Addressing

Working with ICP and ICPY

Block transfer Call: ICPY < Function block No. > < -R >
syntax As operand:
ICPY < Function block No. > < Input/output >
- R , if remanent data is required for the operation
Number of elements: 1...255
Execution time:
Due to the hardware structure of the PS 4 200 series the
execution time of this function block heavily depends on
the type of source and destination operands involved.
Approx. values:
MOD 0: (355 + 25 x n) \is
M O D 1 : (355 + 10 x n) us
n = number of elements

Representation
CPY 63
] MOD:
&] SADR:
&] DADR:
B] NO:
[B] ERR:
Description Inputs:
MOD Copy/Initialize mode
= 1 Copy data fields
= 0 Initialize data fields
SADR Source address
Start address of source data block from which
the transfer is to begin
DADR Destination address
Destination address to which the source data
is to be transferred or from where initializing is
to begin
NO Number of elements to be transferred 1-255
Outputs:
ERR = 0 Data limits are permissible
= 1 NO is 0
= 2 SADR parameters incorrectly set
= 3 DADR parameters incorrectly set
= 4 SADR is the same as DADR

Klockner-Moeller 4/94 AWB 27-1186-GB 8-13


Indirect Addressing

Working with ICP and ICPY

Description The ICPY function block supports the transfer of data


blocks within the system. A transfer is always made from
a "source" to a "destination".
The following operands are valid:

Source Destination Data format

M M Byte
SD SD
RD RD
Address inputs Address inputs

It is therefore not possible to write input image registers


using the block transfer function.
The function block can be used in the copy mode and
the initialize mode which are selected by setting a 1 or a
0 at the MOD input.
The differentiation between address and data is
important with this function block. With typical
operations such as L M 2.2, it is always the data that is
stored in this case in the marker cell which is accessed.
In the case of the block transfer, the source address
SADR from which the copying is to be made and the
destination address DADR must be specified. The
address operator "&" must be used here. This signifies
that the operand behind it is an address and not a data
value.

Copy mode The number of data cells specified by the NO value are
copied from the source address specified by SADR to
the destination address specified by DADR.
In the following example (see Figure 8-8) the data from
marker fields MB 23 to MB 26 is copied to marker field
MB 30 to MB 33.

8-14 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Working with ICP and ICPY

Function block in IL: Marker field:


ICPYO Address:
[ ] MOD: K1 MB 23 7Dh
Source: | [&] SADRi&MB 23 MB 24 3Bh
Destination: | [&] DADR:&MB 30 MB 25 64h
NO: KB4 MB 26 A6h
IB] ERR: MB 27 OOh
MB 28 OOh
MB 29 OOh
MB 30 7Dh
MB 31 3Rh
MB 32 64h
MB 33 A6h
MB 34 OOh

Figure 8-8: Example of the copy mode of the ICPY function block

Initialize m o d e This involves a transfer of the d a t a stored under address


SADR in a n u m b e r of d a t a cells specified by NO,
beginning with the DADR destination address.

In the following example (see also Figure 8-9) the marker


field from MB 27 to MB 32 is initialized with the d a t a
value 7Dh w h i c h is stored in MB 23.

Function block in IL: Marker field:


ICPYO
[ ] MOD: K0 MB 23 7Dh
[&] SADR:&MB 23 MB 24 OOh
[&] DADR:&MB 27 MB 25 OOh
[B] NO: KB6 MB 26 OOh
[Bl ERR:
MB 27 7Dh
MB 28 7Dh
MB 29 7Dh
MB 30 7Dh «
MB 31 7Dh
MB 32 7Dh
MB 33 OOh
MB 34 OOh

Figure 8-9: Example of initialize mode of the ICPY function block

Klockner-Moeller 4/94 AWB 27-1186-GB 8-15


Indirect Addressing

Working with ICP and ICPY

Block comparison Call: ICP < Function block > < -R >
syntax
As operand:
ICP < Function block > < Input/Output >
- R , if remanent data is required for the operation
Number of
elements: 1...255
Execution time:
Due to the hardware structure of the PS 4 200 series, the
execution time of this function block heavily d e p e n d s on
the t y p e of source a n d destination operands involved.

Approx. values:
M O D 0: (244 + 7 x n) LIS
M O D 1 : (264 + 20 x n) LIS
n = n u m b e r of elements

Representation IL
ICP 5
MOD:
SADR:
DADR:
NO:
GT:
EQ:
U:
Q:
ERR:

Description Inputs:
MOD Block/Single character c o m p a r i s o n
= 1 C o m p a r e data fields
= 0 Search for data value
SADR Source address
Start address of the source data block from
which the c o m p a r i s o n is to be m a d e
DADR Destination address
Destination address from w h i c h the
c o m p a r i s o n is to be m a d e
NO Number of elements 1 - 255 to be c o m p a r e d

8-16 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Working with ICP and ICPY

Outputs:
GT Greater Than
= 1 Data value in SADR > data value in
DADR
+ / - signs are not included
EQ Equal
= 1 Data values are identical
+ / - signs are not included
LT Less Than
= 1 Data value in SADR < data value in
DADR
Q Offset output
Indicates the relative offset address of the
unequal value (comparison) or of the found
data value (data value search). The offset from
the beginning of the block is determined
(DADR).
The calculation of the offset is restricted to the
following limits:
0 < = Q < = NO
ERR: = 0 Data limits are permissible
= 1 NOisO
= 2 SADR parameters incorrectly set
= 3 DADR parameters incorrectly set
= 4 SADR is the same as DADR
The coding on the MOD input determines whether a
comparison or a data value search is to be carried out.

Compare mode The block compare mode makes a comparison between


NO elements starting with the source address given by
SADR and the same number of elements starting from
the destination address specified by DADR. If both data
blocks are found to be equal, the Q = NO output and the
EQ output are set to 1.

Klockner-Moeller 4/94 AWB 27-1186-GB 8-17


Indirect Addressing

Working with ICP and ICPY

Compare mode The following applies when the compared data blocks
are equal:
Q = NO; EQ = 1; LT = GT = 0.
If the compared data blocks are not equal, output Q
indicates the location of the unequal data. The EQ
output is set to 0 and the LT and GT output are set
according to the result of the comparison (either 1 or 0).
The following applies when the compared data blocks
are not equal:
0 < Q < NO; EQ = 0; LT and GT depending on the result
of the last comparison.
In the following example (see Figure 8-10) the marker
field from MB 23 to MB 26 is compared with the marker
field from MB 30 to MB 33.

Function block in IL: Marke - field:


ICP 0
[ ] MOD: K1 MB 23 7Dh
Source: - MB 24 3Bh
Destination: [&J UAUn:&IVlD oil |~~ MB 25 64h
MB 26 A6h
[] GT: MB 27 OOh
[] EQ: MB 28 OOh
[] LT: MB 29 OOh
[B] Q: — • M B 30 7Dh
[B] ERR: MB 31 3Bh •4 1
MB 32 64h
Result: MB 33 A6h
GT = 0
MB 34 OOh
EQ =1
LT = 0
Q =4

Figure 8-10: Example of the block compare mode of the ICP function block
The two data blocks are identical, this is indicated by
EQ = 1 and Q = NO (run completed).

8-18 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Working with ICP and ICPY

Search mode The data value whose address is SADR is searched for
in the data field of NO elements starting with the
destination address given by DADR.
If this value is found, the location is indicated via output
Q and the output EQ is set (=1).
The following applies when a character is found:
0 < Q < NO; EQ = 1; LT = GT = 0.
If the data value is not found in the block, the output Q is
equal to NO. The EQ output is set to 0 and the outputs
LT and GT are set according to the last comparison.
The following applies when a character is not found:
Q = NO; EQ = 0; LT and GT according to the last
comparison.
In the following example (see Figure 8-11), the value 7Dh
in MB 23 is searched for in the marker field from MB 27
to MB 32.

Function block Marker field:


inIL:
MB 23 7Dh
[] MOD: KO MB 24 OOh
l&] SADR:&MB 23 MB 25 OOh
[&] DADR:&MB 27 MB 26 OOh Search
IB] NO: KB6 MB 27 3Dh
II GT:
MB 28 8Dh
II EQ:
MB 29 4Dh
M LT:
Found;
[B] Q: MB 30 7Dh
ERR: MB 31 5Dh therefore
[B]
search
MB 32 5Dh
Result: routine
MB 33 OOh
Q =3 aborted
MB 34 OOh
LT = 0
EQ = 1
LT = 0

Figure 8-11: Example of a data value search using the ICP function block

The data value 7Dh was f o u n d at the address DADR+Q


(here: MB 27+3) and the search was t e r m i n a t e d .

Klockner-Moeller 4 / 9 4 A W B 27-1186-GB 8-19


8-20 4/94 AWB 27-1186-GB Kiockner-Moeller
Indirect Addressing

Working with the "&" Address Operator

In order to identify an indirect address, the address


operator "&" is placed in front of the operand
concerned.
e . g . L&MB12
This also applies to symbolic programming
e. g. L& 'Input 1
See the introduction to this chapter for possible
operands.
A sequence beginning with the "&" address operator
must end with one or several allocation instructions to
the address inputs of the function blocks used for
indirect addressing.

e.g. L&MBO.O
= ICPYO SADR
= ICPY6 DADR
The address operands can be processed in word format
in SUCOsoft like normal operands. Addresses can thus
be used with addition, subtraction, multiplication,
division, comparison operations etc. It must be ensured
that only operations are used which can be processed
with word operands (see Chapter 5, IL instructions).

When using the address operator "&", only byte format


is permitted.
All other sequences can only be processed in word
format since, however, the content of the data field
8 bit = 1 byte, but the address for each data field is
16 bit = 1 word.
Example:
1. L &MB0
ADD MW6
SUB MW234
ICPY255 SADR

Klockner-Moeller 4/94 AWB 27-1186-GB 8-21


Indirect Addressing

Working with the "&" Address Operator

2. ICPY255
MOD:
SADR: L &MB26
DIV ICP254 DADR
ROTR
O &MB22
DADR:
NO:
ERR:

Only operands with the "&" address operator are


permissible with the function block parameters SADR,
DADR (for ICPY and ICP).

e. g. ICPY8

[&] SADR: &MB0

[&] DADR: &MB6

The address operator can only be used in byte


operands.

8-22 4/94 AWB 27-1186-GB Klockner-Moeller


Indirect Addressing

Application Examples

Summation The contents of the four marker bytes MB20 to MB23


are added up via the auxiliary marker byte MB30. The
result is written in MW40 (e. g. for averaging).
Data memory (byte)
MB20 1 2 d
MB21 3 4 d
MB22 5 6 d
MB23 7 8 d

MB30 (12 34 ^K 7Q\

MB40 1 8 0 d
MW40
MB41 0 0

Summation program
0010 SSUM "Start of SUM
LKWO
= MW0
= MW40
0011 LOOP "Start of SUM
ICPY5
[ ] MOD: K1
[&] SADR:&MB20
ADD MB0
[&] DADR:&MB30
[B] NO: KB1
[B] ERR:
LMW30
ADD MW40
= MW40
LMB0
ADD KB1
= MB0
LMB0
CPKB4
BLT LOOP
0012 END "End PM SUM
EM
The summation program was written in the SSUM
function block. The call instruction for the function block
is not shown here.

Klockner-Moeller 4/94 AWB 27-1186-GB 8-23


Indirect Addressing

Application Examples

Multiplication of A marker field contains time values for several different


delay factor to mixing operations. Due to t h e difference in temperature
mixing time table of the various c o m p o n e n t s a d d e d , all the mixing times
must be modified by the s a m e factor. This can be
carried out using the ICPY function block in the
following way:

1 st run 2nd run 3rd run 4th run

Delay factor MB99 02 h


MB100 72 h
MB101 3Eh
Basic mixing
MB102 6Fh
times
MB103 03 h
MB104

MB121

Intermediate
marker word MB199 MUL MUL -> MUL MUL
MB200 E4h
MB201 7Ch
Current
MB202 DEh
mixing times
MB203 06 h

Run 1 up to 122 is performed in one PLC cycle

8-24 4/94AWB27-1186-GB Klockner-Moeller


Indirect Addressing

Application Examples

"Printout of file: c: mixtim.q42 dated 2. 3. 94"


00000 "Initialisation
001
002 L INBO.O Scan during 1 st cycle
003 JCN M2
004
005 L KB 0
006 = MB50
007
008 LKB 114
009 = MB100
010
011 L KB 62
012 =MB102
013
014 L KB 111
015 =MB104
016 LKB3
017 =MB106
018
00001 M2
001 "A delay factor < 50 which specifies the
002 "multiplicator for the individual mixing
003 "times is stored in MB99.
004 "The current mixing times are
005 "generated from the product of
006 "the individual mixing time times the delay factor
007
008 L IBO.0.0.0
009 = MB99
010
00002 M3
001 "The current mixing time is now to be
002 "stored in marker field MB 200 to
003 "MB 203.
004 "The ICPY function block is used for this purpose.
005
006 "In each cycle, a mixing time is
007 "copied to auxiliary marker byte
008 "MB 199.0
009
010 ICPY0

Klockner-Moeller 4/94 AWB 27-1186-GB 8-25


Indirect Addressing

Application Examples

Continued 011 [ ] MOD: K 1


012 [&]SADR:&MB100
013 ADO MB50
014 [&] DADR: & MB199
015 [b] NO: KB 1
016 [b] ERR: QBO.0.1.0
017
00003 M4 "Calculate current mixing time
001
002 LMB199
003 MUL MB99
004 = MB199
005
00004 M5 "Write value in destination range
001 ICPY1
002 [ ] MOD: K1
003 [&]SADR:&MB199
004 [&] DADR: & MB200
005 ADD MB50
006 [b] NO: KB 1
007 [b] ERR: QBO.0.2.0
008
00005 M6 "Increase offset for next cycle
001
002 LMB50 Loop counter
003 CP KB 20
004 BGT RESET
005
006 LMB50 Loop counter
007 ADD KB 1
DOB = MB50 Loop counter
009
010 JPM3
011
00006 RESET "Reset Loop counter
001
002 LKBO
003 = MB50 Loop counter
00007 END
001 EP

8-26 4/94 AWES 27-1186-GB Klockner-Moeller


Indirect Addressing

Test Functions

Status indication The status indication facility enables data ranges to be


displayed in the form of a table. This is useful for
checking the indirect transfer functions. It is also
possible to show on screen two non-relating data
ranges at the same time (double range).
This "range display" function can be called up in the test
and commissioning of SUCOsoft using the F6 DISPLAY
RANGE function key
F5 ONLINE PROGRAMMING
F9 STATUS DISPLAY
F6 DISPLAY RANGE.
Further entries:
F2 Display range
From: MB 0
To: MB 20
After making this entry, the contents of MB 0 to MB 20
are displayed on screen in byte format.

Klockner-Moeller 4/94 AWB 27-1186-GB 8-27


8-28 4/94 AWB 27-1186-GB Klockner-Moeller
9 Program Examples

Contents

Foreword 9-3

General examples
- Fail-safe programming 9-5
- Creating a configuration file 9-6

Examples with bit sequences


- AND/OR sequence 9-9
- OR/AND sequence 9-10
- Binary divider 9-12
- Fleeting make contact, constant 9-13
- Fleeting make contact, variable 9-14
- Fleeting break contact, constant 9-15
- Fleeting break contact, variable 9-16

Examples with function blocks


- SDAT: Save data in retentive range 9-17
- RDAT: Reload data from retentive range 9-21
- CK, SCK:Summer-/wintertime 9-22
- TR: Rolling shutter control 9-24
- TR: Two-point controller with hysteresis 9-26
- FALARM: Bottling plant 9-30
- CALARM: Encoder 9-33
- TALARM: Encoder 9-34
- TALARM: Encoder with delay 9-36
- TR: Pulse generator 9-38
- C: Down counter 9-41

Klockner-Moeller 4/94 AWB 27-1186-GB 9-1


9-2 4/94 AWB 27-1186-GB Klockner-Moeller
Program Examples

Foreword

This manual gives advice on programming the


SUCOcontrol PS 4 200 series in instruction list (IL) using
program examples. A basic knowledge of control
engineering is assumed.

The solutions of the problems shown in this manual


illustrate the scope of programming possibilities of the
SUCOsoft S 30-S 4-200.
These examples do not claim to be a complete
representation of all programming features and do not
exclude the possibility of other solutions.

Klockner-Moeller 4/94 AWB 27-1186-GB 9-3


9-4 4/94 AWB 27-1186-GB Klockner-Moeller
Program Examples

Fail-safe Programming

The central processing unit of the PS 4 200 series


recognizes whether an external transducer is on (voltage
present). Of course it does not recognize whether this
state comes from a make contact or a break contact,
i. e. whether the transducer has been actuated or not.
To ensure fail-safety in the event of wire breakage, as in
all control engineering, make contacts should be used
for switching on and break contacts for switching off.
For PLC programming, all external break contacts
should be programmed as make contacts
(see Figure 9-1).
L I 0.1
A I 0.2
= Q0.1

+ 24V

Figure 9-1: Fail-safe circuit of the PS 4 200 series

The output Q 0.1 is 1 if the input I 0.1 is activated and the


input I 0.2 is not activated.
This means for the inputs of the PS 4 200 series that the
output Q 0.1 is 1 if the input Q 0.1 and the input I 0.2
arel.

Klockner-Moeller 4/94 AWB 27-1186-GB 9-5


Program Examples

Creating a Configuration File

The user has to configure the device in the SUCOsoft


S 30-S 4 200 before writing a program for the PS 4 200
series. All devices which are networked or connected by
the user are stated in the "Device configuration" menu.
Figure 9-2 shows a device configuration in which a
PS 4-201-MM1 is connected to three different local LE4
modules. The PS 4-201-MM1 is also connected to a
remote PS 3-AC, an EM4 module with four LE4
modules, and a PS 3-DC. How to create a device
configuration is described in Chapter 1, Device
configuration.

PS4-201-MM1 116-XD1 116-DX1 116-DX1

|pS3-AC

|EM4-201-DX2 116-XD1 116-DX1 116-DXi 116-DX1

- MAIN MENU—PROGRAMMING— >DEUICE CONFIGURATION u:le4dxl.k42


F 1 Return F 4 Replace nodule
F 2 Add s t a t i o n F 5 Zoom/Normal F 8 Delete
F 3 Add module F 6 Parameter e d i t o r FIB Help

Figure 9-2: Device configuration menu

Note!
A device configuration file must be created for
each user program and incorporated in the
user program, irrespective whether the
PS 4 200 series is connected with other
devices or not.

9-6 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

Creating a Configuration File

The following program printout shows how the device


configuration file created in SUCOsoft is incorporated in
the user program.
Printout the file: c:examplea.q42 Date 24. 3. 94
00000 BL0CK0 "Incorporate configuration file
001
002 #include"examplea.k42"
003
00001 BL0CK1 "Start of program

Klockner-Moeller 4/94 AWB 27-1186-GB 9-7


s

9-8 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

AND/OR sequence

The circuit diagram in Fig. 9-3 contains an "AND" and an


"OR" sequence.
The output of the PS 4 200 series is activated if the
switches are closed on the inputs I 0.0 "AND" I 0.4 "OR"
if the switch is closed on the input I 0.2.

10.0 \ 10.2\

I 0.4\

QO.O

Figure 9-3: Circuit diagram of AND/OR sequence


Printout of file: c:exampleb.q42 Date 29. 3. 94
00000 BL0CK0 "Incorporate configuration file
001
002 =H=include"exampleb.k42"
003
00001 BL0CK1 "Start of program
001
002 LI 0.0 Input 0
003 A I 0.4 Input 4
004 0 I 0.2 Input 2
005 • = Q 0.0 Output 0
006
00002 BL0CK2 "End of program
001
002 tP

Klockner-Moeller 4/94 AWB 27-1186-GB 9-9


Program Examples

OR/AND sequence

The circuit diagram in Fig. 9-5 contains an "OR" and an


"AND" sequence.
The output Q 1.2.1.0.1 of the LE 4-116-XD 1 is activated if
the switch is closed on the input 11.2.0.0.0 "OR" on the
input 11.2.0.0.3 of the EM 4-201-DX 2 "AND" if the
switch on the input I 0.5 of the PS 4 200 series is closed.

This description shows that the EM 4-201-DX 2 and the


LE 4-116-XD 1 are connected to the PS 4 200 series. In
this case the connection is made via SUCOnet K. The
following figure shows the device configuration.
-0 1
PS 4-201

-1
201-DX2

r-2
201-DX 2 116-XD1

11.2.0.0.0
?
11.2.0.0.3 Q 1.2.1.0.1
Figure 9-4: Device configuration of OR/AND sequence

11.2.0.0 o\
I J \ 11.2.0.0.3

\ 10.5

• Q 1.2.1.0.1

Figure 9-5: Circuit diagram of OR/AND sequence

9-10 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

OR/AND sequence

Printout of file: c:examplec.q42 Date 29. 3. 94


00000 BLOCK0 "Incorporate configuration file
001
002 #lnclude"examplec.k42"
003
00001 BL0CK1 "Start of program
001
002 L11.2.0.0.0 Input 0EM4
003 011.2.0.0.3 lnput3EM4
004 AI 0.5 Input 5 PS4
005 = 0 1.2.1.0.1 Output 1LE4
006
00002 BL0CK2 "End of program
001
002 EP

I
Klockner-Moeller 4/94 AWB 27-1186-GB 9-11
Program Examples

Binary Divider

A binary divider is to be created with the ratio 2:1


according to the following diagram.

10.5
_r J L
Q0.3

Figure 9-6: Signal sequence of the binary divider


With the first H signal on the input I 0.5 the output Q 0.3
is set (= 1); with the second signal the output is reset
(Q 0.3 = 0) and with the next signal the output is set, etc.
Printout of file: c:exampled.q42 Date: 12.4.94
00000 BL0CK0 "Incorporate configuration file
001
002 #lnclude"exampled.k42"
003
00001 BL0CK1 "Start of program
001
002 L I 0.5 scal input 10.5
003 AN M 0.1
004 JCN BL0CK2
005
006 LN M 0.2
007 = M0.2
008
00002 BL0CK2 "
001
002 L I 0.5 Scan input 10.5
003 = M0.1
004
005 LM0.2
006 = 0.0.3
007
00003 BL0CK3 "End of program
001
002 Fi-

9-12 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

Fleeting Make Contact, Constant

A fleeting make contact with a constant time is


programmed. When changing from 0 to 1 on the input
10.1, the output Q 0.2 switches to 1 for one program
cycle.The following diagram shows the sequence.

Q0.2 I I
1 cycle
Figure 9-7: Signal sequence of fleeting make contact with constant time
Printout of file: c:examplee.q42 Date: 12.4.94
00000 BLOCK0 "Incorporate configuration file
001
Oil? #lnclude"examplee.k42"
003
00001 BL0CK1 "Start of program
001
002 L I 0.1 Scan input
003 AN M 0.0
004 = Q 0.2 Output Q 0
005
DOfi LI0.1 Scan input
007 = M0.0
008
00002 BL0CK2 "End of program
001
002 l-P

I
Klockner-Moeller 4/94 AWB 27-1186-GB 9-13
Program Examples

Fleeting Make Contact, Variable

A fleeting make contact with a variable time is


programmed. When changing from 0 to 1 on the input
10.1, the output Q 0.2 switches to 1 for the duration of
the programmed time (here: 5 seconds). The following
diagram shows the sequence.

10.1 J~i
Q0.2 J L
- H t, h- —H t, |«—
Figure 9-8: Signal sequence of fleeting make contact with variable time
t| is set in the TRO timer
Printout of file: c:examplef.q42 Date: 12.4.94
00000 BLOCK0 "Incorporate conflturation file
001
002 #lnclude"examplef.k42"
003
00001 BL0CK1 "Start of program
001
002 L I 0.1 Scan input I 0.1
003 0 Q 0.2 Output Q 0.2
004 = M0.1
005
006 LM0.1
007 AN M 0.2
008 = Q 0.2 Output Q 0.2
009
010 "The signal length is 5 seconds in this example
(III
012 TRO -S
013 [ ] S: M0.1
014 [ ] R:
015 [ ] STOP:
016 [w] I: KW5
ill/ [ ] EQ: M0.2
018 [w] Q:
019
00002 BL0CK2 "End of program
001
002 EP

9-14 4/94AWB27-1186-GB Klockner-Moeller


Program Examples

Fleeting Break Contact, Constant

A fleeting break contact with a constant time is


programmed. When changing from 1 to 0 on the input
10.1, the output Q 0.2 switches to 1 for one program
cycle. The following diagram shows the sequence.

Q0.2 I I
Vcycle
Figure 9-9: Signal sequence of fleeting break contact with constant time
Printout of file: c:exampleg.q42 Date: 13.4.94
00000 BL0CK0 "Incorporate configuration file
001
002 #lnclude"exampleg.k42"
003
00001 BL0CK1 "Start of program
001
002 L I 0.1 Scan input
00:! =N M 0.1
004
005 LM0.1
006 AN M 0.0
007 = 0.0.2 Output Q 0
008
009 LM0.1
010 = M0.0
011
00002 BL0CK2 "End of program
001
002 LP

Klockner-Moeller 4/94 AWB 27-1186-GB 9-15


Program Examples

Fleeting Break Contact, Variable

A fleeting break contact with a variable time is


programmed. When changing from 1 to 0 on the output
10.1, the output Q 0.2 switches to 1 for the programmed
time (here: 8 seconds). The following diagram shows the
sequence.

io.i i i i_r
Q.o.2 i i r~

Figure 9-10: Signal sequence fleeting break contact with variable time
t, is set in the TRO timer

Printout of file: c:exampleh.q42 Date: 1 3 . 4 . 9 4


00000 BL0CK0 "Incorporate configuration file
001
002 #lnclude"exampleh.k42"
003
00001 BL0CK1 "Start of program
001
002 L I 0.1 Scan input I 0.1
003 0M0.1
004 AN M 0.4
005 = M0.1
006
007 LN I 0.1 Scan input I 0.1
008 A M 0.1
009 OQ0.2 Output Q 0.2
010 AN M 0.4
011 = 0.0.2 Output Q 0.2
012
013 "The signal length is 8 seconds in this example:
014
015 TRO -S
016 [ ] S: Q0.2 Output Q 0.2
017 [ ] R:
018 [ ] STOP:
019 [w] I: KW8
020 [ ] EQ: M0.4
ii? I [w] Q:
022
00002 BL0CK2 "End of program
001
002 EP

9-16 4/94 AWES 27-1186-GB Klockner-Moeller


Program Examples

SDAT: Save Data in Retentive Range

Bottling plant data needs to be saved retentively before


switching off the plant since the RAM of the PS 4-201-
MM1 is not battery backed.This data is contained in the
marker bytes MB 100 to MB 119 and must be saved in
the 64 byte flash EEPROM memory module (ZB 4-160-
SM 1 or ZB 4-128-SF 1) before the plant is switched off.
This is required so that the bottling plant starts with the
same data after it has been switched on again.
The marker bytes MB 100 to MB 119 should be saved on
the segment number 11 of the 64 Kbyte flash EEPROM
memory for retentive marker ranges (cold start retentive
range). This is carried out by activating the input I 0.0 of
the PS 4 200 series.

511
510
509

13
12
11*)
10
9
8
7
6
5
4
3
2
1
0

Figure 9-11: Segment structure of the 64 Kbyte flash EEPROM memory for
saving the retentive marker ranges, which keep their data also with a cold
start
*) 20 bytes are saved unter the segment number 11.

Klockner-Moeller 4/94 AWB 27-1186-GB 9-17


Program Examples

SDAT: Save Data in Retentive Range

Printout of file: c:examplei.q42 Date: 24.3.94


00000 BL0CK0 "Incorporate configuration file
001
fur,' #lnclude"examplei.k42"
003
00001 BL0CK1 "Start of program
001
002
00002 BL0CK2 "value assignment for retentive marker ranges
001 "to be saved with the SDATO function block
00? "in the memory module.
003 "This assignment is variable.
004
005 LI 0.0.1.0.1 Input 1 of the 1st LE4 module
(Mil, A M 0.2
007 S M 100.0 Retentive marker for saving
008
009 LI 0.0.1.0.2 Input 2 of the 1st LE4 module
010 A M 0.6
(ill OM0.5
OK' R M 100.0 Retentive marker for saving
013 S M 101.6 Retentive marker for saving
014
01',
010
01/'
018
019 Input 6 of the PS 4 200 series
L I 0.6
020
0M0.5
0/1 Input 1 of the 1st LE4 module
AI 0.0.1.0.1
022
S M 119.7 Retentive marker for saving
023
R M 117.3 Retentive marker for saving
024
00003 BL0CK3 "Call of the SDATO function block for saving the
001 "retentive marker range in the flash EEPR0M memory
002 "module. The marker ranges are saved on segment
on:; "number 11 of the flash EEPROM memory. The
004 segment length is 20 bytes.
005
006
007 SDATO
008 [ ] S: 10.0 Set input
HO'i [ & ] SADR: & MB 100 Source address
010 [ w ] SGNO: KW11
011 [ b ] LEN: KB 20
012 [ b ] ERR: MB 0 Error message on MBO
013
00004 BL0CK4 "End of program
001
002 EP

9-18 4/94 AWES 27-1186-GES Klockner-Moeller


Program Examples

SDAT: Save Data in Retentive Range

Warning!
If program modifications are made in the
"Device configuration" menu and the IL
program is re-compiled, the retentive data, that
keeps its information also after a cold start, can
be modified after the program transfer. Before
a modification of the device configuration, the
data should thus be written to the flash
EEPROM memory module with the SDAT
function block and written out of the flash
EEPROM memory with the RDAT function
block after the modification. You can find
further descriptions on this operation in
Chapter 1, System parameters.

Klockner-Moeller 4/94 AWB 27-1186-GB 9-19


;

9-20 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

RDAT: Reload Data from Retentive Range

With the bottling plant mentioned in the previous


example the data saved retentively must be re-written
from the 64 Kbyte flash EEPROM memory module to the
marker range MB 100 to MB 119 when the plant is
switched on.
The data that is on the segment number 11 in the
64 Kbyte flash EEPROM memory is re-written to the
marker bytes MB 100 to MB 119 by activating the digital
input 10.1 of the PS 4 200. The data can thus be
processed again in the program.
Printout of file: c:examplej.q42 Date: 24.3.94
00000 BL0CK0 "Incorporate configuration file
001
002 #lnclude"examplej.k42"
003
00001 BL0CK1 "Start of program
001
00002 BL0CK2 "Call the RDATO function block for the regeneration of the
001 "retentive data of the flash EEPROM memory in the
002 "marker range MB 100 to MB 119.
003 "The data is in the flash EEPROM memory on the
004 "segment number 11
005 "The segment is 20 bytes.
006 "The error messages of the RDATO function block are
007 "written in the marker byte MB 1 for further processing.
008
009
010 RDATO
011 [ ] S: 10.1 Set input
012 [ & ] • DADR: & MB 100 Destination address
013 [ w ] SGNO: KW11
014 [ b ] LEN: KB 20
015 [ b ] ERR: MB 1 Error message on MB1
016
00003 BL0CK3 "Further program processing
001
002 L MB 110 Data from flash EEPROM memory
003 ADD KB 20
004 = MB 130
005
006 "
007
00004 BL0CK4 "End of program
001
002 EP

Klockner-Moeller 4/94 AWB 27-1186-GB 9-21


Program Examples

CK, SCK: Summer/Winter Time

In this example the real-time clock of the PS 4 200


series is to be put forward by one hour in order to switch
from winter to summer time on the 27.3.1994 at 2:00 h.
This operation is to be carried out automatically.
In order to solve this task, the function blocks CKO and
SCKO are required in the user program.
When switching from summer time to winter time and
vice versa, it is not necessary to use the programming
device.
Printout of file: c:examplek.q42 Date: 24.3.94
00000 BLOCK0 "Incorporate configuration file
001
002 #lnclude"examplek.k42"
003
00001 BL0CK1 "Start of program
001
00002 BL0CK2 "Set parameters when the CKO function is to set the
001 "SCKO function block
002
003 LKB0
004 = MB 2 Minute 0
005
006 LKB2
007 = MB 3 Hour 2
008
009 LKB3
010 = MB 4 Month March
011
012 LKB27
013 = MB 5 Day 27
014
00003 BL0CK3 "The CKO function block has the task of putting forw
001 "the real-time clock of the PS 4 200 series on
002 "27.03.1994 at 2:00 h to 3:00 h via its EQ output an
003 "SCKO function block
004
005

9-22 4/94AWB27-1186-GB Klockner-Moeller


Program Examples

CK, SCK: Summer/Winter Time

006 CK0
007 [ ] S: K I
008 [x] TIME:
009 [x] DAY:
010 [x] DATE:
011 [w] VDAT: MW4
0I2 [w] VTIM: MW2
013 [ ] GT:
014 [ ] EQ: MO.O Set SCKO
Ol', [ ] LT:
nil, [ ] ERR:
017
00004 BL0CK4 "New parameters for SCKO function block in ordc
001 "put forward the real-time clock by one hour
002
mi:;
004 LKB94
005 = MB10 Year 1994
006
007 LKB3
008 = MB 11 Month March (3)
009
010 LKB27
011 = MB12 Day 27
012
013 LKB0
014 = MB13 Weekday (Sunday)
015
016 LKB3
017 = MB14 Hour 3 (1 hour forward)
018
019 LKB0
020 = MB15 Minute 0 * *
021
022 LKB0
023 = MB16 Second 0
024
00005 BL0CK5 "Put forward real-time clock by one hour via
001 "SCKO function block
002
003 SCKO
004 [ ] S: MO.O Set SCKO
005 [ & ] SADR: & M B 1 0 Year 1994
006 [ b ] ERR: MB 20 Error message
007
00006 BL0CK6 "End of program
001
002 EP

Klockner-Moeller 4/94 AWB 27-1186-GB 9-23


Program Examples

TR: Rolling Shutter Control

This example describes a simple rolling shutter control.


The rolling shutter at the entrance of a multi-storey car
park should be opened and closed via an electric motor.
This is implemented by a key switch outside and by
pressing a button inside. The rolling shutter closes itself
after a set time has elapsed. A warning lamp is lit which
thus ensures that no car enters the garage while the
shutter is closing.
A light barrier prevents the shutter from closing as long
as a car is in the entrance area. The lighting inside the
garage and the outside lighting in front of the shutter are
kept on automatically for a fixed period after the shutter
is closed.

Printout of file: c:examplel.q42 Date: 25.3.1994


00000 BLOCK0 "Incorporate configuration file
001
002 #lnclude"examplel.k42"
003
00001 BL0CK1 "Start of program
001
002
00002 BL0CK2 "Control the shutter motor (open)
001
002 L10.1 Button "Shutter open"
003 0 I 0.2 Key button "Shutter open"
004 0 I 0.5 Light barrier "Car in entrance"
005 0 Q 0.1 Load contactor "Shutter open"
006 AN I 0.3 Limit switch "Shutter open"
007 AN Q 0.2 Load conlactor "Shutter close"
008 = Q 0.1 Load contactor "Shutter open"
009
00003 BL0CK3 "Control the shutter motor (close)
001
002 L M 0.7 Contactor relay 1 "Close delay'
003 AN Q 0.1 Load contactor "Shutter open"
004 = Q 0.2 Load contactor "Shutter close"
005
00004 BL0CK4 "Control the warning lamp when the shutter is closed
001
002
003 L M 0.7 Contactor relay 1 "Close delay'
004 = Q 0.3 Load contactor "Shutter close"
005

9-24 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

TR: Rolling Shutter Control

00005 BL0CK5 "Control of garage lighting


001
002 LM0.6 Contactor relay 2 "Time of lighting'
003 = 0.0.4 Load contactor "lighting"
004
00006 BL0CK6 "Set the time for close delay via setpoint potentiometer (P1)
001
002
003 L I 0.3 Limit switch "Shutter open"
004 OM0.7 Contactor relay 1 "Close delay"
005 AN I 0.4 Limit switch "Shutter closed"
006 AN I 0.5 Light barrier "Car in entrance"
007 = M1.7 Contactor relay 3 "Close delay"
008
009 TR0-S Close delay 0-1023 seconds
010 [ ] S: M1.7 Contactor relay 3 "Close delay"
011 [ ] R:
012 [ ] STOP:
013 [ w ] I: MW18 Time value 0-1023 seconds
014 [ ] EQ: M0.7 Contactor relay 1 "Close delay"
015 [ w ] Q:
016
017 LIAW0 Time value 0-1023 seconds
018 = MW18 Time value 0-1023 seconds
019
00007 BL0CK7 "Set time for internal and external lighting
001 "via setpoint potentiometer (P2)
002
003 L I 0.3 Limit switch "Shutter open"
004 SM0.6 Contactor relay 2 "Lighting time"
005
006 TR1 -S Lighting time 0-1023 seconds
007 [ ] S: M0.6 Contactor relay 2 "Lighting time"
008 [ ] R:
009 [ ] STOP:
010 [w] I: MW20 Time value 0-1023 seconds
(III [ ] EQ: M1.6 Contactor relay 4 "Lighting time"
012 [w] Q:
013
014 LIAW2 Time value 0-1023 seconds
015 = MW20 Time value 0-1023 seconds
016
017 LM1.6 Contactor relay 4 "Lighting time"
018 RM0.6 Contactor relay 2 "Lighting time"
019
00008 BL0CK8 "End of program
001
002 EP

Klockner-Moeller 4 / 9 4 AWES 2 7 - 1 1 8 6 - G B 9-25


Program Examples

TR: Two-point Controller with Hysteresis

A two-point controller with settable hysteresis and scan


time is to be programmed. Hysteresis and scan time are
assigned constant words in the IL program. The setpoint
is defined via the setpoint potentiometer P 1 and the
actual value is read in via the analogue input 0. The
closed-loop controller is enabled via the High signal on
the digital input I 0.0.

Note!
The two-point controller basically corresponds
with the function of a switch which can only be
in the "ON" and the "OFF" status. The two-
point controller, however, does not switch
xd = 0 but, due to an inevitable but also desired
hysteresis, only if xd exceeds the values of the
hysteresis +xu or is less than -xu.

In this example the hysteresis is 1 volt which


corresponds to a constant word of KW 102. The scan
time is one second (KW 1000). These values can be
modified as required. The following diagram shows the
function sequence of the two-point controller.

-> t

Figure 9-12: Function sequence two-point controller with hysteresis

x„ = Hysteresis w •• Setpoint value or reference variable


xd = System deviation = w - x y • Manipulated variable
x = Actual value or controlled variable

9-26 4/94 AWB 27-1186-GB Klockner-Moeller


Program Examples

TR: Two-point Controller with Hysteresis

Printout of file: c:examplem.q42 Date: 29.3.94


00000 BL0CK0 "Incorporate configuration file
001
002 #lnclude"examplem.k42"
003
00001 BL0CK1 "Start of program
001
002
00002 BL0CK2 "Initialize the controller parameters
001
no? "Hysteresis Xu is 1 volt.
003
004 LKW102
00b = MW100 Hysteresis Xu
006
00/ "Scan time T is 1 second.
008
009 LKW1000
010 = MW102 Scan time T
011
00003 BL0CK3 "Closed-loop controller enable
001 "I 0.0 = H — closed-loop controller active; L — closed-
loop controller disabled
002
003 L I 0.0 Closed-loop controller enable
004 JC BL0CK4
005
006 LK0
007 = Q0.0 Manipulated variable "ON" or "OFF
008
009 L I 0.0 Closed-loop controller enable
010 JCNBL0CK13
011
00004 BL0CK4 "Setting the scan time T
001
002 TR0-MS Scan time 0.01 to 65.53 seconds
003 [ ] S: NMO.O Basic pulse
004 [ ] R:
005 [ ] STOP:
006 [w] I: MW102 Scan time T
007 [ ] EQ: MO.O Basic pulse
008 [w] Q:
009
010 LN M 0.0 Basic pulse
011 JCBLOCK13
012

Klockner-Moeller 4/94 AWB 27-1186-GB 9-27

You might also like