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

The text of a manual · part 26 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 250 to 259

Pages 250 to 259 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 250

Chapter 5: Standard RLL Instructions - Math

Divide Double (DIVD)

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

DS5

Used

HPP

Used

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.

A aaa

Operand Data Type

DL06 Range aaa

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

See memory map See memory map

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: 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 5 X1

V1401 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 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

DIVD

? V1420

0

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

0

0

0

0

0

0

0

First stack location contains the remainder

OUTD 0

V1500

0

0

3

0

0

V1501

Copy the value in the accumulator to V1500 and V1501

0

0

V1500

Handheld Programmer Keystrokes POP $ Retrieve the remainder OUTD

B

ENT

STR

1

SHFT

L D 3 ANDST

D

SHFT

D

V AND

GX OUT

SHFT

V1502 Copy the value into V1502 and V1503

5–96

DIVD

I 8

3 D

B

E

B

E

B

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

F 1

C

A 5

A 0

4

1

3

A 4

1

3

A 2

A 0

0

0

0 ENT

ENT ENT

Page 251

Chapter 5: Standard RLL Instructions - Math

Divide Real (DIVR) Used

HPP

N/A

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 be Real data type (IEEE floating point format).

1 2 3 Operand Data Type DL06 Range aaa 4 5 Discrete Bit Flags Description 6 7 8 NOTE: Status flags are valid only until another instruction uses the same flag. 9 10 11 12 13 14 A B NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT 5 for this feature. C D ....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Real Constant . . . . . . . . . . . . . . . . . . . . . . . . . . R

SP63 SP70 SP71 SP72 SP74

DIVR

A aaa

See memory map See memory map -3.402823E + 38 to + -3.402823E + 38

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 anytime the V-memory specified by a pointer (P) is not valid. On anytime the value in the accumulator is an invalid floating point number. On anytime a floating point math operation results in an underflow error.

DirectSOFT 5 DirectSOFT32 Display X1

4

1

7

0

0

0

0

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

LDR

R15.0

Load the real number 15.0 into the accumulator.

¸

1

5

1

0

(decimal)

¸

1 . 5

DIVR

R10.0

V1401

Divide the accumulator contents by the real number 10.0.

3

F

C

V1400 0

0

0

(Hex number)

Real Value

OUTD

Acc.

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

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

V1400

Copy the result in the accumulator to V1400 and V1401.

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

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

DS5

5–97

Page 252

Chapter 5: Standard RLL Instructions - Math

Increment (INC)

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

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

5–98

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

DEC A aaa

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

In the following increment example, when C5 makes an Off-to-On transition the value in V1400 increases by one. Direct SOFT 5

V1400

C5

8

9

8

9

3

5

INC V1400 Increment the value in V1400 by “1”.

V1400 3

6

Handheld Programmer Keystrokes $ STR SHFT

I 8

NEXT

NEXT

N TMR

C

NEXT

NEXT

F

B

E

2

5

1

ENT A

4

A 0

ENT

0

In the following decrement example, when C5 makes an Off-to-On transition the value in V1400 is decreased by one. Direct SOFT 5

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

D 3

NEXT

NEXT

E

C 4

2

NEXT

NEXT

F

B

E 1

5

ENT A

4

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

A 0

0

ENT

Page 253

Chapter 5: Standard RLL Instructions - Math

Add Binary (ADDB) DS5

Used

HPP

Used

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

1 ADDB 2 A aaa 3 4 Operand Data Type DL06 Range aaa 5 6 Discrete Bit Flags Description 7 8 9 NOTE: Status flags are valid only until another instruction uses the same flag. 10 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 11 copied to V1500 and V1501 using the Out Double instruction. 12 13 14 A B C D ....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

SP63 SP66 SP67 SP70 SP73

See memory map See memory map 0-FFFF, h=65636

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.

Direct SOFT32 Display DirectSOFT 5

Use either V-memory

OR

Constant

V1400

X1

0

LD

LD

A

0

5

K2565

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 0

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

ENT

X(IN)

1

SHFT

L

D

V

1

SHFT

A

D

D

B

OU T

SHFT

D

STR

V

4

1

0

0

ENT

V

1

4

2

5

0

0

ENT

0

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

ENT

5–99

Page 254

Chapter 5: Standard RLL Instructions - Math

Add Binary Double (ADDBD)

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

DS5

Used

HPP

Used

5–100

Add Binary Double is a 32 bit instruction that adds the unsigned 2s complement binary value in the accumulator with the value (Aaaa), which is either two consecutive V-memory locations or 32-bit unsigned 2s complement binary constant. The result resides in the accumulator.

ADDBD A aaa

Operand Data Type

DL06 Range aaa

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

See memory map See memory map 0-FFFF 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 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 binary value in the accumulator is added with the binary value in V1420 and V1421 using the Add Binary Double instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT 5 Direct SOFT32 Display

Use either V-memory

OR

Constant V1401

X1

LDD V1400

LDD K2561

Load the value in V1400 and V1401 into the accumulator

BIN

ADDBD

V1400

0

0

0

0

0

A

0

1

0

0

0

0

0

A

0

1

(Accumulator)

+ 1

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.

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

V1500

V1500

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

B STR

1

SHFT

L ANDST

D

SHFT

A

D

GX OUT

SHFT

ENT

B 3

3

A 4

D 1

B

D

E 1

3 D

3

0

B

D 3

B 3

F 1

A 0 E 1

A 5

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

A 0

0

0

ENT C

4 ENT

A 2

0

ENT

Page 255

Chapter 5: Standard RLL Instructions - Math

Subtract Binary (SUBB) DS5

Used

HPP

Used

Subtract Binary is a 16 bit instruction that subtracts the unsigned 2s complement binary value (Aaaa), which is either a V-memory location or a 16-bit 2s complement binary value, from the binary value in the accumulator. The result resides in the accumulator. Operand Data Type

S UBB A aaa

DL06 Range aaa

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

See memory map See memory map 0-FFFF, h=65636

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 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 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. Direct SOFT32 Display DirectSOFT 5

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

0

2

4

(Accumulator)

0

A

0

B

(V1420)

0

6

1

9

0

6

1

9

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 V1500 Copy the value in the lower 16 bits of the accumulator to V1500

V1500 Handheld Programmer Keystrokes STR

X(IN)

1

ENT

SHFT

L

D

V

1

4

SHFT

S

SHFT

U

B

B

V

1

4

2

0

ENT

OUT

SHFT

D

V

1

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

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

5–101

Page 256

Chapter 5: Standard RLL Instructions - Math

Subtract Binary Double (SUBBD)

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

DS5

Used

HPP

Used

5–102

Subtract Binary Double is a 32 bit instruction that subtracts the unsigned 2s complement binary value (Aaaa), which is either two consecutive V-memory locations or a 32-bit unsigned 2s complement binary constant, from the binary value in the accumulator The result resides in the accumulator. Operand Data Type

S UBBD A aaa

DL06 Range aaa

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

See memory map See memory map 0-FFFF FFFF

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 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 binary value in V1420 and V1421 is subtracted from the binary value in the accumulator using the Subtract Binary Double instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. Use either V-memory

Direct SOFT32 Display DirectSOFT 5

X1

OR

Constant

LDD K393471

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

0

V1401 0 0

6

0

V1400 0 F

F

BIN

SUBBD V1420

0

0

0

6

0

0

F

F

(Accumulator)

-

0

0

0

0

1

A

0

1

(V1421 and V1420)

Acc.

0

0

0

5

E

6

F

E

0

0

5

E

6

F

E

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

V1500

V1500

V1501

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

$ STR SHFT

1 L ANDST

D

ENT B

D 3

SHFT

S RST

SHFT

GX OUT

SHFT

D

U

B ISG

B 1

B 3

E 1

3

A 0

D 1

F 1

A 4 3

A 5

0 B 1

A 0

0

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

ENT E

ENT

C 4

A 2

0

ENT

Page 257

Chapter 5: Standard RLL Instructions - Math

Multiply Binary (MULB) DS5

Used

HPP

Used

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

MULB A aaa

Operand Data Type

DL06 Range aaa

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

See memory map See memory map 0-FFFF

Discrete Bit Flags

Description

SP63 SP70

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.

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 using the Out instruction. Use either V-memory

DirectSOFT32 Display DirectSOFT 5

X1

OR

Constant

V1400

LD

LD V1400

0

A

0

1

0

A 0

1

(Accumulator)

0

0

2

E

(V1420)

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

0

0

0

1

C

C

2

E

0

0

0

1

C

C

2

E

V1501

V1500

Handheld Programmer Keystrokes STR

X

1

ENT

SHFT

L

D

V

1

SHFT

M

U

L

B

OUT

SHFT

D

V

4

1

0

0

ENT

V

1

4

2

5

0

0

ENT

0

ENT

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

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

5–103

Page 258

Chapter 5: Standard RLL Instructions - Math

Divide Binary (DIVB)

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

DS5

Used

HPP

Used

5–104

Divide Binary is a 16 bit instruction that divides the unsigned 2s complement binary value in the accumulator by a binary value (Aaaa), which is either a V-memory location or a 16-bit unsigned 2s complement binary constant. The first part of the quotient resides in the accumulator and the remainder resides in the first stack location. Operand Data Type

DIVB A aaa

DL06 Range aaa

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

See memory map See memory map 0-FFFF

Discrete Bit Flags

Description

SP53 SP63 SP70

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.

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 is divided by the binary value in V1420 using the Divide Binary instruction. The value in the accumulator is copied to V1500 using the Out instruction. Use either V-memory

DirectSOFT 5 DirectSOFT32 Display

X1

OR

Constant

LD

LDD K64001

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

BIN

F

V1400 A 0

1

F

A 0

1

(Accumulator)

0

0

5

0

(V1420)

0

3

2

0

0

The unused accumulator bits are set to zero 0

DIVB

0

0

0

_..

V1420

Acc.

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

0

0

OUT V1500

0

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

3

2

0

V1500

Handheld Programmer Keystrokes STR

0

0

0

0

First stack location contains the remainder

X

1

ENT

SHFT

L

D

V

1

SHFT

D

I

V

B

OUT

SHFT

D

V

4

1

0

0

ENT

V

1

4

2

5

0

0

ENT

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

0

ENT

0

Page 259

Chapter 5: Standard RLL Instructions - Math

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

DL06 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 Direct SOFT32 5 C5

V2000 4

INCB

A

3

Handheld Programmer Keystrokes C

$ STR

V2000

SHFT

Increment the binary value in V2000 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

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

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

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

V2000 4

A

? 3

Handheld Programmer Keystrokes C $

DECB

STR

V2000

SHFT

Decrement the binary value in V2000 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

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

0

ENT

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

5–105