Chapter 9
16-bit Timer
IX - 64 Input Capture
Figure:9.9.1 Count TIming of Input Capture
9.9.2 Setup Example
■ Input Capture Setup Example
The value of the binary counter is read at the rising edge of the external input signal (TM8AIO), and the pulse
width can be measured. The oscillation frequency is 10 MHz, 6 multiplication and IOCLK=MCLK/2. A setup
procedure with a description of each step is shown below.
Figure:9.9.2 Input Capture Setup Example One
Setup Procedure Description
(1) Stop the counter
TM8MD(0x0000A200)
bp6: TMLDE=0
bp7: TMCNE=0
(1) Set the TMLDE flag and the TMCNE flag of the timer 8
mode register (TM8MD) to stop counting of the timer 8.
(2) Disable the interrupt
G7ICR(0x0000891C)
bp8: G7IE1=0
(2) Set the G7IE1 flag of the G7ICR register to “0” to disable
the interrupt.
(3) Select the count clock source
TM8MD(0x0000A200)
bp2-0: TMCK2-0=000
(3) Select the count clock source (IOCLK) by the TMCK2-0
flag of the TM8MD register.
(4) Select the timer up/down
TM8MD(0x0000A200)
bp9-8: TMUD1-0=00
(4) Select the timer up counting by the TMUD1-0 flag of the
TM8MD register.
Capture input
edge
Interrupt
request flag
Count
clock
Binary counter
Edge detection
flag
Compare/capture
register
006 007 008 009 010 000 001 002
010 004
003 004 000 001 002
Input pin
(TM8AIO)
Interrupt Interrupt
Palse width to be measured