BAT32G1x9 user manual | Chapter 6 Universal timer unit Timer4/8
189 / 1149
Rev.1.02
6.8 Stand-alone channel operation of the universal timer unit
6.8.1
Operation as an interval timer/square wave output
(1) Interval timer
It can be used as a reference timer for generating INTMmn (timer interrupts) at regular intervals. The
interrupt generation period can be calculated using the following calculation:
(2) Operation as a square wave output
TOmn alternates outputs while generating INTMmn, outputting a square wave with a duty cycle of 50%.
The period and frequency of the TOmn output square wave can be calculated using the following equation:
In interval timer mode, the timer count register mn (TCRmn) is used as a decrement counter.
After setting the channel start trigger bit (TSmn, TSHm1, TSHm3) of the timer channel start register m (TSm),
pass the first A counting clock loads the value of the timer data register mn (TDRmn) into the TCRmn register. At
this point, if the MDmn0 bit of the timer mode register n(TMRmn) is "0", intTMmn is not output and TOmn also does
not have alternating outputs. If the MDmn0 bit of the TMRmn register is "1", intTMmn is output and TOmn is
alternately output. The TCRmn register then decrements the count through the counting clock.
If TCRmn becomes "0000H", intTMmn is output via the next counting clock and TOmn is alternately output. At
the same time, load the value of the TDRmn register into the TCRmn register again. After that, the same run
continues.
The TDRmn register can be rewritten at any time, and the value of the rewritten TDRmn register is valid from
the next cycle.
The production cycle of INTTMmn (Hours interrupt) = counting clock circumference Period x (setpoint
+1 for T DRmn).
• Square wave
period
of
TTon output =
counting clock cycle
(
×
setpoint
+1
for
TDRmn)
× 2
• Square wave frequency of TTon output = count clock rate /{(TDRmn.) Set the value +1)
×
2}