English
Language : 

Z8F1680SH020SG Datasheet, PDF (117/412 Pages) Zilog, Inc. – High-Performance 8-Bit Microcontrollers
Z8 Encore! XP® F1680 Series
Product Specification
92
3. Write to the Timer Control 0 Register to set the timer interrupt configuration field
TICONFIG.
4. Write to the Timer High and Low Byte registers to set the starting count value. This
value only affects the first pass in COUNTER Mode. After the first timer reload in
COUNTER Mode, counting always begins at the reset value of 0001H. Generally, in
COUNTER Mode the Timer High and Low Byte registers must be written with the
value 0001H.
5. Write to the Timer Reload High and Low Byte registers to set the reload value.
6. If required, enable the timer interrupt and set the timer interrupt priority by writing to
the relevant interrupt registers.
7. Configure the associated GPIO port pin for the Timer Input alternate function.
8. When 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 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
9.2.3.5. COMPARATOR COUNTER Mode
In COMPARATOR COUNTER Mode, the timer counts output transitions from an analog
comparator output. The assignment of a comparator to a timer is based on the TIMTRG
bits in the CMP0 and CMP1 registers. The TPOL bit in the Timer Control 1 Register
selects whether the count occurs on the rising edge or the falling edge of the comparator
output signal. In COMPARATOR COUNTER Mode, the prescaler is disabled.
Caution: The frequency of the comparator output signal must not exceed one-fourth the timer
clock frequency.
Upon reaching the reload value stored in the Timer Reload High and Low Byte registers,
the timer generates an interrupt, the count value in the Timer High and Low Byte registers
is reset to 0001H and counting resumes. Also, if the Timer Output alternate function is
enabled, the Timer Output pin changes state (from Low to High or High to Low) at timer
reload.
Observe the following steps to configure a timer for COMPARATOR COUNTER Mode
and initiate the count:
PS025015-1212
PRELIMINARY
Timers