ML66517 Family User’s Manual
Chapter 9
Capture/Compare Timer
9 – 15
9.8
Example of Capture/Compare Timer Register Settings
9.8.1 Digital Filter Equipped Capture Module Settings
(1) External interrupt control register 1 (EXI1CON)
If the capture/compare timer is to be used, write 55H to EXI1CON.
(2) Port 17 mode register (P17IO)
If CAPF0 is to be used, reset bit 0 (P17IO0) to “0” to configure the port as an input. If CAPF1 is to be used,
reset bit 1 (P17IO1) to “0” to configure the port as an input.
(3) Port 17 secondary function control register (P17SF)
If CAPF0 is to be used, specify with bit 0 (P17SF0) whether or not CAPF0 is pulled-up. If CAPF1 is to be
used, specify with bit 1 (P17SF1) whether or not CAPF1 is pulled-up.
(4) Capture control register 0 (CAPCON0)
Specify the valid edge for CAPF0 with bits 4 and 5 (CAP0E0 and CAP0E1). If the digital filter is to be
used, specify the sampling clock for the digital filter with bits 0, 1 and 2 (DF0CK0, DF0CK1 and
DF0CK2), and set bit 3 (DF0RUN) to “1”. To stop the digital filter, reset bit 3 (DF0RUN) to “0”.
(5) Capture control register 1 (CAPCON1)
Specify the valid edge for CAPF1 with bits 4 and 5 (CAP1E0 and CAP1E1). If the digital filter is to be
used, specify the sampling clock for the digital filter with bits 0, 1 and 2 (DF1CK0, DF1CK1 and
DF1CK2), and set bit 3 (DF1RUN) to “1”. To stop the digital filter, reset bit 3 (DF1RUN) to “0”.
(6) Capture interrupt control register (CAPINT)
If CAPF0 capture events are to generate interrupts, set bit 2 (CAPIE0) to “1” to enable CAPF0 interrupts. If
CAPF1 capture events are to generate interrupts, set bit 3 (CAPIE1) to “1” to enable CAPF1 interrupts. The
generation of a CAPF0 or CAPF1 interrupt will set the respective bit 0 (INTCAP0) or bit 1 (INTCAP1) to
“1”, and since these bits are not reset by the hardware, they must be reset to “0” by the program.
(7) Free running counter (FRC)
The initial value at the start of counting can be set by writing an arbitrary 16-bit value. During counting,
reading from and writing to the FRC is possible.
(8) Free running counter control register (FRCON)
Bits 0, 1, and 2 (FRCK0, FRCK1, and FRCK2) specify the count clock for the free running counter. If bit 3
(FRRUN) is set to “1”, the free running counter will begin counting. If reset to “0”, the free running counter
will stop counting.