10 - using math instructions, About the math instructions, Using math instructions – Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 167

Advertising
background image

10

Chapter

10–1

Using Math Instructions

This chapter contains general information about math instructions and
explains how they function in your logic program. Each of the math
instructions includes information on:

what the instruction symbol looks like

typical execution time for the instruction

how to use the instruction

how to enter the instruction

In addition, the last section contains an application example for a paper
drilling machine that shows the math instructions in use.

Math Instructions

Mnemonic

Function
Code

Name

Purpose

Page

ADD

80

Add

Adds source A to source B and stores the result in the destination.

10–4

SUB

81

Subtract

Subtracts source B from source A and stores the result in the destination.

10–5

MUL

82

Multiply

Multiplies source A by source B and stores the result in the destination.

10–8

DIV

83

Divide

Divides source A by source B and stores the result in the destination and the
math register.

10–9

DDV

84

Double Divide

Divides the contents of the math register by the source and stores the result in
the destination and the math register.

10–10

CLR

85

Clear

Sets all bits of a word to zero.

10–11

SQR

86

Square Root

Calculates the square root of the source and places the integer result in the
destination.

10–11

SCL

87

Scale Data

Multiplies the source by a specified rate, adds to an offset value, and stores the
result in the destination.

10–12

These instructions perform the familiar four function math operations. The
majority of the instructions take two input values, perform the specified
arithmetic function, and output the result to an assigned memory location.

For example, both the ADD and SUB instructions take a pair of input values,
add or subtract them, and place the result in the specified destination. If the
result of the operation exceeds the allowable value, an overflow or underflow
bit is set.

Since these are output instructions, they do not have LD, AND, and OR
equivalents.

To learn more about the math instructions, we suggest that you read the Math
Instructions Overview that follows.

About the Math Instructions

Advertising