General-Purpose Timers
17-6
Élan™SC520 Microcontroller User’s Manual
17.5.5.2
External Clock
Separate external clock input pins, TMRIN0 and TMRIN1, are provided to each of the
following two timers: GP Timer 0 and GP Timer 1, respectively. Table 17-4 specifies the
external clock source frequency range for the TMRIN0 and TMRIN1 inputs for the general-
purpose timers. The maximum frequency of the external clock is one-fourth the frequency
of the crystal used.
17.5.6
Interrupts
Each GP timer provides its own interrupt on the programmable interrupt controller (PIC).
See Chapter 15, “Programmable Interrupt Controller”, for more information on interrupt
steering.
The GP Timer x Mode/Control (GPTMRxCTL) registers for the general-purpose timers are
used to enable the timer interrupt request generation. An interrupt request is generated
when a maximum count is reached.
In the case where both Maximum Count Compare A and B registers are used, an interrupt
request is generated when the GP Timer x Count (GPTMRxCNT) register is equal to either
the value of the GP Timer x Maxcount Compare A (GPTMRxMAXCMPA) register or the
value of the GP Timer x Maxcount Compare B (GPTMRxMAXCMPB) register.
The GP Timers Status (GPTMRSTA) register (MMCR offset C70h) contains the interrupt
status information for the three general-purpose timers. A timer’s corresponding interrupt
status bit is set when that timer’s interrupt request signal is asserted and remains set until
cleared.
17.5.7
Software Considerations
17.5.7.1
Combining GP Timer Count Elements
Both GP Timer 0 and GP Timer 1 can be configured to be clocked by GP Timer 2 at the
same time. This configuration provides a maximum of two 32-bit counters. GP Timer 2 is
a common element between the two resulting 32-bit counters. The possible combinations
of the timers include:
■
GP Timer 2, GP Timer 1, and GP Timer 0 separate, resulting in three independent 16-bit
counters
■
GP Timer 2 + GP Timer 0 (as one 32-bit), with GP Timer 1 separate (as one 16-bit)
■
GP Timer 2 + GP Timer 1 (as one 32-bit), with GP Timer 0 separate (as one 16-bit)
■
GP Timer 2 + GP Timer 0 (as one 32-bit), with GP Timer 2 + GP Timer 1 (as second
32-bit), where GP Timer 2 is a common timebase
17.5.7.2
Reading the Cascaded 32-Bit Timer
When cascading GP Timer 0 or GP Timer 1 with GP Timer 2 to form a single 32-bit timer,
caution must be exercised when reading the two counter outputs in order to properly handle
rollover conditions. This is slightly complicated by the fact that there is no way to atomically
read the contents of both counters. The goal is to develop an algorithm to return the 32-bit
value of the cascaded timer at the time that the 16-bit “least significant” timer is read.
Table 17-4
GP Timers External Clock Sources (Using a 33.333 MHz Crystal)
External Clock Source
Frequency Range
TMRIN0
0–8.33325 MHz
TMRIN1
0–8.33325 MHz
Содержание Elan SC520
Страница 1: ...lan SC520 Microcontroller User s Manual Order 22004A...
Страница 4: ...iv lan SC520 Microcontroller User s Manual...
Страница 28: ...Introduction xxviii lan SC520 Microcontroller User s Manual...
Страница 42: ...Architectural Overview 1 14 lan SC520 Microcontroller User s Manual...
Страница 78: ...System Initialization 3 22 lan SC520 Microcontroller User s Manual...
Страница 108: ...Clock Generation and Control 5 10 lan SC520 Microcontroller User s Manual...
Страница 118: ...Reset Generation 6 10 lan SC520 Microcontroller User s Manual...
Страница 148: ...System Arbitration 8 24 lan SC520 Microcontroller User s Manual...
Страница 214: ...SDRAM Controller 10 36 lan SC520 Microcontroller User s Manual...
Страница 230: ...Write Buffer and Read Buffer 11 16 lan SC520 Microcontroller User s Manual...
Страница 288: ...GP Bus DMA Controller 14 22 lan SC520 Microcontroller User s Manual...
Страница 316: ...Programmable Interval Timer 16 8 lan SC520 Microcontroller User s Manual...
Страница 328: ...Software Timer 18 4 lan SC520 Microcontroller User s Manual...
Страница 346: ...Real Time Clock 20 12 lan SC520 Microcontroller User s Manual...
Страница 360: ...UART Serial Ports 21 14 lan SC520 Microcontroller User s Manual...
Страница 414: ...AMDebug Technology 26 8 lan SC520 Microcontroller User s Manual...