EasyManua.ls Logo

Panasonic FP-E - Page 336

Panasonic FP-E
1334 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
High−level Instructions
3 − 72
Explanation of example
Subtracts the contents of data register DT20 from the contents of data register DT10 when trigger R0 turns
on. The subtracted result is stored in data register DT30.
Example 1: When the decimal number 16 is in DT10 and the decimal number
4 is in DT20.
·
Bit position
DT10
15
000
12
0
11
000
8
0
7
000
4
1
3
000
0
0
Minuend [S1]: K16
Bit position
DT20
15
000
12
0
11
000
8
0
7
000
4
0
3
010
0
0
Subtrahend [S2]: K4
Bit position
DT30
15
000
12
0
11
000
8
0
7
000
4
0
3
110
0
0
Result [D]: K12
−
·· ·· ·· ··
·· ·· ·· ··
·· ·· · ··
(Subtraction)
Example 2: When the decimal number 3 is in DT10 and the decimal number
5 is in DT20.
·
−
Bit position
DT30
15 1211 8 7 4 3 0
Bit position
DT20
15 1211 8 7 4 3 0
Bit position
DT10
15 1211 8 7 4 3 0
Minuend [S1]: K3
Subtrahend [S2]: K5
Result [D]: K−2
0000000000000011
00000000000001 10
1111 1111 1111 111
0
·· ·· ·· ··
·· ·· ·· ··
·· ·· · ··
(Subtraction)
Precautions during programming
If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If the calculated result accidentally overflows or underflows, use of the F28 (D−) instruction (32-bit data
subtraction) is recommended.
When you use the F28 (D−) instruction instead of F27 (−) be sure to convert the 16-bit subtrahend and
minuend into 32-bit data using the F89 (EXT) instruction.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com