16-BIT TIMER 6
S3CC40D/FC40D_UM_REV1.20
FUNCTION DESCRIPTION
Timer 6 Interrupts (IRR20, IRR21)
The Timer 6 module can generate two interrupts: the Timer 6 overflow interrupt (T6OVF), and the Timer 6 match/
capture interrupt (T6INT). T6OVF is interrupt level IRR21. T6INT belongs to interrupt level IRR20.
Interval Timer Function
The Timer 6 module can generate an interrupt: the Timer 6 match interrupt (T6INT).
In interval timer mode, a match signal is generated and T6OUT is toggled when the counter value is identical to
the value written to the T6 reference data register, T6DATAH/L. The match signal generates a Timer 6 match
interrupt (T6INT) and clears the counter.
If, for example, you write the value 1087H to T6DATAH/L and 03H to T6CON, the counter will increment until it
reaches 1087H. At this point, the T6 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
T6PWM pin. As in interval timer mode, a match signal is generated when the counter value is identical to the
value written to the Timer 6 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 T6PWM 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 T6CAP pin opens a gate and loads the current counter
value into the T6 data register. You can select the rising or falling edges to trigger this operation.
Timer 6 also gives you capture input source: the signal edge at the T6CAP pin. You select the capture input by
setting the value of the Timer 6 capture input selection bit in the port 3 control register low, P3CONL.7-.6
(3F003DH). When P3CONL.7-.6 is “00”, the T6CAP input is selected.
Both kinds of Timer 6 interrupts can be used in capture mode: the Timer 6 overflow interrupt is generated
whenever a counter overflow occurs; the Timer 6 match/capture interrupt is generated whenever the counter
value is loaded into the T6 data register.
By reading the captured data value in T6DATAH/L, and assuming a specific value for the Timer 6 clock
frequency, you can calculate the pulse width (duration) of the signal that is being input at the T6CAP pin.
18-2