beautypg.com

Entering parameters, Using arithmetic status bits – Rockwell Automation 1747-PT1, D1747NP002 Hand-Held Terminal User Manual

Page 298

background image

Chapter 20
Math Instructions

20–22

This instruction can be used to solve linear equations of the form

Dest = (Rate/10000) x Source + Offse

t

“Rate” is sometimes referred to as Slope.

When the SCL instruction is true, the value at the source address is
multiplied by the rate value. The rounded result is added to the offset value
and placed in the destination.

Example

SCL

SCALE
Source

N7:0

100

Rate [/10000]

25000

Offset

127

Dest

N7:1

377

The source 100 is multiplied by
25000/10000 and added to 127.
The result 377 is placed in
the destination.

Important: In some cases, a mathematical overflow can occur before the

offset is added. The overflow sets minor error bit S:5/0. If this
bit is not reset in your ladder program before the end of the
scan, a major error will be declared.

Entering Parameters

The range of values for the following parameters is –32,768 to 32,767.

Source – This can be a program constant (decimal) or a word address.

Rate – This is the positive or negative value you enter divided by 10,000.
It can be a program constant (decimal) or a word address. The rate
parameter is limited to a range of –3.2768 to 3.2767.

Offset – This can be a program constant (decimal) or a word address.

Destination – This is a word address containing the linear calulation
(Rate/10000) x Source + Offset.

Using Arithmetic Status Bits

C reserved

V presence of an overflow at the destination is checked before and after the

offset value is applied. This bit is set if an overflow is detected; otherwise
reset. On overflow, minor error bit S:5/0 is also set and the value –32,768
or 32,767 is placed in the destination.

Z set when destination value is zero.

S set if the destination value is negative; otherwise reset.