beautypg.com

Clear (clr), Square root (sqr), Programming – Rockwell Automation 1761 MicroLogix 1000 Programmable Controllers User Manual

Page 143: Updates to arithmetic status bits

background image

Using Math Instructions

8–11

Clear (CLR)

Use the CLR instruction to set the destination to zero. All of the bits reset.

Updates to Arithmetic Status Bits

With this Bit:

The Controller:

S:0/0

Carry (C)

always resets.

S:0/1

Overflow (V)

always resets.

S:0/2

Zero (Z)

always sets.

S:0/3

Sign (S)

always resets.

Square Root (SQR)

When this instruction is evaluated as true, the square root of the absolute value of
the source is calculated and the rounded integer result is placed in the destination.

The instruction calculates the square root of a negative number without overflow or
faults. In applications where the source value may be negative, use a comparison
instruction to evaluate the source value to determine if the destination may be
invalid.

Updates to Arithmetic Status Bits

With this Bit:

The Controller:

S:0/0

Carry (C)

sets if the source is negative; otherwise cleared.

S:0/1

Overflow (V)

always resets.

S:0/2

Zero (Z)

sets when destination value is zero.

S:0/3

Sign (S)

always resets.

Programming

Execution Times

(

µ

sec) when:

True

False

20.80

4.25

CLR

CLEAR
Dest

Execution Times

(

µ

sec) when:

True

False

71.25

6.78

SQR

SQUARE ROOT
Source

Dest