EasyManua.ls Logo

Allen-Bradley SLC 500 Series

Allen-Bradley SLC 500 Series
694 pages
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...
Publication 1747-RM001G-EN-P - November 2008
Math Instructions 4-7
Example of 32-bit Addition
The following example shows how a 16-bit signed integer is added to a 32-bit
signed integer. Remember that S:2/14 must be set for 32-bit addition.
Note that the value of the most significant 16 bits (B3:3) of the 32-bit number
is increased by 1 if the carry bit S:0/0 is set and it is decreased by 1 if the
number being added (B3:1) is negative.
To avoid a major error from occurring at the end of the scan, you must
unlatch overflow trap bit S:5/0 as shown in the example ladder diagram to
follow.
TIP
The largest possible number is 2,147,483,647
(7FFF FFFF)h.
Table 4.6 Add 16-bit value B3:1 to 32-bit value B3:3 B3:2
Add Operation Binary Hex
Decimal
(1)
Addend
Addend
B3:3 B3:2
B3:1
0000 0000 0000 0011 0001 1001 0100 0000
0101 0101 1010 1000
0003 1940
55A8
203,072
21,928
Sum B3:3 B3:2 0000 0000 0000 0011 0110 1110 1110 1000 0003 6EE8 225,000
(1)
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.

Table of Contents

Other manuals for Allen-Bradley SLC 500 Series

Related product manuals