EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Timer 0 Mode 2 (8-Bit Auto-Reloadable Mode); Timer 0 Mode; Used as Real-Time Operating System Metronome)

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
- 284 -
13.2.5 Timer 0 mode 2 (8-bit auto-reloadable mode)
In this mode, Timer/Counter 0 is an 8-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)
TH0
(8bits)
T0CLKO
Interrupt
P3.5
Toggle
T0CLKO
control
Timer/counter 0 mode 2: 8-bit auto-reloadable mode
The overflow of TL0 not only sets TF0, but also reloads the content of TH0 into TL0. The content of TH0 is preset
by software, and its content remains unchanged during reloading.
When T0CLKO/INT_CLKO.0=1, the P3.5/T1 pin is configured as timer 0's clock output T0CLKO. The output
clock frequency is T0 overflow rate/2.
If C/T=0, the timer/counter 0 counts the internal system clock, then:
if T0 works in 1T mode (AUXR.7/T0x12=1), the output clock frequency = (SYSclk)/(256-TH0)/2
if T0 works in 12T mode (AUXR.7/T0x12=0), the output clock frequency = (SYSclk)/12/(256-TH0)/2
If C/T=1, the timer/counter T0 counts the external pulse input (P3.4/T0), then:
Output clock frequency = (T0_Pin_CLK) / (256-TH0)/2
13.2.6 Timer 0 mode 3 (16-bit auto-realoadable mode with non-maskable
interrupt, which can be used as real-time operating system metronome)
For timer/counter 0, its working mode 3 is the same as working mode 0 (the schematic diagram of timer mode 3
in the figure below is the same as working mode 0). The only difference is: when timer/counter 0 is working in mode
3, its interrupt can be enabled just setting ET0/IE.1 (timer/counter 0 interrupt enable bit), and EA/IE.7 (total interrupt
enable bit) is not required. The timer/counter 0 interrupt in this mode has nothing to do with the total interrupt enable
bit EA. Once the timer/counter 0 interrupt working in mode 3 is enabled (ET0=1), then the interrupt is non-maskable,
and the priority of the interrupt is the highest, that is, the interrupt cannot be interrupted by any interrupt, and the
interrupt is neither controlled by EA/IE.7 nor controlled by ET0 after it is enabled, When EA=0 or ET0=0, this interrupt
cannot be disabled. This mode is so called the 16-bit automatic reload mode with non-maskable interrupt.

Table of Contents

Related product manuals