Using Math Instructions
8–7
(U)
S:5
0
END
] [
B3
0
[OSR]
B3
1
When the rung goes
true for a single scan,
B3:1 is added to B3:2.
The result is placed in
B3:2.
SUB
SUBTRACT
Source A
B3:3
0000000000000011
Source B
1
Dest
B3:3
0000000000000011
ADD
ADD
Source A
B3:1
0101010110101000
Source B
B3:2
0001100101000000
Dest
B3:2
0001100101000000
ADD
ADD
Source A
1
Source B
B3:3
0000000000000011
Dest
B3:3
0000000000000011
] [
S:0
0
] [
B3
31
Add 16–bit value B3:1 to 32–bit value B3:3 B3:2
Add Operation
Binary
Hex
Decimal
B3:3 B3:2
B3:1
B3:3 B3:2
0000 0000 0000 0011 0001 1001 0100 0000
0101 0101 1010 1000
0000 0000 0000 0011 0110 1110 1110 1000
0003 1940
55A8
0003 6EE8
203,072
21,928
225,000
Addend
Addend
Sum
➀
If a carry is generated
(S:0/0 set), 1 is added
to B3:3.
If B3:1 is negative
(B3/31 set), 1 is
subtracted from B3:3.
Overflow trap bit
S:5/0 is unlatched to
prevent a major error
from occurring at the
end of the scan.
➀
The programming device displays 16-bit decimal values only. The decimal value of a 32-bit integer is derived
from the displayed binary or hex value. For example, 0003 1940 Hex is 16
4
x3 + 16
3
x1 + 16
2
x9 + 16
1
x4 + 16
0
x0
= 203,072.
Programming
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive