Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 21 of 59

Mini-PLC-2/02, 2/16, 2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual: 13 - Three-Digit Math Instructions

Pages 170 to 173 of 492, from Mini-PLC-2/02, 2/16, 2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual

The original document is the PDF (2.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1772-LX / LXP

Page 170

Chapter

13

Three-Digit Math Instructions

Chapter Objectives

This chapter explains the three-digit math instructions.

Three-Digit Math

Your processor can perform four operations using three-digit math: addition subtraction multiplication division These operations are not signed functions. Addition Reports the sum of two values from the two Get instructions immediately preceding the addition instruction. Programmed in the output position of the ladder diagram rung. The sum is stored in the add instruction word address. 030 G 320

031 G 380

032 + 700

When the sum exceeds 999, the overflow bit (bit 14) in the add instruction word is set. When the processor is operating in the Run/Program, Run, or Test mode, the overflow condition is displayed on the industrial terminal screen as a “1” preceding the sum. If an overflow value (four digits) is used for subsequent comparisons or other arithmetic operations, inaccurate results could occur. 030 G 999

031 G 999

032 + 1998

13-1

Page 171

Chapter 13 Three Digit Math Instructions

Subtraction Reports the difference between two Get values immediately preceding the subtraction instruction. The second get word value is subtracted from the first get word value. Programmed in the output position of the ladder diagram rung. The difference is stored in the subtract instruction word address. 070 G 134

071 G 039

072 095

When the difference is a negative number, the underflow bit (bit 16) in the subtract instruction word is set. When your processor is in the Run, Test or Run/Program mode, the negative sign is displayed on the industrial terminal screen preceding the difference. 070 G 100

071 G 134

072 -034

Important: Use only positive values. If you use a negative BCD value for subsequent operation, inaccurate results could occur. Multiplication Reports the product of two values stored in the Get instruction words immediately preceding the multiply instruction. Programmed in the output position of the ladder diagram. The product is stored in two multiplication instruction words. The first word contains the most significant digit and the second word contains the least significant digit. If the product is less than six digits, leading zeros appear in the product. 130 G 123

131 G 061

051 X 007

052 X 503

Important: Use consecutive word addresses for the two addresses of the multiply instruction.

13-2

Page 172

Chapter 13 Three Digit Math Instructions

Division Reports the quotient of two values stored in the two Get instructions immediately preceding division instruction. Programmed in the output position of the ladder diagram rung. The quotient is stored in two divide instruction words. The first word contains the most significant word and the second word contains the least significant digit. 140 G 050

141 G 025

066 067 : : 002.000

Important: Use consecutive word addresses for the two addresses of the divide instruction. Quotient is expressed as a decimal, accurate to 3 decimal places. Any remaining data is rounded. Division by zero (including 0/0) gives the result of 999.999. This result differs from the PLC-2/20 and PLC-2/30 controllers where 0/0 = 1.000. 140 G 000

Entering a Three-Digit Math Instruction

141 G 000

066 067 : : 999.999

Enter a three digit math operation by performing the following keystrokes. 1.

Start the rung. Press -[G]-.

2.

Enter <address>.

3.

Enter <data> if appropriate.

4.

Press -[G]-.

5.

Enter <address>.

6.

Enter <data> if appropriate.

7.

Close the rung by pressing the appropriate math instruction key (Table 13.A). Table 13.A Three Digit Math Functions

8.

Addition

-( + )-

Subtraction

-( - )-

Multiplication

-( x )-

Division

-( ÷ )-

Enter <address(es)>.

13-3

Page 173

Chapter 13 Three Digit Math Instructions

Editing a Completed Rung Edit a three-digit math operation by performing the following steps.

13-4

1.

See chapter 12 and follow the editing procedure for a Get instruction.

2.

Position the cursor over the math function.

3.

Press the appropriate instruction key.

4.

Enter <address(es)>.