EasyManua.ls Logo

Cmsemicon CMS32L051 - 5.8 Independent channel operation function of the universal timer unit

Default Icon
703 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
V1.2.2
CMS32L051 User Manual |Chapter 5 Universal Timer Unit (Timer4)
www.mcu.com.cn 163 / 703
5.8 Independent channel operation function of the universal timer unit
5.8.1 Operates as an interval timer / square wave output
(1) Interval timer
It can be used as a reference timer to generate INTTMmn (timer interrupt) at regular intervals. The interrupt
generation period can be calculated using the following formula:
(2) Operates as square wave output
TOmn produces INTTMmn while alternating the output, with an output duty cycle of 50% square wave.
The period and frequency of the TOmn output square wave can be calculated using the following formula:
In interval timer mode, the timer count register mn (TCRmn) is used as a decreasing counter.
After setting the channel start trigger bit (TSmn, TSHm1, TSHm3) of the timer channel start register m
(TSm) to 1, pass through the first A count clock loads the value of the timer data register mn (TDRmn) into
the TCRmn register. At this point, if the MDmn0 bit of timer mode register n (TMRmn) is 0, INTTMmn is not
output and TOmn also does not alternate outputs. If the MDmn0 bit of the TMRmn register is 1, INTTMmn is
output and TOmn is output alternately. The TCRmn register then decrements the count by counting the clock.
If the TCRmn becomes 0000H, INTTMmn is output alternately by the next count clock and TOmn is
output. At the same time, the value of the TDRmn register is loaded into the TCRmn register again. After that,
continue with the same run.
TDRmn registers can be overridden at any time, and the values of the overridden TDRmn registers are
valid from the next cycle.
INTTMmn (timer interrupt) generation period = Counting clock period
x
(Setting value of TDRmn+1
)
Square wave
period of TOm
n output
= Counting clock period
(
Setting value of TDRmn +1)
2
Square wave frequency of TOm
n
output = Counting
clock frequency / {(Setting value of TDRmn
+1)
2}

Table of Contents

Related product manuals