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

The text of a manual · part 31 of 68

DL405 User Manual: Chapter 5: Standard RLL Instructions, pages 263 to 272

Pages 263 to 272 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 263

Standard RLL Instructions Math Instructions

Subtract Double (SUBD)

430 440 450

DS

HPP

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

Operand Data Type

5--91

SUBD 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.

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 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is subtracted from the value in the accumulator. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. V1401

DirectSOFT X1

0

1

0

1

0

V1400 6

3

2

7

4

LDD V1400 Load the value in V1400 and V1401 into the accumulator y

SUBD V1420

ACC.

0

6

3

2

7

4

(Accumulator)

6

7

2

3

7

5

(V1421 and V1420)

0

0

3

9

0

8

9

9

0

0

3

9

0

8

9

9

The value in V1420 and V1421 is subtracted from the value in the accumulator OUTD V1500

V1501

V1500

Copy the value in the accumulator to V1500 and V1501

STR

X(IN)

1

LD

SHFT

D

SHFT

V

1

4

0

0

SUB

SHFT

D

SHFT

V

1

4

2

0

OUT

SHFT

D

SHFT

V

1

5

0

0

DL405 User Manual, 4th Edition

Standard RLL Instructions

Handheld Programmer Keystrokes

Page 264

5--92

Standard RLL Instructions Math Instructions

The Subtract Real is a 32--bit instruction that subtracts a real number, which is either two consecutive V--memory locations or a 32--bit constant, from 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.

Subtract Real (SUBR)

430 440 450

DS

HPP

Operand Data Type

SUBR 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

1

B

0

0

0

0

0

R22.0 Load the real number 22.0 into the accumulator. --

2

2

4

1

B

0

0

0

0

0

(Accumulator)

1

5

+ 4

1

7

0

0

0

0

0

(SUBR)

7

Acc. 4

0

E

0

0

0

0

0

0

0

(decimal)

SUBR R15.0

V1401 4

Subtract the real number 15.0 from the accumulator contents, which is in real number format.

OUTD

Standard RLL Instructions

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

0

E

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

0

1

1

1

0

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) 128 + 1 = 129 129 -- 127 = 2 Implies 2 (exp 2)

Mantissa (23 bits) 1.11 x 2 (exp 2) = 111. binary= 7 decimal

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

Page 265

Standard RLL Instructions Math Instructions

Multiply (MUL)

430 440 450

DS

HPP

Multiply is a 16 bit instruction that multiplies the BCD value (Aaaa), which is either a V--memory location or a 4--digit (max.) constant, by the BCD value in the lower 16 bits of the accumulator The result can be up to 8 digits and resides in the accumulator. Operand Data Type

5--93

MUL 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--9999

0--9999

0--9999

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.

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 multiplied by the value in the accumulator. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT

V1400

X1

LD

1

0

1

0

0

0

V1400 The unused accumulator bits are set to zero

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

0

0

0

0

¢

MUL

Acc.

V1420

0

0

(Accumulator)

2

5

(V1420)

0

0

0

2

5

0

0

0

0

0

0

2

5

0

0

0

The value in V1420 is multiplied by the value in the accumulator

OUTD

V1501

V1500

V1500

Copy the value in the accumulator to V1500 and V1501

Handheld Programmer Keystrokes STR

X(IN)

1

V

1

4

0

0

V

1

4

2

0

OUT

SHFT

D

SHFT

V

1

5

0

0

DL405 User Manual, 4th Edition

Standard RLL Instructions

LD MUL

Page 266

5--94

Standard RLL Instructions Math Instructions

Multiply Double (MULD)

430 440 450

DS

HPP

Multiply Double is a 32 bit instruction that multiplies the 8-digit BCD value in the accumulator by the 8-digit BCD value in the two consecutive V-memory locations specified in the instruction. The lower 8 digits of the results reside in the accumulator. Upper digits of the result reside in the accumulator stack. Operand Data Type

MULD A aaa

DL450 Range A aaa

V--memory

V

All (See p. 3--42)

Pointer

P

----

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.

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 constant Kbc614e hex will be loaded into the accumulator. When converted to BCD the number is ”12345678”. That number is stored in V1400 and V1401. After loading the constant K2 into the accumulator, we multiply it times 12345678, which is 24691356. DirectSOFT

1

X1

2

3

4

5

6

LDD Kbc614e

V1401

Convert the value to BCD format. It will occupy eight BCD digits (32 bits).

BCD

Output the number to V1400 and V1401 using the OUTD instruction.

OUTD V1400

K2

V1400

Multiply the accumulator contents (2) by the 8-digit number in V1400 and V1401.

V1402

Move the result in the accumulator to V1402 and V1403 using the OUTD instruction.

MULD

OUTD

(Accumulator)

V1400

1

2

3

4

5

6

7

8

2

4

6

9

1

3

5

6

2

4

6

9

1

3

5

6

2

¢ Acc.

V1403

V1500

Handheld Programmer Keystrokes

Standard RLL Instructions

8

Load the constant K2 into the accumulator.

LD

STR

X(IN)

1

K(CON)

SHFT

B(H)

C(H)

OUT

SHFT

D

SHFT

LD

K(CON)

2

LD

SHFT

D

SHFT

6

1

4

E(H) 0

0

0

2

V

1

4

MUL

SHFT

D

1

4

V

1

4

0

0

OUT

SHFT

D

SHFT

V

DL405 User Manual, 4th Edition

7

Load the hex equivalent of 12345678 decimal into the accumulator.

BCD

(Accumulator)

Page 267

5--95

Standard RLL Instructions Math Instructions

The Multiply Real instruction multiplies a real number in the accumulator with either a real constant or a real number occupying two consecutive V-memory locations. The result resides in the accumulator. Both numbers must conform to the IEEE floating point format.

Multiply Real (MULR)

430 440 450

DS

HPP

Operand Data Type

V--memory

MULR A aaa

DL450 Range A aaa

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

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)

x

1

5

+ 4

1

7

0

0

0

0

0

(MULR)

1

0

5

Acc. 4

2

D

2

0

0

0

0

2

0

(decimal)

MULR R15.0

V1401 4

Multiply the accumulator contents by the real number 15.0

2

D

V1400 0

0

0

(Hex number)

Real Value

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

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

1

0

1

1

0

1

0

0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Sign Bit

Exponent (8 bits)

1.101001 x 2 (exp 6) = 1101001. binary= 105 decimal

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 + 4 + 1 = 133 133 -- 127 = 6 Implies 2 (exp 6)

Mantissa (23 bits)

Page 268

5--96

Standard RLL Instructions Math Instructions

Divide (DIV)

430 440 450

DS

HPP

Divide is a 16 bit instruction that divides the BCD value in the 32-bit accumulator by a BCD value (Aaaa), which is either a V--memory location or a 4-digit (max.) constant. The first part of the quotient resides in the accumulator and the remainder resides in the first stack location. Operand Data Type

DIV 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 V mem (See p. 3--42)

Constant

K

0--9999

0--9999

0--9999

Discrete Bit Flags

Description

SP53

On when the value of the operand is larger than the accumulator can work with.

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.

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 accumulator will be divided by the value in V1420 using the Divide instruction. The value in the accumulator is copied to V1500 using the Out instruction. DirectSOFT

V1400

X1

5

0

0

0

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

0

0

0

(Accumulator)

5

0

(V1420)

0

0

0

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

­ V1420 Acc.

The value in the accumulator is divided by the value in V1420

1 V1500

Standard RLL Instructions

Handheld Programmer Keystrokes X(IN)

1

0

V1500

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

STR

0

0

0

0

0

0

0

First stack location contains the remainder

OUT

LD

V

1

4

0

0

DIV

V

1

4

2

0

OUT

V

1

5

0

0

DL405 User Manual, 4th Edition

1

0

Page 269

5--97

Standard RLL Instructions Math Instructions

Divide Double (DIVD)

430 440 450

DS

HPP

Divide Double is a 32 bit instruction that divides the BCD value in the accumulator by a BCD value (Aaaa), which must be obtained from two consecutive V--memory locations. (You cannot use a constant as the parameter in the box.) The first part of the quotient resides in the accumulator and the remainder resides in the first stack location. Operand Data Type

DIVD A aaa

DL440 Range

DL450 Range

A 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)

Discrete Bit Flags

Description

SP53

On when the value of the operand is larger than the accumulator can work with.

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.

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 divided by the value in V1420 and V1421 using the Divide Double instruction. The first part of the quotient resides in the accumulator and the remainder resides in the first stack location. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT

V1401

X1

0

LDD

1

5

V1400 0

0

0

0

0

V1400 The unused accumulator bits are set to zero

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

0

1

5

0

0

0

0

0

(Accumulator)

­ 0

0

0

0

0

0

5

0

(V1421 and V1420)

0

0

3

0

0

0

0

Acc.

0

The value in the accumulator is divided by the value in V1420 and V1421

0

0

0

0

0

0

0

0

First stack location contains the remainder

OUTD 0

V1500

0

0

3

V1501

Copy the value in the accumulator to V1500 and V1501

0

0

0

0

V1500

STR

X(IN)

1

LD

SHFT

D

SHFT

V

1

4

0

0

DIV

SHFT

D

SHFT

V

1

4

2

0

OUT

SHFT

D

SHFT

V

1

5

0

0

DL405 User Manual, 4th Edition

Standard RLL Instructions

Handheld Programmer Keystrokes

Page 270

5--98

Standard RLL Instructions Math Instructions

The Divide Real instruction divides a real number in the accumulator by either a real constant or a real number occupying two consecutive V-memory locations. The result resides in the accumulator. Both numbers must conform to the IEEE floating point format.

Divide Real (DIVR)

430 440 450

DS

HPP

Operand Data Type

V--memory

DIVR A aaa

DL450 Range A aaa

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

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

1

7

0

0

0

0

0

R15.0 Load the real number 15.0 into the accumulator.

1

5

÷ 1

0

4

1

7

0

0

0

0

0

(Accumulator)

÷ 4

1

2

0

0

0

0

0

(DIVR)

Acc. 3

F

C

0

0

0

0

0

0

0

(decimal)

1 . 5 DIVR R10.0

V1401 3

Divide the accumulator contents by the real number 10.0.

F

C

V1400 0

0

0

(Hex number)

Real Value

OUTD

Standard RLL Instructions

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

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

0

1

1

1

1

1

1

1

1

0

0

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)

64 + 32 + 16 + 8 + 4 + 2 + 1 = 127 127 -- 127 = 0 Implies 2 (exp 0)

Mantissa (23 bits) 1.1 x 2 (exp 0) = 1.1 binary= 1.5 decimal

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

Page 271

Standard RLL Instructions Math Instructions

Add Binary (ADDB)

430 440 450

DS

HPP

Add Binary is a 16 bit instruction that adds the binary value in the lower 16 bits of the accumulator with a binary value (Aaaa), which is either a V--memory location or a 16-bit constant. The result can be up to 32 bits and resides in the accumulator.

Operand Data Type

5--99

ADDB 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 V mem (See p. 3--41)

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

Constant

K

0--FFFF

0--FFFF

0--FFFF

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.

SP73

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

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 (constant) will be loaded into the accumulator using the Load instruction. The binary value in the accumulator will be added to the binary value in V1420 using the Add Binary instruction. The value in the accumulator is copied to V1500 and V1501 using the OUTD instruction. Use either V--memory OR Constant

DirectSOFT X1

LD

LD

K2565

V1400

V1400

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

0

A

0

5

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

A

0

5

(Accumulator)

1

2

C

4

(V1420)

1

C C

9

1

C C

9

BIN

ADDB V1420 The binary value in the accumulator is added to the binary value in V1420

+ Acc.

OUTD V1500 Copy the value in the lower 16 bits of the accumulator to V1500 and V1501

STR

X(IN)

1

LD

V

1

4

0

0

ADD

SHFT

B

SHFT

V

1

4

2

0

OUT

SHFT

D

SHFT

V

1

5

0

0

DL405 User Manual, 4th Edition

Standard RLL Instructions

V1500

Handheld Programmer Keystrokes

Page 272

5--100

Standard RLL Instructions Math Instructions

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

Operand Data Type

DL440 Range

ADDBD A aaa

DL450 Range

A aaa aaa

V--memory

V

All (See p. 3--41)

All (See p. 3--42)

Pointer

P

All (See p. 3--41)

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

Constant

K

0--FFFFFFFF

0--FFFFFFFF

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.

SP73

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

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 (constant) will be loaded into the accumulator using the LDD instruction. The binary value in the accumulator is added with the binary value in V1420 and V1421 using the ADDBD instruction. The value in the accumulator is copied to V1500 and V1501 using the OUTD instruction. DirectSOFT

Use either V--memory OR Constant

X1

LDD

LDD V1400

K2561

Load the value in V1400 and V1401 into the accumulator

BIN V1401 0

0

0

V1400 0

0

A

0

1

ADDBD V1420 The binary value in the accumulator is added with the value in V1420 and V1421 OUTD

0

0

0

0

A

0

1

(Accumulator)

0

0

0

C

0

1

0

(V1421 and V1420)

1

0

0

0

C

A

1

1

1

0

0

0

C

A

1

1

Acc.

V1500

Standard RLL Instructions

0 + 1

Copy the value in the accumulator to V1500 and V1501 Handheld Programmer Keystrokes STR

X(IN)

1

LD

SHFT

D

ADD

SHFT

OUT

SHFT

DL405 User Manual, 4th Edition

V1501 SHFT

V

1

4

0

B

D

SHFT

V

1

4

2

D

SHFT

V

1

5

0

0

V1500

0 0