
BASIC TIMER and TIMER 0
S3C821A/P821A
10-4
T0CON is located in set 1, at address D2H, and is read/write addressable using Register addressing mode.
A reset clears T0CON to "00H". This sets timer 0 to normal interval timer mode, selects an input clock frequency
of fx/4096, and disables all timer 0 interrupts. You can clear the timer 0 counter at any time during the normal
operation by writing a "1" to T0CON.3.
The timer 0 overflow interrupt (T0OVF) has interrupt level IRQ0 and the vector address FAH. When a timer 0
overflow interrupt occurs and is serviced by the CPU, the pending condition is cleared automatically by hardware.
To enable the timer 0 match/capture interrupt (IRQ0, vector FCH), you must write T0CON.1 to "1". To detect a
match/capture interrupt pending condition, the application program polls T0CON.0. When a "1" is detected, a
timer 0 match or capture interrupt is pending. After the interrupt request is serviced, the pending condition must
be cleared by software by writing a "0" to the timer 0 interrupt pending bit, T0CON.0.
MSB
LSB
.7
.6
.5
.4
.3
.2
.1
.0
TIMER 0 CONTROL REGISTER (T0CON)
D2H, Set 1, R/W
Timer 0 match/capture
interrupt pending bit:
0 = No interrupt pending
0 = Clear pending bit (write)
1 = Interrupt is pending
Timer 0 match/capture interrupt
enable bit:
0 = Disable interrupt
1 = Enable interrupt
Timer 0 overflow interrupt enable bit:
0 = Disable overflow interrupt
1 = Enable overflow interrupt
Timer 0 counter clear bit:
0 = No effect
1 = Clear the timer 0 counter (when write)
Timer 0 input clock selection bits:
00 = fxx/4096
01 = fxx/256
10 = fxx/8
11 = External clock (P2.4/T0CK)
Timer 0 operating mode selection bits:
00 = Interval mode
01 = Capture mode (capture on rising edge,
counter running, OVF can occur)
10 = Capture mode (capture on falling
edge, counter running, OVF can occur)
11 = PWM mode (OVF interrupt can occur)
Figure 10-2. Timer 0 Control Register (T0CON)