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

The text of a manual · part 24 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 230 to 239

Pages 230 to 239 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 230

Chapter 5: Standard RLL Instructions - Logical

Or with Stack (ORS)

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

DS5

Used

HPP

Used

The ORS instruction is a 32 bit instruction that logically ORs the value in the accumulator with 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 from the stack and all values are moved up one level. Discrete status flags indicate if the result of the ORS is zero or a negative number (the most significant bit is on). Discrete Bit Flags

OR S

Description

SP63 SP70

ON if the result in the accumulator is zero. ON if the result in the accumulator is negative.

In the following example when X1 is on, the binary value in the accumulator will be ORed with the binary value in the first level of the stack. The result resides in the accumulator.

DirectSOFT 5 DirectSOFT32 X1

V1401

LDD

5

V1400

4

7

E

2

V1400 8 7

A

Load the value in V1400 and V1401 in the accumulator 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8 7

6 5

4 3

2

1

0

Acc.

0

1

0 1

0

1

0

0 0

1

1

1

1 1

1

0

0

0

1 0

1

0

0

0 0

1

1

1

1 0

1

0

Acc.

0

1

0 1

0

1

0

0 0

1

1

1

1 1

1

0

0

0

1 0

1

0

0

0 0

1

1

1

1 0

1

0

36476A38 OR (top of stack)

0

0

1

0 1

1

0

1 0

0

0

1 1

0

1

1

1 0

1

0

0 1

1

1

0 0

0

1 0

1 0 0 1

0

1 0

0 0

1 0

1 0

1 0 0 1

1 0

0

1

1 0

1

1

0 0

1

1

1 0

6

F

A

A

ORS

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

Acc.

1

1

0

1 0

1

1 0

0

0

0

OUTD V1500 Copy the value in the accumulator to V1500 and V1501

7

7

V1501

Handheld Programmer Keystrokes $

B STR

1

ENT D

SHFT

L ANDST

D 3

3

Q

SHFT

S RST

ENT

SHFT

D

OR GX OUT

5–76

B

B 3

E 1

F 1

A 4

A 5

A 0

A 0

0

0

ENT

ENT

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

6

7

V1500

1

0

1

0

Page 231

Chapter 5: Standard RLL Instructions - Logical

Exclusive Or (XOR) DS5

Used

HPP

Used

The XOR instruction is a 16 bit instruction that performs an exclusive OR of the value in the lower 16 bits of the accumulator and a specified V-memory location (Aaaa). The result resides in the in the accumulator. The discrete status flag indicates if the result of the XOR is zero. Operand Data Type

XOR A aaa

DL06 Range aaa

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

See memory map See memory map

Discrete Bit Flags

Description

SP63 SP70

ON if the result in the accumulator is zero. ON if the result 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 V2000 will be loaded into the accumulator using the LD instruction. The value in the accumulator is exclusive ORed with V2006 using the XOR instruction. The value in the lower 16 bits of the accumulator are output to V2010 using the OUT instruction. DirectSOFT 5 Direct SOFT32 X1

V2000

LD

2

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

8

7

A

The upper 16 bits of the accumulator will be set to 0 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Acc. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 1 0 0 1

0 0 0 1 1 1 1 0 1 0

XOR V2006 XOR the value in the accumulator with the value in V2006

Acc.

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0

6A38 XOR (V2006)

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 0

Acc. 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0

0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0

OUT V2010 4

Copy the lower 16 bits of the accumulator to V2010

2

4

2

V2010

Handheld Programmer Keystrokes $

SHFT

STR SHFT

D L ANDST 3

SHFT

X

GX OUT

SET

X

B SET

1 SHFT

SHFT

Q

SHFT

V AND

OR C 2

ENT V AND

C

SHFT

V AND

C

A

B

A

0

A 2

1

A 0

A 0

A 2 0

0 A

0

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

Page 232

Chapter 5: Standard RLL Instructions - Logical

Exclusive Or Double (XORD)

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

DS5

Used

HPP

Used

The XORD is a 32 bit instruction that performs an exclusive OR of the value in the accumulator and the value (Aaaa), which is either two consecutive V-memory locations or an 8 digit (max.) constant. The result resides in the accumulator. Discrete status flags indicate if the result of the XORD is zero or a negative number (the most significant bit is on).

XORD K aaa

Operand Data Type

DL06 Range aaa

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

See memory map See memory map 0–FFFFFFFF

Discrete Bit Flags

Description

SP63 SP70

ON if the result in the accumulator is zero. ON if the result 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 V2000 and V2001 will be loaded into the accumulator using the LDD instruction. The value in the accumulator is exclusively ORed with 36476A38 using the XORD instruction. The value in the accumulator is output to V2010 and V2011 using the OUTD instruction. DirectSOFT 5

Direct SOFT32 X1

V2001 5

LDD

4

7

V2000 E

2

8

7

A

V2000 Load the value in V2000 and V2001 into the accumulator

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8

7

6 5

4 3

2

1

0

Acc.

0

1

0

1

0

1

0

0

0

1

1

1

1

1

1

0

0

0

1

0

1

0

0

0

0

1

1

1

1

0

1

0

Acc.

0

1

0

1

0

1

0

0

0

1

1

1

1

1

1

0

0

0

1

0

1

0

0

0

0

1

1

1

1

0

1

0

XORD 36476A38

0

0

1

1

0

1

1

0

0

1

0

0

0

1

1

1

0

1

1

0

1

0

1

0

0

0

1

1

1

0

0

0

Acc.

0

1 0

1 0

0

0

0 1

1 0

0

0

0

1 0

1 0

1 0

0

0

1 0

0

1

0

0

0

0

1

0

0

1

0

0

0

0

1

0

2

3

9

4

2

4

2

XORD K36476A38 XORD the value in the accumulator with the constant value 36476A38 OUTD V2010 Copy the value in the accumulator to V2010 and V2011

6

V2011

Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

SHFT

X

Q

D

G

OR E

6

GX OUT

SHFT

5–78

D 3

SET

3

ENT

4 D

C 3

SHFT

D

H

G 7

6 2

A

A

0

0

SHFT

K JMP

SHFT

A

SHFT

D

A

B

A

ENT

3

C 3

A 2

0

0 1

0

ENT

0

I 3

8

ENT

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

V2010

Page 233

Chapter 5: Standard RLL Instructions - Logical

Exclusive Or Formatted (XORF) Used

HPP

Used

The XORF instruction performs an exclusive OR of the XO R F A aaa binary value in the accumulator and a specified range of K bbb discrete memory bits (1–32). The instruction requires a starting location (Aaaa) and the number of bits (Bbbb) to be exclusive ORed. Discrete status flags indicate if the result of the XORF is zero or negative (the most significant bit =1). Operand Data Type

DL06 Range aaa bbb

0-777 0-777 0-1777 0-1777 0-377 177 0-777 -

1-32

A/B Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relays . . . . . . . . . . . . . . . . . . . . . . . . . SP Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

Discrete Bit Flags SP63 SP70

Description ON if the result in the accumulator is zero. ON if the result 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 binary pattern of C10–C13 (4 bits) will be loaded into the accumulator using the LDF instruction. The value in the accumulator will be logically exclusive ORed with the bit pattern from Y20–Y23 using the XORF instruction. The value in the lower 4 bits of the accumulator are output to C20–C23 using the OUTF instruction. DirectSOFT 5 DirectSOFT32 X1

LDF

C10

Location

Constant

C13 C12 C11 C10

C10

K4

OFF ON

ON OFF

K4 Load the status of 4 consecutive bits (C10-C13) into the accumulator X0RF

The unused accumulator bits are set to zero

Y20 K4

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8

7 6 5

4 3

2

1

0

0

0

0 0

0

0

1 1

0

0

0

0 0

0

0

0

0

0 0

0 0

0

0

0

0

0

0 0

0 0

0

0

0

0

0

0

Acc.

0

0

0 0

0

0

0 0

0

0

0

0 0

0

0

0

0 0

1

1

0

1

0

0

0

0 0

0

0

0

0 0

0

0

0

0 1

1

1

0

Accumulator

Exclusive OR the binary bit pattern (Y20-Y23) with the value in the accumulator

Acc.

0

0 0

0

0

0

0

Y23 Y22 Y21 Y20 XORF (Y20-Y23) ON OFF OFF OFF

OUTF

0

C20 K4

Copy the specified number of bits from the accumulator to C20-C23

Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

SHFT

X SET

Q

SHFT

F

GX OUT

OR 5

Constant K4

C23 C22 C21 C20 ON ON ON OFF

ENT F

3

Location C20

NEXT

5 SHFT

F 5 PREV

PREV

NEXT

NEXT

NEXT

NEXT

C

A

C

A 2

2

B

A 1

0

4 E

0

E 0

E

4

4

ENT

Standard RLL

DS5

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

ENT

ENT

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

5–79

Page 234

Chapter 5: Standard RLL Instructions - Logical

Exclusive Or with Stack (XORS)

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

DS5

Used

HPP

Used

The XORS instruction is a 32 bit instruction that performs an exclusive or of the value in the accumulator with 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 from the stack and all values are moved up one level. Discrete status flags indicate if the result of the XORS is zero or a negative number (the most significant bit is on).

XO R S

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

Discrete Bit Flags

Description

SP63 SP70

ON if the result in the accumulator is zero. ON if the result in the accumulator is negative

In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the LDD instruction. The binary value in the accumulator will be exclusively ORed with 36476A38 using the XORS instruction. The value in the accumulator is output to V1500 and V1501 using the OUTD instruction. DirectSOFT 5 DirectSOFT32 V1401

LDD

X1

5

V1400

4

7

V1400 E

2

8

7

A

Load the value in V1400 and V1401 into the accumulator 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9

8 7

6 5

4 3

2

1

0

Acc.

0

1

0 1

0

1

0

0 0

1

1

1

1 1

1

0

0

0

1 0

1

0

0

0 0

1

1

1

1 0

1

0

Acc.

XORS

Exclusive OR the value in the accumulator with the value in the first level of the accumulator stack

0

1

0 1

0

1

0

0 0

1

1

1

1 1

1

0

0

0

1 0

1

0

0

0 0

1

1

1

1 0

1

0

36476A38 XOR (1st level of Stack) 0

0

1 1

0

1

1

0 0

1

0

0

0 1

1

1

0

1

1 0

1

0

1

0 0

0

1

1

1 0

0

0

0

1 0

1 0 0

0

0 1

1 0

0 0

0

1 0

1 0

1 0 0

0

1 0

0

1

0 0

0

0

1

0 0

1

0

0

0 0

1

0

2

9

2

2

Acc.

OUTD V1500 6

Copy the value in the accumulator to V1500 and V1501

3

V1501

Handheld Programmer Keystrokes $

B STR

1

SHFT

L ANDST

D

SHFT

X SET

Q

GX OUT

SHFT

D

5–80

ENT D

3 OR 3

B 3

SHFT

E 1

S RST

ENT

B

F 1

A 4

A 5

A 0

A 0

0

0

ENT

ENT

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

4

4

V1500

Page 235

Chapter 5: Standard RLL Instructions - Logical

Compare (CMP) DS5

Used

HPP

Used

The CMP instruction is a 16 bit instruction that compares the value in the lower 16 bits of the accumulator with the value in a specified V-memory location (Aaaa). The corresponding status flag will be turned on indicating the result of the comparison. The data format for this instruction is BCD/Hex, Decimal and Binary. Operand Data Type

CMP A aaa

DL06 Range aaa

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

See memory map See memory map

Discrete Bit Flags

Description

SP60 SP61 SP62

On when the value in the accumulator is less than the instruction value. On when the value in the accumulator is equal to the instruction value. On when the value in the accumulator is greater than the instruction value.

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

In the following example when X1 is on, the constant 4526 will be loaded into the lower 16 bits of the accumulator using the LD instruction. The value in the accumulator is compared with the value in V2000 using the CMP instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the CMP instruction, SP60 will turn on Direct SOFT 5 X1

CONSTANT

LD

4

K4526 Load the constant value 4526 into the lower 16 bits of the accumulator

5

? 2

6

The unused accumulator bits are set to zero Acc.

0

0

0

0

44 55 2? 2 66 ?

Compared with

CMP V2000

8

Compare the value in the accumulator with the value in V2000 SP60

9

4

5

V2000

C30

OUT Handheld Programmer Keystrokes $

B 1

STR

ENT

SHFT

L ANDST

D

SHFT

C

SHFT

M ORST

P

SHFT

SP STRN

G

SHFT

C

D

$ STR GX OUT

2

SHFT

3

2

K JMP

E

F 4

C CV A 0 A 3

A 2

6

0

C 5

G 2

A 0

6 A

0

0

ENT ENT

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

Page 236

Chapter 5: Standard RLL Instructions - Logical

Compare Double (CMPD)

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

DS5

Used

HPP

Used

The Compare Double instruction is a 32–bit instruction that CMPD compares the value in the accumulator with the value (Aaaa), A aaa which is either two consecutive V-memory locations or an 8–digit (max.) constant. The corresponding status flag will be turned on indicating the result of the comparison. The data format for this instruction is BCD/Hex, Decimal and Binary. Operand Data Type aaa See memory map See memory map 0–FFFFFFFF

Discrete Bit Flags SP60 SP61 SP62

Description On when the value in the accumulator is less than the instruction value. On when the value in the accumulator is equal to the instruction value. On when the value in the accumulator is greater than the instruction value.

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 compared with the value in V2010 and V2011 using the CMPD instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on energizing C30. Direct SOFT 5 X1

V2000

V2001

LDD

4

5

2

6

7

2

9

9

Acc. 4

5

2

6

7

2

9

9

0

2

6

V2000 Load the value in V2000 and V2001 into the accumulator

Compared with

CMPD V2010 6

Compare the value in the accumulator with the value in V2010 and V2011 SP60

7

3

9

5

V2011

V2010

C30

OUT

Handheld Programmer Keystrokes $

B 1

STR

ENT

SHFT

L ANDST

D 3

3

SHFT

C

SHFT

M ORST

P

SHFT

SP STRN

G

SHFT

C

D

$ STR GX OUT

5–82

DL06 Range

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

2

D

C

2

A 2

A 0

D CV

C

A 0 A 3

0

0 A

2

3

6

A 0

ENT ENT

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

ENT B

0

A 1

0

ENT

Page 237

Chapter 5: Standard RLL Instructions - Logical

Compare Formatted (CMPF) DS5

Used

HPP

Used

The Compare Formatted compares the value in the C MP F A aaa accumulator with a specified number of discrete locations K bbb (1–32). The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be compared. The corresponding status flag will be turned on indicating the result of the comparison. The data format for this instruction is BCD/Hex, Decimal and Binary.

1 2 3 Operand Data Type DL06 Range 4 5 6 7 8 Discrete Bit Flags Description 9 10 NOTE: Status flags are valid only until another instruction uses the same flag. In the following example, when X1 is on the Load Formatted instruction loads the binary 11 value (6) from C10–C13 into the accumulator. The CMPF instruction compares the value in the accumulator to the value in Y20–Y23 (E hex). The corresponding discrete status flag will 12 be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on 13 energizing C30. 14 A B C D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A/B Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relays . . . . . . . . . . . . . . . . . . . . . . . . . SP Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

SP60 SP61 SP62 aaa 0-777 0-777 0-1777 0-1777 0-377 0-177 0-777 - bbb 1-32

On when the value in the accumulator is less than the instruction value. On when the value in the accumulator is equal to the instruction value. On when the value in the accumulator is greater than the instruction value.

DirectSOFT 5 DirectSOFT32 X1

C10

LDF

K4

CMPF

Y20

K4

SP60

Load the value of the specified discrete locations (C10- C13) into the accumulator Compare the value in the accumulator with the value of the specified discrete location (Y20- Y23)

Constant K4

C13 C12 C11 C10

OFF ON ON OFF

The unused accumulator bits are set to zero

Acc.

C30

OUT

Location

C10

Y23 Y22 Y21 Y20

0

0

0

0

0

0

0

6

Compared with

ON ON ON OFF

E

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

5–83

Page 238

Chapter 5: Standard RLL Instructions - Logical

Compare with Stack (CMPS)

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

DS5

Used

HPP

Used

5–84

The Compare with Stack instruction is a 32-bit instruction that C MP S compares the value in the accumulator with the value in the first level of the accumulator stack. The data format for this instruction is BCD/Hex, Decimal and Binary. The corresponding status flag will be turned on indicating the result of the comparison. This does not affect the value in the accumulator. Discrete Bit Flags

Description

SP60 SP61 SP62

On when the value in the accumulator is less than the instruction value. On when the value in the accumulator is equal to the instruction value. On when the value in the accumulator is greater than the instruction value.

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 is loaded into the accumulator using the Load Double instruction. The value in V1410 and V1411 is loaded into the accumulator using the Load Double instruction. The value that was loaded into the accumulator from V1400 and V1401 is placed on top of the stack when the second Load instruction is executed. The value in the accumulator is compared with the value in the first level or the accumulator stack using the CMPS instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value in the stack, SP60 will turn on, energizing C30. DirectSOFT 5 DirectSOFT32

V1400

V1401

X1

Load the value in V1400 and V1401 into the accumulator

LDD

6

5

0

0

3

5

4

4

6

5

0

0

3

5

4

4

5

V1411 5 0 0

3

V1410 5 4 4

5

3

5

V1400 Load the value in V1410 and V1411 into the accumulator

LDD

Acc.

V1410 Compare the value in the accumulator with the value in the first level of the accumulator stack

CMPS

SP60

C30 OUT

Acc. 5

B STR

1

ENT

SHFT

L ANDST

D

SHFT

L ANDST

D 3

3

SHFT

C

SHFT

M ORST

P

$

PREV

G

A

ENT

STR GX OUT

2

D 3

B 3

E 1

B

D

6

0

NEXT

NEXT

0

4

4

Compared with Top of Stack

Handheld Programmer Keystrokes $

0

CV

NEXT

A 4

E

A 0

B

1

4

S RST

ENT

SHFT

C

A 1

D 2

0 0

A 3

0

ENT ENT

ENT

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

Page 239

Chapter 5: Standard RLL Instructions - Logical

Compare Real Number (CMPR) DS5

Used

HPP

Used

The Compare Real Number instruction compares a real number value in the accumulator with two consecutive V-memory locations containing a real number. The corresponding status flag will be turned on indicating the result of the comparison. Both numbers being compared are 32 bits long. Operand Data Type ....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Constant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . R

Discrete Bit Flags SP60 SP61 SP62 SP71

CMPR A aaa

DL06 Range aaa See memory map See memory map -3.402823E+ 038 to + -3.402823E+ 038

Description On when the value in the accumulator is less than the instruction value. On when the value in the accumulator is equal to the instruction value. On when the value in the accumulator is greater than the instruction value. On anytime the V-memory specified by a pointer (P) is not valid

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

In the following example when X1 is on, the LDR instruction loads the real number representation for 7 decimal into the accumulator. The CMPR instruction compares the accumulator contents with the real representation for decimal 6. Since 7 > 6, the corresponding discrete status flag is turned on (special relay SP62) turning on control relay C1. DirectSOFT DirectSOFT32 5 X1

LDR R7.0

CMPR R6.0

SP62

Load the real number representation for decimal 7 into the accumulator

Acc.

4

0

E

0

0

0

0

0

Compare the value with the real number representation for decimal 6

CMPR

4

0

D

0

0

0

0

0

C1 OUT

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