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

The text of a manual · part 27 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 260 to 269

Pages 260 to 269 of 524

The original document is the PDF (6.4 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 Direct Logic DL06 and Koyo DL06 D0-06DD1

Page 260

Chapter 5: Standard RLL Instructions - Math

Add Formatted (ADDF)

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

DS5

Used

HPP

Used

5–106

Add Formatted is a 32 bit instruction that adds the BCD value in the accumulator with the BCD value (Aaaa) which is a range of discrete bits. The specified range (Kbbb) can be 1 to 32 consecutive bits. The result resides in the accumulator. Operand Data Type

ADDF A aaa K bbb

DL06 Range

....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relays . . . . . . . . . . . . . . . . . . . . . . . . . SP Global I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . GX Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K aaa bbb

0–777 0–777 0–1777 0–1777 0–377 0–177 0-137 320-717 0-3777 ––

–– –– –– –– –– –– –– –– 1–32

Discrete Bit Flags

Description

SP63 SP66 SP67 SP70 SP73 SP75

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 an incorrect sign bit. 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 X6 is on, the BCD value formed by discrete locations X0–X3 is loaded into the accumulator using the LDF instruction. The BCD value formed by discrete locations C0–C3 is added to the value in the accumulator using the ADDF instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the OUTF instruction. DirectSOFT 5 DirectSOFT32 Display X6

LDF

X0 K4

X3 X2 X1 X0 ON OFF OFF OFF

Load the BCD value represented by discrete locations X0–X3 into the accumulator

The unused accumulator bits are set to zero ADDF

C0 K4

OUTF

Y10 K4

Add the BCD value in the accumulator with the value represented by discrete location C0–C3

0

0

0

0

0

0

0

+ Acc.

0

0

0

1

0

0

0

8

(Accumulator)

C3

3

(C0-C3)

OFF OFF ON ON

1

Copy the lower 4 bits of the accumulator to discrete locations Y10–Y13

Handheld Programmer Keystrokes $

G STR

6

SHFT

L ANDST

D

SHFT

A

D

GX OUT

SHFT

OFF OFF OFF ON

F 3

A

F

F

4 NEXT

5

3 B

5

E 0

5 D

3

0

Y13 Y12 Y11 Y10

ENT

A 1

0

ENT

NEXT

NEXT

E

ENT

4

NEXT

A

E 0

DL06 Micro PLC User Manual, 3rd Edition Rev. A

4

ENT

C2

C1

C0

Page 261

Chapter 5: Standard RLL Instructions - Math

Subtract Formatted (SUBF) DS5

Used

HPP

Used

Subtract Formatted is a 32 bit instruction that subtracts the BCD value (Aaaa), which is a range of discrete bits, from the BCD value in the accumulator. The specified range (Kbbb) can be 1 to 32 consecutive bits. The result resides in the accumulator.

1 2 3 Operand Data Type DL06 Range aaa bbb 4 5 6 7 Discrete Bit Flags Description 8 9 10 11 NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X6 is on, the BCD value formed by discrete locations X0–X3 12 is loaded into the accumulator using the LDF instruction. The BCDvalue formed by discrete location C0–C3 is subtracted from the BCD value in the accumulator using the SUBF instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using 13 the OUTF instruction. 14 A B C D ....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relays . . . . . . . . . . . . . . . . . . . . . . . . . SP Global I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . GX Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

SP63 SP64 SP65 SP70 SP73 SP75

0–777 0–777 0–1777 0–1777 0–377 0–177 0-137 320-717 0-3777 ––

–– –– –– –– –– –– –– –– 1–32

On when the result of the instruction causes the value in the accumulator to be zero. On when the 16-bit subtraction instruction results in a borrow. On when the 32 bit subtraction instruction results in a borrow On any time the value in the accumulator is negative. On when a signed addition or subtraction results in an incorrect sign bit. On when a BCD instruction is executed and a NON-BCD number was encountered.

DirectSOFT 5 DirectSOFT32 Display X6

S UBF A aaa K bbb

X3

LDF

X0

K4

SUBF

C0

K4

Load the BCD value represented by discrete locations X0-X3 into the accumulator

Y10

K4

X1

X0

The unused accumulator bits are set to zero

Subtract the BCD value represented by C0-C3 from the value in the accumulator

0

0

0

0

0

0

0 y

ACC. 0

OUTF

X2

ON OFF OFF ON

0

0

0

0

0

0

9

(Accumulator)

C3

8

(C0- C3)

ON OFF OFF OFF

C2

C1

C0

1

Copy the lower 4 bits of the accumulator to discrete locations Y10- Y13

Handheld Programmer Keystrokes

Y13 Y12 Y11 Y10

$

G

STR

6

SHFT

L ANDST

D

SHFT

S RST

SHFT

GX OUT

SHFT

F

ENT

OFF OFF OFF ON

F

3

A

B

F 5

1

ISG B

5

4

0

5

U

E

A 1

0

ENT

NEXT

NEXT

E

ENT

4

NEXT

NEXT

A

E 0

4

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–107

Page 262

Chapter 5: Standard RLL Instructions - Math

Multiply Formatted (MULF)

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

DS5

Used

HPP

Used

Multiply Formatted is a 16 bit instruction that multiplies the BCD value in the accumulator by the BCD value (Aaaa) which is a range of discrete bits. The specified range (Kbbb) can be 1 to 16 consecutive bits. The result resides in the accumulator. Operand Data Type

MULF A aaa K bbb

DL06 Range

....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relays . . . . . . . . . . . . . . . . . . . . . . . . . SP Global I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . GX Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K aaa bbb

0–777 0–777 0–1777 0–1777 0–377 0–177 0-137 320-717 0-3777 ––

–– –– –– –– –– –– –– –– 1–16

Discrete Bit Flags

Description

SP63 SP70 SP75

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. 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 X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value formed by discrete locations C0–C3 is multiplied by the value in the accumulator using the Multiply Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction. DirectSOFT 5 DirectSOFT32 Display

X3

X6

LDF

X0 K4

Load the value represented by discrete locations X0- X3 into the accumulator

X2

X1

X0

OFF OFF ON ON The unused accumulator bits are set to zero

MULF

C0 K4

Multiply the value in the accumulator with the value represented by discrete locations C0- C3

0

Y10 K4

0

0

0

0

0

X Acc. 0

OUTF

0

0

0

0

0

0

0

3

(Accumulator)

C3

2

(C0- C3)

OFF OFF ON OFF

6

Copy the lower 4 bits of the accumulator to discrete locations Y10- Y13

Handheld Programmer Keystrokes $

G STR

6

SHFT

L ANDST

D

SHFT

M ORST

U

GX OUT

SHFT

F

5–108

Y13 Y12 Y11 Y10

ENT

OFF ON ON OFF

F

A

3

5

ISG

L ANDST

4

0 F

NEXT

5 B

5

E

A 1

0

ENT

NEXT

NEXT

E

ENT

4

NEXT

A

E 0

DL06 Micro PLC User Manual, 3rd Edition Rev. A

4

ENT

C2

C1

C0

Page 263

Chapter 5: Standard RLL Instructions - Math

Divide Formatted (DIVF) DS5

Used

HPP

Used

Divide Formatted is a 16 bit instruction that divides the BCD value in the accumulator by the BCD value (Aaaa), a range of discrete bits. The specified range (Kbbb) can be 1 to 16 consecutive bits. The first part of the quotient resides in the accumulator and the remainder resides in the first stack location. Operand Data Type

DIVF

A aaa K bbb

DL06 Range

....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relays . . . . . . . . . . . . . . . . . . . . . . . . . . P Global I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K aaa bbb

0–777 0–777 0–1777 0–1777 0–377 0–177 0-137 320-717 0-3777 ––

–– –– –– –– –– –– –– –– 1–16

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 any time the value in the accumulator is negative. 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 X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value in the accumulator is divided by the value formed by discrete location C0–C3 using the Divide Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction. DirectSOFT 5 DirectSOFT32 Display X6

X3 LDF

X0 K4

Load the value represented by discrete locations X0- X3 into the accumulator

X2

X1

X0

ON OFF OFF OFF The unused accumulator bits are set to zero

DIVF

C0 K4

OUTF

Y10 K4

0

Divide the value in the accumulator with the value represented by discrete location C0- C3

0

0

0

0

0

0

_.. Acc. 0

0

0

0

0

0

0

8

(Accumulator)

C3

2

(C0- C3)

OFF OFF ON OFF

4

0

Y13 Y12 Y11 Y10

$

OFF ON OFF OFF

STR

6

SHFT

L ANDST

D

SHFT

D

I

GX OUT

3 SHFT

ENT F

A

3

5

8

V AND

F

F A 1

4 NEXT

5 B

5

E 0

0

0

0

0

ENT

NEXT

NEXT

E

ENT

4

0

0

First stack location contains the remainder

Copy the lower 4 bits of the accumulator to discrete locations Y10- Y13

Handheld Programmer Keystrokes G

0

C2

NEXT

A

E 0

4

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

0

C1

C0

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

5–109

Page 264

Chapter 5: Standard RLL Instructions - Math

Add Top of Stack (ADDS)

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

DS5

Used

HPP

Used

5–110

Add Top of Stack is a 32 bit instruction that adds the BCD value in the accumulator with the BCD value in 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 and all stack values are moved up one level.

ADDS

Discrete Bit Flags

Description

SP63 SP66 SP67 SP70 SP73 SP75

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 an incorrect sign bit. 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 loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The value in the first level of the accumulator stack is added with the value in the accumulator using the Add Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT 5 DirectS OF T 32 Dis play X1

V1400

V1401 Load the value in V1400 and V1401 into the accumulator

LDD

0

0

3

9

5

0

2

6

0

0

3

9

5

0

2

6

V1400 Acc.

V1420

V1421 0

Load the value in V1420 and V1421 into the accumulator

LDD V1420

Add the value in the accumulator with the value in the firs t level of the accumulator s tack

ADDS

V1500

B STR

1 L ANDST

D

SHFT

L ANDST

D

SHFT

A

D

SHFT

GX OUT

SHFT

1

3

3

B 3

D

3

E

B

D

3

0

3

4 E

1 S RST

ENT

B

F 1

A 0

4

A 5

A

C

A 0

0 A

2

0

5

6

Acc.

0

1

7

2

0

5

6

Acc.

0

0

5

6

7

0

8

2

0

5

V1501

D

D

2

6

7

0

0

8

V1500

ENT

3

0

7

0

0

Handheld Programmer Keystrokes $

1

Level 1

X

X

X

X

X

X

X

X

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Accumulator s tack after 2nd LDD

C opy the value in the accumulator to V1500 and V1501

OU T D

0

Accumulator s tack after 1s t LDD

ENT ENT

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

2

Level 1

0

0

3

9

5

0

2

6

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Page 265

Chapter 5: Standard RLL Instructions - Math

Subtract Top of Stack (SUBS) DS5

Used

HPP

Used

Subtract Top of Stack is a 32 bit instruction that subtracts the BCD value in the first level of the accumulator stack from the BCD value in the accumulator. The result resides in the accumulator. The value in the first level of the accumulator stack is removed and all stack values are moved up one level.

S UBS

Discrete Bit Flags

Description

SP63 SP64 SP65 SP70 SP73 SP75

On when the result of the instruction causes the value in the accumulator to be zero. On when the 16-bit subtraction instruction results in a borrow. On when the 32 bit subtraction instruction results in a borrow. On anytime the value in the accumulator is negative. On when a signed addition or subtraction results in an incorrect sign bit. 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 loaded into the accumulator using the Load Double instruction, pushing the value previously loaded into the accumulator onto the accumulator stack. The BCD value in the first level of the accumulator stack is subtracted from the BCD value in the accumulator using the Subtract Stack instruction. The value in the accumulator is copied to V1500 and V1501 DirectSOFT 5 DirectSOFT32 Display X1

V1400

V1401 Load the value in V1400 and V1401 into the accumulator

LDD

0

0

1

7

2

0

5

6

0

0

1

7

2

0

5

6

V1400 Acc.

Load the value in V1420 and V1421 into the accumulator

LDD V1420

V1421 0

Subtract the value in the first level of the accumulator stack from the value in the accumulator

SUBS

0

3

V1420 9

5

0

2

6

Acc.

0

0

3

9

5

0

2

6

Acc.

0

0

2

2

2

9

7

0

Accumulator stack after 1st LDD Level 1

X

X X

X X

X X

X

Level 2

X

X X

X X

X X

X

Level 3

X

X X

X X

X X

X

Level 4

X

X X

X X

X X

X

Level 5

X

X X

X X

X X

X

Level 6

X

X X

X X

X X

X

Level 7

X

X X

X X

X X

X

Level 8

X

X X

X X

X X

X

Accumulator stack after 2nd LDD Copy the value in the accumulator to V1500 and V1501

OUTD

Level 1

0

0

5

6

Level 2

X

X X

X X

X X

X

Level 3

X

X X

X X

X X

X

Level 4

X

X X

X X

X X

X

Handheld Programmer Keystrokes

Level 5

X

X X

X X

X X

X

$

Level 6

X

X X

X X

X X

X

Level 7

X

X X

X X

X X

X

Level 8

X

X X

X X

X X

X

Sta

V1500

0

0

2

V1501

B STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

S RST

SHFT

GX OUT

SHFT

D

ENT B

D 3 D 3

B 3

U

B ISG

1 B

3

E 1

3

1

A 4

E

C

1

4

S RST

ENT

F

A 5

A 0 A 2

A 0

0

0

0

ENT

2

2

9

7

V1500

0

1

ENT

7

2

0

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

ENT

DL06 Micro PLC User Manual, 1st Ed., Rev. A DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–111

Page 266

Chapter 5: Standard RLL Instructions - Math

Multiply Top of Stack (MULS) DS5

Used

HPP

Used

Multiply Top of Stack is a 16 bit instruction that multiplies a 4digit BCD value in the first level of the accumulator stack by a 4-digit BCD value in the accumulator. The result resides in the accumulator. The value in the first level of the accumulator stack is is removed and all stack values are moved up one level.

MULS

Discrete Bit Flags

Description

SP63 SP70 SP75

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. 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 loaded into the accumulator using the Load instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The BCD value in the first level of the accumulator stack is multiplied by the BCD value in the accumulator using the Multiply Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT 5 DirectSOFT32 Display X1

V1400 Load the value in V1400 into the accumulator

LD

5

0

0

0

5

0

0

0

The unused accumulator bits are set to zero

V1400

Acc. 0

0

0

0

V1420 Load the value in V1420 into the accumulator

LD V1420

0

0

0

The unused accumulator bits are set to zero

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

MULS

2

Acc. 0

0

0

0

0

2

0

0

Acc. 0

1

0

0

0

0

0

0

Accumulator stack after 1st LDD Level 1

X

X

X

X X

X

X

X

Level 2

X

X

X

X X

X

X

X

Level 3

X

X

X

X X

X

X

X

Level 4

X

X

X

X X

X

X

X

Level 5

X

X

X

X X

X

X

X

Level 6

X

X

X

X X

X

X

X

Level 7

X

X

X

X X

X

X

X

Level 8

X

X

X

X X

X

X

X

Copy the value in the accumulator to V1500 and V1501

OUTD V1500

0

1

0

V1501

0

0

0

V1500

Handheld Programmer Keystrokes B

$ STR

1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

M ORST

U

GX OUT

SHFT

D

5–112

ENT B

3

E 1

B 3 ISG 3

L ANDST

A 4

E

0 C

1

4

S RST

ENT

B

F 1

A A 2

A 5

0 0

A 0

0

0

ENT ENT

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

0

Level 1

0

0

0

0

5

0

0

0

Level 2

X

X

X

X X

X

X

X

Level 3

X

X

X

X X

X

X

X

Level 4

X

X

X

X X

X

X

X

Level 5

X

X

X

X X

X

X

X

Level 6

X

X

X

X X

X

X

X

Level 7

X

X

X

X X

X

X

X

Level 8

X

X

X

X X

X

X

X d d RLL

Accumulator stack after 2nd LDD

S

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

Page 267

Chapter 5: Standard RLL Instructions - Math

Divide by Top of Stack (DIVS) DS5

Used

HPP

Used

Divide Top of Stack is a 32 bit instruction that divides the 8-digit BCD value in the accumulator by a 4-digit BCD value in the first level of the accumulator stack. The result resides in the accumulator and the remainder resides in the first level of the accumulator stack.

1 2 Discrete Bit Flags Description 3 4 5 NOTE: Status flags are valid only until another instruction uses the same flag. 6 In the following example, when X1 is on, the Load instruction loads the value in V1400 into the accumulator. The value in V1420 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator 7 stack. The BCD value in the accumulator is divided by the BCD value in the first level of the accumulator stack using the Divide Stack instruction. The Out Double instruction copies the 8 value in the accumulator to V1500 and V1501. 9 10 11 12 13 14 A B C D 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 any time the value in the accumulator is negative. On when a BCD instruction is executed and a NON-BCD number was encountered.

DirectSOFT 5 DirectSOFT32 Display X1

DIVS

Accumulator stack after 1st LDD

V1400

Load the value in V1400 into the accumulator

LD

V1400

0

0

0

0

0

0

0

0

Load the value in V1420 and V1421 into the accumulator

Acc.

0

0

0

5

5

0

2

0

V1420

V1421

V1420

2

The unused accumulator bits are set to zero Acc.

LDD

0

0

0

0

0

0

0

0

0

0

0

Level 1

X X

X

X

X X

X

X

Level 2

X X

X

X

X X

X

X

Level 3

X X

X

X

X X

X

X

Level 4

X X

X

X

X X

X

X

Level 5

X X

X

X

X X

X

X

Level 6

X X

X

X

X X

X

X

Level 7

X X

X

X

X X

X

X

Level 8

X X

X

X

X X

X

X

Accumulator stack after 2nd LDD

Divide the value in the accumulator by the value in the first level of the accumulator stack

DIVS

Acc.

Copy the value in the accumulator to V1500 and V1501

OUTD

V1500

0

0

0

0

0

0

V1501

2

2

5

5

0

0

0

0

V1500

0

0

Level 1

0

0

0

0

0

0

2

0

Level 2

X X

X

X

X X

X

X

Level 3

X X

X

X

X X

X

X

Level 4

X X

X

X

X X

X

X

Level 5

X X

X

X

X X

X

X

Level 6

X X

X

X

X X

X

X

Level 7

X X

X

X

X X

X

X

Level 8

X X

X

X

X X

X

X

Handheld Programmer Keystrokes $

B

STR

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

D

I

GX OUT

SHFT

3

D

1

B

3 3 8 3

The remainder resides in the first stack location

ENT

D

1

B

3

V AND

E

4 1

S RST

ENT

B

F

1

5

A E

A

0 4

0

A

C

A

0 2

0

ENT

A

0

ENT

ENT

Level 1

0

0

0

0

0

0

0

0

Level 2

X

X

X

X X

X

X

X

Level 3

X

X

X

X X

X

X

X

Level 4

X

X

X

X X

X

X

X

Level 5

X

X

X

X X

X

X

X

Level 6

X

X

X

X X

X

X

X

Level 7

X

X

X

X X

X

X

X

Level 8

X

X

X

X X

X

X

X

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–113

Page 268

Chapter 5: Standard RLL Instructions - Math

Add Binary Top of Stack (ADDBS)

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

DS5

Used

HPP

Used

5–114

Add Binary Top of Stack instruction is a 32 bit instruction that adds the binary value in the accumulator with the binary value in 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 and all stack values are moved up one level.

ADDBS

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 an 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 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the first level of the accumulator stack is added with the binary value in the accumulator using the Add Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT 5 DirectS OF T 32 Dis play X1

V1400

V1401 Load the value in V1400 and V1401 into the accumulator

LDD

0

0

3

A

5

0

C

6

0

0

3

A

5

0

C

6

V1400 Acc.

V1420

V1421 0

Load the value in V1420 and V1421 into the accumulator

LDD V1420

Add the binary value in the accumulator with the binary value in the firs t level of the accumulator s tack

ADDBS

V1500

1

7

B

0

B STR

1

SHFT

L ANDST

D

0

0

1

7

B

0

5

F

Acc.

0

0

5

2

0

1

2

5

0

0

5

2

0

1

SHFT

L ANDST

D

SHFT

A

D

GX OUT

SHFT

ENT

3

B 3

D 3

D

B 3

1 B

3

E 1

3 D

3

0

B

D

1

A 4

E 1

4

S RST

ENT

F

A 5

A 0

C

A 0

0 A

2

0

F

Acc.

Handheld Programmer Keystrokes $

5

Level 1

X

X

X

X

X

X

X

X

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Accumulator s tack after 2nd LDD

C opy the value in the accumulator to V1500 and V1501

OU T D

0

Accumulator s tack after 1s t LDD

0

ENT ENT

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

2

5

Level 1

0

0

3

A

5

0

C

6

Level 2

X

X

X

X

X

X

X

X

Level 3

X

X

X

X

X

X

X

X

Level 4

X

X

X

X

X

X

X

X

Level 5

X

X

X

X

X

X

X

X

Level 6

X

X

X

X

X

X

X

X

Level 7

X

X

X

X

X

X

X

X

Level 8

X

X

X

X

X

X

X

X

Page 269

Chapter 5: Standard RLL Instructions - Math

Subtract Binary Top of Stack (SUBBS) DS5

Used

HPP

Used

Subtract Binary Top of Stack is a 32 bit instruction that subtracts the binary value in the first level of the accumulator stack from the binary value in the accumulator. The result resides in the accumulator. The value in the first level of the accumulator stack is removed and all stack locations are moved up one level.

S UBBS

Discrete Bit Flags

Description

SP63 SP64 SP65 SP70 SP73

On when the result of the instruction causes the value in the accumulator to be zero. On when the 16-bit subtraction instruction results in a borrow. On when the 32 bit subtraction instruction results in a borrow On any time the value in the accumulator is negative. On when a signed addition or subtraction results in an 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 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the first level of the accumulator stack is subtracted from the binary value in the accumulator using the Subtract Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT 5 DirectSOFT32 Display X1

V1401 Load the value in V1400 and V1401 into the accumulator

LDD V1400

Acc.

V1400

0

0

1

A

2

0

5

B

0

0

1

A

2

0

5

B

V1420

V1421 0

Load the value in V1420 and V1421 into the accumulator

LDD V1420

Subtract the binary value in the first level of the accumulator stack from the binary value in the accumulator

SUBBS

V1500

3

B 1

SHFT

L ANDST

D

SHFT

L ANDST

D

SHFT

S RST

SHFT

GX OUT

SHFT

D

B

D D 3

B 3

U

B ISG

A 0

C 4

2

1

S RST

ENT

A

A

5

0

0 A

1

F 1

A

0

6

3

A

5

0 C

6

Acc.

0

0

2

0

3

0

B

0

4 E

B 1

B 3

E 1

3

C

0

ENT

3

0

0

Handheld Programmer Keystrokes

STR

5

Acc.

0

2

V1501

$

A

6

Level 1

X X

X

X X

X

X

X

Level 2

X X

X

X X

X

X

X

Level 3

X X

X

X X

X

X

X

Level 4

X X

X

X X

X

X

X

Level 5

X X

X

X X

X

X

X

Level 6

X X

X

X X

X

X

X

Level 7

X X

X

X X

X

X

X

Level 8

X X

X

X X

X

X

X

Accumulator stack after 2nd LDD

Copy the value in the accumulator to V1500 and V1501

OUTD

0

Accumulator stack after 1st LDD

0

ENT

0

3

0

6

V1500

B

Level 1

0

0

1

A 2

0

5

B

Level 2

X X

X

X X

X

X

X

Level 3

X X

X

X X

X

X

X

Level 4

X X

X

X X

X

X

X

Level 5

X X

X

X X

X

X

X

Level 6

X X

X

X X

X

X

X

Level 7

X X

X

X X

X

X

X

Level 8

X X

X

X X

X

X

X

ENT

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

ENT

DL06 Micro PLC User Manual, 3rd Edition Rev. A

5–115