Siemens SIMATIC S5-100U System Manual page 201

Simatic s5 series cpu 100/102/103
Hide thumbs Also See for SIMATIC S5-100U:
Table of Contents

Advertisement

S5-100U
Example
A photoelectric barrier that counts
piece goods is installed at input
I 0.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 0.3. 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 812 6120-02b
STL
Call data block 10.
C
DB
10
A
I
0.0
Input I 0.1 loads the count of
CU
C
10
counter 10 with the constant 0. With
A
I
0.1
each positive edge change at I 0.0,
L
KC
000
the counter is incremented by 1. The
S
C
10
counter is reset by either input I 0.2
O
I
0.2
or flag F 5.2.
O
F
5.2
R
C
10
The current count of the counter is
LD
C
10
stored in data word DW12 in BCD
T
DW
12
code.
As long as bit 8 of data word DW12
TBN
D
12.8
is zero, program processing jumps to
function block FB5. This is the case
JC
FB
5
for the first, third, fifth etc. batch of
100 pieces.
As long as bit 8 of data word DW12
TB
D
12.8
is "1", program scanning jumps to
function block FB 6. This is the case
JC
FB
6
for the second, fourth, sixth, etc.
batch of 100 pieces.
When data bit 11 of data word DW12
TB
D
12.11
becomes "1" (the count is then 800),
flag F 5.2 is set conditionally.
=
F
5.2
Input I 0.4 loads the count of counter
:A
I
0.3
20 with the constant 0. The count is
:CU C
2
incremented by 1 with each positive
:A
I
0.4
edge change at input I 0.3. If the
:L
KC 000
count has reached 256 = 100
:S
C
20
is "1"), program scanning jumps to
the label "FULL". Otherwise the
:TB C
20.8
block is terminated.
:JC =
FULL
:BEU
Bit 8 of counter C 20 is set to "0"
FULL:RU C
20.8
unconditionally. Then the count is
:BE
again 000
STEP 5 Operations
Explanation
(bit 8
H
.
H
8-43

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents