English
Language : 

Z8F4822AR020SG Datasheet, PDF (89/323 Pages) Zilog, Inc. – High Performance 8-Bit Microcontrollers
Z8 Encore! XP® F64xx Series
Product Specification
69
6. Configure the associated GPIO port pin for the timer input alternate function.
7. Write to the Timer Control 1 Register to enable the timer and initiate counting.
In CAPTURE Mode, the elapsed time from timer start to capture event can be calculated
using the following equation:
Capture Elapsed Time (s) = ---C----a---p---t-u---r--e----V-----a--l--u---e----–-----S---t--a---r--t---V----a---l-u---e------------P---r--e---s--c---a---l-e-
System Clock Frequency (Hz)
COMPARE Mode
In COMPARE Mode, the timer counts up to the 16-bit maximum compare value stored in
the Timer Reload High and Low Byte registers. The timer input is the system clock. Upon
reaching the compare value, the timer generates an interrupt and counting continues (the
timer value is not reset to 0001H). Also, if the timer output alternate function is enabled,
the timer output pin changes state (from Low to High or from High to Low) upon com-
pare.
If the Timer reaches FFFFH, the timer rolls over to 0000H and continue counting.
Observe the following procedure for configuring a timer for COMPARE Mode and initiat-
ing the count:
1. Write to the Timer Control 1 Register to:
– Disable the timer
– Configure the timer for COMPARE Mode
– Set the prescale value
– Set the initial logic level (High or Low) for the timer output alternate function, if
appropriate
2. Write to the Timer High and Low Byte registers to set the starting count value.
3. Write to the Timer Reload High and Low Byte registers to set the compare value.
4. If appropriate, enable the timer interrupt and set the timer interrupt priority by writing
to the relevant interrupt registers.
5. If using the timer output function, configure the associated GPIO port pin for the timer
output alternate function.
6. Write to the Timer Control 1 Register to enable the timer and initiate counting.
In COMPARE Mode, the system clock always provides the timer input. The compare time
is calculated using the following equation:
PS019924-0113
PRELIMINARY
Operation