Visual kv series – KEYENCE Visual KV Series User Manual
Page 273

4.7 Examples of Direct Clock Pulse Output
3-249
Visual KV
Series
1
4
Chapter 4 High-speed Counters
2109
SET
2110
RES
2111
RES
CTH0
RES
2105
RES
2105
SET
2203
SET
2813
SET
CTH1
RES
2002
#00050
CTC0
1000
DIFU
#00020
CTC1
CTH0
2101
0002
2104
RES
2105
SET
2106
SET
2107
RES
2108
RES
2103
SET
EI
2008
1000
0001
0003
0005
2002
0012
2002
#10000
CTC2
CTH1
0500
0008
END
0010
RETI
0013
ENDH
0014
INT
CTC2
0011
0000
0004
0006
0009
0007
#00000
DW
DM1940
4.7.3
Example of Stopping the Pulse Output at a Specified
Pulse Count
This section describes a programming example that will output a clock pulse of 500
µs (2 kHz)-period and 200 µs-width from output relay 0500 and then stop it after
10000 pulses are output.
■ Special utility relay, internal clock, and CTC settings
Set the special utility relay according to the following table.
Specify the internal clock and CTC0/CTC1 preset values according to the following
table.
■ Example
•
Sets the pulse output from output relay 0500 with special utility relays 2104 through 2107
and 2108 through 2111.
In this example, turns OFF 2104 to enable direct output from 0500. Turns ON 2106 to turn
ON the output from 0500 when the CTH0 value reaches the CTC0 value and turns ON
2109 to turn OFF the output when the CTH0 value reaches the CTC1 value.
•
Turns ON 2103 to set CTH0 to be cleared when its value reaches the CTC0 value. This
ensures that the first clock pulse is output at the proper pulse width.
•
Uses an EI instruction to enable interrupts.
The interrupt program (INT CTC2) stops the clock pulse when the CTH1 current value
reaches the CTC2 preset value (when 10000 pulses are output).
•
Turns ON 2203 to set CTH1 to be cleared when its value reaches the CTC2 value. This
forces the operation to repeat by the specified pulses (10000).
•
Relay 2813 must be turned ON when counting pulses with CTH1.
.
o
N
y
a
l
e
R
g
n
i
t
t
e
S
.
o
N
y
a
l
e
R
g
n
i
t
t
e
S
3
0
1
2
N
O
8
0
1
2
F
F
O
4
0
1
2
F
F
O
9
0
1
2
N
O
5
0
1
2
F
F
O
0
1
1
2
F
F
O
6
0
1
2
N
O
1
1
1
2
F
F
O
7
0
1
2
F
F
O
2
1
1
2
F
F
O
y
a
l
e
r
y
t
i
l
i
t
u
l
a
i
c
e
p
S
k
c
o
l
c
l
a
n
r
e
t
n
I
e
u
l
a
v
t
e
s
e
r
p
0
C
T
C
e
u
l
a
v
t
e
s
e
r
p
1
C
T
C
0
0
1
2
0
.
1
µs
0
0
5
0
0
2
1
0
1
2
0
.
0
1
µs
0
5
0
2
2
0
1
2
0
.
0
0
1
µs
5
2
KVNKA Chap 04_2.p65
08.3.11, 0:08 PM
249