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

The text of a manual · part 22 of 40

DL05 Micro PLC User Manual, Volume 1 of 2: Chapter 5: Standard RLL and Intelligent Box Instructions, pages 194 to 203

Pages 194 to 203 of 379, from DL05 Micro PLC User Manual, Volume 1 of 2

The original document is the PDF (5.8 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 D0-05AA

Page 194

Chapter 5: Standard RLL - Math Instructions

Subtract Double (SUBD) DS5

Used

HPP

Used

1 2 Operand Data Type DL05 Range 3 aaa 4 5 Discrete Bit Flags Description 6 7 NOTE: The status flags are only valid until another instruction that uses the same flags is executed. 8 In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in V2006 and V2007 is 9 subtracted from the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. 10 11 12 13 14 A B C D Subtract Double is a 32 bit instruction that subtracts the BCD value (Aaaa), which is either two consecutive V-memory locations or an 8digit (max.) constant, from the BCD value in the accumulator. ....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

SP63 SP64 SP65 SP70 SP75

See memory map See memory map 0–99999999

On when the result of the instruction causes the value in the accumulator to be zero. On when the 16 bit addition instruction results in a borrow On when the 32 bit addition instruction results in a borrow On anytime the value in the accumulator is negative. On when a BCD instruction is executed and a NON–BCD number was encountered.

V2001

Direct SOFT

0

X1

SUBD A aaa

1

0

V2000

6

3

2

7

4

LDD

V2000

Load the value in V2000 and V2001 into the accumulator

0 1

_

SUBD

V2006

ACC.

0

6

3

2

7

4

6

7

2

3

7

5

0

0

3

9

0

8

9

9

0

0

3

9

0

8

9

9

(Accumulator) (V2006 and V2007)

The in V2006 and V2007 is subtracted from the value in the accumulator OUTD

V2010

V2011

V2010

Copy the value in the accumulator to V2010 and V2011

Handheld Programmer Keystrokes $

B

STR

1

SHFT

L ANDST

D

SHFT

S RST

SHFT

GX OUT

SHFT

D

ENT

C

D

3

U

B

ISG

A

0

D

1 C

3

A

2

3

C

3 A

2

A

0

A

2 B

0

A 1

0

0

ENT

A

0

G

0

6

ENT

ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

5–71

Page 195

Chapter 5: Standard RLL - Math Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

Multiply (MUL) DS5

Used

HPP

Used

5–72

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

MUL A aaa

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

See memory map See memory map 0–99999999

Discrete Bit Flags

Description

SP63 SP70 SP75

On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative. On when a BCD instruction is executed and a NON–BCD number was encountered.

NOTE: The status flags are only valid until another instruction that uses the same flags is executed.

In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in V2006 is multiplied by the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. V2000

DirectSOFT 5 Direct SOFT32 X1

1 0

LD

0 0

V2000 The unused accumulator bits are set to zero

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

0

0

0

0

1 0 0 0

X

MUL

Acc.

V2006

0

0

0

0

2

5

0

2

5

0

0

0

0

2

5

0

0

0

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

OUTD

V2011

V2010

V2010

Copy the value in the accumulator to V2010 and V2011

Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

SHFT

M ORST

U ISG

GX OUT

SHFT

D

ENT C

3

A 2

L ANDST

C

A

A 2

A 0

2 C

3

A 0

0 B

0

0 A 0 A

1

ENT G

0

DL05 Micro PLC User Manual, 6th Edition, Rev. A

6 ENT

ENT

(Accumulator) (V2006)

Page 196

Chapter 5: Standard RLL - Math Instructions

Multiply Double (MULD) DS5

Used

HPP

Used

1 2 3 Operand Data Type DL05 Range 4 aaa 5 Discrete Bit Flags Description 6 7 NOTE: Status flags are valid only until another instruction uses the same flag. 8 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 9 V1400 and V1401. After loading the constant K2 into the accumulator, we multiply it times 12345678, which is 24691356. 10 11 12 13 14 A B C D Multiply Double is a 32 bit instruction that multiplies the 8digit 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. ....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P

SP63 SP70 SP75

See memory map See memory map

On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative. On when a BCD instruction is executed and a NON–BCD number was encountered.

Direct SOFT32 Display DirectSOFT 5 X1

MULD A aaa

1

2

3

4

5

6

7

8

(Accumulator)

Load the hex equivalent of 12345678 decimal into the accumulator.

LDD

Kbc614e

V1401

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

BCD

1

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

OUTD

V1400

V1400

2

3

4

5

6

7

8

2

4

6

9

1

3

5

6

2

4

6

9

1

3

5

6

X

Acc.

2

(Accumulator)

Load the constant K2 into the accumulator.

LD

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

V1403

V1402

Handheld Programmer Keystrokes

$

B

STR

1

SHFT

L ANDST

D

SHFT

B

C

GX OUT

SHFT

D

SHFT

L ANDST

D

SHFT

M ORST

U

SHFT

D

GX OUT

ENT

D

3

1

3

D

2

3

B

B

E

A

A

1

PREV

3

L ANDST

4

C

2

D

C

1

2

B

SHFT

G

A

ENT

6

E

1

4

SHFT

E

4

ENT

0

B

E 1

E 1

0

A 4

ENT

ENT

3 B

3

SHFT

ENT

3

ISG

PREV

A 4

C 0

2

0

0

ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

5–73

Page 197

Chapter 5: Standard RLL - Math Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

Divide (DIV) DS5

Used

HPP

Used

Divide is a 16 bit instruction that divides the BCD value in the 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.

A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

See memory map See memory map 0–99999999

Discrete Bit Flags

Description

SP53 SP63 SP70 SP75

On when the value of the operand is larger than the accumulator can work with. On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative. On when a BCD instruction is executed and a NON–BCD number was encountered.

NOTE: The status flags are only valid until another instruction that uses the same flags is executed.

In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in the accumulator will be divided by the value in V2006 using the Divide instruction. The value in the accumulator is copied to V2010 using the Out instruction. DirectSOFT Direct SOFT32 5

V2000

X1

5 0

0

0

0

0

0

(Accumulater)

4

9

V2006

0

2

0

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

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

DIV

÷ V2006 1

Acc.

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

1 V2010

0

V2010

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

B STR

1

SHFT

L ANDST

D

SHFT

D

I 3

ENT C

3 8 SHFT

A 2

V AND V AND

A 0

C A 2

A 0

A 2

C

0

0

0

0

0

0

First stak location contains the remainder

OUT

GX OUT

5–74

DIV

0 B

0

0 A 0 A

1

ENT G

0

6 ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

ENT

2

2

Page 198

Chapter 5: Standard RLL - Math Instructions

Divide Double (DIVD) DS5

Used

HPP

Used

1 2 3 Operand Data Type DL05 Range 4 aaa 5 Discrete Bit Flags Description 6 7 8 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 9 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 10 quotient resides in the accumulator an the remainder resides in the first stack location. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. 11 12 13 14 A B C D 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.

DIVD

A aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P

SP53 SP63 SP70 SP75

See memory map See memory map

On when the value of the operand is larger than the accumulator can work with. On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative. On when a BCD instruction is executed and a NON–BCD number was encountered.

DirectSOFT 5

V1401

X1

0

LDD

1

5

V1400

0

0

0

0

0

V1400

Load the value in V1400 and V1401 into the accumulator

The unused accumulator bits are set to zero

DIVD

V1420

0

1

5

0

0

0

0

0

(Accumulator)

쐦

0

0

0

0

0

0

5

0

(V1421 and V1420)

Acc.

0

0

0

3

0

0

0

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

V1501

Copy the value in the accumulator to V1500 and V1501

3

0

0

0

0

V1500

Handheld Programmer Keystrokes $

B

STR

B

1

E

A

4

1

B

E

L ANDST

D

A

ENT

SHFT

D

3

8

A

ENT

GX OUT

SHFT

0

C

4 F

1

SHFT

0

1 B

ENT

2 A

5

0 A

0

0

D

3

3

I

V AND D

3

ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

5–75

Page 199

Chapter 5: Standard RLL - Math Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

Increment (INC) DS5

Used

HPP

Used

INC

The Increment instruction increments a BCD value in a specified V-memory location by “1” each time the instruction is executed.

A aaa

Decrement (DEC) DS5

Used

HPP

Used

The Decrement instruction decrements a BCD value in a specified V-memory location by “1” each time the instruction is executed.

A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P

See memory map See memory map

Discrete Bit Flags

Description

SP63 SP75

On when the result of the instruction causes the value in the accumulator to be zero. 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. DirectSOFT 5 Direct SOFT32

V1400

C5

INC

8

9

8

9

3

5

V1400 Increment the value in V1400 by “1”.

V1400

Handheld Programmer Keystrokes $ STR I

SHFT

8

NEXT

NEXT

N TMR

C

NEXT

NEXT

F

B

E

2

6

ENT

5

1

3

A 4

A 0

ENT

0

In the following increment example, when C5 is on the value in V1400 increases by one. DirectSOFT 5 Direct SOFT32

V1400

C5

DEC

8

9

8

9

3

5

V1400 Decrement the value in V1400 by “1”.

V1400 3

4

Handheld Programmer Keystrokes $ STR SHFT

5–76

DEC

D 3

NEXT

NEXT

E

C 4

2

NEXT

NEXT

F

B

E

5

1

DL05 Micro PLC User Manual, 6th Edition, Rev. A

ENT A

4

A 0

0

ENT

Page 200

Chapter 5: Standard RLL - Math Instructions

Increment Binary (INCB) DS5

Used

HPP

Used

INCB

The Increment Binary instruction increments a binary value in a specified V-memory location by “1” each time the instruction is executed.

A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P

See memory map See memory map

Discrete Bit Flags

Description

SP63

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

In the following example when C5 is on, the binary value in V2000 is increased by 1. DirectSOFT 5 Direct SOFT32 C5

V2000 4

INCB

A

3

Handheld Programmer Keystrokes C

$ STR

V2000

SHFT

Increment the binary value in the accumulator by“1”

I 8

SHFT

C

N TMR

C

F 2

ENT

5 B

2

C 1

A 2

A 0

A 0

0

ENT

V2000 4

A

3

D

Decrement Binary (DECB) DS5

Used

HPP

Used

The Decrement Binary instruction decrements a binary value in a specified V-memory location by “1” each time the instruction is executed.

DECB A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P

See memory map See memory map

Discrete Bit Flags SP63

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

NOTE: The status flags are only valid until another instruction that uses the same flags is executed.

In the following example when C5 is on, the value in V2000 is decreased by 1. DirectSOFT 5 Direct SOFT32 C5

V2000 4

A

3

C

DECB

Handheld Programmer Keystrokes $ STR

V2000

SHFT

Decrement the binary value in the accumulator by“1”

V2000 4

A

3

D 3

SHFT

C

E

C 4

F 2

5 B

2

ENT C

1

A 2

A 0

A 0

B

DL05 Micro PLC User Manual, 6th Edition, Rev. A

0

ENT

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

5–77

Page 201

Chapter 5: Standard RLL - Math Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

Add Binary (ADDB) DS5

Used

HPP

Used

5–78

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.

ADDB A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

See memory map See memory map 0–FFFF

Discrete Bit Flags

Description

SP63 SP66 SP67 SP70 SP73

On when the result of the instruction causes the value in the accumulator to be zero. On when the 16 bit addition instruction results in a carry. On when the 32 bit addition instruction results in a carry. On anytime the value in the accumulator is negative. 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 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 Out Double instruction. DirectSOFT 5

Use either V-memory

X1

OR

Constant V1400 0

A

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

LD

LD

0

5

K2565

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

BIN

+

ADDB V1420

Acc.

A

0

5

(Accumulator)

1

2

C

4

(V1420)

1

C

C

9

C

C

9

The binary value in the accumulator is added to the binary value in V1420 OUTD V1500

1

V1500

Copy the value in the lower 16bits of the accumulator to V1500 and V1501 Handheld Programmer Keystrokes X(IN)

1

SHFT

L

D

V

1

SHFT

A

D

D

B

OUT

SHFT

D

STR

ENT

V

4

1

0

0

ENT

V

1

4

2

5

0

0

ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

0

ENT

Page 202

Chapter 5: Standard RLL - Math Instructions

Subtract Binary (SUBB) DS5

Used

HPP

Used

Subtract Binary is a 16 bit instruction that subtracts the binary value (Aaaa), which is either a V-memory location or a 4-digit (max.) binary constant, from the binary value in the accumulator. The result resides in the accumulator.

S UBB A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

See memory map See memory map 0–FFFF

Discrete Bit Flags

Description

SP63 SP64 SP65 SP70

On when the result of the instruction causes the value in the accumulator to be zero. On when the 16 bit addition instruction results in a borrow On when the 32 bit addition instruction results in a borrow On any time the value 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 value in V1400 will be loaded into the accumulator using the Load instruction. The binary value in V1420 is subtracted from the binary value in the accumulator using the Subtract Binary instruction. The value in the accumulator is copied to V1500 using the Out instruction. DirectSOFT 5 DirectSOFT32 Display

X1

Use either V-memory

OR

Constant

LD

LD

K1024

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

V1400 0 2 4

1

BIN

SUBB

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

V1420 The binary value in V1420 is subtracted from the value in the accumulator

Acc.

OUT

0 2

4

(Accumulator)

0

A 0

B

(V1420)

0

6

1

9

6 1

9

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

0

V1500 Handheld Programmer Keystrokes STR

X(IN)

1

ENT

SHFT

L

D

V

1

4

SHFT

S

SHFT

U

B

B

2

0

ENT

V

1

V

1

4

OUT

SHFT

D

0

0

ENT

5

0

0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

5–79

Page 203

Chapter 5: Standard RLL - Math Instructions

Multiply Binary (MULB)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

DS5

Used

HPP

Used

5–80

Multiply Binary is a 16 bit instruction that multiplies the binary value (Aaaa), which is either a V-memory location or a 4-digit (max.) binary constant, by the binary value in the accumulator. The result can be up to 32 bits and resides in the accumulator.

MULB A aaa

Operand Data Type

DL05 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

See memory map See memory map 1–FFFF

Discrete Bit Flags

Description

SP63 SP70

On when the result of the instruction causes the value in the accumulator to be zero. On any time the value 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 value in V1400 will be loaded into the accumulator using the Load instruction. The binary value in V1420 is multiplied by the binary value in the accumulator using the Multiply Binary instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. Use either V-memory

DirectSOFT DirectSOFT325 Display X1

OR

Constant

LD

V1400

LD

V1400

0

K2561

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

BIN

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

MULB x

V1420

Acc.

The binary value in V1420 is multiplied by the binary value in the accumulator OUTD V1500 Copy the value of the accumulator to V1500 and V1501

A

0

1

0

A 0

1

(Accumulator)

0

0

2

E

(V1420)

0

0

0

1

C

C

2

E

0

0

0

1

C

C

2

E

V1501

V1500

Handheld Programmer Keystrokes STR

ENT

X

1

SHFT

L

D

V

1

SHFT

M

U

L

B

OUT

SHFT

D

V

4

0

0

V

1

4

2

1

5

0

0

ENT

DL05 Micro PLC User Manual, 6th Edition, Rev. A

ENT 0

ENT