Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual ยท part 30 of 68

DL405 User Manual: Chapter 5: Standard RLL Instructions, pages 253 to 262

Pages 253 to 262 of 608, from DL405 User Manual

The original document is the PDF (8.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the AutomationDirect D4-08B-1, AutomationDirect D4-08ND3S, AutomationDirect D4-16TA, PLC Direct D4-16TD2, AutomationDirect D4-32ND3-1, Konnect-It D4-08B-1, Koyo D4-08B-1, Konnect-It D4-08ND3S, and 6 more models

Page 253

5--81

Standard RLL Instructions Accumulator Logic Instructions

Exclusive Or with Stack (XORS)

430 440 450

DS

HPP

The Exclusive Or with Stack instruction is a 32 bit instruction that performs an exclusive or of the value in the accumulator with the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed from the stack and all values are moved up one level. Discrete status flags indicate if the result of the Exclusive Or with Stack is zero or a negative number (the most significant bit is on).

XORS

Discrete Bit Flags

Description

SP63

Will be on if the result in the accumulator is zero

SP70

Will be on is the result in the accumulator is negative

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is on, the binary value in the accumulator will be exclusive Hoped with the binary value in the first level of the accumulator stack. The result will reside in the accumulator. DirectSOFT X1

V1400

V1401

LDD

5

V1400

4

7

E

2

8

7

A

Load the value in V1400 and V1401 into the accumulator 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8

7

6 5

4 3

2

1

0

Acc.

0

1

0

1

0

1

0

0

0

1

1

1

1

1

1

0

0

0

1

0

1

0

0

0

0

1

1

1

1

0

1

0

Acc.

0

1

0

1

0

1

0

0

0

1

1

1

1

1

1

0

0

0

1

0

1

0

0

0

0

1

1

1

1

0

1

0

0

0

1

1

0

1

1

0

0

1

0

0

0

1

1

1

0

1

1

0

1

0

1

0

0

0

1

1

1

0

0

0

0

1 0

1 0

0

0

0 1

1 0

0

0

0

1 0

1 0

1 0

0

0

1 0

0

1

0

0

0

0

1

0

0

1

0

0

0

0

1

0

2

3

9

4

2

4

2

XORS

36476A38 Exclusive OR the value in the accumulator with XOR (1st level of stack) the value in the first level of the Acc. accumulator stack OUTD V1500

6

Copy the value in the accumulator to V1500 and V1501

V1501

V1500

Handheld Programmer Keystrokes STR

X(IN)

1

SHFT

D

SHFT

V

1

X

SHFT

OR

SHFT

S

OUT

SHFT

D

SHFT

V

1

4

0

0

5

0

0

Standard RLL Instructions

LD SHFT

DL405 User Manual, 4th Edition

Page 254

5--82

Standard RLL Instructions Accumulator Logic Instructions

Compare (CMP)

430 440 450

DS

HPP

The compare instruction is a 16 bit instruction that compares the value in the lower 16 bits of the accumulator with the value in a specified V--memory location (Aaaa). The corresponding status flag will be turned on indicating the result of the comparison. You can compare either binary or BCD numbers, as long as both numbers are of the same data type. Operand Data Type

CMP A aaa

DL430 Range

DL440 Range

DL450 Range

A aaa aaa aaa

V--memory

V

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Pointer

P

----

All (See p. 3--41)

All (See p. 3--42)

Discrete Bit Flags

Description

SP60

On when the value in the accumulator is less than the instruction value.

SP61

On when the value in the accumulator is equal to the instruction value.

SP62

On when the value in the accumulator is greater than the instruction value.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is on, the constant 4526 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the accumulator is compared with the value in V1410 using the Compare instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on energizing C30. DirectSOFT X1

K4526

Load the constant value 4526 into the lower 16 bits of the accumulator

V1410

Compare the value in the accumulator with the value in V1410

LD

CMP

SP60

Standard RLL Instructions

5

2

6

4

5

2

6

The unused accumulator bits are set to zero Acc. 0

0

0

0

C30 OUT

Compared with 8

Handheld Programmer Keystrokes

9

4

V1410

STR

X(IN)

1

LD

K(CON)

4

5

2

6

CMP

V

1

4

1

0

STR

SPCL

6

0

OUT

C(CR)

3

0

DL405 User Manual, 4th Edition

Constant 4

5

Page 255

5--83

Standard RLL Instructions Accumulator Logic Instructions

Compare Double (CMPD)

430 440 450

DS

HPP

The Compare Double instruction is a 32--bit instruction that compares the value in the accumulator with the value (Aaaa), which is either two consecutive V--memory locations or an 8--digit (max.) constant. The corresponding status flag will be turned on indicating the result of the comparison. You can compare either binary or BCD numbers, as long as both numbers are of the same data type. Operand Data Type

CMPD A aaa

DL430 Range

DL440 Range

DL450 Range

A aaa aaa aaa

V--memory

V

----

All (See p. 3--41)

All (See p. 3--42)

Pointer

P

----

All (See p. 3--41)

All (See p. 3--42)

Constant

K

0--FFFFFFFF

0--FFFFFFFF

0--FFFFFFFF

Discrete Bit Flags

Description

SP60

On when the value in the accumulator is less than the instruction value.

SP61

On when the value in the accumulator is equal to the instruction value.

SP62

On when the value in the accumulator is greater than the instruction value.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is compared with the value in V1410 and V1411 using the CMPD instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on energizing C30. DirectSOFT X1

V1400

Compare the value in the accumulator with the value in V1410 and V1411

CMPD V1410

SP60

V1400

V1401

Load the value in V1400 and V1401 into the accumulator

LDD

4

5

2

6

7

2

9

9

Acc. 4

5

2

6

7

2

9

9

0

2

6

Compared with

C30 OUT 6

7

3

V1411

Handheld Programmer Keystrokes X(IN)

1

LD

SHFT

D

SHFT

V

1

4

0

0

CMP

SHFT

D

SHFT

V

1

4

1

0

STR

SPCL

6

0

OUT

C(CR)

3

0

5

V1410

DL405 User Manual, 4th Edition

Standard RLL Instructions

STR

9

Page 256

5--84

Standard RLL Instructions Accumulator Logic Instructions

The Compare Formatted compares the value in the accumulator with a specified number of discrete locations (1--32). The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be compared. The corresponding status flag will be turned on indicating the result of the comparison.

Compare Formatted (CMPF)

430 440 450

DS

HPP

Operand Data Type

CMPF A aaa K bbb

DL440 Range

DL450 Range

A/B aaa bbb aaa bbb

Inputs

X

0--477

----

0--1777

----

Outputs

Y

0--477

----

0--1777

----

Control Relays

C

0--1777

----

0--3777

----

Stage Bits

S

0--1777

----

0--1777

----

Timer Bits

T

0--377

----

0--377

----

Counter Bits

CT

0--177

----

0--377

----

Special Relays

SP

0--137 320--717

----

0--137 320--717

----

Global I/O

GX

0--1777

----

0--2777

----

Constant

K

----

1--32

----

1--32

Discrete Bit Flags

Description

SP60

On when the value in the accumulator is less than the instruction value.

SP61

On when the value in the accumulator is equal to the instruction value.

SP62

On when the value in the accumulator is greater than the instruction value.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X1 is on the Load Formatted instruction loads the binary value (6) from C10--C13 into the accumulator. The CMPF instruction compares the value in the accumulator to the value in Y20--Y23 (E hex). The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on energizing C30. DirectSOFT X1

LDF

C10 K4

CMPF

Y20 K4

Standard RLL Instructions

SP60

Load the value of the specified discrete locations (C10--C13) into the accumulator

Location

Constant

C10

K4

The unused accumulator bits are set to zero

Compare the value in the accumulator with the value of the specified discrete location (Y20--Y23)

Acc. 0

C30

Y23 Y22 Y21 Y20

OUT

0

0

0

0

Compared with

ON ON ON OFF E

Handheld Programmer Keystrokes STR

X(IN)

1

LD

SHFT

F

SHFT

C

1

0

K(CON)

4

CMP

SHFT

F

SHFT

Y(OUT)

2

0

K(CON)

4

STR

SPCL

6

0

OUT

C(CR)

3

0

DL405 User Manual, 4th Edition

C13 C12 C11 C10 OFF ON ON OFF

0

0

6

Page 257

5--85

Standard RLL Instructions Accumulator Logic Instructions

Compare with Stack (CMPS)

The Compare with Stack instruction is a 32-bit instruction that compares the value in the accumulator with the value in the first level of the accumulator stack.

430 440 450

The corresponding status flag will be turned on indicating the result of the comparison. This does not affect the value in the accumulator.

DS

HPP

CMPS

Discrete Bit Flags

Description

SP60

On when the value in the accumulator is less than the instruction value.

SP61

On when the value in the accumulator is equal to the instruction value.

SP62

On when the value in the accumulator is greater than the instruction value.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is on, the value in V1400 and V1401 is loaded into the accumulator using the Load Double instruction. The value in V1410 and V1411 is loaded into the accumulator using the Load Double instruction. The value that was loaded into the accumulator from V1400 and V1401 is placed on top of the stack when the second Load instruction is executed. The value in the accumulator is compared with the value in the first level or the accumulator stack using the CMPS instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value in the stack, SP60 will turn on, energizing C30. DirectSOFT

V1401

X1

LDD V1400 LDD V1410

SP60

6

5

0

0

3

5

4

4

Load the value in V1410 and V1411 into the accumulator

Acc. 6

5

0

0

3

5

4

4

Compare the value in the accumulator with the value in the first level of the accumulator stack

CMPS

V1400

Load the value in V1400 and V1401 into the accumulator

V1411

C30 OUT

V1410

5

5

0

0

3

5

4

4

Acc. 5

5

0

0

3

5

4

4

Compared with Handheld Programmer Keystrokes

Top of Stack

X(IN)

1

LD

SHFT

D

SHFT

V

1

4

0

0

LD

SHFT

D

SHFT

V

1

4

1

0

CMP

SHFT

S

STR

SPCL

6

0

OUT

C(CR)

3

0

Standard RLL Instructions

STR

DL405 User Manual, 4th Edition

Page 258

5--86

Standard RLL Instructions Accumulator Logic Instructions

Compare Real Number (CMPR)

430 440 450

DS

HPP

The Compare Real Number instruction compares a real number value in the accumulator with two consecutive V-memory locations containing a real number. The corresponding status flag will be turned on indicating the result of the comparison. Both numbers being compared are 32 bits long. Operand Data Type

CMPR A aaa

DL450 Range A aaa

V--memory

V

All (See p. 3--42)

Pointer

P

All (See p. 3--42)

Constant

R

--3.402823E+038 to + --3.402823E+038

Discrete Bit Flags

Description

SP60

On when the value in the accumulator is less than the instruction value.

SP61

On when the value in the accumulator is equal to the instruction value.

SP62

On when the value in the accumulator is greater than the instruction value.

SP71

On anytime the V-memory specified by a pointer (P) is not valid.

SP75

On when a real number instruction is executed and a non--real number was encountered.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is on, the LDR instruction loads the real number representation for 7 decimal into the accumulator. The CMPR instruction compares the accumulator contents with the real representation for decimal 6. Since 7 > 6, the corresponding discrete status flag is turned on (special relay SP62). DirectSOFT X1

R7.0

Load the real number representation for decimal 7 into the accumulator.

R6.0

Compare the value with the real number representation for decimal 6.

LDR

CMPR

SP62

C1 OUT

Standard RLL Instructions

Handheld Programmer Keystrokes STR

X(IN)

1

LD

SHFT

D

SHFT

K(CON)

4

0

E

0

0

0

0

0

CMP

SHFT

R

SHFT

K(CON)

4

0

D

0

0

0

0

0

STR

SPCL

6

0

OUT

C(CR)

3

0

DL405 User Manual, 4th Edition

Acc. 4

0

E

0

0

0

0

0

CMPR 4

0

D

0

0

0

0

0

Page 259

Standard RLL Instructions Math Instructions

5--87

Math Instructions Add (ADD)

430 440 450

DS

HPP

Add is a 16 bit instruction that adds a BCD value in the accumulator with a BCD value in a V--memory location (Aaaa). The result resides in the accumulator.

Operand Data Type

ADD A aaa

DL430 Range

DL440 Range

DL450 Range

A aaa aaa aaa

V--memory

V

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Pointer

P

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Discrete Bit Flags

Description

SP63

On when the result of the instruction causes the value in the accumulator to be zero.

SP66

On when the 16 bit addition instruction results in a carry.

SP67

On when the 32 bit addition instruction results in a carry.

SP70

On anytime the value in the accumulator is negative.

SP75

On when a BCD instruction is executed and a NON--BCD number was encountered.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The value in the lower 16 bits of the accumulator are added to the value in V1420 using the Add instruction. The value in the accumulator is copied to V1500 using the Out instruction. DirectSOFT

V1400

X1

4

9

3

5

The unused accumulator bits are set to zero 0 0 0 0 4

Load the value in V1400 into the lower 16 bits of the accumulator

LD V1400

Add the value in the lower 16 bits of the accumulator with the value in V1420

ADD V1420

+ Acc.

Copy the value in the lower 16 bits of the accumulator to V1500

OUT V1500

9

3

5

(Accumulator)

2

5

0

0

(V1420)

7

4

3

5

7

4

3

5

V1500

STR

X(IN)

1

LD

V

1

4

0

0

ADD

V

1

4

2

0

OUT

V

1

5

0

0

Standard RLL Instructions

Handheld Programmer Keystrokes

DL405 User Manual, 4th Edition

Page 260

5--88

Standard RLL Instructions Math Instructions

Add Double (ADDD)

430 440 450

DS

HPP

Add Double is a 32 bit instruction that adds the BCD value in the accumulator with a BCD value (Aaaa), which is either two consecutive V--memory locations or an 8--digit (max.) BCD constant. The result resides in the accumulator.

Operand Data Type

ADDD A aaa

DL430 Range

DL440 Range

A aaa aaa

DL450 Range aaa

V--memory

V

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Pointer

P

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Constant

K

0--99999999

0--99999999

0--99999999

Discrete Bit Flags

Description

SP63

On when the result of the instruction causes the value in the accumulator to be zero.

SP66

On when the 16 bit addition instruction results in a carry.

SP67

On when the 32 bit addition instruction results in a carry.

SP70

On anytime the value in the accumulator is negative.

SP75

On when a BCD instruction is executed and a NON--BCD number was encountered.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is added with the value in V1420 and V1421 using the Add Double instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT

V1401

X1

6

LDD

7

3

V1400 9

5

0

2

6

V1400 Load the value in V1400 and V1401 into the accumulator ADDD V1420

6

7

3

9

5

0

2

6

(Accumulator)

+ 2

0

0

0

4

0

4

6

(V1421 and V1420)

Acc. 8

7

3

9

9

0

7

2

8

7

3

9

9

0

7

2

Add the value in the accumulator with the value in V1420 and V1421 OUTD

Standard RLL Instructions

V1500

V1501

Copy the value in the accumulator to V1500 and V1501

V1500

Handheld Programmer Keystrokes STR

X(IN)

1

LD

SHFT

D

SHFT

V

1

4

0

0

ADD

SHFT

D

SHFT

V

1

4

2

0

OUT

SHFT

D

SHFT

V

1

5

0

0

DL405 User Manual, 4th Edition

Page 261

5--89

Standard RLL Instructions Math Instructions Add Real is a 32--bit instruction that adds a real number, which is either two consecutive V--memory locations or a 32--bit constant, to a real number in the accumulator. Both numbers must conform to the IEEE floating point format. The result is a 32--bit real number that resides in the accumulator.

Add Real (ADDR)

430 440 450

DS

HPP

Operand Data Type

ADDR A aaa

DL450 Range A aaa

V--memory

V

All (See p. 3--42)

Pointer

P

All V mem (See p. 3--42)

Constant

R

--3.402823E+038 to +3.402823E+038

Discrete Bit Flags

Description

SP63

On when the result of the instruction causes the value in the accumulator to be zero.

SP70

On anytime the value in the accumulator is negative.

SP71

On anytime the V-memory specified by a pointer (P) is not valid.

SP72

On anytime the value in the accumulator is a valid floating point number.

SP73 on when a signed addition or subtraction results in a incorrect sign bit.

SP74

On anytime a floating point math operation results in an underflow error.

SP75

On when a real number instruction is executed and a non-real number was encountered.

NOTE: Status flags are valid only until another instruction uses the same flag. DirectSOFT X1

4

LDR

0

E

0

0

0

0

0

R7.0 Load the real number 7.0 into the accumulator

7 +

4

0

E

0

0

0

0

0

(Accumulator)

1

5

+ 4

1

7

0

0

0

0

0

(ADDR)

2

2

Acc. 4

1

B

0

0

0

0

0

0

0

(decimal)

ADDR R15.0

V1401 4

Add the real number 15.0 to the accumulator contents, which is in real number format.

OUTD V1400 Copy the result in the accumulator to V1400 and V1401.

1

B

V1400 0

0

0

(Hex number)

Real Value 8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

Acc. 0

1

0

0

0

0

0

1

1

0

1

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Sign Bit

Exponent (8 bits)

1.011 x 2 (exp 4) = 10110. binary= 22 decimal

NOTE: If the value being added to a real number is 16,777,216 times smaller than the real number, the calculation will not work. NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature.

DL405 User Manual, 4th Edition

Standard RLL Instructions

128 + 2 + 1 = 131 131 -- 127 = 4

Mantissa (23 bits)

Page 262

5--90

Standard RLL Instructions Math Instructions

Subtract (SUB)

430 440 450

DS

HPP

Subtract is a 16 bit instruction that subtracts the BCD value (Aaaa) in a V--memory location from the BCD value in the lower 16 bits of the accumulator The result resides in the accumulator.

Operand Data Type

SUB A aaa

DL430 Range

DL440 Range

DL450 Range

A aaa aaa aaa

A aaa aaa aaa

V--memory

V

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Pointer

P

All (See p. 3--40)

All (See p. 3--41)

All (See p. 3--42)

Discrete Bit Flags

Description

SP63

On when the result of the instruction causes the value in the accumulator to be zero.

SP64

On when the 16 bit subtraction instruction results in a borrow.

SP65

On when the 32 bit subtraction instruction results in a borrow.

SP70

On anytime the value in the accumulator is negative.

SP75

On when a BCD instruction is executed and a NON--BCD number was encountered.

NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The value in V1420 is subtracted from the value in the accumulator using the Subtract instruction. The value in the accumulator is copied to V1500 using the Out instruction. V1400

DirectSOFT X1

2

4

7

5

2

4

7

5

(Accumulator)

1

5

9

2

(V1420)

0

8

8

3

0

8

8

3

LD V1400 Load the value in V1400 into the lower 16 bits of the accumulator

The unused accumulator bits are set to zero 0 0 0 0

SUB y V1420 Acc.

Subtract the value in V1420 from the value in the lower 16 bits of the accumulator OUT V1500

V1500

Standard RLL Instructions

Copy the value in the lower 16 bits of the accumulator to V1500 Handheld Programmer Keystrokes

DL405 User Manual, 4th Edition

STR

X(IN)

1

LD

V

1

4

0

0

SUB

V

1

4

2

0

OUT

V

1

5

0

0