This publication is subject to replacement by a later edition. To determine whether
a later edition exists, or to request copies of publications, contact:
ZiLOG Worldwide Headquarters
532 Race Street
San Jose, CA 95126-3432
Telephone: 408.558.8500
Fax: 408.558.8300
www.ZiLOG.com
ZiLOG is a registered trademark of ZiLOG Inc. in the United States and in other countries. All other
products and/or service names mentioned herein may be trademarks of the companies with which
they are associated.
Figure 25. Timer Mode Register T
Figure 26. Counter/Timer Output Using T
Figure 27. Internal Clock Output Using T
Figure 28. Timer Mode Register T
Figure 29. Prescaler 1 T
The Z86D99 is a low-voltage general-purpose one-time programmable (OTP) Z8
microcontroller with an integrat ed four-channel 8-bit sigma delta analog-to-digital
converter. The Z86L99 is the read-only memory (ROM) version of this controller.
The Z86D99/Z86L99 family is designed to be used i n a wide vari ety of embedded
control applications including battery chargers, home appliances, infrare d (IR)
remote controls, security systems, and wire less keyboards.
It has three counter/timers, a general- purpose 8-bit counter/ti mer with a 6-bit pres caler and an 8-bit/16-bit counter/timer pair that can be used individually for general-purpose timing or as a pair to automate the generation and reception of
complex pulses or signals. Unique features of the Z86D99/Z86L99 family of products include 489 bytes of general-purpose random-access memory (RAM), 256
bytes of which are mapped into the program memory space and can be used to
store data variables or as executable RAM, a low-battery detection flag, and a
controlled current output pin, which is a regulated current source that sinks a predefined current (I
). Table 1 highlights the basic product features of these
The Z8 microcontroller core of fers more flexibility and performance than accumulator-based microcontroll ers. All 256 general-purpose registers, including dedicated input/output (I/O) port registers, can be used as accumulators. This unique
register-to-register architecture avoids accumulator bottlenecks for high code efficiency. The registers can be used as address pointers for indirect addressing, as
index registers, or for implement ing an on-chip stack.
The Z8 has a sophisticated interrupt structur e and automatically saves the program counter and status flags on the st ack for fast context-switching. Speed of
execution and smooth programming are also supported by a “working register
area” with short 4-bit register addresses.
PS003807-1002P R E L I M I N A R Y
Features
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
The Z8 instruction set, consisting o f 43 basic instructions, is optimized for highcode density and reduced execution time. It is similar in form to the ZiLOG Z80
instruction set. The eight instruction types and six addressing modes together
with the ability to operate on bits, 4-bit nibbles or binary coded decimal (BCD) digits, 8-bit bytes, and 16-bit words, make for a code-ef fi cient, fl exible micr ocontro ller.
•
Four-channel, 8-bit sigma delta analog-to-digital (A/D) converter wit h external
voltage references (no t avai lable in the 28-pin configuration)
•
Two independent analog comparators
•
Controlled current output
2
•
489 bytes of RAM
–
233 bytes of general-purpose register-based RAM
–
256 bytes of RAM mapped into the program memory space that can be
used as data RAM or executable RAM
•
32 Kbytes of OTP memory (Z86D99X)
•
16 Kbytes of ROM (Z86L99X)
Counter/Timers
•
Special architecture to automate generation and reception of complex pulses
or signals:
–
Programmable 8-bit counter/time r (T8) with two 8-bit c apture r egisters and
two 8-bit load registers
–
Programmable 16-bit counter/timer (T16) with one 16-bit capture register
pair and one 16-bit load register pair
–
Programmable input glitch filter for pulse reception
•
One general-purpose 8-bit counter/timer (T1) with 6-bit prescaler
Input/Output and Interrupts
•
Thirty-two I/Os, twenty- ni ne of which ar e bidi recti onal I /Os wi th programmable
resistive pull-up transistors (24 I/Os are available in the 28-pin configuration)
•
Sixteen I/Os are selectable as stop-mode recovery sources
•
Six interrupt vectors with nine i nterrupt sources
–
Three external sources
–
Two comparator interrupts
PS003807-1002P R E L I M I N A R Y
–
Three timer interrupts
–
One low-battery detector flag
Operating Characteristics
•
8-MHz operation
•
3.0 V to 5.5 V operating voltage (Z86D990/Z86D991)
•
2.3 V to 5.5 V operating voltage (Z86L990/Z86L991)
•
Low power consumption with three standby modes:
–
Stop
–
Halt
–
Low Vol tage Standby
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
3
•
Low-battery detection flag
•
Low-voltage protection circ uit (also known as VBO, or voltage brownout,
circuit)
•
Watch-dog timer and power-on reset circuits
User-Programmable Option Bits
•
Clock source—RC/other (LC, resonator, or crystal)
•
Watch-dog timer permanently enable
•
32-kHz crystal
•
Port 20–27 pull-up resistive transistor
•
Port 40–42 pull-up resistive transistor
•
Port 44–47 pull-up resistive transistor
•
Port 50–51 pull-up resistive transistor
•
Port 54–57 pull-up resistive transistor
•
Port 60–63 pull-up resistive transistor (not available in Z86D991/Z86L991)
•
Port 64–67 pull-up resistive transistor (not available in Z86D991/Z86L991)
•
P43 high impedance in STOP mode (available in OTP only)
Force P43 to output a 1 in the open-drain configuration
PS003807-1002P R E L I M I N A R Y
Functional Block Diagra m
Figure 1 shows the functional block diagram for the microcontrollers.
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
4
Register File
256 x 8-bit
Expanded
Register File
8
V
7
Program
Memory
Power Filter
DD_padring
V
DD_CORE
***
††
Port 2
Machine
0
7
*
Port 4
256 Bytes
P52
CIN2
P53
CREF2
Two Analog
Comparators
Z8 Core
Timing
and
Instruction
Control
XTAL 1
XTAL 2
Controlled
0
CIN1
P51
CREF1
P50
8
Current
Output
P43
7
Port 5
8-Bit C/T
0
(Carrier)
7
Port 6
**
0
*Controlled Current Output
**P6 is only in the Z86L990/Z86D990.
***In the 28-pin package, V
DD_padring
are bonded together.
and V
16-Bit C/T
(Modulation)
DD_CORE
8-Bit A/D†
V
Ref+
†ADC is only in the Z86L990/Z86D990.
††Program memory is as follows:
8-Bit C/T
(General)
V
Ref–
Z86D99032K OTP
Z86D99132K OTP
Z86L99016K ROM
Z86L99116K ROM
Figure 1. Functional Block Diagram
PS003807-1002P R E L I M I N A R Y
MUX
ADC0/P44
ADC1/P45
ADC2/P46
ADC3/P47
Pin Descriptions
Figure 2 through Figure 4 show the pin names and locations.
P20243440I/OPort 2 Bit 0
P21253541I/OPort 2 Bit 1
P22263644I/OPort 2 Bit 2
P23273745I/OPort 2 Bit 3
P24283846I/OPort 2 Bit 4
P25133I/OPort 2 Bit 5
P26244I/OPort 2 Bit 6
P27355I/OPort 2 Bit 7
P40192934I/OPort 4 Bit 0, T8 Output
PDIP/SOIC40PDIP48SSOPDirectionDescription
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
Table 2. Pin Descriptions (Continued)
Pin #
28
Symbol
P41203035I/OPort 4 Bit 1, T16 Output
P42213136I/OPort 4 Bit 2
P43233339OutputT8/T16 Output, Controlled current output
P44489I/OPort 4 Bit 4, A/D Channel 0*
P455910I/OPort 4 Bit 5, A/D Channel 1*
P4661011I/OPort 4 Bit 6, A/D Channel 2*
P4771112I/OPort 4 Bit 7, A/D Channel 3*
P50, CREF1 182833I/OPort 5 Bit 0, Comparator 1 reference
P51, CIN1111720I/OPort 5 Bit 1, Capture timer input, IRQ
P52, CIN2121821InputPort 5 Bit 2, Timer 1 timer input, IRQ
P53, CREF2 131922InputPort 5 Bit 3, Comparator 2 reference, IRQ
P54142023I/OPort 5 Bit 4, High drive output
P55152528I/OPort 5 Bit 5, High drive output
P56172732I/OPort 5 Bit 6, Timer 1 output, High drive output
P57162629I/OPort 5 Bit 7, High drive output
P603947I/OPort 6 Bit 0
P614048I/OPort 6 Bit 1
P6211I/OPort 6 Bit 2
P6322I/OPort 6 Bit 3
P642124I/OPort 6 Bit 4
P652225I/OPort 6 Bit 5
P662326I/OPort 6 Bit 6
P672427I/OPort 6 Bit 7
XTAL1101618InputCrystal, Oscillator clock
XTAL291517OutputCrystal, Oscillator clock
AV
DD
V
DD_CORE
AV
SS
V
Ref–
V
Ref+
V
DD_padring
V
SS
Notes:
PDIP/SOIC40PDIP48SSOPDirectionDescription
2
0
1
1314Analog power supply
1315Z8 core power supply
67Analog ground
78InputA/D converter lower reference
1213InputA/D converter upper reference
8**1416Power supply (pad ring)
22**3237, 38Ground
*A/D converter is not available in the 28-pin configuration.
**In the 28-pin configuration, all three (core, pad ring, and analog) powers are tied together.
8
PS003807-1002P R E L I M I N A R Y
Operational De scription
Central Processing Unit (CPU) Description
The Z8 architecture is characterized by a flexible I/O scheme, an efficient register
and address space structure and a number of ancillary features for cost-sens itive,
high-volume embedded control applica tions. ROM-b ased pro duct s are geared for
high-volume production (where the software is stable) and one-time programmable equivalents for prototyping as well as volume production where time to market
or code flexibility is critical.
Architecture Type
The Z8 register-oriented architecture centers around an internal register file composed of 256 consecutive bytes, known as the standar d register file. The standard
register file consists of 4 I/O port registers (R2, R4, R5, and R6), 12 control and
status registers, 23 3 general-purpose registers , and 7 registers reserved for future
expansion. In addition to the standard register file, the Z86D99/Z86L99 family
uses 21 control and status registers located in the Z8 expanded register file. Any
general-purpose register can be used as an accumulator and address pointer or
an index, data, or stack regist er.
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
9
All active registers can be reference d or modif ied by any instru ction t hat accesses
an 8-bit register, without the requirement for special instructions. Registers
accessed as 16 bits are tr eated as even-odd register p ai rs. In thi s case, the da ta’ s
most significant byte (MSB) is stored in the even-numbered register, while the
least significant byte (LSB) goes into th e next higher odd-numbered register.
The Z8 CPU has an instruction set designed for the l arge regi ster fil e. The inst ruc tion set provides a full compliment of 8-bit arithmetic and logical operations. BCD
operations are supported using a decimal adjustment of binary values, and 16-bit
quantities for addresses and counters can be incremented and decremented. Bit
manipulation and Rotate and Shif t instructions complete the data-manipulat ion
capabilities of the Z8 CPU. No speci al I/ O in struct ions ar e nece ssary beca use t he
I/O is mapped into the register file.
CPU Control Registers
The standard Z8 control registers gover n the operation of the CPU. Any instruction which references the register file can access these control registers. The following are available control registers:
•
Register Pointer (RP)
•
Stack Pointer (SP)
•
Program Control Flags (FLAGS)
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
•
Interrupt Control (IPR, IMR, and IRQ)
•
Stop Mode Recovery (SMR, P2SMR, and P5SMR)
•
Low-Battery Detect (LB) Flag
The Z8 uses a 16-bit Program Counter (PC) to determine the sequence of current
program instructions. The PC is not an addressabl e regi ster.
Peripheral registers are used to transf er data, configure the operating mode, and
control the operation of the on-chip peripherals. Any instruction that references
the register file can access the peripheral registers. The following are peripheral
control registers:
•
Analog/Digital Converter (ADCCTRL and ADCDATA)
•
T1 Timer/Counter (TMR, T1, and PRE1)
10
•
T8 Timer/Counter (CTR0, HI8, LO8, TC8H, and TC8L)
•
T16 Timer/Counter (CTR2, HI16, LO16, TC16H, and TC16L)
•
T8/T16 Control Registers (CTR1and CTR3)
In addition, the four port registers are considered to be peripheral registers. The
following are port control registers:
•
Port Configuration Registers (P456CON and P3M)
•
Port 2 Control and Mode Registers (P2 and P2M)
•
Port 4 Control and Mode Registers (P4 and P4M)
•
Port 5 Control and Mode Registers (P5 and P5M)
•
Port 6 Control and Mode Registers (P6 and P6M)
The functions and applications of the control and peripheral registers are
explained in “Control and Status Registers” on page 52.
Memory (ROM/OTP and RAM)
There are four basic address spaces available to support a wide range of configurations:
•
Program memory (on-chip)
•
Standard register file
•
Expanded register file
•
Executable RAM
The Z8 standard register file totals up to 256 consecutive bytes organized as 16
groups of 16 eight-bit registers. These registers consist of I/O port registers,
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
general-purpose RAM registers, and control and status registers. Every RAM register acts l ike an ac cumulator, speeding instruction execution and maxi mizing cod ing efficiency. Working register groups allow fast context switching.
The standard registe r file of the Z8 (known as Bank 0) has been exp anded to form
16 expanded register file (ERF) banks. The expanded register file allows for additional system control registers and for the mapping of additional peripheral
devices into the register ar ea. Eac h ERF bank can pot enti all y consist of up t o 256
registers (the same amount as in the standard register file) that can then be
divided into 16 working register group s. Currently, only Group 0 of ERF Banks F
and D (
0Fh and 0Dh) has been implemented.
In addition to the standard program memory and the RAM register files, the
Z86D99/Z86L99 family also has 256 bytes of execut able RAM that has been
mapped into the upper 256 bytes of the program memory address space (
FFFFh). Data can be written to the executable RAM by using the LDC instruction.
FF00h–
11
Program Memory Structure
The first 12 bytes of program memory are reserved for the interrupt vectors.
These locations contain six 16-bit vectors that correspond to the six available
interrupts (IRQ
through IRQ5.) Address 12 (0Ch) up to 32,767 (7FFFh) consists of
0
on-chip one-time programmable memory. The Z86L99X only has the 4K/8K/16K
ROM size.
After any reset operation (power-on reset, watch-dog timer time out, and stop
mode recovery), program execution resumes with t he ini ti a l instruction fetch from
location
000Ch. After a reset, t he fir st routin e execu ted must be one th at i niti aliz es
the control registers to the required system configuration.
A unique feature of the Z86D99/Z86L99 family is the presence of 256 bytes of on-
chip executable RAM. This random-ac cess memo ry is in addition to the standard
Z8 register file memory available on all Z8 microcontrollers. As illustrated in
Figure 5, the executable RAM is mapped into the upper 256 bytes of the 64K program memory address space (
FF00h–FFFFh). Data can be written to the execut-
able RAM by using the LDC instruction.
Memory locations between
8000h and FEFFh have not been implemented on the
Z86D99X microcontrollers.
The Z86D99/Z86L99 family does not have the capabili ty of accessing external
memory.
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
Location (Hex)
FFFF
256 bytes
Executable RAM
FF00
Not Implemented
3FFF/7FFF
(ROM)/(OTP)PROGRAM
MEMORY
000CLocation of the first byte of the initial instruction executed after
Bank 0 of the Z8 expanded register file archi tecture is known as the standard register file of the Z8. As shown in Figure 6, the Z8 standard register file consists of
16 groups of sixteen 8-bit registers known as Working Register (WR) groups.
Working Register Gr oup F cont ains vari ous control and st atus registers. The lower
half of Working Register Group 0 consists of I/O port registers (R0 to R7), the
upper eight registers are available for use as general-purpose RAM registers.
Working Register Group 1 through Group E of the standard register file are available to be used as general-purpos e RAM registers. The user can use 233 bytes of
general-purpose RAM registers in the standard Z8 register file (Bank 0).
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
Grp/BnkRegWorking Register Group Function
(
F0h)r0 to 15 Control and Status Registers
(
E0h)r0 to 15General-purpose RAM registe rs
D0h)r0 to 15 General-purpose RAM registers
(
(
C0h)r0 to 15 General-purpose RAM registers
(
B0h)r0 to 15 General-purpose RAM registers
A0h)r0 to 15General-purpose RAM registe rs
(
(
90h)r0 to 15General-purpose RAM registe rs
(
80h)r0 to 15 General-purpose RAM registers
(
70h)r0 to 15General-purpose RAM registers
60h)r0 to 15General-purpose RAM registe rs
(
(
50h)r0 to 15General-purpose RAM registe rs
(
40h)r0 to 15General-purpose RAM registe rs
30h)r0 to 15General-purpose RAM registe rs
(
(
20h)r0 to 15General-purpose RAM registe rs
(
10h)r0 to 15General-purpose RAM registe rs
r8 to 15 Gener al- pur pose RAM regi ste rs
(
00h)r0 to 7I/O Port Registers
13
Figure 6. Standard Z8 Register File (Working Reg. Groups 0–F, Bank 0)
Z8 Expanded Register File
In addition to the Standard Z8 Register File (Bank 0), Expanded Register File
Banks F and D of Working Register Group 0 have been implemented on the
Z86D99/Z86L99. Figure 7 illustrates the Z8 Expanded Register File architecture.
These two expanded register file banks of Working Register Group 0 provide a
total of 32 additional RAM control and st atus registers. The Z86D99/Z86L99 family has implemented 21 of the 32 available registers.
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
14
Z8 Standard Register File
F
Control and Status Reg.
E
D
C
B
A
Working
Register
Groups
9
8
7
6
5
4
3
2
1
0
I/O Port Registers
Bank 0
Figure 7. Z8 Expanded Register File Architecture
Clock Circuit Description
The Z8 derives its timing from on-board clock circuitry connected to pins XTAL1
and XTAL2. The clock circuitry consists of an oscillator, a divide-by-two shaping
circuit, and a clock buffer. The oscillator’s input is XTAL1, and the oscillator’s output is XTAL2. The clock can be driven by a crystal, a cer amic r esonat or, LC clock,
RC, or an external clock source.
General-Purpose
RAM Registers
Bank F
Banks 2 through C are
Reserved—Not Implemented
(Bank E is also reserved)
Z8 Expanded Register Files
Group 0, Bank F
Stop Mode
Recovery and
Port Mode
Registers
Group 0, Bank D
Timer
Control
Registers
Clock Control
The Z8 offers software control of the internal system clock using programming
register bits in the SMR register. This register selects the clock divide value and
determines the mode of STOP Mode Recovery.
The default setting is external clock divide-by-two. When bits 1 and 0 of the SMR
register are set to 0, the System Clock (SCLK) and Timer Clock (TCLK) are equal
to the external clock frequency divided by two.
When bit 1 of the SMR register is set to 1, then SCLK and TCLK equal the external clock frequency. Refer to Table 53 on page 85 for the maximum clock frequency.
A divide-by-16 prescaler of SCLK and TCLK allows the user to selectively reduce
device power consumption during normal processor execution (under SCLK control) and/or HALT mode, where TCLK sources counter/timers and interrupt logic.
Combining the divide-by-two circuitry with the divide-by-16 prescaler allows the
external clock to be divided by 32.
PS003807-1002P R E L I M I N A R Y
Interrupts
The Z86D99/Z86L99 family allows up to six dif ferent interrupt s, t hree external and
three internal, from nine possible sources. The six interrupts are assigned as follows:
•
•
•
•
Table 3 presents the interrupt types, the interrupt sources, and the location of the
specific interrupt vectors.
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
15
Three edge-triggered external inte rrupts (P51, P52, and P53), two of which
are shared with the two analog comparators
One internal interrupt assigned to the T8 Timer
One internal interrupt assigned to the T16 Timer
One internal interrupt shared between the Low-Battery Detect flag and the T1
Timer
Table 3. Interrupt Types, Sources, and Vectors
Vector
NameSource
IRQ
0
IRQ
1
IRQ
2
IRQ
3
IRQ
4
IRQ
5
Notes:
P52 (F/R), Comparator 20,1External interrupt (P52) is triggered by
P53 (F)2,3External interrupt (P53) is triggered by
P51 (R/F), Comparator 14,5External interrupt (P51) is triggered by
T16 Timer6,7Internal interrupt
T8 Timer8,9Internal interrupt
LVD, T1 Timer10,11Internal interrupt, LVD flag is
F = Falling-edge triggered; R = Rising-edge triggered.
When LVD is enabled, IRQ5 is triggered only by low-voltage detection. Timer
1 does not generate an interrupt.
Location C omments
either rising or falling edge; internal
interrupt generated by Comparator 2
is mapped into IRQ
a falling edge
either a rising or falling edge; internal
interrupt generated by Comparator 1
is mapped into IRQ
multiplexed with T1 Timer End-ofCount interrupt
0
2
These interrupts can be masked and their priorities set by using the Interrupt
Mask Register (IMR) and Interrupt Priority Register (IPR) (Figure 8.) When more
than one interrupt is pending, prioriti es are resolved by a priority encoder, controlled by the IPR.
PS003807-1002P R E L I M I N A R Y
EI Instruction
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
16
S
R
Power-On Reset
Figure 8. Interrupt Block Diagram
(POR)
Reset
Interrupt Request Register
(IRQ,FAH)
Interrupt requests are stored in the Interrupt Request Register (IRQ), which can
also be used for polling. When an interrupt request is granted, the Z8 enters an
“interrupt machine cycle” that globally disables all other interrupts, saves the program counter (the address of the next inst ruction t o be execut ed) and statu s flags,
and finally branches to the vector locati on for the interrupt granted. It is only at this
point that control passes to the interrupt service routine for the specific interrupt.
All six interrupt s can be globally disabled by resetting t he ma ster Interrupt Enable
(bit 7 of the IMR) with a Disable Interrupts (DI) instruction. Interrupts are globally
enabled by setting the same bit with an Enable Interrupts (EI) instruction.
Descriptions of three interrupt control registers—the Interrupt Request Register,
the Interrupt Mask Register, and the Interrupt Priority Register—are provided in
“Register Summary” on page 52. The Z8 family supports both vectored and polled
interrupt handling.
External Interrupt Sources
External sources involve interrupt request lines P51, P52, and P53 (IRQ
and IRQ
, respectively.) IRQ0, IRQ1, and IRQ2 are generated by a transition on
1
the corresponding port pin. As shown in Figure 9, when the appropriate port pin
(P51, P52, or P53) transitions, the firs t flip-flop is set. The next two flip-flops synchronize the request to the internal clock and del ay it by two internal clock periods. The output of the most recent flip-flop (IRQ
The programming bits for the Int errupt Edge Select f unction are located in t he IRQ
register, bits 6 and 7. The configuration of these bits and the resulting interrupt
edge is shown in Table 4.
17
Table 4. Interrupt Edge Select for External Interrupts
Although interrupts are edge tr iggered, minimum interrupt
(P51)IRQ0 (P52)
2
request Low and High times must be observed for proper
operation. See “Electrical Chara cteristi cs” on p age 85 for exact
timing requirements (T
IL, TWIH) on external interrupt
W
requests.
Internal Interrupt Sources
Internal sources are ORed with the external sources, so that either an internal or
external source can trigger the int errupt.
Interrupt Request Register Logic and Timing
Figure 10 shows the logic diagram for the Interrupt Request Register. The leading
edge of an interrupt request sets the first flip-flop. It remains set until the interrupt
requests are sampled.
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
Figure 10. IRQ Logic
Internal interrupt requests are sampled during the most recent clock cycle before
an Op Code fetch (see Figure 11.) External interrupt requests are sampled two
internal clocks earlier than internal interrupt requests because of the synchronizing flip-flops shown in Fi gure 9.
18
Figure 11. Interrupt Request Timing
At sample time, the interrupt request is trans ferred to the second flip- flop shown in
Figure 10, which drives the interrupt mask and priority logic. When an interrupt
cycle occurs, this flip-flop is reset only for the highest priorit y level that is enabled.
The user has direct access to the second flip -flop by reading and writing to the
IRQ. The IRQ is read by specifying it as the source regis ter of an instruction, and
the IRQ is written by specifying it as the destination register.
Interrupt Initializatio n
After RESET, all interrupts are disabled and must be re- initia lized bef ore vecto red
or polled interrupt processing can begin. The Interrupt Priority Register, Interrupt
Mask Register, and Interrupt Request Regi ster must b e i niti alized, in that order, to
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
start the interrupt pr ocess. However, the IPR does not have to be initialized for
polled processing.
Interrupts must be globally enabled using the EI instruction. Setting bit 7 of the
IMR is not sufficient. Subsequent to this EI instruction, interrupts can be enabled
either by IMR manipulation or by use of the EI instruction, with equivalent effects.
Additionally, interrupts must be disabled by executing a DI instruction before the
IPRs or IMRs can be modified. Interrupts can then be enabled by executing an EI
instruction.
IRQ Software I nterrupt Generatio n
IRQ can be used to generate sof tware inter rupt s by specif ying I RQ as th e dest ination of any instruction referencing the Z8 Standard Register File. These Software
Interrupts (SWIs) are controlled in the same manner as hardware-generated
requests (the IPR and the IMR control t he priority and enabl ing of each SWI level ).
19
To generate a SWI, the request bit in the IRQ is set as follows:
ORIRQ, #NUMBER
where the immediate data, NUMBER, has a 1 in the bit position corresponding to
the appropriate level of the SWI.
For example, for an SWI on IRQ5, NUMBER has a 1 in bit 5. With this i nstr uct ion,
if the interrupt system is globally enab led, IRQ5 is enabled, and there are no
higher priority pending requests, control is transferred to the service routine
pointed to by the IRQ5 vector.
Reset Conditions
A system reset overrides all other operating conditions and puts the Z8 into a
known state. The control and status registers are reset to their default condit ions
after a power-on reset (POR) or a W at ch-Dog T imer (WDT) time-out while in RUN
mode. The control and status registers are not reset to their default conditions
after Stop Mode Recovery (SMR) while in HALT or STOP mode.
General-purpose registers are undefined after the device is powered up. Resetting the Z8 does not affect the contents of the general-purpose registers. The registers keep their most recent value after any reset, as long as the reset occurs in
the specified V
from a V
Following a reset (see Table 5), the first routine executed must be one that initializes the control registers to the required system configuration.
reset, if VCC drops below V
LV
operating range. Registers do not keep their most recent state
CC
(see Table 54 on page 87).
RAM
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
Table 5. Control and Status Register Reset Conditions
Register Pointer
Stack Pointer
Program Control Flags
Low Battery Detect
ADC Control
ADC Data
Interrupt Mask
Interrupt Priority
Interrupt Request
Port Configuration (A)
Port Configuration (B)
Port 2 Data
Port 2 Mode
Port 4 Data
Port 4 Mode
Port 5 Data
Port 5 Mode
Port 6 Data
Port 6 Mode
T1 Timer Data
T1 Timer Mode
T1 Timer Prescale
T8/T16 Control (A)
T8/T16 Control (B)
T8 Timer Control
T8 High Capture
T8 Low Capture
T8 High Loa d
T8 Low Load
T16 Timer Control
T16 High Capture
T16 Low Capture
T16 High Load
T16 Low Load
Stop Mode Recovery0Fhr11SMRR/W00100000
Port 2 SMR Source
Port 5 SMR Source
Notes:
0Fhr1P2SMRR/W00000000
0Fhr5P5SMRR/W00000000
†
This register is not reset following Stop Mode Recovery (SMR).
*This bit is not reset following SMR.
X means this bit is undefined at POR and is not reset following SMR.
**In OTP, the default for P43 is open-drain output at power up; you need to
initialize the P43 data. In the mask part, the P43 output is disabled until it is
configured as output.
Power-On Reset
21
A POR (cold start) always reset s the Z8 control and status registe rs to their default
conditions. A POR sets bit 7 of the Stop Mode Recovery register to 0 to indicate
that a cold start has occurred.
A timer circuit clocked by a dedicated on-board RC oscillator is used for the
Power-On Reset Timer (TPOR) function. The POR time is speci fied as T
T
time allows VCC and the oscillator circuit to st abilize before instruction exe-
POR
POR
.
cution begins.
The POR delay timer circuit is a one-shot timer triggered by one of three condi-
tions:
•
Power Fail to Power OK status including reco very from Low Voltage (V
LV)
Standby mode
•
STOP-Mode Recovery (when bit 5 of the SMR register = 1)
•
WDT time-out
Under normal operating conditions, a stop mode recovery event always triggers
the POR delay timer. This delay is necessary to allow the external oscillator time
to stabilize. When using an RC or LC oscillator (with a low Q factor), the shorter
wake-up time means the delay can be eliminated.
Bit 5 of the SMR register selects whether the POR timer delay is used after StopMode Recovery or is bypa ssed. If bit 5 =1 , then t he POR timer delay i s use d. If bit
5 = 0, then the POR timer delay is bypassed. In this cas e , the SMR source must
be held in the recovery state for 5 TpC to pass the Reset signal internally.
Watch-Dog Timer (WDT)
The WDT is a retriggerable one-shot timer that resets the Z8 if it reaches its
terminal count. When operating in the RUN modes, a WDT reset is functionally
PS003807-1002P R E L I M I N A R Y
equivalent to a hardware POR reset. If the mask option of the permanently
enabled watch-dog timer is selected, it runs when power up. If the option is not
selected, the WDT is initially enabled by executing the WDT instruction and
refreshed on subsequent executions of the WDT instruction.
The WDT instruction does not affect the Zero (Z), Sign (S) , and Overflow (V) flags.
Permanently enabled WDTs are always enabled, and the WDT instruction is used
to refresh it. The WDT cannot be disabled after it has been initially enabled. The
WDT is off during both HALT and STOP modes.
The WDT circuit is dri ven by an on-board RC oscillator. The time-out period for the
WDT is fixed to a typical value (see Table 57 on page 90).
Power Management
In addition to the standard RUN mode, the Z8 supports three power-down modes
to minimize device current consumption. The following three modes are supported:
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
22
•
HALT
•
STOP
•
Low-Voltage Standby
Table 6 shows the status of the internal CPU clock (SCLK), the internal Timer
clock (TCLK), the external oscillator, and the Watch-Dog Timer duri ng the RUN
mode and three low-power modes.
Table 6. Clock Status in Operating Modes
Operating ModeSCLK TCLKExternal OSC WDT*
RUNOnOnOnOn
HALT OffOnOnOff
STOPOffOffOffOff
Low-Voltage StandbyOffOffOffOff
Note: * When WDT is enabled by the mask option bit
Using the Power-Down Modes
In order to enter HALT or STOP mode, it is necessary to first flush the instruction
pipeline to avoid suspending execution in mid-instruction. You can flush the
PS003807-1002P R E L I M I N A R Y
Z86D990/Z86D991 OTP and Z86L99X ROM
Low-Voltage Microcontrollers with ADC
instruction pipeline by executing a NOP (Op Code = FFh) immediately before the
appropriate sleep instruction. For example:
Mnemonic CommentOp Code
NOP; clear the pipeline
STOP; enter STOP mode
FFh
6Fh
or
Mnemonic CommentOp Code
NOP; clear the pipeline
HALT; enter HALT mode
FFh
7Fh
23
HALT
HALT mode suspends instruction execution and turns off the internal CPU clock
(SCLK). The on-chip oscillator circuit remains active, so the internal Timer clock
(TCLK) continues to run and is applied to the counter/timers and interrupt logic.
An interrupt request, either internally or externally generated, must be executed
(enabled) to exit HALT mode. After the interrupt service routine, the program continues from the instruction immediately following the HALT.
The HAL T mode can also be exited by a POR. In thi s case, the program execution
restarts at the reset address
000Ch.
STOP
STOP mode provides the lowest possible device stan dby current. This instruction
turns off both the internal CPU clock (SCLK) and internal Timer clock (TCLK) and
reduces the standby current to the minimum.
The STOP mode is terminated by a POR or SMR source. Terminating the STOP
mode causes the processor to restart the application program at address
Note:
When the STOP instruction is execut ed, the microcontroller goes into the
000Ch.
STOP mode despite any state/change of the state of the port. The ports
need to be checked immediately before the NOP and ST OP instru ctions to
ensure the right input logic before wai ting for the change of the ports.
Stop Mode Recovery Sources
Exiting STOP mode using an SMR source is greatly simpli fied in the Z86D99/
Z86L99 family. The Z86D99/Z86L99 family of products allows 16 individual I/O
PS003807-1002P R E L I M I N A R Y
Loading...
+ 72 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.