KEYENCE Visual KV Series User Manual

Page 372

Advertising
background image

8.2 Details

3-348

8

Chapter 8 Programming Examples

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2002

0012

LDA

DM0001

0001

LDA

DM0000

0013

CON

0002

CON

0014

SUB

DM0000

0003

SUB

DM0001

0015

CON

0004

MPS

0016

CMP

#00005

0005

ANB

2009

0017

CON

0006

CMP

#00005

0018

ANB

2009

0007

CON

0019

OUT

1001

0008

ANB

2009

0020

LD

1000

0009

OUT

1000

0021

OR

1001

0010

MPP

0022

OUT

0500

0011

AND

2009

0000

LDA

C001

STA

DM0001

#09999

C001

0001

0000

LDA

C002

STA

DM0002

#09999

C002

0002

0000

LDA

C003

STA

DM0003

#09999

C003

0003

2002

ADD

DM0002

LDA

DM0001

STA

DM0100

ADD

DM0003

2002

CMP

#0005

2009

LDA

DM0000

SUB

DM0001

1000

2009

CMP

#0005

SUB

DM0000

LDA

DM0001

2009

1001

2009

1000

0500

1001

Total count
Writes total count of counters C001 to C003 into DM0100. The total count must be
within 65535.

Ladder diagram

Coding

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LDB

0000

0013

C

003 #09999 0003

0001

C

001 #09999 0001

0014

CON

0002

CON

0015

LDA

C003

0003

LDA

C001

0016

CON

0004

CON

0017

STA

DM0003

0005

STA

DM0001

0018

LD

2002

0006

LDB

0000

0019

LDA

DM0001

0007

C

002 #09999 0002

0020

CON

0008

CON

0021

ADD

DM0002

0009

LDA

C002

0022

CON

0010

CON

0023

ADD

DM0003

0011

STA

DM0002

0024

CON

0012

LDB

0000

0025

STA

DM0100

Writes C001 current value into DM0001.

Writes C002 current value into DM0002.

Writes C003 current value into DM0003.

Writes total count (DM0001 + CM0002 + DM0003) into
DM100.

➮ Refer to p. 3-150.

Application of SUB instruction

Comparison of absolute values
Compares the DM0000 value to the DM0001 value and turns ON 0500 when the
difference of the two absolute values is greater than 5.

Ladder diagram

Coding

➮ Refer to p. 3-150.

KVNKA Chap 08.p65

08.3.11, 0:12 PM

348

Advertising