Application of tbin instruction – KEYENCE Visual KV Series User Manual

Page 206

Advertising
background image

2.4 Instruction Details

3-182

2

Chapter 2 Instructions

0400

LDA

C001

STA

2002

0001

TBIN

#09999

C001
0000

Line No.

Instruction

Operand

0000

LD

2002

0001

LDA

0400

0002

CON

0003

TBIN

0004

CON

0005

STA

C001

0006

LDB

0001

0007

C

001 #09999 0000

Converts data of 0400 to 0415 to BIN data and writes
into C001.

Sets C001

Output of 8-digit BCD data
Outputs the calculated product of DM0000 x DM0001 (0 to 99999999) in BCD of 8
digits at maximum as below:

High-order 4-digit BCD data

➞ To 0600 to 0615

Low-order 4-digit BCD data

➞ To 0500 to 0515

Coding

Application of TBIN instruction

Input of 4-digit BCD data
Sets 4 digits of the BCD digital switch (0400 to 0415) as the counter C001 value.

Coding

DM0000

LDA

DM0001

MUL

DM0101

STA

#10000

DIV

TM01

LDA

TBCD

0500

STA

2002

DM0101

LDA

TBCD

0600

STA

TM00

DM0000 x DM0001 =

TM00

0600 to 0615

0500 to 0515

... TM01

÷ #10000

=

Display

Internal register

High-order 4 digits Low-order 4 digits

High-order 4 digits

Internal register

Internal register

TM00

Low-order 4 digits

Remainder

High-order 4 digits

Low-order 4 digits

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2002

0010

CON

0001

LDA

DM0000

0011

TBCD

0002

CON

0012

CON

0003

MUL

DM0001

0013

STA

0500

0004

CON

0014

CON

0005

DIV

#10000

0015

LDA

DM0101

0006

CON

0016

CON

0007

STA

DM0101

0017

TBCD

0008

CON

0018

CON

0009

LDA

TM01

0019

STA

0600

TBCD / @TBCD / TBIN / @TBIN

KVNKA Chap 02_4dP.p65

08.3.11, 0:04 PM

182

Advertising