
BAT32G1x9 user manual | Chapter 10 Timer M
402 / 1149
Rev.1.02
10.7.3
Counting sources
•To switch the counting source, you must switch after stopping counting.
[Change Step].
(1) Place the TSTARTi bits (i=0, 1) of the TMSTR register to "0" (stop count).
(2) Change the TCK0~TCK2 bit of the TMCRi register.
• To select f
HOCO
(64MHz or 48MHz) as the counting source for timer M, register 1 (PER1) must be allowed
on the Peripheral Set f
CLK
to f
IH
before bit4 (TMMEN) is set. If you want to change the f
CLK
to a clock
other than f
IH
, you must allow bit4 of register 1 (PER1) in the Peripheral to be cleared (TMMEN) after
making changes.
10.7.4
Enter the capture function
•
The pulse width of the input capture signal must be at least 3 timer M operating clock cycles.
• After the input capture signal is input from the TMIOji pin (j=A, B, C, D), you need to wait 2~ The
operating clock (f
CLK
) cycle of the 3 timers M is then passed to the TMGRji register (in the absence
of a digital filter).
•
In input capture mode, if the TMTSTARTi bit of the TMSTR register is "0" (stop count), the TMIOji pin
is input to TMIORki The IOj0 bit of the register and the edge of the IOj1 bit selection generate an
input capture interrupt request (i=0, 1) at the valid edge of the TMIOji input
,
j=A, B, C, D
,
k=A, C)
。
10.7.5
Configuration steps (i=0, 1) for TMIOAi, TMIOBi, TMIOCi, TMIODi pins
After reset, the multiplexed I/O ports of the TMIOAi, TMIOBi, TMIOCi, TMIODi pins are used as input
ports.
•
To output from the TMIOAi, TMIOBi, TMIOCi, TMIODi pins, you must follow the steps below to set
them.
[Change Step].
(2)
Set the mode and initial values.
(3)
Place the TMUAi, TMIOBi, TMIOCi, TMIODi pins as allowed outputs (TMOER1 registers).
(4)
Place the port registers at "0" corresponding to the TMIOAi, TMIOBi, TMIOCi, and TMIODi pins.
(5)
Set the bit of the port mode register corresponding to the TMIOAi, TMIOBi, TMIOCi, TMIODi pins to
output mode (from TMIOAi, ., TMIODi, TMIODi TMIOBi, TMIOCi, TMIODi pins start output).
(6)
Start counting (place TSTART0 bits and TSTART1 at position "1").
•
To change the bits of the port mode registers corresponding to the TMUAi, TMIOBi, TMIOCi, and TMIODi
pins from output mode to input mode, you must follow the steps below to set them.
[Change Step].
(1) Set the bit of the port mode register corresponding to the TMIOAi, TMIOBi, TMIOCi, TMIODi pins to
input mode (from TMIOAi, TMIOBi, TMIOCi, TMIODi pin start input).
(2) Set to input capture function.
(3) Start counting (place TSTART0 bits and TSTART1 at position "1").
•
When switching the TMIOAi, TMIOBi, TMIOCi, TMIODi pins from output mode to input mode, input capture
operation may be performed depending on the state of the pins. Edge detection after at least 2 CPU clock
cycles when no digital filter is used; When using digital filters, up to 5 sampling clock cycles of digital filters
are required for edge detection.