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

The text of a manual · part 23 of 59

Mini-PLC-2/02, -2/16, -2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual: 14 - EAF Math Instructions, pages 180 to 186

Pages 180 to 186 of 490, 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 180

Chapter 14 EAF Math Instructions

Multiplication and Division

This EAF multiplies (or divides) two numbers. Word formats for multiplication and division are the same. The only difference between the two EAFs is their function numbers: multiplication is 03 and division is 04. Both of these functions limit calculations to six digits per operand, stored anywhere within the 12 available digits. (+/- xxx xxx . xxx xxx) x or / (+/- xxx xxx . xxx xxx)= +/- yyy yyy . yyy yyy or (+/- Operand A) x or / (+/- Operand B) = +/- Result Enter an EAF rung like that shown in Figure 14.6. Figure 14.6 EAF Multiplication Input and Result Display Rungs 060 G 080 040 G 000 050 G 000

061 G 300 041 G 400 051 G 200

062 G 000 042 G 000 052 G 000

063 G 000 043 G 000 053 G 000

EXECUTE AUX FUNCTION FUNCTION NUMBER: 03 DATA ADDR: 040 RESULT ADDR: 060

Enter the values for Operands A and B. The quotient of the Division EAF is expressed as a decimal. The first 5 most significant digits are accurate. Division by zero (including 0/0) gives the result of 999.999 and the overflow bit is set. This result differs from the PLC-2/20 and PLC-2/30 processors where 0/0 = 1.000. Entry of Operand A = 000 400 000 000 and Operand B = 000 200 000 000 produces the result 080 000 000 000 for multiplication (Figure 14.6) or 000 002 . 000 000 for division. Figure 14.7 shows how the words are stored in the data table.

14-8

Page 181

Chapter 14 EAF Math Instructions

Figure 14.7 EAF Multiplication Format in the Data Table After Execution 17 Operand A

15 14 13

0

Operand B

Result

16 0

X

0

0

0

0

10 7

0

43

0

Data 0 Address 040

4

0

0

041

0

0

0

042

0

0

0

043

0

0

0

050

2

0

0

051

0

0

0

052

0

0

0

053 Result Address

0

8

0

0

0

0

061

0

0

0

062

0

0

0

063

060

10351-I

Y to the X

This EAF instruction is a feature of the Mini-PLC-2/17 processor only and finds the value of the equation y+/–x = r. The Operand and Result words have the format: y = input base (positive only) x = exponent ( +/– ) r = resultant number (positive only) yyy yyy . yyy yyy+/-xxx xxx . xxx xxx = rrr rrr . rrr rrr

Enter an EAF rung like that shown in Figure 14.8.

14-9

Page 182

Chapter 14 EAF Math Instructions

Figure 14.8 EAF Power Function Input and Display Rungs 060 G 000 040 G 000 050 G 000

061 G 032 041 G 005 051 G 002

062 G 000 042 G 000 052 G 000

063 G 000 043 G 000 053 G 000

EXECUTE AUX FUNCTION FUNCTION NUMBER: 33 DATA ADDR: 040 RESULT ADDR: 060

Enter the values for the base and the exponent. Entry of y = 2 in word 050 and x = 5 in word 041 produces the result 32. Figure 14.9 shows how the words are stored in the data table. If a result has numbers beyond 12 digits, the result is truncated. Figure 14.9 EAF Power of Y Format in the Data Table After Execution 17 Operand A

Operand B

Result

One Operand EAFs

14-10

X

16 0

15

14 13

10 7

43

0

Data Address

0

0

0

040

0

0

5

041

0

0

0

0

042

0

0

0

0

043

0

0

0

0

050

0

0

2

051

0

0

0

052

0

0

0

053

0

0

0

0

0

0

Result Address 060

0

3

2

061

0

0

0

062

0

0

0

063 10352-I

When a processor executes an EAF, it uses the data table format shown in Figure 14.10. The Operand represents a number you are going to manipulate.

Page 183

Chapter 14 EAF Math Instructions

Figure 14.10 EAF One Operand Word and Digit Format in the Data Table 17

16

15

14 13

S Operand A

Result

X

S

0

10 7

43

0

Data Address

Digit 1 MSD

Digit 2

Digit 3

040

Digit 4

Digit 5

Digit 6

046

Digit 7

Digit 8

Digit 9

052

Digit 10

Digit 11

Digit 12 LSD

055 Result Address 060

O/U

061 062 063

10348-I

The Operand and the Result words have the format xxx xxx . xxx xxx. You can enter them from the keyboard of your 1770-T3 terminal or through ladder diagram instructions. If you select a data address (inside the EAF) other than 010 for the Operand, you can locate the data anywhere in your data table. However, you must select four consecutive data table addresses (Figure 14.11). If you choose to use the default address (010) as the data address of the EAF instruction, the processor seeks its data (operand) from the Get instructions in the rung. Address 010 will not be altered or used by this instruction. The Get instructions must be located in the rung immediately before the EAF instruction. You may select up to four data table addresses but they do not need to be consecutive addresses (Figure 14.10). To enter the number ABC use only one Get or one data table word. Important: If there is only one GET, the value is placed immediately to the left of the decimal point. ––––[G]––– +/– ABC xxx ABC . xxx xxx

To enter the number ABC DEF use two Gets or two data table words. ––––[G]–––[G]––– +/– ABC DEF

ABC DEF . xxx xxx

14-11

Page 184

Chapter 14 EAF Math Instructions

To enter the number ABC DEF . GHI use three Gets or three data table words. ––––[G]–––[G]–––[G]––– +/– ABC DEF GHI

ABC DEF . GHI xxx

To enter the number ABC DEF . GHI JKL use four Gets or four data table words. ––––[G]–––[G]–––[G]–––[G]––– ABC DEF . GHI JKL +/– ABC DEF GHI JKL The numbers have a fixed decimal point that is implied but not displayed. The Result word can be placed in any legal location in the data table. However, you must select four consecutive locations. Its word format is similar to the operand except that there are three status bits. Bits 14 to 16 of the Result word are reserved for status bits. These bits have the following meanings: Bits 14-17 of the result word are reserved for status bits: This Bit: 14

Stores this: overflow/underflow 10 to the X 1 you entered a number larger than 5.999 999 and the result indicates 999 999 0 result is in range Reciprocal 1 you tried to find the reciprocal of zero and the result indicates zero 0 result is in range

15 zero indicator 1 zero result 0 non-zero result

16 sign bit 1 negative (-) 0 positive (+)

17

14-12 not used

Page 185

Chapter 14 EAF Math Instructions

Data Table Format After Address Entry Be careful not to select data and result addresses so that they overlap. Figure 14.11 EAF Word Format in the Data Table After Address Entry 17

16

15 14 13

S Operand A

Result

X

S

0

10 7

43

Data 0 Address

Digit 1 MSD

Digit 2

Digit 3

Digit 4

Digit 5

Digit 6

041

Digit 7

Digit 8

Digit 9

042

Digit 10

Digit 11

Digit 12 LSD

043

040

Result Address 060

O/U

061 062 063 10354-I

Entry and Display of Input and Result Values Figure 14.12 shows one method for displaying input values and the result of an EAF. The first branch contains the Result. The second branch contains the Operand. The addresses of the Operand do not have to be consecutive if you use data address of 010. Figure 14.12 EAF Input and Result Rung 060 G 000 040 G 000

061 G 012 041 G 100

062 G 000 042 G 000

063 G 000 043 G 000

EXECUTE AUX FUNCTION FUNCTION NUMBER: 05 DATA ADDR: 040 RESULT ADDR: 060

14-13

Page 186

Chapter 14 EAF Math Instructions

Keystrokes Enter a one operand EAF (like Figure 14.12) by performing the following steps. 1.

Press

2.

Enter result and data branch.

3.

Enter the values for the Operand.

4.

Complete the parallel branches.

5.

Press [Shift] [EAF].

6.

Enter the appropriate function number (Table 14.A).

7.

Enter the data and result addresses of the EAF instruction.

.

ATTENTION: Do not enter data in hexadecimal. Enter all data in BCD. Failure to observe this warning could cause unwanted machine motion and may injure personnel.

Exponential and Square Root

The Exponential EAF instruction is a feature of the Mini-PLC-2/17 processor only. Word formats for Exponential and Square Root functions are the same. The function number for the exponential function is 32 and the square root is 05. The operand and result are accurate to 6 decimal places for each function. The exponential function finds the value of e+/–x = y (where e is approximately equal to 2.71828). The Operand and Result words have the format: x = exponent of e y = resultant number e+/–xxx xxx . xxx xxx =yyy yyy . yyy yyy

14-14