beautypg.com

Application of sub instruction – KEYENCE Visual KV Series User Manual

Page 178

background image

2.4 Instruction Details

3-154

2

Chapter 2 Instructions

Application of SUB instruction

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

Coding

2002

2009

2009

DM0000

LDA

DM0001

SUB

#0005

CMP

1001

1000

2009

DM0001

LDA

DM0000

SUB

1000

2009

#00005

CMP

1001

0500

Line No.

Instruction

Operand

0000

LD

2002

0001

LDA

DM0000

0002

CON

0003

SUB

DM0001

0004

MPS

0005

ANB

2009

0006

CMP

#00005

0007

CON

0008

ANB

2009

0009

OUT

1000

0010

MPP

0011

AND

2009

0012

LDA

DM0001

0013

CON

0014

SUB

DM0000

0015

CON

0016

CMP

#00005

0017

CON

0018

ANB

2009

0019

OUT

1001

0020

LD

1000

0021

OR

1001

0022

OUT

0500

SUB / @SUB

KVNKA Chap 02_4cP.p65

08.3.11, 0:02 PM

154