English
Language : 

Z8F4822AR020SG Datasheet, PDF (86/323 Pages) Zilog, Inc. – High Performance 8-Bit Microcontrollers
Z8 Encore! XP® F64xx Series
Product Specification
66
enabled, the timer output pin changes state (from Low to High or from High to Low) at
timer reload.
Observe the following procedure for configuring a timer for COUNTER Mode and initiat-
ing the count:
1. Write to the Timer Control 1 Register to:
– Disable the timer.
– Configure the timer for COUNTER Mode.
– Select either the rising edge or falling edge of the timer input signal for the count.
This also sets the initial logic level (High or Low) for the timer output alternate
function. However, the timer output function does not have to be enabled.
2. Write to the Timer High and Low Byte registers to set the starting count value. This
only affects the first pass in COUNTER Mode. After the first timer reload in COUN-
TER Mode, counting always begins at the reset value of 0001H. Generally, in COUN-
TER Mode the Timer High and Low Byte registers must be written with the value
0001H.
3. Write to the Timer Reload High and Low Byte registers to set the reload value.
4. If appropriate, enable the timer interrupt and set the timer interrupt priority by writing
to the relevant interrupt registers.
5. Configure the associated GPIO port pin for the timer input alternate function.
6. If using the timer output function, configure the associated GPIO port pin for the timer
output alternate function.
7. Write to the Timer Control 1 Register to enable the timer.
In COUNTER Mode, the number of timer input transitions since the timer start is calcu-
lated using the following equation:
COUNTER Mode Timer Input Transitions = Current Count Value – Start Value
PWM Mode
In PWM Mode, the timer outputs a Pulse-Width Modulator (PWM) output signal through
a GPIO port pin. The timer input is the system clock. The timer first counts up to the 16-
bit PWM match value stored in the Timer PWM High and Low Byte registers. When the
timer count value matches the PWM value, the timer output toggles. The timer continues
counting until it reaches the reload value stored in the Timer Reload High and Low Byte
registers. Upon reaching the reload value, the timer generates an interrupt, the count value
in the Timer High and Low Byte registers is reset to 0001H and counting resumes.
PS019924-0113
PRELIMINARY
Operation