KronoTech

PLC

Basic

Counters

Timer

Arithmetic

Comparison

Functions

ABS

CLR

CPT

SCL

SCP

SQR

SWP

XPY

Trig Functions

RSLogix 5000

Structured Text

HMI

Instruments

Introduction

We have started with PLC Math instructions the next step is to have a look at some of the Math functions. These functions do some specific but rather more frequently used Math functions. Anything done in these functions could be achieved by simple combination of math instructions.

Definition

The following is a list of the Math Functions in SLC 500:

CLR - Clear

Definition

When Clear instruction is executed it sets all bits of a word to zero. Upon execution of this instruction, all arithmetic status bits are reset

SQR - Square Root

Definition

When rung conditions are true, this output instruction calculates the square root of the absolute value of the source and places the rounded result in the destination.

This instruction calculates the square root of a negative number without overflow or faults.

SCP - Scale with Parameters

Definition

Produces a scaled output value that has a linear relationship between the input and scaled values. The scaled result is returned to the address indicated by the output parameter.

SCL - Scale Data

Definition

Use this instruction to scale data from your analog module and bring it into the limits prescribed by the process variable or another analog module. When rung conditions are true, this instruction multiplies the source by a specified rate. The rounded result is added to an offset value and placed in the destination.

ABS - Absolute Value

Definition

Absolute value |x| of a number x is itself, if x is positive or zero, but if x is negative, then its absolute value |x| is its negation –x, that is, the corresponding positive value. For example, |-1| = 1, but |2| = 2. The absolute value function strips a number of its sign.

CPT - Compute

Definition

When compute is executed then copy, arithmetic, logical, or conversion operation residing in the expression field of this instruction is performed and the result is sent to the destination. The execution time of a Compute instruction is longer than that of a single arithmetic operation and uses more instruction words.

Definition

Swaps the low and high bytes of a specified number of words in a bit, integer, ASCII, or string file.

XYP - X to the Power of Y

Definition

When this instruction is executed then it will calculate X to the power of Y and stores the result in the destination.