A SERVICE OF

logo

8. Function Commands
NEG, NEGP
- 195 -
Program example
(1) Program to subtract D20 from D10 when XA turns ON and obtain an absolute value when the
results are negative.
D20
D10
-
NEG
D10
XA
D10-D20 is executed.
15
D20
XA
10
<
M3
M3 turns ON when D10 < D20
D10
D10
M3
The absolute value (complement of 2)
when M3 turns ON is obtained.
Coding
No. of
steps
Com-
mand
Device
10 LD XA
11 AND< D10 D20
14 OUT M3
15 LD XA
16 - D10 D20 D10
20 AND M3
21 NEG D10
23