4

Math Functions

The Micro PLC instruction set includes these Math functions:

Addition

Adds together two numbers and places the total in a specified

 

register.

Subtraction The Subtraction function subtracts one number from another and places the result in a specified register.

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

Division

The Division function divides one number by another, and

 

places the result in two consecutive registers.

For the Math functions, all numbers are assumed to be positive. There are no negative numbers.

Power flow from a Math function is always true.

Addition (ADD)

The Addition function adds together two numbers and places the total in a specified register.

number + number =

register

46130

The numbers added can be constants, as in the second addition shown on the facing page, or the contents of register locations in memory. For example, if R1 contains the value 23 and you add the constant 16 to it, then register R3 will contain the value 39.

Maximum Total

The maximum total for the Addition function is 65535. If the total exceeds 65535, only the excess is placed in the specified register. For example:

1st number

2nd number

Total in register

50,000

+ 50,000

= 34464 (excess above 65536)

The program can compare the total with the two numbers that were added. If the total is less than either number, a ªrolloverº has occurred.

4-22

Micro PLC Programmer's Guide ± April 1994

GFK-0804B

Page 63
Image 63
GE GFK-0804B manual Math Functions, Addition ADD, Maximum Total, Division