
General-Purpose Timer Registers
élanSC520 Microcontroller Register Set Manual
14-11
Programming Notes
3
PSC_SEL
GP Timer 1 Prescaler
This bit selects the GP Timer 1 clock source when the TMRIN1 input pin is not
configured as the timer clock source (i.e., when the EXT_CLK bit is 0).
0 =The GP Timer 1 clock source is the internal clock (33.000 MHz or 33.333 MHz,
depending on the crystal frequency).
1 =The GP Timer 1 is pre-scaled by GP Timer 2 (i.e., the internal GP Timer 2 output is
used as the input clock source for GP Timer 1).
This bit is ignored when external clocking is enabled (i.e., the EXT_CLK bit is 1).
2
EXT_CLK
GP Timer 1 External Clock
This bit selects the external GP Timer 1 clock source.
0 =An internal GP Timer 1 clock source is used as configured via the PSC_SEL bit.
When the timer clock is not being sourced from GP Timer 2, the timer advances
every 4th CPU clock period.
1 =An external GP Timer 1 clock source is used (i.e., the TMRIN1 pin). GP Timer 1
advances upon every positive edge driven on the TMRIN1 input pin. In this mode,
the maximum timer input clock frequency is 1/4th of the CPU clock speed.
1
ALT_CMP
GP Timer 1 Alternate Compare
This bit selects whether the GP Timer 1 count is compared to a single maximum count
register value, or alternately to both maximum count register values.
0 =Single compare mode: the timer counts to the GPTMR1MAXCMPA register value
(see page 14-13) and then resets the GPTMR1CNT register value to 0
(page 14-12). In this mode, the GPTMR1MAXCMPB register is not used.
In single compare mode, the TMROUT1 pin is high while the counter is counting and
being compared to the GPTMR1MAXCMPA register. The TMROUT1 pin is pulsed
Low for a single CPU clock cycle after the maximum value is reached.
1 = Alternate compare (square wave) mode: if the timer is enabled, the timer counts to
the GPTMR1MAXCMPA register value and then resets the GPTMR1CNT register to
0. Then the timer counts to the GPTMR1MAXCMPB register value (page 14-14) and
then resets the GPTMR1CNT register value to 0.
In alternate compare mode, the TMROUT1 pin is high while the counter is counting
and being compared to the GPTMR1MAXCMPA register. The TMROUT1 pin is Low
while the counter is counting and being compared to the GPTMR1MAXCMPB
register.
If the CONT_CMP bit is set, alternate compare mode generates a square wave
signal on the TMROUT1 pin with a frequency and duty cycle determined by the two
maximum count register values.
Note:
If external clocking is used and the clock is stopped during a count sequence, the
timer output remains n ts previous state (i.e., the state t was n prior to the clock stopping).
The remaining timer status also remains the same and normal operation commences
upon the external clock being driven again.
See the Continuous mode bit description below for a more detailed description of how
the comparison registers are used in continuous and noncontinuous modes.
0
CONT_CMP
GP Timer 1 Continuous Mode
This bit is used to configure GP Timer 1 for continuous or noncontinuous mode.
0 =Noncontinuous mode: the GPTMR1CNT register (see page 14-12) is cleared and
the timer halts whenever the count reaches the maximum count value. The ENB bit
is also cleared by hardware after every counter sequence.
1 =Continuous mode: The timer count is reset to 0 after it reaches the maximum count
value (A or B), and the timer immediately begins counting again.
If the CONT_CMP bit is cleared and the ALT_CMP bit is set, GP Timer 1 counts to the
GPTMR1MAXCMPA register value (see page 14-13) and then resets the count value.
After the timer count has been reset, the timer continues operation by counting to the
GPTMR1MAXCMPB register value (page 14-14). When the timer count reaches the
GPTMR1MAXCMPB register value, the timer clears its count value, clears the ENB bit
and then halts.
Bit
Name
Function