
8-BIT TIMER 1
S3CC40D/FC40D_UM_REV1.20
FUNCTION DESCRIPTION
Timer 1 Interrupts (IRR34, IRR35)
The Timer 1 module can generate two interrupts: the Timer 1 overflow interrupt (T1OVF), and the Timer 1 match/
capture interrupt (T1INT). T1OVF is interrupt level IRR35. T1INT belongs to interrupt level IRR34.
Interval Timer Function
The Timer 1 module can generate an interrupt: the Timer 1 match interrupt (T1INT).
In interval timer mode, a match signal is generated and T1OUT is toggled when the counter value is identical to
the value written to the T1 reference data register, T1DATA. The match signal generates a Timer 1 match
interrupt (T1INT) and clears the counter.
If, for example, you write the value 10H to T1DATA and 03H to T1CON, the counter will increment until it reaches
10H. At this point, the T1 interrupt request is generated, the counter value is reset, and counting resumes.
Pulse Width Modulation Mode
Pulse width modulation (PWM) mode lets you program the width (duration) of the pulse that is output at the
T1PWM pin. As in interval timer mode, a match signal is generated when the counter value is identical to the
value written to the Timer 1 data register. In PWM mode, however, the match signal does not clear the counter
but can generate a match interrupt. The counter runs continuously, overflowing at FFH, and then repeats the
incrementing from 00H. Whenever an overflow occurs, an overflow (OVF) interrupt can be generated.
Although you can use the match or the overflow interrupt in PWM mode, interrupts are not typically used in PWM-
type applications. Instead, the pulse at the T1PWM pin is held to High level as long as the reference data value is
less than or equal to (
≤ ) the counter value, and then the pulse is held to Low level for as long as the data value
is greater than ( > ) the counter value. One pulse width is equal to tCLK × 256.
Capture Mode
In capture mode, a signal edge that is detected at the T1CAP pin opens a gate and loads the current counter
value into the T1 data register. You can select the rising or falling edges to trigger this operation.
Timer 1 also gives you capture input source: the signal edge at the T1CAP pin. You select the capture input by
setting the value of the Timer 1 capture input selection bit in the port 1 control register high, P1CONH.1-.0
(3F0034H). When P1CONH.1-.0 is “00”, the T1CAP input is selected.
Both kinds of Timer 1 interrupts can be used in capture mode: the Timer 1 overflow interrupt is generated
whenever a counter overflow occurs; the Timer 1 match/capture interrupt is generated whenever the counter
value is loaded into the T1 data register.
By reading the captured data value in T1DATA and assuming a specific value for the Timer 1 clock frequency,
you can calculate the pulse width (duration) of the signal that is being input at the T1CAP pin.
13-2