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

The text of a manual · part 22 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 173 to 179

Pages 173 to 179 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 173

Chapter

14

EAF Math Instructions

Chapter Objectives

This chapter describes the EAF (Execute Auxiliary Function) math instructions. Table 14.A lists these instructions. Table 14.A EAF Function Numbers If you want to perform an operation of this type

Use this function number

The Mini-PLC-2/02, Mini-PLC-2/16, and Mini-PLC-2/17 can perform these functions. Addition Subtraction Multiplication Division Square Root BCD to Binary Binary to BCD 10x

(01) (02) (03) (04) (05) (13) (14) (37)

The Mini-PLC-2/17 can perform these additional functions. Y to the X (y+/-x) Powers of e (e+/-x) Reciprocal (1/x)

Two Operand EAFs

(33) (32) (34)

When a processor executes an EAF, it uses the data table format shown in Figure 14.1. Operands A and B represent the numbers you manipulate.

14-1

Page 174

Chapter 14 EAF Math Instructions

Figure 14.1 EAF Two Operand Word and Digit Format in the Data Table 17

16

15

S Operand A

S Operand B

Result

X

S

0

Digit 1 MSD

Digit 2

Digit 3

0 Data Address a

Digit 4

Digit 5

Digit 6 a+1

Digit 7

Digit 8

Digit 9 a+2

Digit 10

Digit 11

Digit 12 LSD a+3

Digit 1 MSD

Digit 2

Digit 3

Digit 4

Digit 5

Digit 6 d

Digit 7

Digit 8

Digit 9 g

Digit 10

Digit 11

Digit 12 LSD k

14 13

10 7

43 b

Result Address m

O/U m+1 m+2 m+3 10348-I

The Operands and the Result words have the format xxx xxx . xxx xxx. Only the Addition and Subtraction EAFs use all 12 digits. All other EAFs use 6 digits maximum, located anywhere within the 12 available digits. Legal formats are: 123456. 12345.6 1234.56 123.456

12.3456 1.23456 .123456

Enter the operands from the keyboard of your 1770-T3 terminal or through ladder diagram instructions. Operand A (which is the data address of the EAF instruction) can be placed in any legal address in the data table. However, you must select four consecutive addresses. Important: Operand A does not need to be shown in the EAF rung.

14-2

Page 175

Chapter 14 EAF Math Instructions

Operand B can have as many as 4 data table words. They must be in the same rung as the EAF. Conditioning statements are not permitted between these Gets and the EAF. This operand can use as many as 4 Gets, and their addresses do not have to be consecutive. See the data addresses of Operand B in Figure 14.1 (b, d, g, and k). To enter the number ABC use only one Get or one data table word. 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

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. The Result Address of the EAF points to the first result word. However, you must select four consecutive locations. Its word format is similar to the operands except there are 3 status bits.

14-3

Page 176

Chapter 14 EAF Math Instructions

Bits 14-17 of the result word are reserved for status bits: This Bit: 14

Stores this: overflow/underflow 1 indicates overflow/underflow 0 result is in range

15 zero indicator 1 zero result 0 non-zero result

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

17 not used

Data Table Format After Address Entry If you select a data address of 040 for operand A, the EAF establishes a data table format with four consecutive words as shown in Figure 14.2. You can locate the result word anywhere in your data table. However, four consecutive word addresses must be available. If you select an address of 060 for the result, the EAF automatically reserves 061, 062 and 063. Be careful not to select data and result addresses so that they overlap.

14-4

Page 177

Chapter 14 EAF Math Instructions

Figure 14.2 EAF Word Format in the Data Table After Address Entry 17

16

15

S Operand A

S Operand B

Result

X

S

0

Digit 1 MSD

Digit 2

Digit 3

0 Data Address 040

Digit 4

Digit 5

Digit 6

041

Digit 7

Digit 8

Digit 9

042

Digit 10

Digit 11

Digit 12 LSD

043

Digit 1 MSD

Digit 2

Digit 3

047

Digit 4

Digit 5

Digit 6

050

Digit 7

Digit 8

Digit 9

053

Digit 10

Digit 11

Digit 12 LSD

057

14 13

10 7

43

Result Address

O/U Digit 1 MSD

Digit 2

Digit 3

Digit 4

Digit 5

Digit 6

061

Digit 7

Digit 8

Digit 9

062

Digit 10

Digit 11

Digit 12 LSD

063

060

10349-I

Entry and Display of Input and Result Values You can monitor the values in the Operands and Result words by entering the instructions shown in Figure 14.3. This figure shows one method for monitoring input and result values of an EAF instruction. The shaded portion is called a primary ladder diagram. It contains Operand B and an EAF block. You can have as many as 4 Gets in this rung to select Operand B and they need not be consecutive data table addresses. Any rung conditions must be at the beginning of the rung. Nothing except a Branch End can be between the Gets and the EAF. Operand A must have four consecutive data table word addresses. They can be stored anywhere in your data table.

14-5

Page 178

Chapter 14 EAF Math Instructions

Figure 14.3 EAF Input and Result Rung Result Operand A Operand B

060 G 000 040 G 000 050 G 000

061 G 300 041 G 250 051 G 050

062 G 000 042 G 000 052 G 000

063 G 000 043 G 000 053 G 000

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

Keystrokes Enter an EAF input and result rung (like Figure 14.3) be performing the following steps. 1.

Press

2.

Enter Result and Operand branches.

3.

Enter the values for Operands A and B. You can enter these values from the keyboard of your 1770-T3 terminal or through ladder diagram functions.

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 for 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.

Addition and Subtraction

This EAF adds (or subtracts) two numbers. Word formats for addition or subtraction are the same. The only difference between the two EAFs is their function number: addition is 01 and subtraction is 02. (+/- xxx xxx . xxx xxx) +/- (+/- xxx xxx . xxx xxx) = +/- yyy yyy . yyy yyy or (+/- Operand A) +/- (+/- Operand B) = +/- Result Enter a rung like that shown in Figure 14.4

14-6

Page 179

Chapter 14 EAF Math Instructions

Figure 14.4 EAF Addition Function Input and Display Rungs 060 G 359 040 G 256 050 G 102

061 G 130 041 G 384 051 G 746

062 G 000 042 G 000 052 G 000

063 G 000 043 G 000 053 G 000

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

Enter values for operands A and B. Entry of Operand A = 256384 and Operand B = 102746 produces the Result 359130 for addition (Figure 14.4) or 153638 for subtraction. Figure 14.5 shows how the words are stored in the data table. Figure 14.5 EAF Addition Format in the Data Table After Execution

Operand A

17 16 0

15

14 13

0

Operand B

10 7

43

Data 0 Address

2

5

6

3

8

4

041

0

0

0

042

0

0

0

043

1

0

2

050

7

4

6

051

0

0

0

052

0

0

0

053

040

Result Address Result

X

0

0

0

3

5

9

060

1

3

0

061

0

0

0

062

0

0

0

063

10350-I

Error Message If the result has more than 12 digits, bit 14 is set (1) indicating overflow. Underflow does not exist for either addition or subtraction.

14-7