Siemens SIMATIC S5-115U User Manual page 243

Simatic s5 series cpu 941-7ub11 cpu 942-7ub11 cpu 943-7ub11 and cpu 943-7ub21 cpu 944-7ub11 and cpu 944-7ub21
Table of Contents

Advertisement

S5-115U Manual
Example
A photoelectric barrier that
counts piece goods is installed at
input I 2.0. After every 100 pieces,
the program is to jump to FB5 or
FB6. After 800 pieces, counter 10
is to be reset automatically and
start counting again.
A photoelectric barrier that
counts piece goods is installed at
input I 10.0. After every 256
pieces, the counter is supposed to
be reset and start counting again.
Note
Times and counts are stored in the timer/counter word in hexadecimal notation in the
10 least significant bits (bits 0 to 9).
The time base is stored in bits 12 and 13 of the timer word.
EWA 4NEB 811 6130-02b
STL
C
DB 10
Call data block 10.
A
I
2.0
CU
C
10
Input I 3.0 loads the count of
A
I
3.0
counter 10 with the constant 0.
L
KC 0
With each positive edge change at
S
C
10
I 2.0, the counter is incremented by
O
I
4.0
1. The counter is reset by either
O
F
5.2
input I 4.0 or flag F 5.2. The current
R
C
10
count of the counter is stored in
LC
C
10
data word DW 12 in BCD code.
T
DW 12
TBN D
12.8
As long as bit 8 of data word DW 12
is zero, program processing jumps
JC
FB
5
to function block FB5. This is the
case for the first, third, fifth etc.
batch of 100 pieces.
TB
D
12.8
As long as bit 8 of data word DW 12
is "1", program scanning jumps to
JC
FB
6
function block FB6. This is the case
for the second, fourth, sixth etc.
batch of 100 pieces.
TB
D
12.11
When data bit 11 of data word
DW 12 becomes "1" (the count is
=
F
5.2
then 800), flag F 5.2 is set condi-
tionally.
:A
I
10.0
Input I 11.0 loads the count of
:CU C
20
counter 20 with the constant 0. The
:A
I
11.0
count is incremented by 1 with each
:L
KC 0
positive edge change at input
:S
C
20
I 10.0. If the count has reached
256=100
:TB C
20.8
scanning jumps to the label "FULL".
Otherwise the block is terminated.
:JC = FULL
:BEU
FULL:RU C
20.8
Bit 8 of counter C 20 is set to "0"
:BE
unconditionally. Then the count is
again 000
STEP 5 Operations
Explanation
(bit 8 is "1"), program
H
.
H
8-43

Advertisement

Table of Contents
loading

Table of Contents