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

The text of a manual · part 25 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 240 to 249

Pages 240 to 249 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 240

Chapter 5: Standard RLL Instructions - Math

Math Instructions

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

Add (ADD) DS5

Used

HPP

Used

Operand Data Type

A aaa

DL06 Range aaa

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

See memory map See memory map

Discrete Bit Flags

Description

SP63 SP66 SP67 SP70 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 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 V2000 will be loaded into the accumulator using the Load instruction. The value in the lower 16 bits of the accumulator are added to the value in V2006 using the Add instruction. The value in the accumulator is copied to V2010 using the Out instruction. DirectSOFT Direct SOFT32 5

V2000

X1

4

9

3

5

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

9

3

5

(Accumulator)

2

5

0

0

(V2006)

7

4

3

5

7

4

3

5

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

+

V2006

Acc.

Add the value in the lower 16 bits of the accumulator with the value in V2006 OUT 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

A

D

GX OUT

5–86

ADD

Add is a 16 bit instruction that adds a BCD value in the accumulator with a BCD value in a V-memory location (Aaaa). (You cannot use a constant as the parameter in the box.) The result resides in the accumulator.

0

V2010

ENT A

C 2

3

A 0

C

D 3

3

SHFT

V AND

A 2

C

A 2

A 0 A 0

B 0

0

G 0

A 1

ENT

0

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

6 ENT

ENT

Page 241

Chapter 5: Standard RLL Instructions - Math

Add Double (ADDD) DS5

Used

HPP

Used

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

ADDD A aaa

Operand Data Type

DL06Range aaa

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

See memory map See memory map 0–99999999

Discrete Bit Flags

Description

SP63 SP66 SP67 SP70 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 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 V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is added with the value in V2006 and V2007 using the Add Double instruction. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. DirectSOFT 5 Direct SOFT

V2000

V2001

X1

6

LDD

7

3

9

5

0

2

6

V2000 Load the value in V2000 and V2001 into the accumulator ADDD V2006 Add the value in the accumulator with the value in V2006 and V2007

6

7

3

9

5

0

2

6

(Accumulator)

+ 2

0

0

0

4

0

4

6

(V2006 and V2007)

Acc. 8

7

3

9

9

0

7

2

8

7

3

9

9

0

7

2

OUTD V2010

V2001

Copy the value in the accumulator to V2010 and V2011

V2010

Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

SHFT

A

D

GX OUT

SHFT

ENT D

3

0

C

D 3

D 3

A 2

3

C

D 3

A 0

3 SHFT

A

C

A

A 2

0

0

2 V AND

A 0

G 6

0 B

0

ENT

A 1

0

ENT 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–87

Page 242

Chapter 5: Standard RLL Instructions - Math

Add Real (ADDR)

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

DS5

Used

HPP

Used

5–88

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

ADDR A aaa

DL06 Range aaa

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

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

Discrete Bit Flags

Description

SP63 SP70 SP71 SP72 SP73 SP74

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 when a signed addition or subtraction results in a incorrect sign bit. On anytime a floating point math operation results in an underflow error.

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

LDR R7.0 Load the real number 7.0 into the accumulator

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

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

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.

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

Page 243

Chapter 5: Standard RLL Instructions - Math

Subtract (SUB) DS5

Used

HPP

Used

SUB

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

A aaa

DL06Range aaa

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

See memory map See memory map

Discrete Bit Flags

Description

SP63 SP64 SP65 SP70 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 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 V2000 will be loaded into the accumulator using the Load instruction. The value in V2006 is subtracted from the value in the accumulator using the Subtract instruction. The value in the accumulator is copied to V2010 using the Out instruction.

DirectSOFT Direct SOFT325

V2000

X1

2

4

7

5

The unused accumulator bits are set to zero 0 0

0

0

2

4

7

5

1

5

9

2

0

8

8

3

0

8

8

3

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

_

SUB V2006

Acc. Subtract the value in V2006 from the value in the lower 16 bits of the accumulator OUT V2010

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

S RST

U

GX OUT

ENT C

3

A 2

B ISG

1

SHFT

V AND

C 2

A

A

0

0

SHFT

V AND

C

A

B

A

0

1

0

ENT A

2 0

A 0

G 0

6

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–89

Page 244

Chapter 5: Standard RLL Instructions - Math

Subtract Double (SUBD)

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

DS5

Used

HPP

Used

5–90

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. Operand Data Type

SUBD A aaa

DL06 Range aaa

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

See memory map See memory map 0–99999999

Discrete Bit Flags

Description

SP63 SP64 SP65 SP70 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 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 V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in V2006 and V2007 is subtracted from the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. DirectSOFT Direct SOFT32 5

V2001 0

X1

1

V2000

0

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

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 ENT

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

G 0

6

ENT

Page 245

Chapter 5: Standard RLL Instructions - Math

Subtract Real (SUBR) DS5

Used

HPP

N/A

The Subtract Real instruction 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

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

SP63 SP70 SP71 SP72 SP73 SP74

S UBR 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 when a signed addition or subtraction results in a incorrect sign bit. On anytime a floating point math operation results in an underflow error.

DirectSOFT 5 DirectSOFT32 LDR

4

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

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

4

0

E

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

V1400

Copy the result in the accumulator to V1400 and V1401.

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 ndard RLL s tructions

X1 format. You must use DirectSOFT 5 for this feature

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

5–91

Page 246

Chapter 5: Standard RLL Instructions- - Math

Multiply (MUL)

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

DS5

Used

HPP

Used

5–92

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.

MUL A aaa

Operand Data Type

DL06 Range aaa

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

See memory map See memory map 0–9999

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

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

L ANDST

A

A 2

A 0

2 C

3

A 0

A 0

B 0

0

G 0

A 1

ENT

0

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

6 ENT

ENT

(Accumulator) (V2006)

Page 247

Chapter 5: Standard RLL Instructions - Math

Multiply Double (MULD) DS5

Used

HPP

Used

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

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

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

ENT D

3

1

D 2

GX OUT

SHFT

D

SHFT

L ANDST

D

SHFT

M ORST

U

GX OUT

SHFT

D

3 3

3

B

E

A

A

1 PREV

3 L ANDST

4 C 2

D

C 1

0

2

B

SHFT

G

A

ENT

6

E 1

4

SHFT

E 4

ENT

B

E 1

E 1

0

A 4

ENT

ENT

3 B

3

SHFT

ENT B

ISG

PREV

A 4

C 0

2

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–93

Page 248

Chapter 5: Standard RLL Instructions - Math

Multiply Real (MULR)

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

DS5

Used

HPP

Used

5–94

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

MULR A aaa

DL06 Range aaa

....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Real Constant . . . . . . . . . . . . . . . . . . . . . . . . . . R

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

Discrete Bit Flags

Description

SP63 SP70 SP71 SP72 SP73 SP74

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 when a signed addition or subtraction results in a incorrect sign bit. On anytime a floating point math operation results in an underflow error.

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

LDR

4

0

E

0

0

0

0

0

R 7.0 Load the real number 7.0 into the accumulator. 4

0

E

0

0

0

0

0

(Accumulator)

x

1

5

X 4

1

7

0

0

0

0

0

(MULR)

1

0

5

Acc. 4

2

D

2

0

0

0

0

2

0

7

(decimal)

MULR R 15.0

V1401

Multiply the accumulator contents by the real number 15.0

4

2

D

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

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

Exponent (8 bits)

Sign Bit 128 + 4 + 1 = 133 133 - 127 = 6 Implies 2 (exp 6)

Mantissa (23 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 5 for this feature.

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

Page 249

Chapter 5: Standard RLL Instructions - Math

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.

DIV A aaa

Operand Data Type

DL06 Range aaa

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

See memory map See memory map 0–9999

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: Status flags are valid only until another instruction uses the same flag.

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

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

0

0

0

0

0

0

2

First stak location contains the remainder

1

OUT V2010

0

2

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

GX OUT

3

ENT C

3 8 SHFT

A 2

V AND V AND

A 0

C

A 2

C

A 2

A 0 A 0

B 0

0

G 0

A 1

ENT

0

6

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–95