English
Language : 

Z8F1680SH020SG Datasheet, PDF (124/412 Pages) Zilog, Inc. – High-Performance 8-Bit Microcontrollers
Z8 Encore! XP® F1680 Series
Product Specification
99
Observe the following steps to configure a timer for CAPTURE RESTART Mode and ini-
tiate the count:
1. Write to the Timer Control 1 Register to:
– Disable the timer
– Configure the timer for CAPTURE RESTART Mode. Setting the mode also
involves writing to TMODE[3] bit in the TxCTL0 Register
– Set the prescale value
– Set the Capture edge (rising or falling) for the Timer Input
2. Write to the Timer Control 2 Register to choose the timer clock source.
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 (typi-
cally 0001H).
5. Write to the Timer Reload High and Low Byte registers to set the reload value.
6. Clear the Timer PWM High and Low Byte registers to 0000H. This allows user soft-
ware to determine if interrupts are generated by either a Capture Event or a Reload. If
the PWM High and Low Byte registers still contain 0000H after the interrupt, then the
interrupt is generated by a Reload.
7. If required, enable the timer interrupt and set the timer interrupt priority by writing to
the relevant interrupt registers. By default, the timer interrupt will be generated for
both input capture and reload events. If required, configure the timer interrupt to be
generated only at the Input Capture event or the reload event by setting TICONFIG
field of the Timer Control 0 Register.
8. Configure the associated GPIO port pin for the Timer Input alternate function.
9. 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-
Timer Clock Frequency (Hz)
PS025015-1212
PRELIMINARY
Timers