KEYENCE Visual KV Series User Manual
Page 186

2.4 Instruction Details
3-162
2
Chapter 2 Instructions
0000
TBCD
C000
LDA
0500
STA
DM0000
ORA
$00FF
ANDA
$FF00
ANDA
0500
LDA
DM0000
STA
2002
2002
2002
#00099
C000
0001
Sets C000.
Writes data of 0008 to 0015 into DM0000.
ORs the data in the internal register and the DM0000
data and sends the ORed data to 0500 to 0515.
2002
0100
LDA
$000F
ANDA
DM0000
STA
0200
LDA
$000F
ANDA
#04
SLA
DM0000
ORA
C004
STA
#00300
C004
0005
TBIN
0004
Converts the current value of C000 to BCD and retains
the low-order 2 digits of BCD in the internal register.
Line No.
Instruction
Operand
Line No.
Instruction
Operand
0000
LDB
0000
0009
LDA
C000
0001
C
001 #00099 0001
0010
CON
0002
LD
2002
0011
TBCD
0003
LDA
0500
0012
CON
0004
CON
0013
ANDA
$00FF
0005
ANDA
$FF00
0014
LD
2002
0006
CON
0015
ORA
DM0000
0007
STA
DM0000
0016
CON
0008
LD
2002
0017
STA
0500
ORA / @ORA
Arithmetic flag
2009
No change
2010
Turns ON when the internal register is "0" after an ORA operation. Turns
OFF at other times.
2011
No change
2012
The DM or relay indirectly addressed with #TM is out of range.
➮ "Indirect addressing" (p. 3-127)
Tips
Solution when connecting two-digit data of a BCD digital switch (inputs 0100
to 0103 for the first digit and 0200 to 0203 for the second digit) separately
Fetches the two-digit data of the BCD digital switch, which are separated into the
first digit (0100 to 0103) and the second digit (0200 to 0203), and transfers the
values as the setting value of a counter (C004).
Application of ORA instruction
■ Output of BCD 2-digit data
Converts the current value of counter C000 to BCD and sends 2 digits of BCD data
to output relays 0500 to 0507.
However, retain ON/OFF of 0508 to 0515 which are loaded.
Coding
KVNKA Chap 02_4cP.p65
08.3.11, 0:02 PM
162