![](http://datasheet.mmic.net.cn/130000/ML66Q517-NGA_datasheet_5009273/ML66Q517-NGA_203.png)
ML66517 Family User’s Manual
Chapter 9
Capture/Compare Timer
9 – 16
9.8.2 Compare Out Module Settings
(1) External interrupt control register 1 (EXI1CON)
If the capture/compare timer is to be used, write 55H to EXI1CON.
(2) Compare register (CMPR)
If the compare out module is to be used, set a count value in CMPR that will be compared to the free
running counter. A compare match signal will be output when this count value matches the value of the free
running counter.
(3) 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.
(4) 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.
9.8.3 Capture/Compare Out Module Settings
Capture mode 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 CPCMF0 is to be set to the capture mode, reset bit 2 (P17IO2) to “0” to configure the port as an input. If
CPCMF1 is to be set to the capture mode, reset bit 3 (P17IO3) to “0” to configure the port as an input.
(3) Port 17 secondary function control register (P17SF)
Specify with bit 2 (P17SF2) whether the CPCMF0 capture input is pulled-up. Specify with bit 3 (P17SF3)
whether the CPCMF1 capture input is pulled-up.
(4) Capture/compare control register (CPCMCON)
Specify the valid edge for CPCMF0 with bits 0 and 1 (CP0E0 and CP0E1). Specify the valid edge for
CPCMF1 with bits 2 and 3 (CP1E0 and CP1E1). If CPCMF0 is to be set to the capture mode, set bit 4
(CP0MD) to “1”. If CPCMF1 is to be set to the capture mode, set bit 5 (CP1MD) to “1”.
(5) Capture/compare interrupt control register (CPCMINT)
If CPCMF0 capture events are to generate interrupts, set bit 2 (CPCMIE0) to “1” to enable CPCMF0
interrupts. If CPCMF1 capture events are to generate interrupts, set bit 3 (CPCMIE1) to “1” to enable
CPCMF1 interrupts. The generation of a CPCMF0 or CPCMF1 capture event will set the respective bit 0
(INTCPCM0) or bit 1 (INTCPCM1) to “1”, and since these bits are not reset by the hardware, they must be
reset to “0” by the program.
(6) 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.
(7) 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.