Visual kv series, 7 examples of direct clock pulse output, Chapter 4 high-speed counters – KEYENCE Visual KV Series User Manual
Page 276: Example

4.7 Examples of Direct Clock Pulse Output
3-252
Visual KV
Series
4
Chapter 4 High-speed Counters
Interrupt routine for
acceleration/deceleration
Acceleration process
Deceleration process
Interrupt for pulse stop
• Clock pulse output is stopped when
the No. of pulses equals the CTC3
preset value.
• Acceleration ratio is added to the
current frequency to change it each
time CTC2 turns ON while
acceleration flag 1200 is ON.
Acceleration stops when the
current frequency reaches fH. Sets
No. of pulses for the deceleration
point.
• Acceleration ratio is subtracted
from the current frequency to
change it each time CTC2 turns
ON while acceleration flag 1200 is
ON. Deceleration stops when the
current frequency reaches fL. The
setting is initialized.
#08000
DW
#00700
DW
$0268
LDA
#01000
LDA
#10000
MUL
DM0012
DIV
#00005
ADD
#00010
DIV
CTC0
STA
DM0010
STA
2100
STA
1200
SET
CTH1
RES
CTH0
RES
EI
2105
RES
#00400
DW
#04000
DM0000 DM0001 DM0002 DM0003
DW
2813
SET
2105
SET
2002
2008
0003
0001
2002
0000
1001
#00010
CTC1
1001
DIFU
#65535
CTC0
CTH0
2100
0003
2105
SET
#65535
CTC2
#65535
CTC3
01
CALL
02
CALL
CTH1
0500
END
RET
SBN
01
RET
SBN
03
RET
DM0003
LDA
CTC3
STA
#00002
DIV
DM0004
STA
DM0001
LDA
DM0012
STA
#00000
DM0011
DW
2002
DM0012
LDA
#00100
DIV
DM0011
ADD
DM0004
CMP
2002
#00010
LDA
#10000
MUL
DM0010
DIV
#00005
ADD
#00010
DIV
DM0011
ADD
CTC2
STA
DM0011
STA
SBN
02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0502
DM0012
LDA
DM0002
ADD
DM0011
STA
2105
SET
CTC2
STA
DM0011
SUB
DM0003
LDA
DM0012
STA
DM0000
CMP
1200
2011
2011
1200
RES
#65535
LDA
CTC2
STA
1201
INT
CTC2
RETI
INT
CTC3
RETI
ENDH
03
CALL
DM0012
LDA
DM0002
SUB
DM0012
STA
DM0001
CMP
1200
2002
2011
02
CALL
2011
02
CALL
2011
2011
02
CALL
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
1201
Specifies high-speed
counters and comparators
Starts positioning
Emergency stop
Calculation routine for
CTC0, CTC2, and DM0011
Initialization routine
Triangle drive check routine
• CTC0 generates a clock pulse.
• CTH1 counts the number of
clock pulses.
CTC0:Pulse period
CTC1: Pulse width
CTC2:Frequency change point
CTC3:Total No. of pulses for positioning
• Sets parameters (DM0000 to
DM0003).
• Sets reverse output.
• Sets emergency stop.
• Specifies the CTC2 preset
value.
DM0010: Pulse period T (µs)
DM0011: No. of accumulated pulses
DM0012: Current frequency (Hz)
1200: Acceleration flag
• Specifies the CTC0 preset value.
CTC0 preset value =
1 ÷ DM0012 x 10
3
x 10
3
■ Example
KVNKA Chap 04_2.p65
08.3.11, 0:08 PM
252