BAT32G1x9 user manual | Chapter 6 Universal timer unit Timer4/8
195 / 1149
Rev.1.02
Figure 6-47 The operation steps when the external event counter function is performed
software operation
Hardware Status
Timer4 Initial
Settings
The input clock of the timer unit m is in a state
where supply is stopped.
(stop providing clock, cannot write registers)
Place the TM4 mEN location "1" of the peripheral enable
register 0 (PER0).
The input clock of the timer unit m is in a
supplied state, and each channel is in an
operation stop state.
(Start providing clock capable of writing
registers)
A clock selection register m (TPSm) that sets the timer.
Determine the clock frequency for CKm0 to CKm3.
channel
initial setting
Allow the noise filter to correspond to register 1
(NFEN12) either "OFF" or "1" (ON).
A timer mode register mn (TMRmn) is set.
A timer data register mn (TDRmn) is set with a count
value.
Output timer to allow TOEmn location "0" for register m
(TOEm).
The channel is in an operational stop state.
(Provide clocks, consume a portion of the
Power)
Start Run
Position TSmn "1".
The TSmn bit is a trigger bit and is automatically returned
to "0".
The TEmn bit becomes "1" and starts
counting.
The value of the TDRmn register is loaded into
the timer count register mn (TCRmn) and
enters the detection waiting state of the TImn
pin input edge.
Running
You can change the settings of the TDRmn register at
will.
Can read TCRmn register at any time.
The TSRmn register is not used.
Prevents the setting of TMRmn registers, TOMmn bits,
TOLmn bits, TOmn bits, and TOEmn bits from being
changed.
The counter (TCRmn) counts down each time
an input edge of the TImn pin is detected, and
if the count reaches '0 000H', loads the value
of the TDRmn register again into the TCRmn
register and continues counting.
A INTTMmn
is generated when TCRmn is detected as
'0000H'.
This run is repeated thereafter.
Stop
Running
Position TTmn "1".
The TTmn bit is a trigger bit and is automatically returned
to "0".
The TEmn bit changes to "0" and stops
counting.
The TCRmn register maintains count values
and stops counting.
Timer4 Stop
Position the TM4 mEN of the PER0 register "0".
The input clock of the timer unit m is in a
stopped supply state.
Initialize the SFRs of all circuits and channels.
Res
ta
rt
O
p
e
ra
ti
o
n