beautypg.com

4 instruction details, Lda / @lda / sta @sta – KEYENCE Visual KV Series User Manual

Page 169

background image

2.4 Instruction Details

1

2

3-145

Chapter 2 Instructions

Note 3: When an STA instruction is executed while the setting value of a counter or
a timer is smaller than the current value, the current value is changed to be the
setting value.

First-in first-out (FIFO)
The data once fetched is written into DM0004,
DM0003, …, to DM0000 in this order. At the
unloading timing, data is fetched from
DM0004 and the contents of DM are shifted
to the next DM.

The OK/NG judgment and unloading timings can be used in asynchronous pro-
grams.

Coding

DM0000

DM0001

DM0002

DM0003

DM0004

Unloading
timing

OK/NG
judgment

Data
shift

0000

1000

0001

DM0004

LDA

$1111

LDA

DM0000

STA

$0000

CMP

DM0003

LDA

DM0004

STA

$0000

LDA

DM0003

STA

1000

0001

$5555

LDA

DM0000

STA

DIFU

2002

2010

DM0003

LDA

$0000

CMP

DM0002

LDA

DM0003

STA

$0000

LDA

DM0002

STA

2002

2010

DM0002

LDA

$0000

CMP

DM0001

LDA

DM0002

STA

$0000

LDA

DM0001

STA

2002

2010

DM0001

LDA

$0000

CMP

DM0000

LDA

DM0001

STA

$0000

LDA

DM0000

STA

2002

$0000

DM0004

STA

0002

2010

LDA

Contents of DM is compared with "$0000".
When two values match, contents of one
previous DM is transferred, then "$0000" is
transferred to DM.

"$0000" is transferred to DM
at unloading timing.

OK/NG judgment
timing

OK/NG judgment

"$1111" is transferred to

DM0000.

"$5555" is transferred to DM0000.

Unloading
timing

Line No.

Instruction

Operand

0000

LD

0000

0001

DIFU

1000

0002

CON

0003

AND

1000

0004

MPS

0005

AND

0001

0006

LDA

$1111

0007

CON

0008

STA

DM0000

0009

MPP

0010

ANB

0001

0011

LDA

$5555

0012

CON

0013

STA

DM0000

0014

LD

2002

0015

LDA

DM0004

0016

CON

0017

CMP

$0000

0018

CON

0019

AND

2010

0020

LDA

DM0003

0021

CON

0022

STA

DM0004

0023

CON

0024

LDA

$0000

0025

CON

0026

STA

DM0003

0027

LD

0002

0028

LDA

DM0003

0029

CON

0030

CMP

$0000

0031

CON

0032

AND

2010

0033

LDA

DM0002

0034

CON

Line No.

Instruction

Operand

0035

STA

DM0003

0036

CON

0037

LDA

$0000

0038

CON

0039

STA

DM0002

0040

LD

2002

0041

LDA

DM0002

0042

CON

0043

CMP

$0000

0044

CON

0045

AND

2010

0046

LDA

DM0001

0047

CON

0048

STA

DM0002

0049

CON

0050

LDA

$0000

0051

CON

0052

STA

DM0001

0053

LD

2002

0054

LDA

DM0001

0055

CON

0056

CMP

$0000

0057

CON

0058

AND

2010

0059

LDA

DM0000

0060

CON

0061

STA

DM0001

0062

CON

0063

LDA

$0000

0064

CON

0065

STA

DM0000

0066

LD

0002

0067

@LDA

$0000

0068

CON

0069

@STA

DM0004

LDA / @LDA / STA @STA

KVNKA Chap 02_4cP.p65

08.3.11, 0:02 PM

145