BS2824 Holtek Semiconductor Inc., BS2824 Datasheet - Page 53

no-image

BS2824

Manufacturer Part Number
BS2824
Description
Touch Key Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
Rev. 1.00
Timer Control Registers - TMR0C, TMR1C
TMR0C Register
The flexible features of the Holtek microcontroller Timer/Event Counters enable them to operate in three
different modes, the options of which are determined by the contents of their respective control register.
The Timer Control Register is known as TMRnC. It is the Timer Control Register together with its
corresponding timer register that control the full operation of the Timer/Event Counter. Before the
timer can be used, it is essential that the Timer Control Register is fully programmed with the right data
to ensure its correct operation, a process that is normally carried out during program initialisation.
To choose which of the three modes the timer is to operate in, either in the timer mode, the event
counting mode or the pulse width capture mode, bits 7 and 6 of the Timer Control Register, which
are known as the bit pair TnM1/TnM0, must be set to the required logic levels. The timer-on bit,
which is bit 4 of the Timer Control Register and known as TnON, provides the basic on/off control of
the respective timer. Setting the bit high allows the counter to run, clearing the bit stops the counter.
Bits 0~2 of the Timer Control Register determine the division ratio of the input clock prescaler. The
prescaler bit settings have no effect if an external clock source is used. If the timer is in the event
count or pulse width capture mode, the active transition edge level type is selected by the logic level
of bit 3 of the Timer Control Register which is known as TnEG. The TnS bit selects the internal
clock source if used.
Bit 7,6
Bit 5
Bit 4
Bit 3
Bit 2~0
Name
POR
R/W
Bit
T0M1, T0M0: Timer0 operation mode selection
T0S: timer clock source
T0S selects the clock source for f
Time-Base and the PWM. If the PWM is enabled, then f
the T0S selection.
T0ON: Timer/event counter counting enable
T0EG:
Event counter active edge selection
Pulse Width Capture active edge selection
T0PSC2, T0PSC1, T0PSC0: Timer prescaler rate selection
Timer internal clock=
000: f
001: f
010: f
011: f
100: f
101: f
110: f
111: f
T0M1
00: no mode available
01: event counter mode
10: timer mode
11: pulse width capture mode
0: f
1: LXT oscillator
0: disable
1: enable
0: count on raising edge
1: count on falling edge
0: start counting on falling edge, stop on rasing edge
1: start counting on raising edge, stop on falling edge
R/W
7
0
SYS
TP
TP
TP
TP
TP
TP
TP
TP
/128
/8
/64
/2
/4
/16
/32
T0M0
R/W
6
0
R/W
T0S
5
0
53
BS2824/BS2854/BS2868
TP
T0ON
R/W
which is provided for Timer 0, Timer 2, the
4
0
T0EG
R/W
3
1
Touch Key MCU
T0PSC2
SYS
R/W
2
0
will be selected, overriding
T0PSC1
R/W
1
0
January 27, 2010
T0PSC0
R/W
0
0

Related parts for BS2824