16-BIT TIMER 9
S3CC40D/FC40D_UM_REV1.20
FUNCTION DESCRIPTION
Timer 9 Interrupts (IRR40, IRR41)
The Timer 9 module can generate two interrupts: the Timer 9 overflow interrupt (T9OVF), and the Timer 9 match/
capture interrupt (T9INT). T9OVF is interrupt level IRR41. T9INT belongs to interrupt level IRR40.
Interval Timer Function
The Timer 9 module can generate an interrupt: the Timer 9 match interrupt (T9INT).
In interval timer mode, a match signal is generated and T9OUT is toggled when the counter value is identical to
the value written to the T9 reference data register, T9DATAH/T9DATAL. The match signal generates a Timer 9
match interrupt (T9INT) and clears the counter.
If, for example, you write the value 1087H to T9DATAH/T9DATAL and 03H to T9CON, the counter will increment
until it reaches 1087H. At this point, the T9 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
T9PWM pin. As in interval timer mode, a match signal is generated when the counter value is identical to the
value written to the Timer 9 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 FFFFH, and then repeats the
incrementing from 0000H. 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 T9PWM 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 × 65536.
Capture Mode
In capture mode, a signal edge that is detected at the T9CAP pin opens a gate and loads the current counter
value into the T9 data register. You can select the rising or falling edges to trigger this operation.
Timer 9 also gives you capture input source: the signal edge at the T9CAP pin. You select the capture input by
setting the value of the Timer 9 capture input selection bit in the port 9 control register low, P9CONH.5-.4
(3F0054H). When P9CONH.5-.4 is “00”, the T9CAP input is selected.
Both kinds of Timer 9 interrupts can be used in capture mode: the Timer 9 overflow interrupt is generated
whenever a counter overflow occurs; the Timer 9 match/capture interrupt is generated whenever the counter
value is loaded into the T9 data register.
By reading the captured data value in T9DATAH/T9DATAL, and assuming a specific value for the Timer 9 clock
frequency, you can calculate the pulse width (duration) of the signal that is being input at the T9CAP pin.
21-2