beautypg.com

KEYENCE Visual KV Series User Manual

Page 196

background image

2.4 Instruction Details

3-172

2

Chapter 2 Instructions

Example

Coding

Description

Operation using the @INC instruction

Every time input relay 0000 turns ON, "1" is added to the contents of the data
memory specified by the operand. The result is then input back to the same data
memory. (In the above example, "1" is added to the contents of DM0000. DM0000 +
1

➞ DM0000) When the data memory specified by the operand is "#65535", the

result of the addition is "#00000" so that special utility relay 2009 turns ON.

Operation using the @DEC instruction

Every time input relay 0000 turns ON, "1" is subtracted from the contents of the data
memory specified by the operand. The result is then input back to the same data
memory. (In the above example, "1" is subtracted from the contents of DM0001.
DM0001 - 1

➞ DM0001) When the data memory specified by the operand is

"#00001", the result of the subtraction is "#00000" so that special utility relay 2010
turns ON.
When the specified data memory is "00000", the result of the subtraction is "#65535
($FFFF)" so that special utility relay 2009 turns ON.

Operands

INC: Increment Memory

@INC: Increment Memory

DEC: Decrement Memory

@DEC: Decrement Memory

Adds 1 to contents of data memory
specified by operand.

Subtracts 1 from contents of data
memory specified by operand.

@

#,$

FUN

FUN

@

#,$

FUN

FUN

L D

7

SET

1

SET

1

RES

0

L D

7

RES

0

O R

9

O R

9

nnnn

INC

nnnn

INC

nnnn

DEC

nnnn

DEC

0000

DM0000

INC

DM0001

DEC

Line No.

Instruction

Operand

0000

LD

0000

0001

@INC

DM0000

0002

@DEC

DM0001

Contents of data memory specified by operand

Contents of data memory specified by operand

1 is subtracted.

Contents of data memory specified by operand

Contents of data memory specified by operand

1 is added.

0 0

1 0

@

0 0

0 1

+

0 0

1 1

0 0

1 1

@

0 0

0 1

0 0

1 0

:

:

:

:

INC instruction

DEC instruction

INC / @INC / DEC / @DEC

Visual KV

KV-300

KV-10/16

KV-24/40/80

DM0000 to DM1999 DM0000 to DM9999 DM0000 to DM0999 DM0000 to DM1999

TM00 to TM29

TM00 to TM29

TM00 to TM29

TM00 to TM29

KVNKA Chap 02_4dP.p65

08.3.11, 0:03 PM

172