Chapter 9
16-bit Timer
Count
clock
Capture input
edge
Edge detection
flag
Binary counter
Compare/capture
register
Interrupt
request flag
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.
Input pin
(TM8AIO)
(1) Stop the counter
TM8MD(0x0000A200)
bp6: TMLDE=0
bp7: TMCNE=0
(2) Disable the interrupt
G7ICR(0x0000891C)
bp8: G7IE1=0
(3) Select the count clock source
TM8MD(0x0000A200)
bp2-0: TMCK2-0=000
(4) Select the timer up/down
TM8MD(0x0000A200)
bp9-8: TMUD1-0=00
IX - 64
Input Capture
006
007
008
009
Figure:9.9.1 Count TIming of Input Capture
Interrupt
Palse width to be measured
Figure:9.9.2 Input Capture Setup Example One
Setup Procedure
010
000
001
002
010
Interrupt
(1) Set the TMLDE flag and the TMCNE flag of the timer 8
mode register (TM8MD) to stop counting of the timer 8.
(2) Set the G7IE1 flag of the G7ICR register to "0" to disable
the interrupt.
(3) Select the count clock source (IOCLK) by the TMCK2-0
flag of the TM8MD register.
(4) Select the timer up counting by the TMUD1-0 flag of the
TM8MD register.
003
004
000
001
004
Description
002