Application of lda and sta instructions – KEYENCE Visual KV Series User Manual

Page 165

Advertising
background image

2.4 Instruction Details

1

2

3-141

Chapter 2 Instructions

Arithmetic flag

2009

No change

2010

Turns ON when the contents of the internal register is "0" after
"LDA #00000" is executed. Turns OFF at other times.

2011

No change

2012

Turns ON when the DM or relay indirectly addressed with #TM is
out of range.

➮ "Indirect addressing" (p. 3-127)

Application of LDA and STA instructions

Changing the counter setting value

Coding

Description

In step

a

), contents of DM00100 is transferred to C001 via the internal register for

use as the C001 preset value, when 0000 is ON.

In step

b)

, contents of #00200 is transferred to C001 via the internal register for

use as the C001 preset value, when 0002 is OFF.

Although the C001 preset value is #09999 in the above example, any value
except #00000 can be given because the preset value is changed to the speci-
fied value by turning ON/OFF 0000.

Note 1: If an STA instruction is executed when the current value is larger than the
preset value, the current value will be changed to the preset value.
Note 2: Do not specify "#00000" as the setting value for C001.

When 0000 is ON, #00100 is transferred as C001
preset value.

When 0000 is OFF, #00200 is transferred as C001
preset value.

When C001 current value equals to its preset value,
0500 turns ON.

0000

C001

0500

b)

#00100

LDA

C001

STA

0000

0002

#00200

LDA

C001

STA

#09999

C001
0001

a)

Line No.

Instruction

Operand

0000

LD

0000

0001

LDA

#00100

0002

CON

0003

STA

C001

0004

LDB

0000

0005

LDA

#00200

0006

CON

0007

STA

C001

0008

LD

0002

0009

C

001 #09999 0001

0010

CON

0011

AND

C001

0012

OUT

0500

LDA / @LDA / STA @STA

KVNKA Chap 02_4cP.p65

08.3.11, 0:02 PM

141

Advertising