EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Timer0 Mode 0 (16-Bit Auto-Reloadable Mode)

Default Icon
901 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...
STC8A8K64D4 Series Manual
- 282 -
When the 8-bit counter TL1 overflows, the system loads the reload value in TH1
into TL1 automatically.
1
1
T1 stops working.
T0_M1/T0_M0: T0 mode select bits.
T0_M1
T0_M0
T0 operating mode
0
0
16-bit auto-reload mode.
When the 16-bit counter [TH0, TL0] overflows, the system loads the reload value in
the internal 16-bit reload register into [TH0, TL0] automatically.
0
1
16-bit non-auto-reload mode.
When the 16-bit counter [TH1, TL1] overflows, timer 1 will count from 0.
1
0
8-bit auto-reload mode.
When the 8-bit counter TL0 overflows, the system loads the reload value in TH0
into TL0 automatically.
1
1
16-bit auto-reload mode. It is similar to mode 0, whose interrupt can not be disabled.
The interrupt has the highest priority, higher than the priority of all other interrupts,
and cannot be turned off. It can be used as the system tick timer of the operating
system or the system monitoring timer. The only way to stop is to turn off the TR0
bit in the TCON register and stop supplying the clock to Timer 0.
13.2.3 Timer0 mode 0 (16-bit auto-reloadable mode)
In this mode, Timer/Counter 0 is used as a 16-bit counter that can be automatically reloaded, as shown in the figure
below.
÷12
÷1
AUXR.7/T0x12=0
AUXR.7/T0x12=1
SYSclk
T0 Pin
C/T=0
C/T=1
TR0
GATE
INT0
TF0
TL0
(8bits)
RL_TH0
(8bits)
RL_TL0
(8bits)
T0CLKO
Interrupt
P3.5
Toggle
T0CLKO
TH0
(8bits)
control
Timer/Counter0 mode 0: 16-bit auto-reload mode
When GATE=0 (TMOD.3), the timer will count if TR0=1. When GATE=1, it is allowed to control timer0 by
external input INT0, so that pulse width measurement can be realized. TR0 is the control bit in the TCON register. For
the specific function description of each bit of the TCON register, see the introduction of the TCON register in the
previous section.
When C/T=0, the multiplexer is connected to the frequency division output of the system clock. T0 counts the
internal system clock, and works in timing mode. When C/T=1, the multiplexer is connected to the external pulse input
P3.4/T0, and T0 works in counting mode.
Timer0 of STC microcontroller has two counting rates: one is 12T mode, which is increased by 1 for every 12
clocks, which is the same as traditional 8051 microcontroller, the other is 1T mode, which is increased by 1 for each
clock, and the speed is 12 times of traditional 8051. The rate of T0 is determined by T0x12 in the special function
register AUXR. If T0x12=0, T0 works in 12T mode, and if T0x12=1, T0 works in 1T mode.
Timer0 has two hidden registers RL_TH0 and RL_TL0. RL_TH0 and TH0 share the same address, and RL_TL0
and TL0 share the same address. When TR0=0, that is, when Timer/Counter0 is disabled, the content written to TL0

Table of Contents

Related product manuals