Applications of tbcd instruction, Description – KEYENCE Visual KV Series User Manual

Page 205

Advertising
background image

2.4 Instruction Details

1

2

3-181

Chapter 2 Instructions

Description

Operation using the TBCD instruction

When input relay 0000 turns ON, the contents of DM0000 are transferred to the
internal register. The contents of the internal register (16-bit binary data) are con-
verted into 4-digit BCD data, which is input back to the internal register, and then
transferred to DM0001.

Operation using the TBIN instruction

When input relay 0001 turns ON, the contents of DM0010 are transferred to the
internal register. The contents of the internal register (4-digit BCD data) are con-
verted into 16-bit binary data, which is input back to the internal register, and then
transferred to DM0011.

Note 1: The TBCD instruction can only convert data up to "#09999". When the
conversion of data of "#10000" or greater is attempted, special utility relay 2012
turns ON and the conversion is disabled.

Note 2: When the data in the internal register is not BCD data, special utility relay
2012 turns ON and the TBIN instruction is disabled.

Applications of TBCD instruction

Output of 4-digit BCD data
Outputs the current value of counter C001 to 0700 to 0715 in 4-digit BCD data.

Coding

Data is converted into BCD of "0" through "9999".

Data is converted into binary number of "0" through "9999".

10

3

(0)

10

2

(0)

10

1

(2)

10

0

(4)

0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0

2

16

2

0

0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0

8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1

(5)

10

3

(5)

10

2

(5)

10

1

(5)

10

0

0 0 0 1 0 1 0 1 1 0 1 1 0 0 1 1

0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1

8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1

D

15

D

14

D

13

D

12

D

11

D

10

D

9

D

8

D

7

D

6

D

5

D

4

D

3

D

2

D

1

D

0

0001

2002

C001

LDA

0700

STA

TBCD

#09999

C001
0000

Converts current value of C001 into BCD data,
and outputs it to 0700 to 0715.

Sets C001.

Line No.

Instruction

Operand

0000

LDB

0001

0001

C

001 #00009 0000

0002

LD

2002

0003

LDA

C001

0004

CON

0005

TBCD

0006

CON

0007

STA

0700

TBCD / @TBCD / TBIN / @TBIN

KVNKA Chap 02_4dP.p65

08.3.11, 0:04 PM

181

Advertising