Supplementary Operations; Logic Operations - Siemens Simatic S5-101U Programming Instructions Manual

Table of Contents

Advertisement

5.2
Supplementary operations
Supplementary operations can only be
programmed i n FB
1.
5.2.1
Logic operations
Accumulators
1
and
2
can be loaded by
two load operations i n keeping w i t h
the operands o f these load operations.
The contents o f both accumulators can
then be d i g i t a l l y gated.
Operation
AW
OW
XOW
D e s c r i p t i o n
D i g i t a l ANDing o f accumul-
a t o r s
1
and 2
D i g i t a l ORing o f accumul-
a t o r s
1
and 2.
D i g i t a l EXORing o f
accumulators
1
and
2.
Example
The hexadecimal number
3F84H i s t o be ANDed
w i t h i n p u t word
1
o f
inputs I W
1.
The
r e s u l t i s t o appear i n
Output word zero of the
outputs (QW
0).
3F84H
IW 3
H
Result AW
The two b i t p a t t e r n s
0101 1110 1000 1011
and
0111 0001 0111 1100
are t o be ORed w i t h
each other.
STL
L
KH 3F84
L
] I N 1
AW
T
QW
0
L
KM
01...11
L KM
01
...
00
Explanation
The hexadecimal number 3F84 i s loaded
i n t o accumulator
l ;
a t the same time,
the o l d contents of accumulator
1
are
s h i f t e d i n t o accumulator 2.
I n p u t word
1
(IW
1)
i s loaded i n t o ac-
cumulator
1
and the hexadecimal number
s h i f t e d i n t o accumulator 2. The con-
tents accumulator
1
are d i g i t a l l y ANDed
w i t h those o f accumulator
2
and the
r e s u l t s t o r e d i n accumulator
1.
The contents o f accumulator
1
( r e s u l t )
are t r a n s f e r r e d t o o u t ~ u t word. QW
0.
The f i r s t b i t p a t t e r n i s loaded i n t o
accumulator
1;
a t the same time, the
o l d contents o f accumulator
1
are s h i f t e d
i n t o accumulator 2.
The second b i t p a t t e r n i s loaded i n t o
accumulator
1
and the f i r s t b i t p a t t e r n
s h i f t e d i n t o accumulator
2.
The contents o f accumulator
1
are ORed
w i t h those o f accumulator 2 and the
r e s u l t stored i n accumulator
1.
The contents o f accumulator
1
( r e s u l t )
are t r a n s f e r r e d t o flagword F W
13.
Data word D W
12
i s loaded i n t o accumulator
1;
a t the same time, the o l d contents of
accumulator
1
are s h i f t e d i n t o accumulator
2. I n p u t word I W
0
i s loaded i n t o accumul-
a t o r
1
and data word L DW
12
s h i f t e d
i n t o accumulator 2.
The contents o f accumulator
1
are EXORed
w i t h those o f accumulator
2
and the
r e s u l t s t o r e d i n accumulator
1.
The contents o f accumulator
1
( r e s u l t )
are t r a n s f e r r e d t o output word QW
0.
0101 1110 1000 1011
0111 0001 0111 1100
Result
OW
I n p u t word I W
0
i s t o
be compared w i t h data-
word
12
f o r e q u a l i t y .
The non-identical
b i t s o f the word are
t o appear i n o u t p u t
word QW
0.
D W
12
EA83H
I W
0
68C5
Result X C K T Z R $
T FW
13
L DW
12
L I W
0
xcu
l
TQW
0

Advertisement

Table of Contents
loading

Table of Contents