
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)
0000000000011000
2
16
2
0
0000000000100100
8421842184218421
(5)
10
3
(5)
10
2
(5)
10
1
(5)
10
0
0001010110110011
0101000101010101
8421842184218421
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
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 PM181
Komentarze do niniejszej Instrukcji