KEYENCE Visual KV Series User Manual
Page 375

8.2 Details
3-351
1
8
Chapter 8 Programming Examples
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 7500 to 7507.
However, retain ON/OFF of 7508 to 7515 which are loaded.
Ladder diagram
Coding
■ Separate input of 2-digit BCD
Fetches only 2 digits of the BCD digital switch (7000 to 7003 for the 1st digit, 8000 to
8003 for the 2nd digit) and sets it as the counter value.
Ladder diagram
Coding
➮ Refer to p. 3-161.
#00099
0001
C000
0000
2002
2002
STA
DM0000
ANDA
$FF00
2002
ANDA
$00FF
TBCD
STA
ORA
DM0000
7500
LDA
7500
LDA
C000
Sets C000.
Writes data of 7008 to 7015 into DM0000.
ORs the data in the internal register and the
DM0000 data and sends the ORed data to 7500
to 7515.
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
000 #00099 0001
0010
CON
0002
LD
2002
0011
TBCD
0003
LDA
7500
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
7500
#00099
0001
C001
0000
2002
2002
STA
DM0000
ANDA
$000F
2002
ANDA
$000F
LDA
7000
LDA
8000
SLA
#04
ORA
DM0000
STA
C001
TBIN
Line No.
Instruction
Operand
Line No.
Instruction
Operand
0000
LDB
0000
0010
CON
0001
C
001 #00099 0001
0011
ANDA
$000F
0002
LD
2002
0012
LD
2002
0003
LDA
7000
0013
SLA
#04
0004
CON
0014
CON
0005
ANDA
$000F
0015
ORA
DM0000
0006
CON
0016
CON
0007
STA
DM0000
0017
TBIN
0008
LD
2002
0018
CON
0009
LDA
8000
0019
STA
C001
KVNKA Chap 08.p65
08.3.11, 0:12 PM
351