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

4.4 Expanded Functions of High-speed Counters
3-227
Visual KV
Series
1
4
Chapter 4 High-speed Counters
0
99999
0013
2008
0004
0006
CTH0
RES
0008
EI
2406
SET
2114
RES
2113
SET
2002
0002
#00001
LDA
DM1919
STA
#34464
LDA
DM1918
STA
CTC1
STA
HSP
0004
0003
0012
END
0007
INT
CTC1
0011
RETI
0010
ENDH
#00010
T000
2)
1)
3)
0500
RES
6)
HSP
0006
2002
CTH0
0004
0005
0500
T000
4)
0500
SET
2002
0009
7)
#65535
CTC1
5)
8)
2112
SET
0001
MEMSW
$0800
Writes preset
value of high-
speed counter
comparator.
Sets high-speed
counter in double (x2)
multiplication mode.
Sets ring
counter.
Automatic reset of
high-speed counter
High-order 16
bits of high-
speed counter
comparator
Low-order 16
bits of high-
speed counter
comparator
When using a 24-bit high-speed counter
The following is a ladder program that uses the ring counter of a 24-bit high-speed
counter with the preset value of "100000".
1) Sets CTH0 as a 24-bit high-speed counter using the MEMSW instruction (Turn
on 3 of SW3.).
2) When the power is turned on, an EI instruction enables interrupts. Sets high-
speed counter CTH0 in double (x2) multiplication mode, CTH0 as a ring counter,
and high-speed counter automatic reset function at counting up. Resets the high-
speed counter.
3) Writes the preset value "100000" of high-speed counter comparator (CTC1) for
the 24-bit high-speed counter (CTH0). Sets the preset value with the STA CTC0
instruction.
4) Sets the input time constant for input relays 0004 and 0006 to 10 µs.
5) Counts 2-phase pulses of input relays 0004 and 0006 at CTH0.
6) Describes a dummy high-speed counter comparator.
7) Output relay 0500 turns ON for 1 second and then turns OFF.
8) When CTC1 turns ON, an interrupt is executed. Output relay 0500 turns ON.
KVNKA Chap 04_1.p65
08.3.11, 0:06 PM
227