English
Language : 

Z8F1680SH020SG Datasheet, PDF (118/412 Pages) Zilog, Inc. – High-Performance 8-Bit Microcontrollers
Z8 Encore! XP® F1680 Series
Product Specification
93
1. Write to the Timer Control 1 Register to:
– Disable the timer.
– Configure the timer for COMPARATOR COUNTER Mode.
– Select either the rising edge or falling edge of the comparator output signal for the
count. This also sets the initial logic level (High or Low) for the Timer Output
alternate function. The Timer Output function does not have to be enabled.
2. Write to the appropriate comparator control register (COMP0 or COMP1) to set the
TIMTRG bits that map the comparator to the timer.
3. Write to the Timer Control 2 Register to choose the timer clock source.
4. Write to the Timer Control 0 Register to set the timer interrupt configuration field
TICONFIG.
5. Write to the Timer High and Low Byte registers to set the starting count value. This
value only affects the first pass in COMPARATOR COUNTER Mode. After the first
timer reload in COMPARATOR COUNTER Mode, counting always begins at the
reset value of 0001H. Generally, in COMPARATOR COUNTER Mode the Timer
High and Low Byte registers must be written with the value 0001H.
6. Write to the Timer Reload High and Low Byte registers to set the reload value.
7. If required, enable the timer interrupt and set the timer interrupt priority by writing to
the relevant interrupt registers.
8. If using the Timer Output function, configure the associated GPIO port pin for the
Timer Output alternate function.
9. Write to the Timer Control 1 Register to enable the timer.
In COMPARATOR COUNTER Mode, the number of comparator output transitions since
the timer start is calculated using the following equation:
Comparator Output Transitions = Current Count Value - Start Value
9.2.3.6. PWM SINGLE OUTPUT Mode
In PWM SINGLE OUTPUT Mode, the timer outputs a Pulse Width Modulator output sig-
nal through a GPIO port pin. The Timer counts timer clocks up to the 16-bit reload value.
The timer first counts up to the 16-bit PWM match value stored in the Timer PWM0 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.
PS025015-1212
PRELIMINARY
Timers