KEYENCE Visual KV Series User Manual
Page 373

8.2 Details
3-349
1
8
Chapter 8 Programming Examples
2002
LDA
TM00
STA
DM0100
MUL
DM0000
LDA
C001
0001
#09999
C001
0000
STA
DM0101
#09999
00001
C001
0000
STA
DM0001
LDA
C001
2002
DM0001 DM0002 DM0003
÷3 → Output to 07500
to 07515 in 4-digit BCD.
2002
#09999
C002
0000
STA
DM0002
LDA
C002
#09999
C003
0000
STA
DM0003
LDA
C003
ADD
LDA
DM0001
ADD
DM0003
TBCD
DIV
#00003
STA
07500
00002
00003
DM0002
Writes the C001 current
value into DM0001.
Writes the C002 current
value into DM0002.
Writes the C003 current
value into DM0003.
Application of MUL instruction
■ Multiplying the counter current value by DM value
Multiplies the counter current value by the DM0000 value and writes the high-order
16 bits of the product into DM0101 and low-order 16 bits of the product into
DM0100.
Ladder diagram
Coding
➮ Refer to p. 3-150.
Application of DIV instruction
■ Total count average
Outputs the average of 3 counter values in 4-digit BCD.
(C001 + C002 + C003) ÷ 3
→ BCD output value
The BCD value is output to 7500 to 7515.
Ladder diagram
Coding
Line No. Instruction
Operand
0000
LDB
0001
0001
C
001 #09999 0000
0002
LD
2002
0003
LDA
C001
0005
MUL
DM0000
0004
CON
0006
CON
0007
STA
DM0100
0008
CON
0009
LDA
TM00
0010
CON
0011
STA
DM0101
Line No.
Instruction
Operand
Line No.
Instruction
Operand
0000
LDB
0000
0015
LDA
C003
0001
C
001 #09999 0001
0016
CON
0002
CON
0017
STA
DM0003
0003
LDA
C001
0018
LD
2002
0004
CON
0019
LDA
DM0001
0005
STA
DM0001
0020
CON
0006
LDB
0000
0021
ADD
DM0002
0007
C
002 #09999 0002
0022
CON
0008
CON
0023
ADD
DM0003
0009
LDA
C002
0024
LD
2002
0010
CON
0025
DIV
#00003
0011
STA
DM0002
0026
CON
0012
LDB
0000
0027
TBCD
0013
C
003 #09999 0003
0028
CON
0014
CON
0029
STA
7500
➮ Refer to p. 3-150.
KVNKA Chap 08.p65
08.3.11, 0:12 PM
349