EasyManua.ls Logo

Cmsemicon CMS32L051 - Operation as Delay Counter

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 180 / 703
FFFFH
0000H
a
b
a+1
b+1
5.8.6 Operation as delay counter
The decreasing count can be started by a valid edge detection (external event) at the TImn pin input and
the INTTMmn is generated at any set interval (Timer interrupt).
During the period when the TEmn bit is 1, it is possible to set the TSmn bit to 1 by software to
start decreasing the count and generate INTTMmn (timer interrupt) at any set interval.
The interrupt generation period can be calculated using the following equation:
In single-count mode, the timer count register mn (TCRmn) is used as a decrement counter.
If the channel start trigger bits (TSmn, TSHm1, TSHm3) of the Timer Channel Start Register m (TSm) are set
to 1, the TEmn bit, TEHm1 bit and TEHm3 bit becomes 1 and enters the valid edge detection wait state of
the TImn pin. The valid edge detection by the TImn pin input starts the operation of the TCRmn register and
loads the value of the Timer Data Register mn (TDRmn). The TCRmn register starts counting decreasingly
from the value of the loaded TDRmn register by counting the clock. If TCRmn changes to 0000H, INTTMmn
is output and counting stops before a valid edge is detected for the next TImn pin input.
TDRmn registers can be overridden at any time, and the values of the overridden TDRmn registers are
valid from the next cycle.
Figure 5-58 Example of basic timing of operation as a delay counter
TSmn
TEmn
TImn
TCRmn
TDRmn
INTTMmn
Note 1. m: unit number (m= 0,1) n: channel number (n=0 ~ 3).
2. TSmn: Bit n of the timer channel start register m (TSm).
TEmn : Bit n of timer channel enable status register m (TEm).
TImn : TImn pin input signal
TCRmn: Timer counter register mn (TCRmn).
TDRmn: Timer data register mn (TDRmn).
INTTMmn (timer interrupt) generation period = period of counting clock
(setting value of TDRmn + 1)

Table of Contents

Related product manuals