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

4.7 Examples of Direct Clock Pulse Output
3-247
Visual KV
Series
1
4
Chapter 4 High-speed Counters
2203
SET
2204
RES
2206
SET
2207
RES
2208
RES
2209
SET
2210
RES
2211
RES
CTH1
RES
2008
2002
#00050
CTC2
#00020
CTC3
CTH1
2201
0001
0002
0003
0004
0005
CTC2
CTC3
ON
ON
ON
ON
To output a clock pulse of 500 µs (2 kHz)-period and 200 µs-width from output relay 0501
This section describes a programming example that will output a clock pulse with
variable ON/OFF ratio from output relay 0501 by using the high-speed counter
(CTH1) and high-speed counter comparator (CTC2 and CTC3).
■ Special utility relay setting
Set the special utility relay (2203 through 2212) according to the following table.
■ Internal clock and CTC2/CTC3 preset values
Specify the internal clock and calculate the preset values of CTC2 and CTC3 for the
clock.
CTC2 preset value = Pulse width (µs) ÷ Internal clock (µs)
CTC3 preset value = Pulse period (µs) ÷ Internal clock (µs)
Obtain the preset values of CTC2 and CTC3 by substituting 200 µs for the pulse
width, 500 µs for the pulse period, and 10 µs for the internal clock (special utility
relay 2201).
In this case, the preset value of CTC3 is "20", and that of CTC2 is "50".
Refer to the following table for the CTC preset values with other internal clocks.
■ Example
Count value
•
Sets the pulse output from output relay 0501 with special utility relays 2204 through 2207
and 2208 through 2211.
In this example, turns OFF 2204 to enable direct output from 0501. Turns ON 2206 to turn
ON the output from 0501 when the CTH1 value reaches the CTC2 value and turns ON
2209 to turn OFF the output when the CTH1 value reaches the CTC3 value.
•
Turns ON 2203 to set CTH1 to be cleared when its value reaches the CTC2 value. This
ensures that the first clock pulse is output at the proper pulse width.
•
Turn ON the input enable relay for CTH1 all the time when CTH1 is used to output the
clock pulse.
.
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
2
2
N
O
8
0
2
2
N
O
4
0
2
2
F
F
O
9
0
2
2
F
F
O
5
0
2
2
F
F
O
0
1
2
2
F
F
O
6
0
2
2
N
O
1
1
2
2
F
F
O
7
0
2
2
F
F
O
2
1
2
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
2
C
T
C
e
u
l
a
v
t
e
s
e
r
p
3
C
T
C
0
0
2
2
0
.
1
µs
0
0
5
0
0
2
1
0
2
2
0
.
0
1
µs
0
5
0
2
2
0
2
2
0
.
0
0
1
µs
5
2
KVNKA Chap 04_2.p65
08.3.11, 0:08 PM
247