Figure - ZiLOG Z8 Technical Manual

Microcomputer
Hide thumbs Also See for Z8:
Table of Contents

Advertisement

Counter/Timers
Counter/timers 0 and 1 are driven by a timer clock
generated by dividing the internal clock by four.
The divide-by-four stage, the 6-bit prescaler, and
the 8-bit counter/timer form a synchronous 16-bit
divide chain.
Counter/timer 1 can also be driven
by an external input (TIN) via Port 3 line P3 1 •
Port 3 line P3 6 can serve as a timer output
(TOUT)
through which TO'
T 1 ,
or the internal
clock can be output.
The timer output will toggle
at the end-of-count.
Figure 11-1 is a block
diagram of the counter/timers.
The counter/timer, prescaler, and associated mode
registers are mapped into the register file as
shown in Figure 11-2.
This allows the software to
treat
the
counter/timers
as
general-purpose
registers, and eliminates the need for special
instructions.
11.2 PRESCAlERS AND COUNTER/TIMERS
The prescalers, PRE O (%F5) and PRE 1
U~F3),
each
consist
of
an
8-bit
register
and
a
6-bit
down-counter
as
shown
in
Figure
11-1.
The
prescaler
registers
are
write-only
registers.
Reading the prescalers returns the value %FF.
Figures
11-3
and
11-4
show
the
prescaler
registers.
The six most significant bits (02-07) of PRE O or
PRE 1 hold the prescalers count modulo, a value
from 1 to 64 decimal.
The prescaler registers
also contain control bits that specify TO and T1
counting modes. These bits also indicate whether
the clock source for T 1 is internal or external.
These control bits will be discussed in detail
throughout this chapter.
The counter/timers, TO (%F4) and T1 (%F 2)' each
consist of an 8-bit down-counter,
a write-only
11-2
DEC
247
245
244
243
242
241
PORT 3 MODE
TO PRESCALER
TIMER/COUNTER 0
T1 PRESCALER
TIMER/COUNTER 1
TIMER MODE
HEX IDENTIFIERS
F7
P3M
F5
PREO
F4
TO
F3
PRE1
F2
T1
F1
TMR
Figure 11-2. Counter/T iDler Register Hap
register which holds the initial count value, and
a read-only register which holds the current count
value (Figure 11-1).
The initial value can range
from 1 to 256 decimal Um1,%02, •• ,%OO).
Figure
11-5 illustrates the counter/timer registers.
R245 PREO
Prescaler 0 Register
(% F5; Write Only)
~
COUNTMODE
o
=
To SINGLE·PASS
1
=
To MODULO·N
RESERVED (MUST BE 0)
PRESCALER MODULO
'--------(RANGE: 1-64 DECIMAL
01-00 HEX)
Figure
11-3. Prescaler 0 Register
R243 PRE1
Prescaler 1 Register
(% F3; Write
Only)
~
COUNTMODE
1
=
T1 MODULO·N
o
=
T1 SINGLE·PASS
CLOCK SOURCE
1
=
T1 INTERNAL
o
=
T 1 EXTERNAL
(TIN)
PRESCALER MODULO
'--------(RANGE: 1-64 DECIMAL
01-00 HEX)
Figure
11-4. Prescaler 1 Register
R242 T1
Counter/Timer 1 Register
(% F2; Read/Write)
R244 TO
CounterlTimer 0 Register
(% F4; Read/Write)
I
0
7
1
0
6
1
0
5
1
0
4
1
0
3
1
0
2
1
0
1
I
Do
I
L
INITIAL VALUE WHEN WRITTEN
(RANGE 1·256 DECIMAL, 01'()0 HEX)
CURRENT VALUE WHEN READ
Figure
11-~.
Counter/Timers
0 and 1 Registers
3047-082,3047-096,3047-097,3047-015

Advertisement

Table of Contents
loading

Table of Contents