Functional Description Of One 16-Bit Timer Mode (Timer 0) - Samsung S3F84B8 User Manual

8-bit cmos
Hide thumbs Also See for S3F84B8:
Table of Contents

Advertisement

S3F84B8_UM_REV 1.00

12.1.2 FUNCTIONAL DESCRIPTION OF ONE 16-BIT TIMER MODE (TIMER 0)

12.1.2.1 Interval Timer Function
Timer 0 module can generate Timer 0 match interrupt (TCINT). The TCINT pending bit will be set whenever the
match condition is met, in spite of global interrupt and peripheral interrupt enable status. If this interrupt has been
serviced, the TCINT pending condition should be cleared by the software.
In interval timer mode, a match signal is generated when the counter value is identical to the values written to
Timer 0 reference data registers, TCDATA and TDDATA. The match signal generates a Timer 0 match interrupt
and clears the counter. For example, if you write the values 32H to TCDATA, 10H to TDDATA, and B8H to
TCCON, the counter will increment until it reaches 3210H. At this point, the Timer 0 interrupt request is
generated. The counter value is reset and counting is resumed.
12.1.2.2 Timer 0 Control Register (TCCON)
You can use the Timer 0 control register, TCCON, for the following purposes:
Enable the Timer 0 operation (interval timer).
Clear the Timer 0 counter.
Enable the Timer 0 interrupt.
Clear the Timer 0 interrupt pending conditions.
You can use the Timer0 prescaler register, TCPS, for the following purposes:
Select the clock source. Comparator 0's output can be configured as the clock source of Timer0.
Program the clock prescaler.
TCCON is located at address E5H, Set1 Bank1, and is read/write addressable using register addressing mode.
A reset clears TCCON to "00H". This sets the Timer 0 to work in 16-bit Timer mode and disables the Timer 0
interrupt. You can clear the Timer 0 counter at any time during normal operation by writing a "1" to TCCON.5.
To enable the Timer 0 interrupt, you must write '1' to TCCON.3. To generate the exact time interval, you should
write TCCON.5 and TCCON.1. This clears the counter and interrupt pending bit.
When Timer 0 is disabled, the interrupt pending bit can still be set when it meets the interrupt condition.
Application program can poll for the pending bit, TCCON.1. When a "1" is detected, Timer 0 interrupt is pending.
The pending condition must be cleared by the software by writing a "0" to Timer 0 interrupt pending bit, TCCON.1.
12-2
12 TIMER 0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents