General-Purpose Timers
17-8 Élan™SC520 Microcontroller User’s Manual
In this example, the second value read for GP Timer 2 (14h) is less than the first value
(7997h), and both values read for GP Timer 0 are 0. So this falls under case 1, and the
correct 32-bit value of the cascaded timer is:
32764 ms + (7997h * 121.2 ns) = 32767.8 ms = 32.7678 s
17.5.7.2.5 Example 2
Suppose GP Timer 0 and GP Timer 2 are programmed as in Example 1, but the values
returned from the timers are:
1. GP Timer 2 = 7997h
2. GP Timer 0 = 15h
3. GP Timer 2 = 5h
4. GP Timer 0 = 16h
In this example, the second value read for GP Timer 2 (5h) is less than the first value
(7997h). However, because the first value read for GP Timer 0 (15h) is less than the second
value (16h), case 3 applies and the correct 32-bit value of the cascaded timer is:
15h * 4ms + 7997 * 121.2 ns = 72.772 ms
17.6 INITIALIZATION
At system reset, all the general-purpose timer registers are reset to zero. Each timer must
be programmed before it can be used.
1. Write the maximum compare count value into the GP Timer x Maxcount Compare
(GPTMR0MAXCMPx) registers.
2. Enable the counting with the desired operation and mode in the GP Timer x Mode/Control
(GPTMRxCTL) register.