Z8 M
ICROCONTROLLER
U
SER
’
S
M
ANUAL
UM001601-0803
©2003 by ZiLOG, Inc. All rights reserved. Information in this publication concerning the devices, applica-
tions, or technology described is intended to suggest possible uses and may be superseded. ZiLOG, INC.
DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE
INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZiLOG ALSO
DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED IN
ANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED HEREIN
OR OTHERWISE. Except with the express written approval of ZiLOG, use of information, devices, or tech-
nology as critical components of life support systems is not authorized. No licenses are conveyed, implicitly
or otherwise, by this document under any intellectual property rights.
ii
UM001601-0803
U
SER
’
S
M
ANUAL
T
ABLE OF
C
ONTENTS
Chapter Title and Subsections
Page
Chapter 1. Z8 MCU Product Overview
Z8 MCU Family Overview
Key Product Line Features .................................................................................................. 1-1
Product Development Support ............................................................................................. 1-3
Chapter 2. Address Space
Introduction ................................................................................................................................. 2-1
Z8 MCU Standard Register File ..................................................................................................2-1
General-Purpose Registers ................................................................................................. 2-2
RAM Protect ......................................................................................................................... 2-2
Working Register Groups ..................................................................................................... 2-2
Error Conditions ................................................................................................................... 2-4
Z8 Expanded Register File ....................................................................................................... 2-5
Z8 Control And Peripheral Registers .......................................................................................... 2-8
Standard Z8 Registers ......................................................................................................... 2-8
Expanded Z8 Registers ....................................................................................................... 2-8
Program Memory ...................................................................................................................... 2-10
Z8 External Memory ................................................................................................................. 2-11
External Data Memory ....................................................................................................... 2-11
Z8 STACKS .............................................................................................................................. 2-12
Chapter 3. Clock
Clock ...........................................................................................................................................
Frequency Control ...............................................................................................................
Clock Control ..............................................................................................................................
SCLK/TCLK Divide-By-16 Select (D0) .................................................................................
External Clock Divide-By-Two (D1) ......................................................................................
Oscillator Control ........................................................................................................................
3-1
3-1
3-1
3-2
3-2
3-2
UM001601-0803
iii
Z8 Microcontrollers
Table of Contents
Chapter Title and Subsections
ZiLOG
Page
3-3
3-3
3-3
3-4
3-5
3-6
3-6
Chapter 3. Clock
(Continued)
Oscillator Operation ....................................................................................................................
Layout ..................................................................................................................................
Indications of an Unreliable Design .....................................................................................
Circuit Board Design Rules ..................................................................................................
Crystals and Resonators ......................................................................................................
LC Oscillator ...............................................................................................................................
RC Oscillator ..............................................................................................................................
Chapter 4. Reset—Watch-Dog Timer
Reset ..........................................................................................................................................
Reset Pin, Internal POR Operation ............................................................................................
Watch-Dog Timer (WDT) ............................................................................................................
Power-On-Reset (POR) ..............................................................................................................
4-1
4-1
4-7
4-8
Chapter 5. I/O Ports
I/O Ports ..................................................................................................................................... 5-1
Mode Registers .................................................................................................................... 5-1
Input and Output Registers .................................................................................................. 5-1
Port 0 .......................................................................................................................................... 5-2
General I/O Mode ................................................................................................................ 5-3
Read/Write Operations ........................................................................................................ 5-4
Handshake Operation .......................................................................................................... 5-4
Port 1 .......................................................................................................................................... 5-5
General I/O Mode ................................................................................................................ 5-5
Read/Write Operations ........................................................................................................ 5-8
Handshake Operations ........................................................................................................ 5-8
PORT 2 ....................................................................................................................................... 5-9
General Port I/O ................................................................................................................... 5-9
Read/Write Operations ...................................................................................................... 5-12
Handshake Operation ........................................................................................................ 5-12
PORT 3 ..................................................................................................................................... 5-13
General Port I/O ................................................................................................................. 5-13
Read/Write Operations ...................................................................................................... 5-18
Special Functions ............................................................................................................... 5-18
Port Handshake ........................................................................................................................ 5-19
I/O Port Reset Conditions ......................................................................................................... 5-24
Full Reset ........................................................................................................................... 5-24
Chapter 5. I/O Ports
Analog Comparators ................................................................................................................. 5-26
iv
UM001601-0803
ZiLOG
Chapter Title and Subsection
Z8 Microcontrollers
Table of Contents
Page
5-26
5-28
5-29
5-29
5-29
5-29
5-29
5-29
5-30
5-30
5-31
5-32
Comparator Description .....................................................................................................
Comparator Programming .................................................................................................
Comparator Operation .......................................................................................................
Interrupts ............................................................................................................................
Comparator Definitions ......................................................................................................
RUN Mode .........................................................................................................................
HALT Mode ........................................................................................................................
STOP Mode .......................................................................................................................
Open-Drain Configuration .........................................................................................................
Low EMI Emission ....................................................................................................................
Input Protection ........................................................................................................................
CMOS Z8 Auto Latches ............................................................................................................
Chapter 6. Counter/Timers
Introduction ................................................................................................................................. 6-1
Prescalers and Counter/Timers .................................................................................................. 6-2
Counter/Timer Operation ............................................................................................................ 6-3
Load and Enable Count Bits ................................................................................................ 6-3
Prescaler Operations ........................................................................................................... 6-4
T
OUT
Modes ............................................................................................................................... 6-5
T
IN
Modes ................................................................................................................................... 6-7
External Clock Input Mode ................................................................................................... 6-8
Gated Internal Clock Mode .................................................................................................. 6-9
Triggered Input Mode ......................................................................................................... 6-10
Retriggerable Input Mode .................................................................................................. 6-11
Cascading Counter/Timers ....................................................................................................... 6-11
Reset Conditions ...................................................................................................................... 6-12
Chapter 7. Interrupts
Introduction .................................................................................................................................
Interrupt Sources ........................................................................................................................
External Interrupt Sources ...................................................................................................
Internal Interrupt Sources ....................................................................................................
Interrupt Request (IRQ) Register Logic and Timing ...................................................................
Interrupt Initialization ..................................................................................................................
Interrupt Priority Register (IPR) Initialization ........................................................................
Interrupt Mask Register (IMR) Initialization ..........................................................................
Interrupt Request (IRQ) Register Initialization .....................................................................
IRQ Software Interrupt Generation .............................................................................................
7-1
7-2
7-2
7-3
7-4
7-5
7-5
7-6
7-7
7-9
Chapter 7. Interrupts
(Continued)
UM001601-0803
v