GE GFK-0804B manual Multiplication MUL, Examples

Models: GFK-0804B

1 160
Download 160 pages 24.24 Kb
Page 67
Image 67

4

Multiplication (MUL)

The Multiply function multiplies one number by another and places the result in two consecutive registers.

R1 x R2 =

R3

R4

46134

Two registers are needed to accommodate the larger numbers that might possibly result from the multiplication. Only the first register (R3 above) is actually specified although R3 and R4 will contain the result. Be sure not to use the second register for any other purpose in the program.

The multiplication can be performed on constants or the contents of register locations in memory.

If the result of the multiplication is 65535 or less, it is placed in the higher numbered register and the lower numbered register is not used. If your application does not use numbers above 65535 for multiplication or division, you do not need to understand how 32-bit numbers are handled.

Examples:

R1

 

R2

 

R3

R4

 

10

*

10

=

00000

00100

(0*65536 + 100)

100

*

1000

=

00001

34464

(1*65536 + 34464)

1000

*

1000

=

00015

16960

(15*65536 + 16960)

If you expect the result of the multiplication to be too large to use easily, you can use the Division function on the result. See page 4-29.

Programming Software Instructions

1.Select Math/Move (F5).

2.Select *MUL (F3) from the Math/Move function keys.

3.Enter the first number to be multiplied. This can be either a constant, or a register location that will contain the number to be multiplied. For example: R001. Then press the Enter key.

4.Enter the second number to be multiplied. This can also be a constant or a register location. Press the Enter key.

5.Enter the first register of a two register location to contain the result. For example, if you entered R003 as shown above, the result of the multiplication would be be located in R003 and R004. Press the Enter key.

If the result of the multiplication is 65535 or less, it is placed in the higher numbered register, and the lower numbered register (R003 in the example) is set to 0.

4-26

Micro PLC Programmer's Guide ± April 1994

GFK-0804B

Page 67
Image 67
GE GFK-0804B manual Multiplication MUL, Examples