KEYENCE Visual KV Series User Manual

Page 374

Advertising
background image

8.2 Details

3-350

8

Chapter 8 Programming Examples

➮ Refer to p. 3-159.

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2002

0011

ANDA

$FF00

0001

LDA

7000

0012

CON

0002

CON

0013

SRA

#08

0003

ANDA

$00FF

0014

CON

0004

CON

0015

TBIN

0005

TBIN

0016

CON

0006

CON

0017

STA

T001

0007

STA

C000

0018

LDB

0001

0008

LD

2002

0019

C

000 #09999 0000

0009

LDA

7000

0020

LDB

0001

0010

CON

0021

T

001 #09999

Application of ANDA instruction

BCD (1-digit) input
Sets a 1-digit BCD value, which is input to 0000 to 0003, in C000.

Ladder diagram

Coding

Fetches input data separately
Sets the low-order 2 digits of the BCD digital switch (7000 to 7007) to counter C000
and the high-order 2 digits to timer T001.

Ladder diagram

Coding

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2002

0005

TBIN

0001

LDA

0000

0006

CON

0002

CON

0007

STA

C000

0003

ANDA

$000F

0008

LDB

7000

0004

LD

2002

0009

C

000 #09999 7001

2002

ANDA

$000F

LDA

0000

2002

STA

C000

TBIN

#09999

C000

7000

7001

Fetches data of 0000 to 0015 and retains data of 0000
to 0003 only.

Converts data to BIN and writes it into C000.

Sets C000.

2002

2002

LDA

#09999

C000

0001

0000

7000

ANDA

$FF00

TBIN

#08

SRA

STA

T001

LDA

7000

ANDA

$00FF

STA

C000

TBIN

#09999

T001

0001

Converts data of 7000 to 7007 to BIN and
writes it into C000.

Shifts data to right by 8 bits, converts it to
BIN, and writes it into T001.

Sets C000.

Sets T001.

KVNKA Chap 08.p65

08.3.11, 0:12 PM

350

Advertising