Documente Academic
Documente Profesional
Documente Cultură
B
-:a
n
n
==
z
-t
:a
=
r-
r-
m
:a
en
1991
-
Table of Contents
Introduction ................................................................................................................................................................... 1
Prod uct Application Portlol io ........................................................................................................................................... 3
Product Reference Chart ................................................................................................................................................. "
CMOS Products
Z86COO/Cl0/C20 CMOS Z81!1 OTP Microcontroller Product Specification ..................................................................... 9
Z86C06 CMOS Z8 CCpN Preliminary Product Specification. ......... ..................... .................... ................ ..... ........ .. .. 21
Z86C08 CMOS Z8 8-Bit Microcontroller Product Specification .................................................................................... 71
Z86E08 CMOS Z8 OTPMicrocontrolier Product Specification ................................................................................... 10~
Z86C09/19 CMOS Z8 CCP Product Specification ...................................................................................................... 1t13
Z86E19 CMOS Z8 OTP Microcontroller Advance Information Specification ............................................................. 187
Z86Cll CMOS Z8 Microcontroller Product Specification ........................................................................................... 189
Z86C12 CMOS Z81CE Product Specification ............................................................................................................. 221
Z86C21 CMOS Z8 Microconlroller Product Specification ........................................................................................... 257
Z86E21 CMOS Z8 OTP Microcontroller Product Specification ................................................................................... 289
Z86C30 CMOS Z8 CCP Product Specification ........................................................................................................... 333
Z86E30 CMOS Z8 OTP CCP Product Specification .................................................................................................... 383
Z86C40 CMOS Z8 CCP Product Specification ................................................................. "......................................... "29
Z86E40 CMOS Z8 OTP CCP Product Specification .................................................................................................... "87
Z86C27/97 CMOS Z8 Digital Television Controller (DTCN) Product Specification ..................................................... 5"1
Z86127 Low-Cost Digital Television Controller (LDTC) Advance Information Specification ....................................... 593
Z86C50 CMOS Z8 CCP ICE Advance Information Specification ................................................................................ 6"1
Z86C61 CMOS Z8 Microcontroller Advance Information Specification ...................................... , ............................... 657
Z86C62 CMOS Z8 Microcontroller Advance Information Specification ............... :...................................................... 659
Z86C89/C90 CMOS Z8 CCP Product Specification .................................................................................................... 661
Z86C91 CMOS Z8 ROMless Microcontroller Product Specification ........................................................................... 719
Z86C93 CMOS Z8 ROMless Microcontroller Preliminary Product Specification ........................................................ 751
Z86C94 CMOS Z8 ROMless Microcontroller Advance Product Specification ............................................................ 789
Z86C96 CMOS Z8 ROMless Microcontroller Advance Information Specification ...................................................... 791
Z88COO CMOS Super8N Microcontroller Advance Information Specification ............................................................ 793
NMOS Products .
Z8600 NMOS Z8 Microcontroller Product Specification ............................................................................................ 799
Z8601/03/11/13 NMOS Z8 Microcontroller Product Specification .............................................................................. 811
Z8602 NMOS Z8 8-Bit Keyboard Controller Preliminary Product Specification .......................................................... 829
Z8604 NMOS Z8 8-Bit Microcontroller Product Specification .................................................................................... 859
Z8612 NMOS Z8 ICE Product Specification ............................................................................................................... 881
Z8671 Z8 NMOS MCU With BASIC/Debug Intrepreter Product Specification ......................................................... 919
Z8681/82 NMOS Z8 ROMless Microcontroller Product Specification ......................................................................... 939
Z8691 NMOS Z8 ROMless Microcontroller Product Specification .............................................................................. 961
Z8800/01/20/22 Super8 ROMless. ROM Product Specification ................................................................................. 979
Peripheral Products
Z86128 Closed-Captioned Controller (CCC) Advance Information Specification .................................................... 1013
ZY65A Floppy Disk Controller (FOC) Product Specification ..................................................................................... 1025
Z5380 SCSI Product Specification ............................................................................................................................ 1053
Z53C80 SCSI Advance Information Specification ..................................................................................................... 1089
Table of Contents
Additional Information
ZS Support Products ................................. ,'............................................................................................................... 1307
Zilog Quality and Reliability Report ........................................................................................................................... 1337
Literature List ............................................................................................................................................................. 1339
Package Information ................................................................................................................................................. 1345
Ordering Information .............................................................................. : .................................................................. 1361
ii
MICROCONTROLLERS
~ZiIm ZILOG Z8® FAMILY
AN INDUSTRY STANDARD 8-BIT
SINGLE-CHIP ARCHITECTURE WITH
VALUE ADDED INTEGRATION
The Zilog Z8 Microcontroller Family has long been a All of Zilog's high integration family are created using
recognized leader in single-chip architecture. Today, Zilog Zilog's Superintegration~ technology. Zilog pioneered the
continues to expand that leadership with an ever growing Superintegration process as the science of creating highly
array of new high integration Z8-based products including efficient, powerful ICs with fully characterized cores and
the Close Caption chip, the Z86128 and the Z86C94, a cells. Zilog's core and cell library is one of the largest
high integration controller with DSP. The expanded family proprietary libraries in the semiconductor industry. Zilog
offers Value Added Integration for a wide variety of appli- uses Superintegration technology to produce a wide vari-
cations such as consumer products, television control, ety of ASSPs (Application Specific Standard Products)
automotive, mass storage and computer peripherals. This that offer great cost/performance benefits and the ability to
edition of the Z8 Microcontroller Data Book describes this customize in software rather than hardware with minimal
entire family of devices including ROM, ROMless and OTP cost and the highest possible quality.
(One-Time-Programmable) versions, as well as the devel-
opment support tools available from Zilog.
2
Product Application Portfolio
I Z86C94
IS'~I IZ86C96
(New)
Z86C62
(New)
Z86C93
(New)
I-
I Z86C61
Z86C21
(New)
I Z86C91
C11IE21- I Z86127
(New)
Z86C21
1E211E22_
IZ86C4D
1E4D
- Z86128
(New) I-
s:::::
Z86C3D _
1
1E3D IZ86C3D
1E3D
o
;:
co IZ86CD8 _
IED8 Z86CD9 IZ86CD8
IED8
r-
J.. /19
-
C)
CD Z86CD6 -
E19(New) Z86CD6 I--
s::::: Z8611
'C Z86Dl
I Z8691
CD IZ538D
'C
'C I Z860D r- Z765A -
c:(
Z86D4 I- -
CD
::J
co
>.. . . . ............... - . . . _.
Consumer TelevIsIon Automotive Mass Storage Computet Peripherals
Market Segments
3
"'"
REFERENCE CHA~~ MICROCONTROILLERS
Pin ROM
Product Count (Kbyte) 1/0 Interrupts UARTS Comparators CTCs WDT Package Type Speed Temp Low Noise
CMOS
Z86COOMCU 28 2 22 3 - - 2 - DIP 8,12 S,E -
Z86C06MCU 18 1 14 5 - 2 2 X DIP,SOIO' 4*,8,12 S,E X
Z86C08MCU 18 2 14 5 - 2 2 X DIP,SOIO' 4*,8,12 S,E X
Z86E08 MCU 18 2 (OTP) 14 5 - 2 2 X DIP 4*,8,12 S X
Z86C09/19 18 2/4 14 5 - 2 2 X DIP,SOIO' 4*,8,12 S,E -
Z86C10 MCU 28 4 22 3 - 2 - DIP 8,12 S,E -
Z86C11 MCU 40,44 4 32 6 1 - 2 - OFP,DIP,PLCC 12,16 S,E -
Z86C12 ICE 84 32 16 6 1 2 - PGA 16 S -
Z86E19 MCUt' 18 4 (OTP) 14 5 - 2 2 X DIP 12 S X
Z86C20MCU 28 8 22 3 - - 2 - DIP 12 S X
Z86C21 MCU 40,44 8 32 6 1 - 2 - OFP,DIP,PLCC 4*,12,16 S,E X
Z86E21/E22* MCU 40,44 8 (OTP) 32 6 1 2 - OFP,DIP,PLCC 4*,12,16 S X
Z86C91 MCU 40,44 - 16 6 1 - 2 - OFP,DIP,PLCC 12,16,20 S,E -
Z86C30MCU 28 4 24 6 - 2 2 X DIP 4*,8,12 S,E X
Z86E30MCU 28 4 (OTP) 24 6 - 2 2 X DIP 12 S X
Z86C40 MCU 40,44 4 32 6 - 2 2 X OFP,DIP,PLCC 4*,8,12 S,E X
Z86E40 MCU 40,44 4 (OTP) 32 6 - 2 2 X OFP,DIP,PLCC 12 S X
Pin ROM
Product Count (Kbyte) 1/0 Interrupts UARTS Comparators CTCs WDT Package Type Speed Temp Low Noise
NMOS
Z8600 MCU 28 2 22 3 - - 2 DIP 8 S,E -
Z8601/02 MCU 40,44 2 32 6 1 - 2 DIP,PLCC 4',8 S,E X'
Z8603 PROTOPACK 40 2 32 6 1 - 2 DIP 8,12 S -
Z8604 MCU 18 1 14 5 - 2 X DIP 8 S -
Z8610MCU 28 4 22 3 - - 2 - DIP 8,12 S,E -
Z8611 MCUt 40,44 4 32 6 1 - 2 - DIP,PLCC 8,12.5 S,E,M -
Z8681 MCUt 40,44 - 16 6 1 - 2 - DIP,PLCC 8,12 S,E,M -
Z8691 MCU 40,44 - 16 6 1 - 2 - DIP,PLCC 8,12 S,E -
Z8612 ICE 64,68 4 32 6 1 - 2 - PLCC,Ceramic 12 S -
Z8613 PROTOPACK 40 4 32 6 1 - 2 - DIP 8,12 S -
Z8800 SUPER8 48,68 - 24 27 1 - 2 - DIP,PLCC 20 S -
Z8801 SUPER8 44 - 17 27 1 - 2 - PLCC 20 S -
Z8820 SUPER8 48,68 8 40 27 1 - 2 - DIP,PLCC 20 S -
Z8821 SUPER8 44 8 33 27 1 - 2 - PLCC 20 S -
01
CMOS PRODUCTS
7
,.'- z·"m
V."" lub
ADVANCED INFORMATION
Product Specification
Z86COO/C10/C20 CM OS
Z8@MCU
FEATURES
• Complete microcomputer, 2K (86COO), 4K (86Cl0), or 8K • Register Pointer so that short, fast instructions can
(86C20) bytes of ROM, 124 bytes of RAM (256 bytes - Z86C20), access any of nine working-register groups in 1.0
and 22 I/O lines. us.
• 144-byte register file, including 124 (238 - Z86C20) general· • On-chip oscillator which accepts crystal, external
purpose registers, four I/O port registers, and 14 status and control clock drive, LC, ceramic resonator.
registers.
• Standby modes - - Halt and Stop.
• Average instruction execution time of 1.5 us,
maximum of 2.8 us. • Single +5V power supply -- all pins TTL-
compatible.
• Vectored, priority interrupts for I/0 and
counter/timers. • 8 and 12 MHz
GENERAL DESCRIPTION
Z86C10/C20 microcomputer (Figures 1 and 2) introduces a Z86C10/C200ffers faster execution; more efficient use of
new level of sophistication to single·chip architecture. memory; more sophisticated interrupt, input/output and
Compared to earlier single·chip microcomputers, the bit'manipulation capabilities; and easier system expansion.
TIMING ( - . . RESET
AND
CONTROL -- os
pOo
+5V
XTALl
XTAL2
--
~) CLOCK
+5V
XTAL2
XTAL1
P36
P3,
P25
.om{H po,
po,
Z86COD
P3,
P35
=} PORT 3
RESET
os
P2.
P2,
--
po, P36
MCU P35 P2,
......
po,
Z86C1D Plo GND P2,
P05 P1, pOo
MCU P17
.o~,@
P2, Pl,
Z86C2D
........---
PO, P16
P2, Pl, po, P1s
MCU PORT 1
P2, Pl, po, Pl,
.....
P2,
P25
GND
P15
P16
P17 ----- po,
pOs
P10
Pl,
Pl,
Pl,
9
PIN DESCRIPTIONS
OS. Data Strobe (output, active Low). Data Strobe is RESET. Reset (input, active Low). RESET initializes the
activated once for each memory transfer. MCU. When RESET is deactivated, program execution
begins from internal program location OOOCH.
POo·PO s, P10·P17, P21·P2S, P31, P3s, P3 s. 110 Port lines
(bidirectional, TTL-compatible). These 22 I/O lines are XTAL 1, XTAL2. Crystal 1, Crystal 2 (time-base input and
grouped in four ports that can be configured under program output). These pins connect a parallel-resonant
control for I/O. crystal to the on-chip clock oscillator and buffer.
ARCHITECTURE
The MCU's architecture is characterized by a flexible 1/0 Two basic internal address spaces are available to support
scheme, an efficient register and address space structure, this wide range of configurations: program memory and the
and a number of ancillary features that are helpful in many register file. The 144-byte random-access register file is
applications. (Figure 3). composed of 124 general-purpose regi.sters, four 1/0 port
registers, and 14 control and status registers.
Microcomputer applications demand powerful I/O
capabilities. The MCU fulfills this with 22 pins dedicated to To unburden the program from coping with real-time
input and output. These lines are grouped in four ports and problems suCh as counting/timing, two counter/timers with
are configurable under software control to provide timing, a large number of user-selectable modes are offered
status signals, and parallel I/O. on-chip.
OUTPUT XTAL
STANDBY MODE
The Z86COO/C10/C20's standby modes are: A reset input releases the standby mode.
• Stop To complete an instruction prior to entering standby mode,
use the instructions:
• Halt
The Stop instruction stops the internal clock and clock LD TMR, #00
oscillation; the Halt instruction stops the internal clock but NCP
not clock oscillation. STOP or HALT
10
ADDRESS SPACES
Program Memory. The 16-bit program counter addresses Instructions can access registers directly or indirectly with
4K or 8K bytes of program memory space as shown in an a-bit address field. The MCU also allows short 4-bit
Figure 4. register addressing using the Register Pointer (one of the
The first 12 bytes of program memory are reserved for the control registers). In the 4-bit mode, the register file is
divided into nine working-register groups, each occupying
interrupt vectors. These locations contain three 16-bit
vectors that correspond to the three available interrupts. 16 contiguous locations (Figure 6). The Register Pointer
addresses the starting location of the active working-register
Register File. The 144-byte register file includes four 110 group.
port registers (Ro-R3), 124 general-purpose registers
Stacks. An a-bit Stack Pointer (R255) is used for the internal
(R4-R127) and 15 control and status registers (R241-R255)'
These registers are assigned the address locations shown in stack that resides within the 124 general-purpose registers
Figure 5. (R4-R127)'
409B
ON·CHIP
LOCATION OF ROM
FIRST BYTE OF
:~ ~------------
INSTRUCTION
EXECUTED
AFTER RESET
11 IRQ5
10 IRQ5
9 IRQ4
a IRQ4
7 RESERVED
INTERRUPT
VECTOR 6 RESERVED
(LOWER BYTE)
5"'-
410-
IRQ2
IRQ2
INTERRUPT
VECTOR 3 RESERVED
(UPPER BYTE)
2 RESERVED
1 RESERVED
0 RESERVED
251 INTERRUPT MASK REGISTER IMR THE UPPER NIBBLE OF THE REGISTER FILE ADDRESS
IRQ PROVIDED BY THE REGISTER POINTER SPECIFIES
250 INTERRUPT REQUEST REGISTER
THE ACTIVE WORKING-REGISTER GROUP.
249 INTERRUPT PRIORITY REGISTER IPR
--I
24a PORTS 0-1 MODE P01M 127
247 PORT 3 MODE P3M
246 PORT 2 MODE P2M
245
244
243
TO PRESCALER
TIMER/COUNTER 0
T1 PRESCALER
PREO
TO
PREI --I
242
241
TIMER/COUNTER 1
TIMER MODE
T1
TMR --{
127
NOT
IMPLEMENTED
--I SPECIFIED WORKING·
THE LOWER
NIBBLE OF
THE REGISTER
FILE ADDRESS
PORT 3 P3
--I
--I
15
PORT 2 P2
PORT 1 Pl t-----'/OPORTS----- 3
PORT 0 PO
11
COUNTER/TIMERS
The MCU contains two 8-bit programmable counter/timers mode) or to automatically reload the initial value and
(To and T1), each driven by its own 6-bit programmable continue counting (modulo-n continuous mode). The
prescaler. The T1 prescaler can be driven by internal or counters, but not the prescalers, can be read any time
external clock sources; however, the To prescaler is driven without disturbing their value or count mode.
by the internal clock only.
The clock source for T1 is user-definable and can be the
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock divided by
clock source by any number from 1 to 64. Each prescaler four, or an external signal input via Port 3. The Timer Mode
drives its counter, which decrements the value (1 to 256) that register configures the external timer input as an external
has been loaded into the counter. When the counter reaches clock , a trigger input that can be
the end of count, a timer interrupt request-IR04 (To) or retriggerable or non-retriggerable, ,or as a gate input for the
IROs (T1)-is generated. internal clock. The counter/timers' can be programmably
cascaded by connecting the To output to the input of T1.
The counters can be started, stopped, restarted to continue,
'port 3 line P36 also serves as a timer output (TOUT) through
or restarted from the initial value. The counters can also be
which To, T1 orthe internal clock can be output.
programmed to stop upon reaching zero (single-pass
I/O PORTS
The MCU has 22 lines dedicated to input and output Port 2 can be programmed independently as input or
grouped in four ports. Under software control, the ports c'an output and is always available for I/O operations. In addition,
be programmed to provide address outputs, timing, status Port 2 can be configured to provide open-drain outputs.
signals, and parallel I/O. All ports have active pull-ups and
Port 3 can be configured as I/O or control lines. P31 is a
pull-downs compatible with TTL loads.
general purpose input or can be used for an external
Port 0 can be programmed as an I/O port. interrupt request signal (IR0 2). P3s and P36 are general
purpose outputs. P36 is also used for timer input (TIN) and
Port 1 can be programmed as a byte I/O port.
output (TOUT) signals.
INTERRUPTS
The MCU allows three different interrupts from three all subsequent interrupts, saves the Program Counter and
sources, the Port 3 line P31 and the two counter/timers. status flags, and branches to the program memory vector
These interrupts are both maskable and prioritized. The locations reserved for that interrupt. This memory location
Interrupt Mask register globally or individually enables or and the next byte contain the 16-bit address of the interrupt
disables the three interrupt requests. When more than one service routine for that particular interrupt request.
interrupt is pending, priorities are resolved by a
Polled interrupt systems are also supported. To accom-
programmable priority encoder that is controlled by the'
modate a polled structure, ·any or all of the interrupt inputs
Interrupt Priority register.
can be masked and the Interrupt Request register polled to
All interrupts are vectored. When an interrupt request is determine which of the interrupt requests needs service.
granted, an interrupt machine cycle is entered. This disables
CLOCK
12
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to Assignment of a value is indicated by the symbol "+-". For
describe the addressing modes and instruction operations example,
as shown in the instruction summary.
dst +- dst + src
IRR Indirect register pair or indirect working-register
indicates that the source data is added to the destination
pair address
data and the result is stored in the destination location. The
Irr Indirect working-register pair only
notation "addr(n)" is used to refer to bit "n" of a given
X Indexed address
location. For example, .
DA Direct address
RA Relative address dst(7)
1M Immediate
refers to bit 7 of the destination operand.
R Register or working-register address
r Working-register address only Flags. Control Register R252 contains the following six
IR Indirect-register or indirect working-register flags:
address
C Carry flag
Ir Indirect working-register address only
Z Zero flag
RR Register pair or working register pair address
S Sign flag
Symbols. The following symbols are used in describing the V Overflow flag
instruction set. D Decimal-adjust flag
H Half-carry flag
dst Destination location or contents
src Source location or contents Affected flags are indicated by:
cc Condition code (see list)
@ Indirect address prefix
o Cleared to zero
1 Set to one
SP Stack pointer (control registers 254-255)
PC Program counter
* Set or cleared according to operation
Unaffected
FLAGS Flag register (control register 252)
X Undefined
RP Register pointer (control register 253)
IMR Interrupt mask register (control register 251)
CONDITION CODES
13
INSTRUCTION FORMATS
OPC CCF, 01, E,:,RET, NOP,
RCF, RET, SCF
One-Byte Instructions
OPC MODE CLR, CPL, DA, DEC, OPC MODE ADC, ADD, AND, CP,
dst/src DECW, INC, INCW, POP, LD, OR, SBC, SUB,
OR 11 1 1 01 dst/sre I sre OR
PUSH, RL, RLC, RR, TCM, TM, XOR
RRC, SRA, SWAP dst OR
MODE OPC LD
LD, LDC, LOCI dstlsrc
ADDRESS
LD
ee DPC JP
OR 11 1 1 01 sre
DAu
DAL
dst I OPC LD
VALUE
OPC CALL
INSTRUCTION SUMMARY
14
INSTRUCTION SUMMARY (Continued)
Addr Mode Opcode Flags Affected Addr Mode Opcode Flags Affected
Instruction Byte Instruction Byte
and Operation dst src (Hex) C Z S V D H and Operation dst src (Hex) C Z S V D H
EI 9F RCF CF 0-----
IMR(7)-1 C-O
HALT 7F RET AF
PC-@SP;SP-SP + 2
INCdst rE - * * * --
dst -dst + 1 r= 0 - F RL dst r::1 I-===:l R 90
R 20 L.:.J~-.JIR 91
IR 21
RLC dst r::--=:=l R 10
INCWdst RR AO -***-- ~IR 11
dst-dst + 1 IR A1
IRET SF
RR dst lriJ L6J IRR EO * * * *
* * * * ** C 7 0
E1
FLAGS - @SP; SP - SP + 1
PC - @SP; SP - SP + 2; IMR (7) - 1 RRC dst r=--=::=-l R CO ****--
~IR C1
JP cc,dst OA cD
SBCdst,src (Note 1) 3D
if cc istrue c=0- F
dst -dst -src .... C
PC-dst IRR 30
SCF OF 1-----
JR cc,dst RA cS
C-1
if cc IS true, c = 0 - F
PC .... PC + dst SRA dst lriJ'~ R DO ***0--
Range: + 127, - 128 ~IR 01
LD dst,src 1m rC SRPsrc 1m 31
dst·- src r R r8 RP -src
R r9
STOP 6F
r = 0 - F
r X C7 SUB dst,src (Note 1) 20
X r 07 dst - dst - src
r Ir E3
Ir r F3 SWAP dst I' 52
-r~--",--,-..:.J'IIR
R FO
c...
F1
R R E4
R IR E5 TCM dst,src (Note 1) 60 -**0--
R 1M E6 (NOT dst) AND src
IR 1M E7
IR R F5 TM dst,src (Note 1) 70 -**0--
dstANOsrc
LDC dst,src r Irr C2
dst-src Irr 02 XORdst,src (Note 1) SO -**0--
dst - dst XOR src
LDCI dst,src Ir Irr C3
NOTE: These instructions have an identical set of addressing modes,
dst - src Irr Ir 03
which are encoded for brevity. The first opcode nibble IS found In
r-r+ 1;rr-rr+ 1 the instruction set table above. The second nibble is expressed
LDE dst,src r Irr . symbolically by a 0 in this table, and its value is found In the
82
follOWing table to the left of the applicable addressing mode pair.
dst-src Irr 92
For·example, the opcode of an ADC instruction using the
LDEI dst,src Ir Irr 83 addressing modes r (destination) and Ir (source) is 13.
dst - src Irr Ir 93
r-r + 1;rr .... rr + 1 AddrMode
Lower
NOP FF dst src Opcode Nibble
PUSHsrc R 70 R 1M
SP -SP - 1; @SP-src IR 71
IR 1M
15
REGISTERS
R244 TD
COUNTER/TIMER D REGISTER
(F4H; Read/Write)
NOT To",
USEDMODES
+~ g~~
INTERNAL CLOCK OUT
'" 00
:= ~~
T MODES
11
j
.-J ~~o =
1
NO FUNCTION
1 ::: LOAD T"
0 ;; DISABLE To COUNT
= ENABLE To COUNT
0 :: NO FUNCTION
~I -
COUNT MODE
0 '" To SINGLE PASS
1 = To MODULO·N
RESEAVED
EXTERNAL Cl.OCK IN~~T =00 . 1 =LOAD 1,
GATE INPUT :c 01 0 ::: DISABLE T, COUNT
PAESCALEA MODULO
(NON-A~~~g~~~~:~~1 '" 10 - , = ENABLE T, COUNT (RANGE: 1-84 DECIMAL
01~OO HEX)
TRIGGER INPUT = 11
(RETRIGGERABLE)
R242T1 R246P2M
COUNTER TIMER 1 REGISTER PORT 2 MODE REGISTER
(F2H; Read/Write) (F6H; Write Only)
I~I~I~I~I~I~I~I~I
~
L T, INITIAL VALUE (WHEN WRITTEN)
---(RANOE 1-256 DECIMAL 01-00 HEX)
T, CURRENT VALUE (WHEN READ)
R243PRE1 R247P3M
PRESCALER 1 REGISTER PORT 3 MODE REGISTER
(F3H; Write Only) (F7H; Write Only)
I~I~I~I~I~I~I~I~I
L
~L
COUNTMODE 0 PORT 2 PULL·UPS O~EN
DRAIN
o = TI SINGLE·PASS 1 PORT 2 PUlL·UPS ACTIVE
1 = T, MODULQ·N
CLOCK SOURCE
1 ::0 T, INTERNAL
o '" T 1 EXTERNAL TIMING INPUT
(TIN) MODE
PRESCALER MODULO
(RANGE: 1-64 DECIMAL
01-00 HEX)
'-------RESERVED (must be 0)
16
REGISTERS (Continued)
I~I~I~I~I~I~I~I~I
.~'~'-":.'
INPUT", 01 ] III [ . .".=~ 01 :::: INPUT
~~ll§
' LUSER FLAG Fl
LUSER FLAG F2
HALF CARRY FLAG
DECIMAL ADJUST FLAG
R2491PR R253RP
INTERRUPT PRIORITY REGISTER REGISTER POINTER
(F9H; Write Only) (FDH; ReadlWrite)
I~I~I~I~I~I~I~I~I
o=
."~.:J
IR03, IROS PRIORITY (GROUP A)
IROS :> IRC3
1 '" IRC3 :> IROS
I I III ~.""" .~"""."m
RESERVED
C > A > B
A > B :> C
A :> C :> B
""
==
.:
=
ODD
001
010
011
REGISTER
POINTER
LOON'TeARE
R250lRQ
INTERRUPT REQUEST REGISTER
(FAH; Read/Write)
I~I~I~I~I~I~I~I~I
RESERVED =r-II I IRQ2 = P31 Input
IRQ4 = To
IRQ5 = T,
R25l1MR R255SPL
INTERRUPT MASK REGISTER STACK POINTER
(FBH; Read/Write) (FFH; ReadlWrlte)
I~I~I~!~I~I~I~I~I
17
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 6 7 8 9 A a C o E F
C
6.5
RRC'
6.5
RRC
12.0
LDC
18.0
LOCI
10.5
LD
r---s:s
RCF
R, IR, ".lrr2 lr,. lrr2 f,',x.R2
0
6.5
SRA
6.5
SRA
12.0
LDC
18.0
LOCI
20.0
CALL"
20.0
CALL
10.5
LD
r---es
SCF
R, IR, f2· lrr, Ir2·lrf, IRR, DA '2·x At
6.5
RR
6.5
RR
~5 10.5 10.5 10.5 10.5 '6s
CCF
E LD LD LD LD LD
R, IR, r,. IR2 R2·R, IR2·R, R,.IM IR,.lM
F
8.5
SWAP
8.5
SWAP
6.5
LD
10.5
LD
r---so
HOP
R, IR, Ir'·(2 R2.1R,
Sequence:
Opcode. First Operand. Second Operand
SECOND
OPERAND NOTE: The blank areas are not defined_
18
ABSOLUTE MAXIMUM RATINGS
Voltages on all pins with respect Stresses greater than those listed under Absolute Maximum Ratings may
to GND , , , , , , , , , , , , , ' , ' . , , , ' , , , ,- O,3V to + 7,OV cause permanent damage to the device, This is a stress rating only;
operation of the device at any condition above those indicated in the
Orerating Ambient
operational sections of these specifications is not implied, Exposure to
Temperature , , , , . , , , , . , , ' ,See Ordering Information absolute maximum rating conditions for extended periods may affect
Storage Temperature, , , , , , , ' , , , , ' ,- 65°C to + 150°C deVice reliability,
2,1K
The DC characteristics listed below apply for the following
standard test conditions, unless otherwise noted, All
voltages are referenced to GND, Positive current flows into
the referenced pin,
Standard conditions are as follows:
• +4.5 ~ Vee ~ +5.5
• GND = OV
Figure 12. Test Load 1
DC CHARACTERISTICS
VCH Clock Input High Voltage 3,B VCC V Driven by External Clock Generator
VCL Clock Input Low Voltage -0.3 O,B V Driven by External Clock Generator
VIH Input High Voltage 2,0 VCC V
VIL Input Low Voltage -0,3 O,B V
VRH Reset Input High Voltage 3.B VCC V
VRL Reset Input Low Voltage -0,3 O,B V
NOTE:
Icc2 low power requires loading TMR (%F1)
with any value prior to stop execution.
Use sequence:
LD TMR, #%00.
Nap
STOP
19
Figure 14. Additional Timing
AC CHARACTERISTICS
Additional TimingTable
Z86C10
Number Symbol Parameter Min Max Notes·
NOTES:
1. Clock timing references use 3.BV for a logic "1" and o.av for a logic "0':
2. Timing references use 2.0V for a logic "1" and O.BVfor a logic "0':
3. Interrupt request via Port 3 .
• Units in nanoseconds (ns).
20
PRELIMINARY PRODUCT SPECIFICATION
Z86C06
CMOS Z8® CCpnt
CONSUMER CONTROLLER PROCESSOR
FEATURES
GENERAL DESCRIPTION
The Z86C06 CCP (Consumer Controller Processor) is a The device applications demand powerful I/O capabilities.
member of the Z8 single-chip microcontroller family with The CCP fulfills this with 14 pins dedicated to input and
1 Kbyte of ROM, and 124 bytes of General Purpose RAM. output. These lines are grouped into two ports, and are
The device is housed in an 18-pin DIP, and is manufactured configurable under software control to provide iiming,
in CMOS technology. Zilog's CMOS microcontroller offers status signals, or parallel I/O.
fast execution, efficient use of memory, sophisticated
interrupts, input/output bit manipulation capabilities, and Three basic address spaces are available to support this
E;lasy hardware/software system expansion along with low wide range of configurations; Program Memory, Register
cost and low power consumption. File, and Expanded Register File. The Register File is
composed of 124 bytes of General-Purpose Registers, two
The Z86C06 architecture is based on Zilog's 8-bit I/O Port registers and fifteen Control and Status registers.
microcontroller core with the addition of an Expanded The Expanded Register File consists of four control reg-
Register File which allows access to register mapped isters, SPI Receive Buffer, and the SPI compare register.
peripheral and I/O circuits. The CCP offers a flexible I/O
scheme, and a number of ancillary features that are useful
in many consumer, industrial, automotive, and advanced
scientific applications.
21
GENERAL DESCRIPTION (Continued)
Port 3 Machine
Timing & Insl.
.-----f Control
Counterl
WDT, PCR
Timers (2) ALU
Interrupt FLAG
Control Prg. Memory
1024 x a-Bit
Serial
Peripheral
Interface
Port 2
1/0
(Bit Programmable)
22
PIN DESCRIPTION
PIN FUNCTIONS
XTAL 1. Crystal 1 (time-based input). This pin connects a Port 2 P20-P27. Port 2 is an a-bit, bi-directional, CMOS
parallel-resonant crystal, ceramic resonator, LC or RC compatible I/O port. These 8 I/O lines can be configured
network or an external single-phase clock to the on-chip under software control to be an input or output, indepen-
oscillator input. dently. Input buffers are Schmitt-triggered and contain
Auto-Latches. Bits programmed as outputs may be globally
XTAL2. CrystaI2(time-based output). This pin connects a programmed as either push-pull or open drain (Figure 3a
parallel-resonant crystal, ceramic resonator, LC or RC and 3b). In addition when the SPI is enabled. P20 functions
network to the on-chip oscillator output. as data-in (01), and P27 functions as data-out (~O) for tile
SPI.
23
PIN FUNCTIONS (Continued)
-
P27
P26 ... .
P25 ... ...
P24
Z86C06
P23 .. . Port 2 (1/0)
P22
P21
P20
- Port 2
Open Drain - - - - - - - - - - ,
P21-P260E ---t---i
PAD
P21-P26 IN
r -----------
I Auto Latch
I I
I
R~500Kn
I_ _ _ _ _ _ _ _ _ _ _ _ --1I
24
Open Drain
P200E
SPIEN
PAD
P20lN
or
SPIDI
r -----------
I Auto Latch
I I
:____________
R= 500Kn JI
Open Drain
Standard
P270UT 0
SPI
SPIDO
PAD
P270E Standard
0
SPI
I
SPIActive
seON
1021 o SPI DO Enable
1 P270UT
·SPI must be enabled with DO.
P27 IN - _ _ _ _<
r -----------
I Auto Latch
I I
:____________
R= 500Kn JI
25
PIN FUNCTIONS (Continued)
Auto-latch. The Auto-Latch puts valid CMOS levels on all parators can process analog signals on P31 and P32 with
CMOS inputs that are not externally driven. Whether this reference to the voltage on P33. The analog function is
level is zero or one cannot be determined. A valid CMOS enabled by programming Port 3 Mode Register (bit 1). Pins
level ratherthan a floating node reduces excessive supply P31 and P32 are programmable as falling, rising, or both
current flow in the input buffer. edge triggered interrupts (IRQ register bits 6 and 7). P33
is the comparator reference voltage input. Access to
Port 3 P31-P36. Port 3 is a 6-bit. CMOS compatible, port. Counter/Timer 1 is made through P31 (Tin)and P36(Tout).
These six lines consist of three fixed inputs (P31-P33) and Pin P34 can also be configured as SPI clock (SK),
three fixed outputs (P34-P36). Pins P31, P32 and P33 are input and output, and pin P35 can be configured as Slave
standard CMOS inputs (no auto-latches) and pins P34, select (SS) in slave mode only, when the SPI is enabled
P35, and P36 are push-pull outputs. Two on-board com- (Figures 4a. and 4b.).
-
P36 I------~
P$ I------~
P34 I - - - - - - - J..~
Port 3
Z86C06
(1/0 or Control)
P33 ~-------
P32 ~-------
P3l
Port 3
R247=P3M
1 = Analog
0= DigHai
, . - - - - - - , DIG. ~
P3l (AN1) ":"1' 0 - - - - - - 0 IR02, Tin, P3l Data Latch
I
1
P32(AN2)
,
1
1
1
,
P33 (REF) I
1
I
26
SKIN
SPI EN -----f
SPI MSTR - - - - ;
PAD
SPI EN - - - - - ,
P31~t
REF . I
I
I
I
ss -------------<
I
I SPIEN
I
I SPIMSTR
I
I PAD
P32~
REF
PCON
DO 0 P34, P35 Standard Output
'--_ _ _ _ _--'--' 1 P34, P35 Comparator Output
PORT Configuration Register (peON). The PORT Con- standard I/O configuration. Bits 5 and 6 of this register
figuration Register (peON) configures the port's individu- configure Port's 2 and 3, respectively, for low EMI opera-
ally for; comparator output on Port 3, low EMI noise on tion. A 1 in these locations configures the port for standard
Port's 2 and 3, and low EMI noise oscillator. The peON operation, and a 0 configures the port for low EMI opera-
Register is located in the Expanded. Register File at bank tion. Finally, bit 7 of the peON Register controls the low EMI
F, location 00 (Figure 5). BilO controls the comparator use noise oscillator. A 1 in this location configures the oscillator
in Port 3. A 1 in this location brings the comparator outputs with standard drive, while a 0 configures the oscillator with
to P34 and P35 (Figure 4b), and a 0 releases the Port to its low noise drive.
27
PIN FUNCTIONS (Continued)
Low EMI Option. The Z86C06 can be programmed to Recovery sources are used to toggle the P33 bit or gener-
operate in a low EMI emission mode by the PCON register. ate IR01. In digital mode, Pin P33 can be used as a P33
The oscillator and all I/O ports can be programmed as low register input or IR01 source (Figure 17).
EMI emission mode independently. Use of this feature
results in: PCON (F) 00
Comparator Inputs. Port 3, Pin P31.and Pin P32 each have low EMI Oscillator
o low EMI Noise
a comparator front end. The comparator reference volt- 1 Standard'
age, Pin P33, is common to both comparators. In analog • Delault Setting Alter Power·On Reset Only.
mode, the P33 input functions as a reference voltage to the
comparators. The internal P33 register and its correspond-
ing IR01 is connected to the STOP Mode Recovery source Figure 5. PORT Configuration Register (PCON)
selected by the SMA. In this mode, any of the STOP Mode
28
FUNCTIONAL DESCRIPTION
The l8 CCP incorporates special functions to enhance the group (Figure 8). Three system configuration registers
l8's application in consumer, automotive, industrial, sci- reside in the Expanded Register File address space in
entific research, and advanced technologies applica- Bank F, while three SPI registers reside in Bank C.lhe rest
tions. of the Expanded Register addressing space is not physically
implemented, and is open for future expansion. To write to
RESET. The device is reset in one of the following condi- the ERF, the upper nibble of the I1P must be zero. To write
tions: to the rest of the register file, the lower nibble must be zero.
The device does not re-initialize the WDTMR, SMR, P2M, Location of On-Chip
or P3M registers to their reset values on a STOP Mode First Byte of ROM
Recovery operation. fnstruction
Executed '-...... - - - - - - - - - -
Program Memory. l86C06 can address up to 1 Kbytes of After RESET 12 l"-
internal program memory (Figure 6). The first 12 bytes of
program memory are reserved for the interrupt vectors. ii IROS
These locations contain six 16-bit vectors that correspond
to the six available interrupts. Byte 13 to byte 1023 consists 10 IROS
of on-chip, mask-programmed ROM.
9 IR04
ROM Protect. The 1 Kbytes of Program Memory is mask
8 fR04
programmable. A ROM protect feature will prevent
"dumping" of the ROM contents by inhibiting execution of
7 IR03
the LDC and LDCI instructions to program memory in all Interrupt
modes. Vector 6 IR03
(Lower Byte)
Expanded Register File. The register file has been ex-
panded to allow for additional system control registers and
S I"- IR02
~~
for mapping of additional peripheral devices and inpuV IR02
output ports into the register address area. The l8 register Interrupt
address space RO through R15 is implemented as 16 Vector 3 IR01
groups of 16 registers per group (Figure 7). These register (Upper Byte)
groups are known as the ERF (Expanded Register File). 2 IR01
Bits 3:0 of the Register Pointer (RP) select the active ERF
group. Bits 7:4 of register RP select the working register 1 IROO
0 IROO
29
FUNCTIONAL DESCRIPTION (Continued)
REGISTER
REGISTER POINTER
SPL U U U U U U U U
GPR U U U U U U U U
RP 0 0 0 0 0 0 0 0
%Fe FLAGS U U U U U U U U
%FB IMR 0 U U U U U U U
"10 FA IRQ 0 0 0 0 0 0 0 0
%F9 IPR U U U U U U U U
%FB P01M U U U 0 U U U U
. %F7 P3M U U U U U U 0 0
. %FG P2M 1 1 1 1 1 1 1 1
%F5 PREO U U U U U U U 0
%F4 TO U U U U U U U U
zs Reg. File %Fa PRE1 U U U U U U 0 0
%FF %F2 T1 U U U U U U U U
%F1 TMR 0 0 0 0 0 0 0 0
%FO Reserved
%(F)~E Reserved
% (F)OO Reserved
Reserved
. % (F)oe
%(F)OB SMR 0 0 1 0 0 0 0 0
%(F)OA Reserved
%(F)09 Reserved
%(F)OG Reserved
%OF
%00 % (F)07 Reserved
% (F)OG Reserved
%(F)OS Reserved
%(F)04 Reserved
Reserved
Reserved
Reserved
peON 1 1 1 U U U U 0
RxBUF
SCOMP
30
R253 RP ttle Expanded Register Group (Figure 7). Tile instructions
can access registers directly or indirectly via an 8-bit
address field. Tilis allows a sllort 4-bit register address
using tile Register Pointer (Figure 9). In tile 4-bit mode, tile
Register File is divided into 16 working register groups,
eacll occupying 16 continuous locations. Tile Register
Expanded Register Group Pointer addresses tile starting location of tile active work-
ing-register group.
Working Register Group
Note: Default Setting After Reset = 00000000 Note: Register Bank EO-EF is only accessed tllrougll
working registers and indirect addressing modes.
Figure 8. Register Pointer Register Caution: D4 of Controt Register POl M (R251) must be O. If
the Z86C06 is emulated by Z86C90, D4 of POl Milas to
change to 0 before submission to ROM code.
Register File. Tile Register File consists of two I/O port
registers, 124 general purpose registers, 15 control and GPR. Tile Z86C061las one extra General Purpose Regis-
status registers, and four system configuration registers in ter located at %FE(R254).
R127
R15
-- - - - - - - - R3
110 Ports
31
FUNCTIONAL DESCRIPTION (Continued)
Stack. The Z86C06 has an 8-bit Stack Painter (R255) used Countermmers. There are two 8-bit programmable counter/
for the internal stack that resides within the 124 general- timers (TO-T1 ). each driven by its own 6-bit programm able
purpose registers. prescaler. The T1 prescaler can be driven by internal or
external clock sources. however. the TO prescaler is driven
by the internal clock only (Figure 10).
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6·Bit S·bit
Down Down
. . - -. . Internal Counter Counter IRQ4/SPI
Clock
External Clock
1---- TOUT
P36
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
ljN P31
32
The 6-bit prescalers divide the input frequency of the clock internal microprocessor clock divided by four, or an exter-
source by any integer number from 1 to 64. Each prescaler nal signal input via Port 3. The Timer Mode register config-
. drives its counter, which decrements the value (1 to 256) ures the external timer input (P31) as an external clock, a
that has been loaded into the counter. When the counter trigger input that can be retriggerable or non-retriggerable,
reaches the end of count, a timer interrupt request-IRQ4 or as a gate input for the intemal clock. Port 3, line P36
(TO) or IRQ5 (T1), is generated. serves as a timer output (Tout) through which TO, T1 or tile
internal clock can be output. The counter/timers can be
The counters are programmed to start. stop, restart to cascaded by connecting the TO output to the input of T1.
continue, or restart from the initial value. The counters can
also be programmed to stop upon reaching zero (single- Interrupts. The Z86C06 has six different interrupts from six
pass mode) or to automatically reload the initial value and different sources. The interrupts are mask-able and priori-
continue counting (modulo-n continuous mode). tized (Figure 11). The six sources are divided as follows;
three sources are claimed by Port 3 lines P31-P33, two
The counters, but not the prescalers, are read at any time sources in the counter/timers, and one source for tile SPI.
without disturbing their value or count mode. The clock The Interrupt Mask Register globally or singularly enables
source for T1 is user-definable and can be either the or disables the six interrupt requests (Table 2).
IROO IR02
IR01, 3, 4, 5
Interrupt ' -_ _
Edge IRa (DS, D7)
Select
Global
Interrupt
Enable
Interrupt
Request
Vector Select
33
FUNCTIONAL DESCRIPTION (Continued)
Note:
When SPI is enabled IRQ3 is an internal interrupt.
When more than one interrupt is pending, priorities are Table 3. IRQ Register
resolved by a programmable priority encoder that is con-
trolled by the Interrupt Priority register. An interrupt ma- IRQ Interrupt Edge
chine cycle is activated when an interrupt request is 07 06 P31 P32
granted. This disables all subsequent interrupts, saves the
Program Counter and Status Flags, and then branches to
o o F F
the program memory vector location reserved for that
o 1 F R
interrupt. All Z86C06 interrupts are vectored through loca-
1 o R F
1 1 RtF RtF
tions in the program memory. This memory location and
the next byte contain the 16-bit starting address of the Notes:
interrupt service routine for that particular interrupt re- F = Falling Edge
quest. R = Rising Edge
To accommodate polled interrupt systems, interrupt in- Clock. The Z86C06 on-chip oscillator has a high-gain,
puts are masked and the interrupt request register is parallel-resonant amplifier for connection to a crystal, RC,
polled to determine which of the interrupt requests needs ceramic resonator, or any suitable external clock source
services. When the SPI is disabled, IR03 has no hardware (XTAL 1 = Input, XT AL2 = Output). The crystal should be AT
source but can be invoked by software (write to IR03 cut, 10KHz to 12 MHz max, with a series resistance (RS)
Register). When the SPI is enabled, an interrupt will be less than or equal to 100 Ohms.
mapped to IR03 after a byte of data has been received by
the SPI Shift Register. The crystal is connected across XT AL 1 and XT AL2 using
the recommended capacitors (C1 =C2 is more than or
An interrupt resulting from AN1 is mapped into IR02, and equal to 22 pF) from each pin to ground. The RC oscillator
an interrupt from AN2 is mapped into IROO. Interrupts option is mask-programmable, to be selected by the
IR02 and IROO may be rising, falling, or both edge trig~ customer at the time the ROM code is submitted. The RC
gered, and are programmable by the user. The software oscillator configuration must be an external resistor con-
can poll to identify the state of the pin. nected from XTAL 1 to XT AL2, with a frequency-setting
capacitor from XTAL 1 to ground (Figure 12).
The programming bits for the INTERRUPT EDGE SELECT
are located in the IRO register (R250), bits 07 and 06. The
configuration is shown in Table 3. .
34
r-~~--lXTAL1 .--~~--l XTAL1 XTAL1 -ll»-----l XTAL1
C1 C1
L
I R
The RC value vs Frequency curves are shown in Figure 54 HALT. Will turn off the internal CPU clock but not tile XTAL
and 55, (Limitation: The RC option is not available in the 12 oscillation, The counter/timers and external interrupts IROO,
MHz part.) In addition, a special feature has been incorpo- IR01, and IR02 remain active, Tile device is recovered by
rated into the Z86C06; in low EMI noise mode (bit 7 of interrupts, either externally or internally generated,
PCON register=O) with the RC option selected, the oscilla-
'tor is targeted to consume considerately less ICC current STOP. This instruction turns off tile internal clock and
at frequencies of 10 KHz or less, external crystal oscillation and reduces tile standby cur-
rent to 10 microamperes or less, The STOP mode is
Power-On Reset. A timer circuit clocked by a dedicated terminated by a RESET of eitller WDT timeout, pon, Sf'l
on-board RC oscillator or by the XTAL oscillator is used for compare, or SMFl recovery, Tilis causes tile processor to
the Power-On Reset (POR) timer function, The POR time restart tile application program at address oooe (HF'X),
allows Vee and the oscillator circuit to stabilize before Note, the crystal remains active in STOP mode if bits 3 and
instruction execution begins, The POR timer circuit is a 4 of tile WDTMR are enabled, In this mode, only tile watcll
one-shot timer triggered by one of the three conditions: dog timer runs in STOP mode,
• Power fail to Power OK status In order to enter STOP (or HALT) mode, it is necessary to
first flustl the instruction pipeline to avoid suspending
• STOP mode recovery (If 05 of SMR=1) execution in mid-instruction, To do this, tile user executes
a NOP (opcode=FFH) immediately before the appropriate
• WOT timeout sleep instruction, i.e,:
The POR time is a nominal 5 ms, Bit 5 of the STOP Mode FF NOP; clear tile pipeline
Register determines whether the POR timer is bypassed 6F STOP; enter STOP mode
after STOP mode recovery (typical for external clock, and or
RC/LC oscillators with fast start up time), FF NOP; clear the pipeline
7F HALT; enter HALT morJe
35
FUNCTIONAL DESCRIPTION (Continued)
Serial Peripheral Interface (SPI). The Z86C06 incorporates Shift Register, through the DI pin, which has the same
a serial peripheral interface for communication with other address as the RxBUF Register. After a byte of data has
microcontrollers and peripherals. The SPI includes fea- been received by the SPI Shift Register, a Receive Char-
tures such as STOP Mode Recovery, Master/Slave se- acter Available (RCA/IRQ3) flag and interrupt is gener-
lection, and Compare mode. Table 4 contains the pin ated. The next byte of data will be received althis time. The
configuration for the SPI feature when itis enabled. The SPI RxBUF Register must be cleared, or a Receive Character
consists offour registers; SPI Control Register (SCaN), SPI Overrun (RxCharOverrun) flag will be set in the SCaN
Compare Register (SCaMP), SPI Receive/Buffer Register Register, and tile data in the RxBUF Register will be
(RxBUF), and SPI Shift Register. SCaN is located in bank overwritten. When the communication between the master
(C) of the Expanded Register Group at address 02 (Figure and slave is complete, the SS goes inactive.
13). This register is a read/write' register that controls;
Master/Slave selection, interrupts, clock source and phase Unless disconnected, for every bit that is transferred into
selection, and error flag. Bit 0 enables/disables the the slave through the DI pin, a bit is transferred out tllrougll
SPI with the default being SPI disabled. A one in this the DO pin on the opposite clock edge. During slave
location will enable the SPI, and a 0 will disable the SPI. Bits operation, the SPI clock pin (SK) is an input. In master
1 and 2 of the SCaN register in Master mode select the mode, the CPU must first activate a SS tllrough one of it's
clock rate. The user may choose whether internal clock is I/O ports. Next, data is transferredthrougllthe master's DO
divide by 2, 4, 8 or 16. In slave mode, Bit 1 of this register pin one bit per master clock cycle. Loading data into tile
flags the user if an overrun of the RxBUF Register has shift register initiates tile transfer. In master mode, the
occurred. The RxCharOverrun flag is only reset by writing master's clock will drive the slave's clock. At the conclu-
a 0 to this bit. In slave mode, bit 2 of the Control Register sion of a transfer, a Receive Character Available (RCA/
disables the data-out I/O function. If a 1 is written to this bit. IR03) flag and interrupt is generated. Before data is
the data-out pin is released to it!:l original port configura- transferred via the DO pin, tile SPI Enable bit in the SCON
tion. If a 0 is written to this bit, the SPI shifts out one bit for Register must be enabled. \
each bit received. Bit 3 of tile SCaN Register enables the
compare feature of the SPI, with the default being dis- SCON (C) 02
abled. When the compare feature is enabled, a compari-
son of the value in the SCaMP Register is made with the
value in the RxBUF Register. Bit 4 signals that a receive
character is available in the RxBUF Register. If the asso-
L SPI Enable
o Disable'
ciated IR03 is enabled, an interrupt is generated. Bit 5 1 Enable
controls the clock phase of the SPI. A 1 in Bit 5 allows for RxCharOVerrun (5)
receiving data on the clock's falling edge and transmitling o Reset
1 Overrun
data on the clock's rising edge. A 0 allows receiving data
CLK Divide (M)
on the clock's rising edge and transmitting on the clock's 00 TCLK/2
falling edge. The SPI clock source is defined in bit 6. A 1 01 TCLK/4
10 TCLK/8
uses TimerO output for the SPI clock, and a 0 uses TCLK for 11 TCLKI16
clocking the SPI. Finally bit 7 determines whether the SPI DO SPI Port Enable (5)
is used as a Master or a Slave. A 1 puts the SPI into Master o SPI DO Port Enabled
1 DO Port to 1/0
mode and a 0 puts the SPI into Slave mode.
cgm[~I;nable
Table 4. SPI Pin Configuration 1 Disable·
RxCharAvaii
Name Function Pin Location o Reset
1 Char. Avail.
DI Data-In P20 Clock Phase
DO Data-Out P27 o TransIFall
1 TransIRise
SS Slave Select P35 CLKSource
SK SPI Clock P34 o TCLK
1 Timer 0 Output
Master Slave
o Slave
SPI Operation. The SPI is used in one of two modes; either (5) Used with Bit 07 equal to 0 1 Master
(M) Used with Bit 07 equal to 1
as system slave, or a system master. Several of the
possible system configurations are shown in Figure 14. In • Defautt Selling After Reset.
the slave mode, data transfer starts when the slave select
(SS) pin goes active. Data is transferred into the slave's SPI Figure 13. SPI Control Register (SCON)
36
Standard Serial Setup
ss
,
..
i
::;;
sk
do
.\
,
di
,
I~ I+ I~ I
rll~ {l'cll~ ilHl ~I 1~~{l~II~~{l~1
Slave Slave Slave Slave
ssl
ss2 __+------,
~ ss3~_+----t-----_,
! ss4~_+----t-----~r_---,
::;; ~I__+~---~~---~~~--_r,
do~_+~-~-t-~~~-~~-_.-~~__,
d~_+_r~+--r_~~--~~~_+-_r_r,
sk
I
::;;
do
di
~
I
I~~ {l'cll~ ~{l
I'til I~
r~o~II~~o'cl
I
Slave Slave en Sla: en Sla:
ss
,
*.
sk
::;; do
,
di
11 I+ IJ I
I~~ {l-oll~ ~{l ~I 1~~O'tiJI~~o'cl
~ sla: ~ sla:
Slave Slave
37
FUNCTIONAL DESCRIPTION (Continued)
SPI Compare. When the SPI Compare Enable bit, 03 of the bit 06 of the SCON Register determines tile division of tile
SCON Register is set to 1, the SPI Compare feature is internal system clock if this is used as the SPI clock source.
enabled. The compare feature is only valid for slave mode. Divide by 2, 4, 8, or 16 is chosen as tile scaler.
A compare transaction begins when the (SS) line goes
active. Data is received as if it were a normal transaction, Receive Character Available and Overrun. When a com-
but there is no data transmitted to avoid bus contention plete data stream is received, an interrupt is generated
with other slave devices. When tile compare byte is re- and the RxCharAvail bit in tile SCON Register is set. Bit 4
ceived, IRQ3 is not generated. Instead, the data is com- in the SCON Register is for enabling or disabling tile
pared with the contents of the SCOMP Register. If the data RxCharAvaii interrupt. The RxCharAvail bit is available for
does nol match, DO remains inactive and lhe slave ignores interrupt pqlling purposes and is reset wilen the RxBUF
all data until the (SS) signal is reset. If the data received Register is read. RxCharAvail is generated in both master
matches the data in the SCOMP register, then a SMR and slave modes. While in slave mode, if the RxBUF is not
signal is generated. DO is activated if it is not tri-stated by read before the next dala stream is received and loaded
02 in the SCON Register, and data is received the same as into the RxBUF Register, Receive Character Overrun
any other SPI slave transaction. (RxCharOverrun) occurs. Since there is no need for clock
control in slave mode, bit 01 in the SPI Control Register is
When the SPI is activated as a slave, it operates in all used to log any RxCharOverrun (Figure 15 and Figure 16).
system modes; STOP, HALT, and RUN. Slaves' not com-
paring remain in their current mode, whereas slaves'
No Parameter Min Units
comparing wake from a STOP or HALT mode by means of
an SMR. 1 01 to SI<. Set-up 10 ns
2 SI<. to DO Valid 15 ns
SPI Clock. The SPI clock is driven from three sources; with 3 SS to SI<. Set-up .5 Tsk ns
TimerO, a division of the internal system clock, or an 4 SS to DO Valid 15 ns
external master when in slave mode. Bit 06 of the SCON 5 SI<. to 01 hold time 10 ns
Register controls what source drives the SPI clock. A 0 in
SK
SS
DO
CD
01
38
SK
DO
SMR DI
SS
TCLK SCLK+n
STOP Mode Recovery Register (SMR). This register se- SMR (F) DB
lects 1I1e clock divide value and determines the mode of
STOP mode recovery (Figure 17). All bits are write only
except bit 7, which is read only. Bit 7 is a flag bit that is
SClKfTClK Divide by 16
hardware set on the condition of a STOP recovery and o OFF"
reset on a power-on cycle. Bit 6 controls whether a low 1 ON
level or high level is required from the recovery source. The XTAl Clock Divide By 2
recovery level must be active LOW to work with SPI. Bit 5 o SClK = XTAU2"
1 SClK=XTAl
controls the reset delay alter recovery. Bits 2,3, and 4 of
the SMR specify the source of the STOP mode recovery
1..-_____ Stop Mode Recovery Source
000 POROnly"
signal. Bit 1 determines whether the XTAL is divided by 1 001 POROnly
or 2. A 0 in this location uses XTAL divide-by-two, and a 1 010 P31
011 P32
uses X rAL. The default for this bit is XTAL divide by two. Bit 100 P33
o controls the divide-by-16 prescaler of SCLK{fCLK. 101 P27
110 P2 NOR 0:3
111 P2NORO:7
SCLKlTCLK divide-by-16 select (DO). DO of the SMR con-
trols a divide-by-16 prescaler of SCLK/TCLK. The purpose
1..-------- o Stop Delay
OFF
1 ON"
of this control is to selectively reduce device power con-
sumption during normal processor execution (SCLK con- 1..---------- o Stop Recovery level
Low Level *
trol) and/or HALT mode (where TCLK sources the counter/ 1 High level
timers and interrupt logic). Slop Flag
o POR"
1 Slop Recovery
XTAL Clock divide-by-2 (D1). This bit determines whether
the XTAL clock is divided by two or one. When this bit is set * Default setting after RESET
to 1, the SCLK{fCLK is equal to the XTAL clock. This option
can work together with the low EMI options in PCON
register to reduce the EMI noise. Maximum frequency is 4
Figure 17. STOP Mode Recovery Register
MHz when divide-by-1 selection is active.
39
FUNCTIONAL DESCRIPTION (Continued)
STOP Mode Recovery Source (02,03,04). These three bits recovery sources active. Note: These other STOP mode
of the SMR specify the wake-up source of the STOP Mode recovery sources have to be active level low (bit 06 in SMR
recovery (Figure 18 and Table 5). set to 0 if P31, P32, P33, and P27 selected, or bit 06 in SMR
set to 1 if logical NOR of Port 2 is selected).
Table 5. STOP Mode Recovery Source
STOP Mode Recovery Delay Select (05). Tilis bit disables
SMR Operation the 5 ms RESET delay after STOP Mode Recovery. Ttw
04 03 02 Description of Action default condition of this bit is 1.
0 0 0 POR recovery only
STOP Mode Recovery Level Select (06). A 1 in this bit
0 0 1 POR recovery only
position indicates that a high level on anyone of tile
0 1 0 P31 transition
0 1 1 P32 transition
recovery sources wakes tile device from STOP mode. A a
indicates low level recovery. Tile default is 0 on POR
0 0 P33 transition (Figure 18).
0 1 P27 transition
1 0 Logical NOR of Port 2 bits 0:3 Cold or Warm Start (D7). Tilis bit is set by tile device upon
1 1 Logical NOR of Port 2 bits 0:7 entering STOP mode. It is active iligil, and is 0 (cold) on
POR/WDT RESET. TiliS bit is READ only. It is used to
distinguisil between cold or warm start.
P31-P33 cannot wake up from STOP mode if the input lines
are configured as analog inputs. When the SPI is enabled Watch Dog Timer Mode Register (WDTMR). Tile WDT is a
and the Compare feature is active, a SMR is generated retriggerable one-silot timer til at resets tile Z8 if it reaclles
upon a comparison in the SPI Shift Register and SCOMP its terminal count. Tile WDT is initially enabled by execut-
Register, regardless of the above SMR Register settings. ing tile WDT instruction and retriggered on subsequent
If SPI Compare is used to wake up the part from STOP executions of tile WDT instruction. Tile timer circuit is
mode, it is still possible to have one ofthe other STOP mode driven by an on- board RC oscillator or external clock
source. Tile POR clock source is selected willl bit 4 of tile
WDTMR.
SMR 040302
0 0
~
o
o 0 1 SMR 04 03 02 SMR 04 03 02 SMR 04 03 02 SMR D4 03 02 SPI
010100 101 1 1 0
voo o 1 1
P31
P32 P27
P23
Dig~aVAnalog Mode
Select (P3M)
40
Bits Oand 1 control a tap circuit that determines tile timeout WDThlR (F) OF
Internal
RESET
WDTSelect
(WDTMR)
ClK Source
Select
(WDTMR)
XTAl
WDT/POR Counter Chain
ClR
Vee
2VREF
From Stop
Mode
Recovery
Source
12 ns Glitch Filter
WDT >-______...J
Stop Delay
Select (SMR)
41
FUNCTIONAL DESCRIPTION (Continued)
WOT Time Select (01,00). Selects the WDT time-out vcc Voltage Comparator. An on-board Voltage Compara-
period. It is configured as shown in Table 6. tor checks that Vee is at the required level to ensure correct
operation of the device. Reset is globally driven if Vee is
Table 6. WDT Time Select below the specified voltage (typically 2.1 V).
WOT During STOP (03). This bit determines whether or not The device functions normally at or above 3.0V under all
the WOT is active during STOP mode. Since XTAL clock is conditions. Below 3.0V, the device functions normally until
stopped during' STOP mode, unless as specified below, the Brown-Out Protection trip point (VBO ) is reached, for the
the on-board RC has to be selected as the clock source to temperatures and operating frequencies in cases 1 and 2
the POR counter. A 1 indicates active during STOP. The above. The device is guaranteed to function normally at
default is 1. If bits 03 and 04 are both set to 1, the WOT supply voltages above the brown-out trip point. The actual
only, is driven by the extemal clock during STOP mode. brown-out trip point is a function of temperature and
process parameters (Figure 21 ).
On-Board, Power-On-Reset RC or External XTALl Oscil-
latorSelect (04). This bit determines which oscillator source ROM Protect. ROM protect is mask-programmable. It is
is used to clock the internal POR and WOT counter chain. selected by the customer at the time the ROM code is
If the bit is a 1, the internal RC oscillator is bypassed and submitted. The selection of ROM protect disables the LOC
the POR and WOT clock source is driven from the external and LOCI instructions.
pin, XTAL 1. The default configuration of this bit is 0, which
selects the RC oscillator.
42
Vee 2.80
(Volts)
2.60
2.40 ~
2.20
I '"-
'"
2.00
"-
1.80
1.60
"" ~"-
V BO (Typical)
1.40
-60 -40 -20 o 20 40 60 80 '"'- 100 120 140
Temperature (OC)
Symbol Description Min Max Units Stress greater than those listed under Absolule Maximum
Ratings may cause permanent damage 10 the device. This
Supply Voltage' -0.3 +7.0 V is a stress rating only: operation of the device at allY
Storage Temp -65 +150 C condition above those indicated in the operational sec-
Oper Ambient Temp t C tions of these specifications is not implied. Exposure to
absolute maximum rating conditions for extended period
Noles: may affect device reliability .
• Voltage on all pins with respect to GND.
t See Ordering Information
43
DC ELECTRICAL CHARACTERISTICS
Va. Clock Input Low 3.3V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 1.6 V Driven by External
Voltage Clock Generator
5.0V Vss-O.3 0.2 Vee Vss-0.3 0.2 Vee 2.7 V Driven by External
Clock Generator
VIH Input High Voltage 3.3V 0.7 Vee Vee+0.3 0.7 Vee Vee+0.3 1.8 V
5.0V 0.7 Vee Vee+0.3 0.7 Vee Vee+0.3 2.8 V
VL Input Low Voltage 3.3V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 1.0 V
5.0V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 1.5 V
Voo Output High Voltage 3.3V Vee-D.4 Vee-O.4 3.1 V IOH= -2.0 mA
5.0V Vee-O.4 Vee-O.4 4.8 V lOll = -2.0 mA
Vll.l Output Low Voltage 3.3V 0.8 0.8 0.2 V Ill. =+4.0 mA
5.0V 0.4 0.4 0.1 V 101. =+4.0 mA
Vru Output Low Voltage 3.3V 1.0 1.0 0.4 V IOl =6 mA,
3 Pin Max
5.0V 1.0 1.0 0.5 V 101. = +12 mA,
3 Pin Max
III Input Leakage 3.3V -1.0 1.0 -1.0 1.0 jJA VIN = OV, Vee
(Input bias current 5.0V -1.0 1.0 -1.0 1.0 jJA VIN = OV, Vee
of comparator)
101. Output Leakage 3.3V -1.0 1.0 -1.0 1.0 JJA VIN = OV, Vee
5.0V -1.0 1.0 -1.0 1.0 jJA VIN = OV, Vee
lee Supply Current 3.3V 6 6 3.0 mA @8MHz [4,5]
5.0V 11.0 11.0 6.0 mA @8MHz [4,5]
3.3V 8.0 8.0 4.5 mA @12MHz [4,5]
5.0V 15 15 9.0 mA @12MHz [4,5]
44
Symbol Parameter Vcc TA =O°C TA=-40°C Typical Units Conditions Notes
Note [3] to 70°C to 105°C @25°C
Min Max Min Max
ICC! Standby Current 3.3V 3.0 3.0 1.3 rnA HALT Mode Y'N =OV, [4,5]
Vee@8MHz
5.0V 5 5 3.0 rnA HALT Mode Y'N =OV, [4,5]
Vr;c@8MHz
3.3V 4.5 4.5 2.0 rnA HALT Mode VIN =OV, [4,5]
Vr;c@12MHz
5.0V 7.0 7.0 4.0 rnA HALT Mode V,N =OV, [4,5]
Vee @12 MHz
3.3V 1.4 1.4 0.7 rnA Clock Divide by 16 [4,5]
@8MHz
5.0V 3.5 3.5 2.0 rnA Clock Divide by 16 [4,5]
@8MHz
3.3V 2.0 2.0 1.0 rnA Clock Divide by 16 [4,5]
@12MHz
5.0V 4.5 4.5 2.5 rnA Clock Divide by 16 [4,5]
@12MHz
1CC2 Standby Current 3.3V 10 20 1.0 ~ STOP Mode V,N =OV, [6]
Vr;cWDT is not Running
5.0V 10 20 3.0 ~ STOP Mode VIN =OV, [6]
Vr;c WDT is not Running
3.3V TBD ~ . STOP Mode Y'N =OV, [6]
Vee WDT is Running
5.0V TBD TBD 200 ~ STOP Mode Y'N =OV, [6]
Vr;c WDT is Running
IAUI Auto latch High 3.3V -4.0 -8.0 -2.0 ~ OV< VIN < Vee
Current 5.0V -9.0 -16.0 -5.0 ~ OV<VnI<Vee
Noles:
[l]lccl Typ Max Unit Freq
Clock Driven on Crystal 3.0 5.0 rnA BMHz
or Ceramic Resonator 0.3 5.0 rnA BMHz
[2] =
Vss = OV GND
[3] 5.0V ± 0.5V, 3.0V ± 0.3V. The VBO increases as the temperature decreases.
[4] All outputs unloaded, I/O pins floating. inputs at rail.
[5] = =
Cu Cl2 100 pF
[6] Same as note [4] except inputs at Vee'
45
AC ELECTRICAL CHARACTERISTICS
Clock
'. 1QQ-
Clock
Setup
f\ r-\ r-\ r-\. r-\ ~
r-l\ '--
~ f
Soureo
• @
AC ELECTRICAL CHARACTERISTICS
No Symbol Parameter Vee TA = (J<'C TO 700 G TA = -40o GTO 105°G Units Notes
Note[3) 8MHz 12 MHz 8 MHz 12MHz
Min Max Min Max Min Max Min Max
TpC Input Clock Period 3.3V 125 loo,()()O 83 100,000 125 ·100,000 83 100,()()0 ns [1]
5.0V 125 loo,()()O 83 100,000 125 100,()()0 83 100,()()0 ns [1]
2 TrC,TfC Clock Input Rise 3.3V 25 15 25 15 ns [1]
and Fall Times 5.0V 25 15 25 15 ns [1]
3 TwC Input Clock Width 3.3V . 37 26 37 26 ns [1]
5.0V 37 26 37 26 ns [1]
4 TwTinL Timer Input Low Width 3.3V 100 100 100 100 ns [1]
5.0V 70 70 70 70 ns [1]
5 TwTinH Timer Input High Width 3.3V 3TpC 3TpC 3TpC 3TpC [1]
5.0V 3TpC 3TpC 3TpC 3TpC [1]
46
No Symbol Parameter Vcr; TA = OOG TO looG TA= -40oG TO 105°G Units Notes
Note[3] BMHz 12 MHz BMHz 12 MHz
Min Max Min Max Min Max Min Max
6 TpTin Timer Input Period 3.3V BTpG BTpG BTpG BTpG [1J
5.0V BTpG BTpG BTpG BTpG [1J
7 TrTin, Timer Input Rise 3.3V 100 100 100 100 ns [1J
TtTin and Fall Timer
5.0V 100 100 100 100 ns [1J
8 TwtL Int. Request Inpul 3.3V 100 100 100 100 ns [1.2J
Low Time
5.0V 70 70 70 70 ns [1,2J
9 TwlH Int. Request Input 3.3V 3TpG 3TpG 3TpG 3TpG [1.2J
High Time
5.0V 3TpC 3TpC 3TpC 3TpC [1.2J
10 Twsm STOP Mode Recovery 3.3V 12 12 12 12 ns
Width Spec
5.0V 12 12 12 12 ns
11 Tost Oscillator Startup Time 3.3V 5TpC 5TpC 5TpC 5TpC Reg.
[4J
5.0V 5TpC 5TpC 5TpC 5TpC ns
Twdt Watchdog Timer 3.3V 15 15 12 12 [5J
Refresh Time
5.0V 5 5 3 3 ms DO = 0 [6J
01 =0[6J
3.3V 30 30 25 25 ms 00= 1 [6]
5.0V 16 16 12 12 ms 01 = 0 [6J
3.3V 60 60 50 50 ms 00= 0 [6J
5.0V 25 25 30 30 ms 01 = 1 [6J
3.3V 250 250 200 200 ms 00= 1 [6J
5.0V 120 120 100 100 ms 01=1 [6J
Noles:
[1] Timing Reference uses 0.9 Vee for a logic 1 and 0.1 Vee for a logic O.
[2] Inlerrupt request via Port 3 (P31-P33)
[3] 5.0V ± O.5V. 3.3V ± O.3V
[4] SMR·D5 = 0
[5] Reg. WDTMR
[6] Internal RC Oscillator only.
47
EXPANDED REGISTER FILE CONTROL REGISTERS
SMR (F)OB PCON (FjOO
t SCLKfTCLK Divide by 16
o OFF'
1 ON
XTALDIvIde
o XTAl.I2'
1 XTAL
Comparator
output PORT 3
o P34, P35 Standard Output'
1 P34, P35 Comparator Output
Reserved
Low EMI Noise
PORT 2
Stop Mode Recovery Souroo o Low EMI Noise
000 POR Only'
1 Standard·
001 POROnly
010 P31 Low EMI Noise
011 P32 PORT 3
100 P33 o Low EMI Noise
101 P27 1 Standard'
110 P2 NOR 0:3
111 P2NORO:7 Low EMI Oscillator
o Low EMI Noise
Slop Delay 1 Standard'
o OFF • Defautt Setting After Reset.
1 ON'
48
Z8 CONTROL REGISTER DIAGRAMS
R240 R243 PRE1
Imlool~I~lool~lmlool
I Reserved Count Mode
o T 1 Single Pass
1 T 1 Modulo-N
Clock Source
Figure 28. Reserved 1 T 1 Internal
o T 1 External Timing Input
R2411MR (TIN) Mode
Pre scaler Modulo
(Range: 1-64 Decimal
01-00 HEX)
o No Function
1 Load TO
o Disable T aeount Figure 31. Prescaler 1 Reg ister
1 Enable To Count (F3H: Write Only)
o No Function
1 LoadT 1
o Disable T 1 Count R244 TO
1 Enable T 1 Count
TINModes Imlool~I~lool~lmlool
00 External Clock Input
01
10
Gate Input
Trigger Input I TO Initial Value
(Non-retriggerable) (When Written)
11 Trigger Input (Range: 1-256 Decimal
(Retriggerable) 01-00 HEX)
TO Current Value
TOUT Mode (When READ)
00 Not Used
01 TOOUT
10 T10UT
11 Internal Clock Out
Figure 32. CounterlTimer 0 Register
(F4H: Read/Write)
Figure 29. Timer Mode Register
(F1 H: Read/Write)
R245 PREO
R242T1
(When Written)
(Range 1-256 Decimal Prescaler Modulo
01-00 HEX) (Range: 1-64 Decimal
T1 CUrrent Value 01-00 HEX)
(When READ)
49
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R246 P2M R249lPR
Iwl~I~I~lool~I~lool
-r
I P2 7 - P20 110 Deflnltlon T I Interrupt Group Prlorlty
o DeHnes BII as OUTPUT 000 Reserved
1 Deflnes BII as INPUT 001 C>A>B
010 A>B>C
011 A>C>B
Figure 34. Port 2 Mode Register 100 B>C>A
101 C>B>A
(F6H : Write Only) 110 B>A>C
111 Reserved
IRQ1, IRQ4 Prlorlty (Group C)
R247P3M
o IRQt >IRQ4
1 IRQ4>IRQl
IRoo, IRQ2 Priority (Group B)
o IRQ2>IRoo
1 IRoo > IRQ2
o Port 2 Open Drain IROO, IRQ5 Priority (Group A)
1 Port 2 Push-pull o IROS> IROO
1 IRQ3>IRQ5
Port 3 Inputs
o Digital o
1 Analog
o Reserved
Figure 37. Interrupt Priority Register
(F9 H : Write Only)
Figure 35. Port 3 Mode Register
(F7H: Write Only)
R250 IRQ
R248 POIM
50
R2511MR R253 RP
Iwloolool~looloolrnlool
1 Enables IROS-IROQ
(DO =IROO)
I L----l_ Expanded Register File Pointer
Working Register Pointer
Q Reserved
1 Enables Interrupts
Figure 41. Register Pointer
(FD H : Read/Write)
Figure 39. Interrupt Mask Register
(FB H : Read/Write)
R254GPR
R252 Flags
User Flag F2
Half Carry Flag R255 SPL
Carry Flag
51
DEVICE CHARACTERISTICS
Current 12 r---~~--~-----r----~----~--~~--~----~lccm5V
(rna)
10
6
Icc at 3.3V
~--~r----+-----r--~~----+---~r----+--~~lcc1m5V
4 1----11-----1:"'"'---+----+----=:00.....=-:=-'1""----+-----1
Icc1 at 5V
(SCLK divided by 16)
Icc1 at3.3V
2
o
l~d~;;;~~:::=r==t::::t==;::::::1r~j:::::1ICC1 at 3.3V
l~=±==f==E=j=:j==!==-l
o 2 4 6 8 10 12 14
__J 16
(SCLKdivided by 16)
Note: XTAL is divided by 2
Frequency (MHz)
Vee 2.0
(Volts)
1.0
A
C
D
0.0
-60 -40 -20 o 20 40 60 80 100 120 130
Temperature (OC)
Legend:
A Vii al Vee = 3.3V
B VO at Vee = S.5V
C Vol at Vee = 3.0V
o Voll at Vee = 5.5V
52
Vee 8.0
(Volts)
6.0
4.0
3.0
rL-==t==$==$:=~~=:$==$==I===t==t=-t Vee=3.0V
VIH atatVee
VOH 5.5V
2.0
VIH at Vee = 3.0V
1.0
53
DEVICE CHARACTERISTICS (Continued)
V OH (Volts)
o 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
o
I
Vcc= 3.0V
Vcc= 5.0V I
Vcc= 5.5V
-1.0
-2.0
-3.0
-4.0
-5.0 1/
-6.0 Jj
-7.0 /~
-8.0 /JB
A C o EF GHI
10H
(rna) -9.0 I
Note: sm Mode
Legend: (Not Low EMI Mode)
A= 125°0 F= -55°0
B=25°0 G= 125°0
0= -55°0 H=25°0
D= 125°0 1=-55°0
E=25°0
54
IOL 24.0
(rna) 22.0
A B C D
20.0
18.0 I 1/ ~
16.0 I ~
14.0 I / /. ~
12.0 I / V/ E
10.0 II /~ ~./
8.0 //
If / / F
~
2.0 V
0
o 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8
VOL (Volts)
55
DEVICE CHARACTERISTICS (Continued)
Time 22.0
(msec)
20.0
A
18.0 V
V
..",., ~
1S.0
/
V ./
~
B
14.0
./ V
';""
~
V ~
C
12.0
~ ",., ",- 0
JIll'" V
~ ~
10.0 ~ ~ E
~
~ ~
8.0
~
.~
..",., ~
~
-"'" -
-~ ........-::::::::::::::::::...-
~ :::::: ,.......-:
".-
F
::::=: :::--- -
s.o ..".
4.0
2.0
o
-SO -40 -20 o 20 40 SO 80 100 120 140
Temperature (OC)
A-Vcc",3.0V D-Vcc",4.5V
B - Vcc",3.5V E- Vcc",5.0V
C-Vcc",4.0V F-Vcc",5.5V
56
Time 45.0
(msec)
40.0
A
35.0
8
30.0
C
25.0
o
20.0 ~---+----~~~----~~~~---r--~~~-+--~TE
F
15.0
10.0
5.0
0
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (Oe)
Note: Using internal RC
Legend:
57
DEVICE CHARACTERISTICS (Continued)
Time 85
(msec) Legend:
80
A- Vee = 3.0V
A B - Vee = 3.5V
75 ./
C - Vee = 4.0V
,/ 0- Vee = 4.5v
70 / =
E- Vee 5.0V
=
65
/ F - Vee 5.5V
,/' B
60 ./ ~
,."
55 L /
/ '/ C
50 ./ ./
/ / V~
45 /: 0-
,/ V
40 / / ./
V E-
'/ V /'
35 / ,/ ./ ./ F_
/ .// ' . / / ' / /'
30 ./
I'
25 ./
V V V.,. ~ ...",-
20
V ~V
i"""
15
10
o
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (Oe)
Note: Using internal RC.
58
Time 170
(msec) Legend:
160
A A- Vcc=3.0V
150 / B- Vcc=3.5V
C- Vcc=4.0V
130 ./
V F - Vcc= 5.5V
/~ B
120
io"""""
110 , .L / ' , ~/ C-
90 V ".
.JII' V- , V ~
D
/
80
V
./ JIll"
"" , V ~
E-
1
L' V V-
70
60 ./
"",
./ V- l /
i""""
~
""~ /
L ,..... F
~
50
40
~~
."
./
/ /
V" ""
30
20
10
o
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (OC)
Note, Using internal RC.
59
DEVICE CHARACTERISTICS (Continued)
Time 700
(msec) Legend:
650
A-Vcc:3.0V
~ A B-Vcc:3.5V
600 C-Vcc:4.0V
550
L
/'
./ "" D-Vcc:4.5v
E-Vcc:5.0V
F - Vcc: 5.5V
500 B-
;/ /
450 , ~
./
./
400 V ./
io""'"
C
350
300
"" V
./
./
./
./
./
~ ~
.."". ~ ~ "'~"
0
./ /
... , , /~
F
250
",
./ , /
~
~
~
V / /
...
200
150 ~~
./
",....- - ",....-
"""
100
50
o
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (0C)
Note: Using internal RC.
60
N 100000
:I:
~
>- 50000
u
c(I) - --
::l
-- - -
tT
~
u.
............ ......
10000
............ i""'-o
....... r--..... r-.~
5000
Uj-J= ±ttt=
I I II " " Ll1L L1__
1000
500
'""-'" ~\
~
""
'"" " I I II
'" ~~
100
50
"~ I\.
'\.
"'-'
\.\
10
'\ ~
A
i" B
5
I I I I I I I I
I I II I I II II
5 10 50 100 500 1000 5000 10000
Resistance (K Ohms)
Note: STD Mode
Legend:
(Not Low EMI Mode)
A - Vcc =5.0V C =33 pF
B - Vee = 3.3V C = 33 pF
Note: This chart for reference only. Each process will have a different characteristic curve.
61
DEVICE CHARACTERISTICS (Continued)
N 10000
:I:
:.:: 5000
'"
~
>-
---
()
,.
C
,
II>
tT
~
U.
1000
---~
................
---
500
\'"
A
B
100
"'-
----
C
50
10 ~ r-----
5
r---..... 0
62
I 20
(IlA) Legend:
A· Vee = 3.0V
15
B· Vee = 4.5V
k~ c· Vee = 5.0V
D· Vee = 5.5V
,
10 C
&V
1 B
I
I D
I I
I A
I
5
I
0
1"1 I
I I
I I
I I
I
I ) / // Volts
I....- ~I
~~ ~
V (V)
·5
~
·10
·15
·20
1V 2V 3V 4V 5V 6V 7V
63
INSTRUCTION SET NOTATION
Addressing Modes, The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o . Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
dst Destination location or contents
src Source location or contents
cc Condition code
@ Indirect address prefix
SP Stack Pointer
PC Program Counter
FLAGS Flag register (Control Register 252)
RP Register Pointer (R253)
IMR Interrupt mask register (R251)
64
CONDITION CODES
65
INSTRUCTION FORMATS
dot OPe
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD, AND, CP,
ORlll10 I dsllsre I DECW, INC, INCW,
POP, PUSH, RL RLC, ore OR
[D, OR, SBC, SUB,
TCM, TM,XOR
RR, RRC, SRA, SWAP dst OR
OPC
dst I ORllll0 I dst
JP, CALL (Indirect)
OPC I MODE
dst ORllll0 I dot
ADC, ADD, AND, CP,
[D, OR, SBC, SUB,
TCM,TM,XOR
OPC SRP VAlUE
VAlUE
MODE I OPC LD
ADC, ADD, AND, CP, sre OR
OR, SBC, SUB, TCM,
TM,XOR dot OR
FFH STOPIHAlT
6FH I 7FH
Two-Byte Instructions Three-Byte Instructions
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" r ", For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the resultis stored in the destination location. The
66
Instruction Address Opcode Flags Instruction Address Opcode Flags
and Operation Mode Byte (Hex) Affected and Operation Mode Byte (Hex) Affected
dst src C Z S V DH dst src C Z S V DH
COMdst R 60 - ** 0
JA CC, dst RA cB - - - - - -
dst~NOTdst IR 61 if cc is true, c=O-F
PC~PC+dst
CPdst, src t A[ ] **** Range: +127,
dst- src -128
DAdsl
dsl~DAdsl
R
IR
40
41
***X LD dsl, src
dsl~src r
1m
R
rC
r8
- - - - - -
R r9
DEC dst
dsl~dst-1
R
IR
00
01
-
*** r=O-F
r X C7
- ** X r D7
DECWdsl
dsl~dst-1
RR
IR
80
81
* r Ir E3
Ir r F3
DI 8F - - - - - - R R E4
IMR(7)~O R IR E5
R 1M E6
DJNZr, dsl RA rA - - - - - -
IR 1M E7
r~r-1 r=O- F IR R F5
ifr*O
PC~PC+dsl LDC dsl, src Irr C2 - - - - - -
Range: +127, dsl~src
-128
LDCI dsl, src Ir Irr C3 - - - - - -
EI 9F - - - - - - dsl~src
IMR(7)~1 r~r + 1;rr~rr + 1
HALT 7F - - - - - - NOP FF - - - -
67
INSTRUCTION SUMMARY (Continued)
PUSH src R 70
SP~SP-1; IR 71 TCM dst, src t 6[ )
@SP~src (NOT dst)
AND src
RCF CF 0-----
C~ TM dsl, src t 7[ ]
dslAND src
RET AF
PC~@SP; XOR dst, src t B[ )
SP~SP+2 dst~dst
XOR src
RL dst R 90 ****--
&4t5P IR 91 t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
RLC dst R 10
set table above. The second nibble is expressed symbolically by a '[ r
****-- in this table, and its value is found in the following table to the left of the
IR 11 applicable addressing mode pair.
Lfu=tEjJ:1
For example, the opcode of an ADC instruction using the addressing
RR dst R EO ****-- modes r (destination) and Ir (source) is 13.
IR E1
L:fu L:[EjjJ Address Mode Lower
RRCdst R dst src Opcode Nibble
CO ****--
IR C1 [2)
~
SBC dst, src t 3[ ) Ir [3]
dst~dst~src~C
R R [4]
SCF DF
C~l R IR [5]
SRAdst R DO
R 1M (6)
IR D1
IR 1M 17)
SRP dst 1m 31
RP~src
STOP 6F 1-----
68
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B c o E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM rl, R2 r2, Rl rl, RA ee, RA r1.IM ce,DA rl
6.5 6.5 6.5 6.5 10.5 10,5 10.5 10.5 t---
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t----
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 t---
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRl 1M rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 t---
4 DA DA OR OR OR OR OR OR
Rl IRl r1, r2 rl,Ir2 R2, Rl IR2, Rl Rl,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 t---;j':o
5 POP POP AND AND AND AND AND AND WDT
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, RI Rl,IM IR1, 1M
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t---;j':o
6 COM COM TCM TCM TCM TCM TCM TCM STOP
>< Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
'"
:E.
7
10/12.1 12/14.1
PUSH PUSH
6,5
TM
6.5
TM
10,5
TM
10.5
TM
10.5
TM
10.5 r---r.o
TM
'"
:0
.Q R2 IR2 rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
HALT
B
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 '16.0
CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRl rl, r2 rl,Ir2 R2,Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 12.0 18.0 10.5 6:5
C RRC RRC LDC LOCI LD RCF
Rl IRl rl,Irr2 Irl,lrr2 rl,x,R2
0
6.5 6.5 20.0 20.0 10.5 f--s:5
SRA SRA CALL' CALL LD SCF
Rl IRl IRRl DA r2,x,Rl
E
6.5
RR
6.5
RR
6,5
LD
10.5
LD
10.5
LD
10.5
LD
10.5
LD
r--s:s
CCF
Rl IRl rl,IR2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 10.5 ~
F SWAP SWAP LD LD NOP
Rl IRl Irl, r2 R2,IRl
\.
.... " .... '" .... ~
2 3 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1 or r 2 = Dst address
Cycles 1 Cycles R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
69
PRELIMINARY PRODUCT SPECIFICATION
~Zilill
Z86C08
CMOS Z8® 8-BIT
MICROCONTROLLER
FEATURES
• 8-bit CMOS microcontrolier • 2 Kbytes of ROM
GENERAL DESCRIPTION
The Z86C08 Microcontroller Unit (MCU) introduces a new There are two basic address spaces available to support
level of sophistication to single-chip architecture. The this wide range of configurations, Program Memory, and
Z86C08 is a member of the Z8 single-chip microcomputer 124 bytes of general-purpose registers.
family with 2 Kbytes of ROM and 124 bytes of general-
purpose RAM. The device is housed in an 18-pin DIP, and To unburden the program from coping with real-time
is manufactured in CMOS technology. The Zilog Z86C08 problems such as counting/timing and I/O data commu-
offers all the outstanding features of the Z8 family archi- nications, the Z86C08 offers two on-chip counter/timers
tecture, and easy software/hardware system expansion with a large number of user selectable modes. Also, there
along with low cost, low power consumption. are two on-board comparators that can process analog
signals with a common reference voltage (Figure 5).
The Z86C08 is characterized by a flexible I/O scheme, an
efficient register and address space structure, and a Note: All Signals with a preceding front slash, "/", are active
number of ancillary features that are useful in,many con- Low, e.g.: BIIW (WORD is active Low); IBIW (BYrE is
sumer, industrial and advanced scientific applications. active Low, only).
71
GENERAL DESCRIPTION (Continued)
YO YO
(Bit Programmable)
P32 P33
72
XTAL1, XTAl2. Crystal in, Crystal Out (time-based input Port 0 (POO-P02). Port 0 is a 3-bit I/O, nibble program-
and output, respectively). These pins connect a parallel- mable, bidirectional, CMOS compatible I/O port. Ttlese 3
resonant crystal, LC, or an external single-phase clock I/O lines can be configured under software control to be an
(12 MHz max) to the on-chip clock oscillator and buffer. input or output (Figure 3) .
- ....
DEN
Out
r -----------
I Auto Latch
I
I I
I____________
R8:::' SOOk!} J
73
PIN DESCRIPTION AND SIGNAL FUNCTIONS. (Continued)
Port 2 (P20-P27). Port 2 is an'S-bit I/O, bit programmable, output, independently. Bits programmed as outputs may
bidirectional, CMOS compatible I/O port. These SI/O lines be globally programmed as either push pull or open drain
can be configured under software control to be an input or (Figure 4).
Open Drain
Open
Out
74
Port 3 (P31-P33). Port 3 is a 3-bit, CMOS compatible port inputs or analog inputs. These three input lines can also be
with three fixed input (P32-P33) lines. These three input used as the interrupt sources IROO-IR03 and as the timer
lines can be configured under software control as digital input signal (T'N) (Figure 5).
MCU Port 3
R247= P3M
0= Analog
1 = Digital
IR03
P32
Data latch
IROO
P33
Data latch
vcc/---o IR01
Comparator Inputs. Two analog comparators are added to supply and common mode rejection ratios are 90dB and
Port 3 inputs for interface flexibility. 60dB, respectively.
Typical applications for the on-board comparators are: Interrupts are generated on either edge of comparator 2's
Zero crossing detection, ND conversion, voltage scaling, output, or on the falling edge of comparator 1's output. The
and threshold detection. comparator output may be used for interrupt generation,
Port 3 data inputs, or Tin through P31. Alternatively, the
The dual comparator (common inverting terminal) features comparators may be disabled, freeing the reference input
a single power supply which discontinues power in STOP (P33) for use as IR01 and/or P33 input.
Mode. The common voltage range is 0-4V; the power
75
FUNCTIONAL DESCRIPTION
The l8 MCU incorporates special functions to enhance the Reset. Upon power up the power-on reset circuit waits for
l8's application in industrial, scientific research, an 50 msec plus 18 crystal clocks and then starts program
advanced technologies applications. execution at address %OOOC (HEX) (Figure 6). Reference
the l86C08 control registers' Reset value (Table 2).
INTOSC XTALOSC
POR
(Cold Start)
Delay Line 18CLK 1-_ _ Chip
50 msec Reset Riter Reset
P27
(Stop Mode)
Table 2. Z86C08 Control Registers Program Memory. The l86C08 can address up to 2 Kbytes
of internal program memory (Figure 7). The first 12 bytes of
Addr. Reg. Reset Condition Comments program memory are reserved for the interrupt vectors.
07 06 05 04 03 02 01 DO These locations contain six 16-bit vectors III at correspond
to the six available interrupts. Bytes 0-2048 are on-chip
F1 TMR 0 0 0 0 0 0 0 0
mask-programmed ROM.
F2 T1 U U U U U U U U
F3 PRE1 U U U U U U 0 0
F4 TO U U U U U U U U 2048
F5 PREO U U U 'U U U U 0
Location of On-Chip
FS" P2M Inputsafier Rrst Byte of ROM
reset Instruction
F7" P3M U U U U U U 0 0 Executed .............. - - - - - - - - -
FS" P01M U U U 0 U U 0 1
After RESET 12 i"-
F9 IPR U U U U U U U U 11 IR05
1 IROO
Nole:
• A reset after a low on P27 to get out of stop mode may affect device 0 IROO
reliability.
76
Register File. The Register File consists of three I/O port Register Pointer. In the 4-bit mode, tile regisler file is
registers. 124 general purpose registers, and 15 control divided into eight working register groups, each occupy-
and status registers (RO-R3, R4-R127 and R241-R255, ing 16 continuous locations. The Register Pointer (Figure
respectively - Figure 8). The Z86C08 instructions can 9) addresses the starting location of tile active working-
access registers directly or indirectly via an 8-bit address register group.
field. This allows short 4-bit register addressing using the
Location Indentifiers
243
Timer/Counter 0
T1 Prescaler
TO
PRE1
.... to the specified
register.
}
242 Timer/Counter 1 T1
....
241
240
Timer Mode TMR
.... 1--- - - -
VOPorts
- - -
R15
R3
Not Implemented
128
127 Figure 9. Register File
General Purpose
Registers
4
3 Port 3 P3
2 Port 2 P2
Reserved I P1
o PortO PO
77
FUNCTIONAL DESCRIPTION (Continued)
Stack Pointer. The Z86C08 has an 8-bit Stack Pointer The counter can be programmed to start, stop, restart to
(R255) used for the internal stack that resides within the continue, or restart from the initial value. The counters can
124 General-Purpose registers. also be programmed to stop upon reaching zero (single
pass mode) or to automatically reload Ihe initial value and
Countermmer. There are tw08-bit programrnable counterl continue counting (modulo-n continuous mode).
timers (TO and T1), each driven by its own 6-bit program-
mable prescaler. The T1 prescaler can be driven by The counters, but not the prescaiers are read at any time
internal or external clock sources, however the TO can be without disturbing their value or count mode. The clock
driven by the internal clock source only (Figure 10). source for T1 is user-definable and can be either the
intemal microprocessor clock divided byfour, or an external
The 6-bit prescalers can divide the input frequency of the signal input via Port 3. The Timer Mode register configures
clock source by any integer number from 1 to 64. Each the external timer input (P30) as an external clock, a trigger
prescaler drives its counter, which decrements the value input that is retriggerable or not retriggerable, or as a gate
(1 to 256) that has been loaded into the counter. When both input for the internal clock.
counter and prescaler reach the end of count, a timer
interrupt request IRQ4 (TO) or IRQ5 (T1) is generated.
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-Bit
Down Down
Counter Counter IR04
Internal
Clock
External Clock
Clock
Logic
6-Bit 8-Bit lAOS
. Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P31
78
Interrupts. The Z86C08 has six interrupts from six different To accommodate polled interrupt systems, illterruptinputs
sources. These interrupts are maskable and prioritized are masked and the interrupt request register is polled to
(Figure 11). The six sources are divided as follows: the determine which of the interrupt requests needs service.
falling edge of P31 (AN 1), P32 (AN2), P33 (REF), the rising
edge of P32 (AN2), and the two counter/timers. The Inter- Table 3. Interrupt Types, Sources, and Vectors
rupt Mask Register globally or individually enables or
disables the six interrupt requests (Table 3). Source Name Vector Location Comments
IROO-IR05
IRO
IMR
IPR
Global
Interrupt
Enable
Interrupt PRIORITY
Request LOGIC
Vector Select
79
FUNCTIONAL DESCRIPTION (Continued)
Clock. The Z86C08 on-chip oscillator has a high-gain, In order to enter STOP (or HALT) mode, it is necessary to
parallel-resonant amplifier for connection to a crystal, first flush the instruction pipeline to avoid suspending
ceramic resonator, or any suitable external clock source execution in mid-instruction. To do this, the user must
(XTAL 1 = Inpul, XT AL2 = Output). The crystal should be AT execute a NOP (opcode=FFH) immediately before the
cut, 12 MHz max, with a series resistance (RS) less than or appropriate sleep instruction. Le.:
equal to 100 Ohms.
FF NOP ; clear the pipeline
The crystal should be connected across XTAL 1 and XTAL2 6F STOP ; enter STOP mode
using the recommended capacitors (capacitance is be- or
tween 10 pF to 250 pF which depends on the crystal FF NOP ; clear the pipeline
manufacturer, ceramic resonator and PCB layout) from 7F HALT ; enter HALT mode
each pin to ground (Figure 12).
Watch Dog Timer (WDT). The Watch Dog Timer is enabled
HALT Mode. Turns off the internal CPU clock but not the by instruction WOT. When the WOT is enabled, it cannot be
crystal oscillation. The counter/timers and external interrupts stopped by the instruction. With the WOT instruction, the
IROO, IR01, and IR02 remain active. The device can be WOT should be refreshed once the WOT is enabled within
recovered by interrupts, either externally or internally every 15 msec; otherwise, the Z86C08 resets itself.
generated. The program execution begins at location
OOOC (HEX). WOT=5F (HEX).
STOP Mode. This instruction turns off the internal clock Opcode WDT(SFH). The first time opcode 5FH is ex-
and external crystal oscillation and reduces the standby ecuted, the WOT is enabled, and subsequent execution
currentto 10 microamps. The STOP Mode can be released clears the WOT counter. This has to be done at least every
by two methods. The first method is a RESET of the device 15 msec. Otherwise, the WOT times out and generates a
by removing VCC. The second method is if P27 is configured reset. The generated reset is the same as a power on reset
as an input line when the device executes the STOP of 50 msec + 18 XTAL clock cycles.
instruction. A low input condition on P27 releases the
STOP Mode. Opeode WDH (4FH). When this instruction is executed it
will enable the WOT during HALT. If not, the WOT will stop
Program execution under both conditions begins at loca- when entering HALT. This instruction does not clear the
tion OOOC (HEX). However, when P27 is used to release the counters, it just makes it possible to have the WOT function
STOP Mode, the I/O port mode registers are not running during HALT Mode. A WOH instruction executed
reconfigured to their default power-on conditions. This without executing WOT (5FH) has no effect.
prevents any I/O, configured as output when the STOP
instruction was executed, from glitching to an unknown
state. To use the P27 release approach with STOP Mode,
use the following instruction:
OR P2M, #80H
NOP
STOP
...---+--l xtal1 ...---+--1 xtal1 --l~--1 xtal1
80
Brown-OutProtection (VBo).The brown-out trip voltage (Veo ) The device will function normally at or above 3.0V under all
is less than 3 volts and above 1.4 volts under the following conditions. Below 3.0V, the device functions normally until
conditions: the Brown-Out Protection trip point (Veo ) is reached. Tile
device is guaranteed to function normally at supply volt-
Maximum (Veo) Conditions: ages above the brown-out trip point for the temperatures
and operating frequencies in Case 1 and Case 2 above.
Case 1 TA= -40°C, +105°C, Internal Clock Frequency The actual brown·out trip point is a function of temperature
equal or less than 1 MHz and process parameters (Figure 13).
Case 2 TA= -40°C, +85°C, Internal Clock Frequency
equal or less than 2 MHz
2 MHz (Typical)
Note: The internal clock frequency is one half the external Temp -40°C O°C +25°C +70°C + 105°C
clock frequency. Veo 2.55 2.4 2.1 1.7 1.6
Vee 2.80
(Volts)
2.60
2.40 ~
2.20
'" ~
"""
2.00
1.60
"'~
1.40
-60 -40 -20 o 20 40 60 80 " ~
100 120
Temperature (0C)
140
81
STANDARD TEST CONDITIONS
+5V
Symbol Parameter Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to tile device. This
Vee Supply Voltage' -0.3 +7 V is a stress rating only; operation of the device at any
TSTG Storage Temp -65 0 +150 0 C condition above those indicated in the operational sec-
TA Oper Ambient Temp t t C tions of these specifications is not implied. Exposure to
absolute maximum rating conditions lor extended periods
Noles: may alfect device reliability.
'Voltages on all pins with respect to GND
t See Ordering Information
CAPACITANCE
Parameter Max
Input capacitance 10 pF
Output capacitance 20 pF
I/O capacitance 25 pF
Vee SPECIFICATION
82
DC ELECTRICAL CHARACTERISTICS
VCH Clock Input High 3.0V 0.7 Vee Vee+0.3 0.7 Vee Vee+0.3 1.7 V Driven by External
Voltage Clock Generator
5.5V 0.7 Vee Vee+0.3 0.7 Vee Vee+0.3 2.75 V Driven by External
Clock Generator
VD- Ctock tnput Low 3.0V. Vss-O.3 0.2 Vee Vss-0.3 0.2 Vee 0.8 V Driven by Externat
Voltage Ctock Generator
5.5V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 1.5 V Driven by External
Clock Generator
VIH Input High Voltage 3.0V 0.7 Vee Vee+0.3 0.7 Vee Vee+0.3 1.8 V
5.5V 0.7 Vee Vee+0.3 0.7 Vee Vee+O·3 2.8 V
V[ Input Low Voltage 3.0V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 0.8 V
5.5V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 1.5 V
Voo Output High Voltge 3.0V Vee-O.4 Vee-O.4 3.0 V 100= -2.0 mA
5.5V Vee-O.4 Vee-O.4 4.8 V IOH= -2.0 mA
3.0V Vee-O.4 Vee-O.4 V Low Noise@0.5 mA
5.5V Vee-0.4 Vee-O.4 V Low Noise@0.5 mA
-----
V0I..1 Output Low Voltage 3.0V 0.8 0.8 0.2 V t{Jl = +4.0 mA
5.5V 0.4 0.4 0.1 V 1{Jl = +4.0 mA
3.0V 0.4 0.4 V Low Noise @0.5 mA
5.5V 0.4 0.4 V Low Noise @0.5 mA
Vru Output Low Voltage 3.0V 1.0 1.0 0.8 V to! =+12 mA,
3 Pin Max
5.5V 0.8 0.8 0.3 V 101.=+12 mA,
3 Pin Max
Vso Vee Brown Out Voltage 1.5 2.7 1.0 2.95 2.1 V @2MHzMax,
Ext. CLK Freq
---------
I[ Input Leakage 3.0V -1.0 1.0 -1.0 1.0 j.V\ VIN=OV,Vee
(Input Bias 5.5V -1.0 1.0 -1.0 1.0 j.V\ VIN = OV, Vee
Current of
Comparator)
101.. Output Leakage 3.0V -1.0 1.0 -1.0 1.0 j.V\ VIN = OV, Vee
5.5V -1.0 1.0 -1.0 1.0 j.V\ VIN = OV, Vee
VPEF 0 Vee-0.7 0 Vee -1.0 V
83
DC ELECTRICAL CHARACTERISTICS (Continued)
Icc Supply Current 3.0V' 3.5 3.5 1.5 rnA All Output and I/O Pins
Floating @2 MHz
5.5V 7.0 7.0 3.0 rnA All Output and I/O Pins
Floating @2 MHz
3.0V 8.0 8.0 3.0 rnA All Output and I/O Pins
Floating @8 MHz
5.5V 11.0 11.0 6.0 rnA All Output and I/O Pins
Floating @ 8 MHz
3.0V 10 10 3.6 rnA All Output and I/O Pins
Floating @12 MHz
5.5V 15 15 9.0 rnA All Output and I/O Pins
Floating @12 MHz
-~-.----~-~--
Iccl Standby Current 3.0V 2.5 2.5 0.7 rnA HALT Mode VIN = OV,
Vee @2 MHz
5.5V 4.0 5.0 2.5 rnA HALT Mode VIN = OV,
Vee @2MHz
3.0V 4.0 4.0 1.0 rnA HALT Mode VIN = OV,
Vee @8MHz
5.5V 5.0 5.0 3.0 rnA HALT Mode VIN = OV,
Vee @8 MHz
3.0V 4.5 4.5 1.5 rnA HALT Mode VIN = OV,
Vee @12MHz
5.5V 7.0 7.0 4.0 rnA HALT Mode VIN = OV,
Vee@12MHz
Icc Supply Current 3.0V 3.5 3.5 1.5 rnA All Oulput and I/O Pins
(Low Noise Mode) Floating @1 MHz
5.5V 7.0 7.0 4.2 rnA All Output and I/O Pins
Floating @1 MHz
3.0V 5.8 5.8 3.0 rnA All Output and I/O Pins
Floating @2 MHz
5.5V 9.0 9.0 6.0 rnA All Output and I/O Pins
Floating @2 MHz
3.0V 8.0 8.0 4.4 rnA All Output and I/O Pins
Floating @4 MHz
5.5V 11.0 11.0 9.0 rnA All Output and I/O Pins
Floating @4 MHz
84
Symbol Parameter Vee TA =O°C TA =-40°C Typical Units Conditions
to +70°C to +105°C @25°C
Min Max Min Max
Iccl Standby Current 3.0V 0.8 1.2 0.4 rnA HALT Mode VIN = OV,
(Low Noise Mode) Vee @1 MHz
5.5V 1.6 0.9 rnA HALT Mode VIN=OV,
Vee @1 MHz
3.0V 0.8 1.5 0.5 rnA HALT Mode VIN = OV,
Vce @2MHz
5.5V 1.9 rnA HALT Mode VIN = OV,
Vee @2MHz
3.0V TBD 2.0 0.8 rnA HALT Mode Vllj = OV,
Vee @4MHz
5.5V 2.0 2.4 0.3 rnA HALT Mode VIN = OV,
Vee@4MHz
------------
leel Standby Current 3.0V 10 20 1.0 ~ STOP Mode VIN = OV,
Vee WOT is not Running
5.5V 10 20 1.0 ~ STOP Mode VIN = OV,
Vee WDT is not Running
IAll Auto Latch Low 3.0V 6.0 8.0 3.0 ~ OV < VIN < Vee
Current
5.5V 22 30 16 ~ OV < VIJj < Vee
l/ill Auto Latch High 3.0V -4.0 -5.0 -1.5 ~ OV < VIN < Vee
Current
5.5V -12.0 -20 -8.0 ~ OV<VIN<VCC
Notes:
[1] Iccl Typ Max Unit Freq
Clock Driven on Crystal 3.0 5.0 mA 8 MHz
or XTAL Resonator 0.3 50 mA 8 MHz
85
DC ELECTRICAL CHARACTERISTICS (Continued)
Timing Diagrams
~'----'} ~~
~bd
Clock I
86
AC ELECTRICAL CHARACTERISTICS
Timing Table (Standard Mode)
Notes:
[1] Timing Reference uses 0.9 Vcc for a logic 1 and 0.1 Vcc for a logic O.
[2] Interrupt request via Port 3 (P31-P33).
87
Low Noise Version
• All pre-driver slew rates reduced to 10 ns typical. The Z86C08 operating in the Low EMI mode generates
EMI as measured in the following chart:
• Intemal SLCK[TCLK operation limited to a maximum of
4 MHz - 250 ns cycle time. The measurements were made while operating 1118 Z86C08
in three states: (1) Idle condition: (2) static output: (3)
• Output drivers have resistances of 200 ohms (typical). switched output.
E
III -75
~
Gi
>CII
..J
.lI:
til -80
CII
D.
-85-+----,_----r_--~----,_----r_--~----~----r_--~
30-60 140-160 300-400 700-1000
Frequency (MHz)
Idle
Static
Switch
88
AC ELECTRICAL CHARACTERISTICS
Low Noise Mode
5 TwTinH Timer Input High Width 3.0V 2.5TpC 2.5TpC 2.5TpC 2.5TpC [1]
5.5V 2.5TpC 2.5TpC 2.5TpC 2.5TpC [1]
6 TpTin Timer Input Period 3.0V 4TpC 4TpC 4TpC 4TpC [1]
5.5V 4TpC 4TpC 4TpC 4TpC [1]
7 TrTin, Timer Input Rise 3.0V 100 100 100 100 ns [1]
min and Fall Timer 5.5V 100 100 100 100 ns [1]
8 TwlL Int. Request Input 3.0V 100 100 100 100 ns [1,2]
Low Time 5.5V 70 70 70 70 ns [1,2]
9 TwlH Int. Request Input 3.0V 2.5TpC 2.5TpC 2.5TpC 2.5TpC [1]
High Time 5.5V 2.5TpC 2.5TpC 2.5TpC 2.5TpC [1,2]
Notes:
[1] TIming Reference uses 0.9 Vcc for a logic 1 and O. 1 Vcc for a logic O.
[2] Interrupt request via Port 3 (P31·P33)
89
Z8 CONTROL REGISTER DIAGRAMS
R2411MR R244 TO
IIDloolool~loolmlrnlool
o No Functlon I TO Initial Value
I LoadTo (When Written)
(Range: 1-256 Decimal
o Disable To Count 01-00 HEX)
I Enable To Count To CUrrent Value
o No Function (When READ)
I LoadT I
o Disable T I Count
I Enable T I Count Figure 19. Counter/Timer 0 Register
TINModes
(F4H: Read/Write)
00 External Clock Input
01 Gate Input
10 Triggerlnput
(Non-retriggerable)
11 Trigger Input R245PREO
(Retriggerable)
Count Mode
Figure 16. Timer Mode Register o TO Single Pass
(F1H: Readiwrlte) I TOModuloN
X
Prescaler Modulo
(Range: 1-64 Decimal
01-00 HEX)
R242TI
IIDloolool~lool~lrnlool
(When READ)
R247P3M
Count Mode
o T I Single Pass
I TI Modulo
Clock Source
o Port 2 Pull-Ups Open Drain
I Tllntemal
I Port 2 Pull-Ups Acllve
o T I External Timing Input
(TIN) Mode Port 3 Inputs
Prescaler Modulo
o Dlgllal
I Analog
(Range: 1-64 Decimal
01-00 HEX) X
90
R248 P01M R250 IRO
x
Figure 25. Interrupt Request Register
(FAH: Read/Write)
Figure 23. Port 0 and 1 Mode Register
(F8H: Write Only) R2511MR
Iwloolool~loolml~lool
R249IPR
1 Enables IRQ5-IROO
-- T I IL..---l-
(DO = IROO)
Reserved
Interrupt Group Priority
000 Reserved 1 Enables Interrupts
001 C:>A>B
010 A>B>C
011 A>C>B
100 B>C>A Figure 26. Interrupt Mask Register
101 C>B>A
110 B>A>C
(FBH: Read/Write)
111 Reserved
IR01. IR04 Priority (Group C)
o IR01 >IRQ4
1 IR04>IR01 R252 Flags
IROO. IR02 Priority (Group B)
o IR02 > IROO
1 IROO >IR02
IR03, IR05 Priority (Group A)
o IR05>IR03 User Flag Fl
1 IR03>IRQ5
User Flag F2
o Half Carry Flag
Decimal Adjust Flag
91
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R253 RP R255SPL
IIDloolool~looloolmlool IIDloolool~looloolmlool
I L..--I_ Don'tGa",
Register Pointer
I Stack Pointer Lower
Byte (SP 0 • SP 7 )
92
DEVICE CHARACTERISTICS
------- --
2.0
1-"'-
I- - -
1.0
o
2 4 6 ,8 10 12 14
Frequency (MHz)
Icc (rnA)
12.0
11.0
10.0
9.0 L 5.5V
8.0
/V'"
-- --- -------
V
7.0
~
6.0
5.0
5.5V
4.0
--- --- -- -
3.0V
1.0
o Frequency
2 4 6 8 10 12 14 (MHz)
HALT
Active
93
DEVICE CHARACTERISTICS (Continued)
Vee (Volt)
6.0
5.5
5.0
4.5
4.0
3.5
3.0
2.5
2.0
1.5
3.0V
1.0
.5 3.0V
5.5V
-60 -40 -20 o 20 40 60 80 100 120 Temp
(CO)
VO!..
V ,L -
6.0
5.5
5.5V
5.0
4.5
4.0
3.5
3.0 5.5V
_3.0V
2.5
2.0
3.0V
1.5
1.0 Temp
-60 -40 -20 o 20 40 60 80 100
VOH VsTemp
V'H Vs Temp
94
lOll
(rnA)
JJ I
n
-3.0 II.
111
-4.0
-5.0 /!J III
-6.0 / II It':
-7.0
125( Is '-40"C
o 125 ~ l-4o·c
-8.0
3.0V
S.SV
-- - -
Figure 34. Typicall oH vs. VOH
95
DEVICE CHARACTERISTICS (Continued)
IOL(mA)
80~----~----~--~----~----~---'
70~----~----+-~~r-----~~~-----i
50~----~--~H-~~~----r---~r----i
40
20~--~~"~~----+-----r---~-----i
10~.H~Y-----+-----r---~r----;-----i
96
Time
(mSec)---..----..,--...,..--.--..--...,..--,.
120~----~--~----+_---+----+_---+--~
100~~--+----r--~----+----+----r---~
90
80
70
60
50
40
30 -I~--_+_-----=PlIor_.!f!o....;!!Io.,.J...:~.d:--~.~.... +125" C
+80"C
+25u c
OU C
-40"C
_SOVC
10~--~-~-~-~--+_-~-~
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
Voltage
97
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags,
as shown in the instructi'on summary,
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Ir Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flags are indicated by:
R Register or working-register address
r Working register address only a Clear to zero
IR Indirect-register or indirect working- 1 Set to one
register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair X Undefined
address
Symbol Meaning
98
CONDITION CODES
99
INSTRUCTION FORMATS
One-Byte Instructions
CLR, CPL. DA, DEC, OPC I MODE ADC, ADD, AND. CPo
~~~~~~~: ~~~i.c,
I dstlsre I RR, LD, OR, SBC. SUB,
OR 11 1 1 0 sre OR TCM,TM.XOR
'-----.... RRC, SRA, SWAP
I
dst OR
JP, CALL (Indirect)
OPC
I - - - d - s t - - I OR 1111 0 I dst OPC I MODE ADC, ADD. AND. CPo
dst ORllll0 I dst
LD. OR. SBC. SUB,
TCM. TM.XOR
OPC SRP VALUE
VAlUE
MODE I OPC LD
ADC, ADD, AND, CP, sre OR
OR, sec, SUB, TCM,
TM,XOR dst OR
FFH STOPIHALT
6FH I 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
'---". For example: operand location. For example:
indicates that the source data is added to the destination refers io bit 7 of the destination operand.
data and the resultis stored in the destination location. The
100
INSTRUCTION SUMMARY (Continued)
101
Instruction Address Opcode Flags Instruction Address Opcode Flags
and Operation Mode Byte (Hex) Affected and Operation Mode Byte (Hex) Affected
dst src C Z S V DH dst src C Z S V DH
OR dst, SIC t 4[ ] -
dst~dst OR SIC **0 STOP 6F - - - - -
POP dst R 50 - - - - - -
SUB dst, SIC
dst~dst~src
t 2[ ]
****1*
dst~@SP; IR 51
SWAPdst R FO X -
SP~SP+1
IR F1 **X -
PUSH src .
SP~SP-1;
@SP~src
R
IR
70
71
- - - - -- 17
25 01
RRCdst R
IR
CO
C1
****-- Address Mode Lower
~7 o~ dst src Opcode Nibble,
t 3[ ] [2]
SBC dst, src
dst~dst~src~C ****1*
Ir [3]
SCF OF - - - --
C~l R R [4]
SRA dst R DO
***0 -- R IR [5]
IR D1
@ R 1M [6]
SRPdst 1m 31 -- - - - - IR 1M [71
RP~src
102
OPCODE MAP
Lower Nibble (Hex)
o 2 3 4 5 7 B 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM rl, R2 r2, Rl rl,RA ce, RA rl,IM ee,DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r---
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r---
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r----
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRl 1M rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 t---;w-
4 DA DA OR OR OR OR OR OR WDH
Rl IRl r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
5
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ts.o
POP POP AND AND AND AND AND AND WDT
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ts.o
COM COM TCM TCM TCM TCM TCM TCM STOP
><., Rl IRl r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
;S
., 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 ~
7 PUSH PUSH 1M 1M 1M 1M 1M 1M HALT
:c.c R2 IR2 r1. r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
Z t-s:1
.,... 8
10.5 10.5
DECW DECW DI
a.
a. RRl IRl
~
6.5 6.5 ~
9 RL RL EI
Rl IRl
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
A INCW !NCW CP CP CP CP CP CP RET
RRl IRl r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
B
6.5
CLR
6.5
CLR
6.5
XOR
6.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
t-w:o
IRET
Rl IR1· rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
C
6.5
RRC
6.5
RRC
12.0
LDC
18.0 10.5 f--s:5
LDCI LD ReF
Rl IRl rl,lrr2 Irl,lrr2 rl,x,R2
D
6.5 6.5 20.0 20.0 10.5 ts:5
SRA SRA CALL' CALL LD SCF
Rl IRl IRRl DA r2,x,Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 I-G:s
E RR RR LD LD LD LD LD CCF
Rl IRl rl,IR2 R2, Rl IR2, Rl Rl,IM IR1,IM
F
8.5
SWAP
8.5
SWAP
6.5
LD
.10.5
LD
t--s:o
NOP
..Rl IRl
V
Irl, r2
....
R2,IRl
or A
V ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1 or r 1 = Dst address
Cycle 1 Cycles R 2 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
103
PRODUCT SPECIFICATION
Z86E08
CMOS Z8® 8-BIT
MICROCONTROLLER
FEATURES
• 18-pin DIP
• 144 bytes of RAM
• Low cost
• Two programmable 8-bit counter/timers each witll a
6-bit programmable prescaler.
• Low noise programmable
• Six vectored, priority interrupts from five different
• ROM protect programmable sources.
• 14 Input/Output lines
• On-chip oscillator that accepts a crystal, ceramic
resonator, LC, or external clock drive.
• All digital inputs, CMOS levels, Schmitt triggered.
GENERAL DESCRIPTION
The Z86E08 Microcontroller (MCU) introduces a new level configurable under software control to provide 110, timing,
of sophistication to single-chip architecture. The Z86E08 is and status signals.
a member of the Z8 single-chip microcontroller family with
2 Kbytes of one-time PROM. The device is housed in an There are two basic address spaces available to support
18-pin DIP, and is manufactured in CMOS technology. The this wide range of configurations; program memory and
device allows easy software development and debug, 124 bytes of general-purpose registers.
prototyping, and small production runs not economically
desirable with a masked ROM version. To unburden the program from coping with real-lime
problems such as counting/timing and I/O data commu-
The Z86E08 has a flexible I/O scheme, an efficient register nications, the Z86E08 offers two on-chip counter/timers
and address space structure. Also, it has a number of with a large number of user selectable modes. Included,
ancillary features that are useful in many consumer, in- are two on-board comparators that process analog signals
dustrial and advanced scientific applications. with a common reference voltage (Figures 1 and 2).
The device applications demand powerful I/O capabilities. Note: All Signals with a preceding front slash, "/", are active
The Z86E08 fulfills this with 14 pins dedicated to input and Low, e.g.: B/fW (WORD is active Low); IBfW (BYTE is
output. These lines are grouped into three ports, and are active Low, only).
105
GENERAL DESCRIPTION (Continued)
Input XTAL
Machine
,.------, ,...--------v'\ Timing & Ins!.
Control
Register
Pointer
1/0 1/0
(BH Programmable)
~o
D..
'IL_-''' ~
D7-DO
106
PIN DESCRIPTION
04 03 P24 P23
05 02 P25 P22
06 01 P26 P21
07 00 P27 P20
Vee GNO Vee GNO
NlC IPGM XTAL2 P02
ICE CLOCK XTALl POl
IOE CLEAR P31 POO
EPM Vpp P32 P33
1-4 D4-7 Data 4,5,6,7 In/Output 1-4 P24-7 Port 2 pin 4,5,6,7 In/Output
5 Vee Power Supply Input 5 Vee Power Supply Input
6 N/C No connection 6 XTAL2 Crystal Osc. Clock Output
7 ICE Chip Enable Input 7 XTALI Crystal Osc. Clock Input
B JOE Output Enable Input B P31 Port 3 pin 1 Input
9 EPM EPROM Prog Mode Input ._----
9 P32 Port 3 pin 2 Input
10 Vpp Prog Voltage Input 10 P33 Port 3 pin 3 Input
11 Clear Clear Clock Input 11-13 POO-2 Port 0 pin 0,1,2 Input/Output
12 Clock Address Input 14 GND Ground Input
13 /PGM Prog Mode Input 15-1B P20-3 Port 2 pin 0,1,2,3 In/Output
14 GND Ground Input
15-1B D0-3 Data 0,1,2,3 In/Output
107
PIN FUNCTIONS
OTP Programming Mode EPM. EPROM Program Mode. This pin controls the differ-
ent EPROM Program Modes by applying different
D7-DO. Data Bus. The data can be read from. or written to voltages.
the EPROM through this data bus.
Vpp' Program Voltage. This pin supplies tile program
VCC. Power Supply. It is 5V during the EPROM Read mode Voltage.
and 6V during the other mode.
Clear. Clear (Active High). Tllis pin resets tile internal
ICE. Chip Enable (Active Low). ,This pin is active during address counter at the High Level.
EPROM Read Mode, Program Mode, and Program Verify
Mode. Clock. Address Clock. This pin is a clock input. The internal
address counter increases by one with one clock signal.
IOE. Output Enable (Active Low). This pin drives the Data
Bus direction. When this pin is Low, the Data Bus is output. IPGM. Program Mode (Active Low). Low Level at tilis pin
When High, the Data Bus is input. programs the data to the EPROM tllrough the Data Bus.
108
Z86E08 Standard Mode
XTAL1, XTAL2. Crystal In. Crystal Out (time-based input Port 0 POO-P02. Port 0 is a 3-bit bi-directional. CMOS
and output. respectively). These pins connect a parallel- compatible I/O port. These 3 I/O lines can be globally
resonant crystal, LC. or an external single-phase clock configured under software control to be an input or output
(12 MHz max) to the on-chip clock oscillator and buffer. (Figure 5).
~1=}~O(I~l
Open
Out
_In______-<LT~------~~----------------~--~
I ----------,
Auto Latch
I I
I I
IL _.R=
_ _500kn
______ _ I
109
Z86E08 Standard Mode (Continued)
Port 2 P2Q-P27. Port 2 is an 8-bit, bit programmable, bi- input or output, independently. Bits programmed as out-
a
directional, CMOS compatible If port. These eight If a puts can be globally programmed as either push-pull or
lines can be configured under software control to be an open-drain (Figure 6).
Z86EO8
Port 2 (110)
- Port 2
Open Drain
Open
Out
110
Port 3 P31-P33. Port 3 is a 3-bit, CMOS compatible port inputs or analog inputs. These three input lines are also
with three fixed input (P30-P32) lines. These three input used as the interrupt sources IROO-IR03 and as the timer
lines can be configured under software control as digital input signal (TIN - Figure 7).
ZB6EOB
0= Digital
R247 =P3M 1 =Analog
•I
~--------~--~~~o-----------------~~L---~ Latch
r-=-= P33 Data
111
Z86E08 Standard Mode (Continued)
Comparator Inputs. Two analog comparators are added to Mode. The common voltage range is 0-4V; the power
input of Port 3, P31 and P32, for interface flexibility. The supply and common mode rejection ratios are 90dB and
comparators reference voltage P3REF is common to both 6OdB, respectively.
comparators.
Interrupts are generated on either edge of comparator 2's
Typical applications for the on-board comparators; Zero output, or on the falling edge of comparator 1's output. TI)e
crossing detection, NO conversion, voltage scaling, and comparator output is used for interrupt generation, Port 3
threshold detection. In analog mode, P33 input functions data inputs, or Tin through P31. Alternatively, the com-
serve as a reference voltage to the comparators. parators can be disabled, freeing the reference input (P33)
for use as IRQ1 and/or P33 input.
The dual comparator (common inverting terminal) features
a single power supply which discontinues power in STOP'
SPECIAL FUNCTIONS
The Z8 MGUincorporates special functions to enhance the circuit waits for 50 msec plus 18 crystal clocks and then
Z8's application in industrial, scientific and advanced starts program execution at address OOOG (HEX). Refer-
technologies applications. ence Table 3 for the Z86E08 control registers' reset values
(Figure 8).
RESET is accomplished through Power On or a watch-
dog timer RESET. Upon Power Up, the power-on reset
INTOSC XTALOSC
POR
(Cold Start)
P27
(Stop Mode)
Power-On Reset (PaR). A timer circuit clocked by a Watch Dog Timer Reset. The WOT is a retriggerable one-
dedicated on-board RG oscillator is used for a paR timer shot timer that resets the Z8 if it reaches its terminal count.
function. The paR time allows Vcc and the oscillator circuit The WOT is initially enabled by executing the WDT in-
to stabilize before instruction execution begins. The paR struction and is retriggered on subsequent execution of
timer circuit is a one-shot timer triggered by one of the four the WOT instruction. 111e timer circuit is driven by an on-
following conditions: board RG oscillator.
112
Table 3. Z86E08 Control Registers
F7* P3M U U U U U U 0 0
F8' P01M U U U 0 U U 0 1
F9 IPR U U U U U U U U
FA IRQ U U 0 0 0 0 0 0 IRQ3 is used for
positive edge
detection.
PB IMR 0 U U U U U U U
PC FLAGS U U U U U U U U
FD RP 0 0 0 0 0 0 0 0
FF SPL U U U U U U U U
Note:
• Not reset after a low on P27 to get out of STOP Mode
Program Memol)'. The Z86E08 addresses up to 2 Kbytes These locations contain six 16-bit vectors that correspond
of internal program memory (Figure 9). The first 12 bytes of to the six available interrupts. Bytes 0-2048 are on-chip
program memory are reserved for the interrupt vectors. one-time programmable ROM.
20 48
Location of On-Chip
First Byte of ROM
Instruction
~ r'- - - - - - -
Executed
After RESET
11 IR05
10 IR05
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 ~ IR02
Intenupl
Vector
..!- f.-""" IR02
3 IR01
(Upper Byte)
2 IR01
1 IROO
0 IROO
113
SPECIAL FUNCTIONS (Continued)
Register File. The Register File consists of three I/O port instructions can access registers directly or indirectly via
registers, 124 general purpose registers, and 14 control an 8-bit address field, This allows short 4-bit register
and status registers RO-R3, R4-R127 and R241-R255, addressing using the Register Pointer. In the 4-bit mode,
respectively (Figure 10). General purpose registers oc- the register file is divided into eight working re'gister
cupy the 04H to 7FH address space. I/O ports are mapped groups, each occupying 16 continuous locations, The
as per the existing CMOS Z8. The Mode and Configuration Register Pointer (Figure 11) addresses the starting loca-
Registers are the same as the Z86C08. The Z86E08 ti.on of the active working-register group,
Location identifiers
255 Stack Pointer (Bits 7-0) SPL
-~1 r7 r6 r5 r 4 ,I r3 r 2 r1 ro 1R253
254 General Purpose Register GPR
253 Register Pointer RP The upper nibble of the register file address
provided by the register pointer specifies
252 Program Control Flags FLAGS the active working· register group
251 . Interrupt Mask Register HMH
250 Interrupt Request Register IRQ R127
RI5
General Purpose
Registers
;- - - -VOPorts
- - - - R3
4
3 Port 3 P3
Figure 11. Register Pointer
2 Port 2 P2
Reserved P1 ,
o PortO PO
114
Stack Pointer. The Z86E08 has an 8-bit Stack Pointer The counter can be programmed to start, stop, restart to
(R255) used for the internal stack that resides within the continue, or restart from the initial value. The counters are
124 general-purpose registers. also programmed to stop upon reaching zero (singte pass
mode) or to automatically reload the initiat value and
GPR. (R254) This register is a general-purpose register. continue counting (modulo-n continuous mode).
Counterffimer. There are two 8-bit programmable counter/ Tile counters, but not the prescalers, arc read at any lime
timers (TO and T1), each driven by its own 6-bit program- without disturbing their value or count mode. Tile clock
mable prescaler. The T1 prescaler is driven by internal or source for T1 is user-definable and is eitiler the internal
external clock sources; however, the TO can be driven by microprocessor clock divided by four, or an oxternal signal
the internal clock source only (Figure 12). input via Port 3. The Timer Mode register configures tile
external timer input (P30) as an external clock, a trigger
The 6-bit prescalers divides the input frequency of tile input that is retriggerable or not retriggerable, or used as
clock source by any integer number from 1 to 64. Each a gate input for the internal clock.
prescaler drives its counter, which decrements the value
(1 to 256) that has been loaded into the counter. Wilen bottl
counter and prescaler reach the end of count, a timer
interrupt request IRQ4 (TO) or IRQ5 (T1) is generated.
Internal Data Bus
PREO To To
Initial Value Initial Value Current Value
Register Register Register
6-Bit a-bit
Down Down
Counter Counter
IR04
Internal Clock
External Clock
Clock
Logic
6-Bit a-Bit IROS
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 Tl Tl
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P3l
115
SPECIAL FUNCTIONS (Continued)
Interrupts. The ZB6EOB has six interrupts from five different To accommodate polled interrupt systems, interrupt in-
sources. These interrupts are maskable and prioritized puts are masked and the interrupt request register is
(Figure 13). The five sources are divided as follows: the polled to determine which of the interrupt requests needs
falling edge of P31 (AN1), P32 (AN2), P33 (REF), and two service.
counter/timers. The Interrupt Mask Register globally or
individually enables or disables the six interrupt requests Table 4. Interrupt Types, Sources, and Vectors
(Table 4).
Source Name Vector Location Comments
When more than one interrupt is pending, priorities are AN2(P32) IROO 0,1 External (F)Edge
resolved by a programmable priority encoder that is con- REF(P33) IR01 2,3 External (F)Edge
trolled by the Interrupt Priority register. All ZB6EOB inter- AN1(P31) IR02 4,5 External (F)Edge
rupts are vectored through locations in program memory. AN2(P32) IR03 6,7 External (R)Edge
When an Interrupt machine cycle is activated, an interrupt TO IR04 B,9 Internal
request is granted. This disables all subsequent inter- T1 IR05 10,11 Internal
rupts, saves the Program Counter and Status Flags, and
then branches to the program memory vector location
Notes:
reserved for that interrupt. This memory location and the F=Falling edge triggered
next byte contain the 16-bit starting address of the inter- R=Rising edge triggered
rupt service routine for that particular interrupt request.
IRoo-IRQS
,
IMR
Global 6
Interrupt
Enable
Interrupt
Request
Vector Select
116
Clock. The Z86E08 on-chip oscillator has a high-gain, to release the STOP Mode, the I/O port mode registers are
parallel-resonant amplifier for connection to a crystal, not reconfigured to their default power-on conditions. Tilis
ceramic resonator,or any suitable external clock source. prevents any I/O, configured as output wilen the STOP
The crystal should be AT cut, 12 MHz max, with a series instruction was executed, from glilching to an unknown
resistance (RS) of less than or equal to 100 Ohms. state. To use the P27 release approach with STOP Mode,
use the following instruction:
The crystal is connected across XTAL 1 and XT AL2 using
the recommended capacitors (capacitance is between. OR P2M, #80H
10 pF to 250 pF depending upon the crystal manufacturer, Nap
ceramic resonator and PCB layout) from each pin to STOP
ground (Figure 14).
In order to enter STOP (or HALT) mode, it is necessary to
+l'"
first flush the instruction pipeline to avoid suspending
~~'" ~~'"
execution in mid-instruction. To do this, lhe user must
Cl I C1
I execute a Nap (opcode=FFH) immediately before the
-=f3 ':' L appropriate sleep instruction, i.e.:
117
SPECIAL FUNCTIONS (Continued)
Opcode WDH (4FH). When this instruction is executed it Auto Reset Voltage (VAST)' The Z86E08 has an auto-reset
enables the WOT during HALT. If not, the WOT stops when built-in. The auto-reset circuit resets the Z86E08 wilen it
entering HALT. This instruction does not clear the counters, detects tile Vee below V~ST' Figure 15 shows tile Aulo Reset
it just makes it possible to have the WOT running during Voltage vs temperature.
HALT Mode. A WOH instruction executed without executing
WOT (5FH) has no effect.
Vee
(Volts)
2.50
2.45
/
/
2.40 /
/
2.35 J
2.30 ~
V
~
2.25
~~ /
2.20 Temp
-5°C 25°C 75°C
118
Low EMI Emission
The Z86E08 can be programmed to operate in a low EMI • Output drivers have resistances of 200 ohms (typical).
emission mode by means of an EPROM programmable bit
option. Use of this feature results in: • Oscillalor divide-by-two circuitry eliminaled.
• Less than 1 mA consumed during HALT mode. ROM Protect. ROM Protect fully protects the Z86E08 HOM
code from being read externally. When ROM protect is
• All drivers slew rates reduced to 10 ns typical. selected, the Z86E08 will disable tile instructions LOC and
LOCI (Z86E08 and Z86C08 do not support the instructions
• Intemal SLCK/TCLK operation limited to a maximum of LDE and LDEI).
of 4 MHz - 250 ns cycle time.
User Modes. Table 5 shows the programming voltage of
each mode of Z86E08.
User Modes Vpp EPM ICE IDE IPGM ADDR DATA Vee
(P33) (P32) (XTAL1) (P31) (P02) (Port2)
Noles:
Vpp= 12.5V±O.5V
VH = 12.5V ± O.5V
X = TTL Level (irrelevant)
V,,=5.0V
V L = OV'
Internal Address Counter. The address of Z86E08 is gen- Programming Waveform. Figures 17, 18 and 19 show the
erated internally with a counter clocked through pin P01 programming waveforms of each mode. Table 6 shows the'
(Clock). Each clock signal increases the address by one timing of programming waveforms.
and the "high" level of pin POO (Clear) will resetthe address
to zero. Figure 16 shows the set-up time of the serial Programming Algorithm. Figure 20 shows tile flow cilart of
address input. the Z86E08 programming algorittlm.
119
Low EMI Emission (Continued)
P01 = Clock
POO = Clear
Internal
Address
14-~- OMin
Vih
Data Invalid
Vii
Legend:
120
Vih
Data
Vii
Vh
EPM
Vii ~
5V
~
VCC
Vih
~
CEB
Vii
Vih
ss
OEB
Vii \ / \ /
VPP Irrelevant
Vih
PGMB ss
Figure 17. Z86E08 Programming Waveform (EPROM Read)
121
low EMI Emission (Continued)
Vih
Address
Vii ~_____________A_dd_r_es_s_s_m_bl_e____________-J~~___
Vih
Data
Vii
VPP
Vpp
Vih
6V
VCC
5V
Vh
CE
Vii
Vih
·PGM
Vii
Vih
OE
Vii
1 4 - - - - Program Cycle ---_i4---Verify Cycle
122
Vih
Address Address Don't Care
Vii
Vih
Data __
V_il____ J~~ __________________D_m_a_D_o_n'_t_Ca_re
______________________________
Vpp
Vpp
Vih
6V
Vee
5V
CE ~V~h____________~----------------------------------------------
Vih
OE
Vh
EPM
Vii Vih
Vih
PGM
Vii
Figure 19. Z86E08 Programming Waveform (EPROM Protect and Low EMI Program)
123
low EMI Emission (Continued)
124
STANDARD TEST CONDITIONS
150pF
I
Figure 21. Test Load Diagram
Symbol Parameter Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. TIlis
Vee Supply Voltage* -0.3 +7 V is a stress rating only; operation of the device at any
TSTG Storage Temp -65 +150 C condition above those indicated in the operational sec-
TA Oper Ambient Temp t t C tions of these specifications is not implied. Exposure to
absolute maximum rating conditions for extended periods
Noles: may affect device reliability .
• Voltages on all pins with respect to GND.
t See Ordering Informaticn
CAPACITANCE
TA = 25°C, Vee = GND = OV, f =1.0 MHz, unmeasured pins to GND.
Parameter Max
Input Capacitance 10 pF
Output Capacitance 20 pF
I/O Capacitance 25 pF
Vee SPECIFICATION
4.4V± O.4V
5.0V± 0.5V
125
DC ELECTRICAL CHARACTERISTICS
VCH Clock Input High 4.0V 0.7 Vee Vee+0.3 2.4 V Driven by External
Voltage Clock Generator
5.5V 0.7 Vee Vee+0.3 2.6 ·V Driven by External
Clock Generator
Va. Clock Input Low 4.0V Vss-0.3 0.2 Vee 1.6 Driven by External
Voltage Clock Generator
55V Vss-0.3 0.2 Vee 2.3 V Driven by External
\
Clock Generator
VrA2. Output Low Voltage 4.0V TBD 0.7 V Ill. = +12 mA,
3 Pin Max
5.5V 0.8 0.5 V 101. =+12mA,
3 Pin Max
126
Symbol Parameter Vcr; T. =DOC Typical Units Conditions
to +7DoC @25°C
Min Max
Icc Supply Current 4.0V 4.0 2.2 rnA All Output and I/O Pins
(Standard Mode) Floating @2 MHz
5.5V 7.0 5.0 rnA All Output and I/O Pins
Floating @2 MHz
4.0V 9.0 4.5 rnA All Output and I/O Pins
Floating @8 MHz
5.5V 11.0 8.3 rnA All Output and I/O Pins
Floating @ 8 MHz
4.0V 10 6.1 rnA All Output and I/O Pins
Floating @12 MHz
5.5V 15 10.8 rnA All Output and I/O Pins
Floating @12 MHz
ICC! Standby Current 4.0V 2.5 0.5 rnA HALT Mode Y'N = OV,
(Standard Mode) Vee @2MHz
5.5V 4.0 1.0 rnA HALT Mode Y'N = av,
Vee @2MHz
4.0V 4.0 1.0 rnA HALT Mode Y'N = OV,
Vee @8MHz
5.5V 5.0 2.0 rnA HALT Mode V,N = OV,
Vee @8MHz
4.0V 5.0 1.3 rnA HALT Mode Y'N = OV,
Vee @12MHz
5.5V 7.0 2.3 rnA HALT Mode Y'N = OV,
Vee @12 MHz
---~--.- ----- -~-
Icc Supply Current 4.0V 4.0 2.2 rnA All Output and I/O Pins
(Low Noise Mode) Floating @ 1 MHz
5.5V 7.0 4.2 rnA All Output and I/O Pins
Floating @ 1 MHz
4.0V 6.0 2.9 rnA All Output and I/O Pins
Floating @ 2 MHz
5.5V 9.0 5.5 rnA All Output and I/O Pins
Floating @ 2 MHz
4.0V 8.0 4.4 rnA All Output and I/O Pins
Floating @ 4 MHz
5.5V 11.0 7.9 rnA All Output and I/O Pins
Floating @ 4 MHz
127
DC ELECTRICAL CHARACTERISTICS (Continued)
leel Slandby Currenl 4.0V 1.2 0.4 rnA HALT Mode VIN = OV,
(Low Noise Mode) Vee @l MHz
5.5V 1.6 0.9 rnA HALT Mode VIN=OV,
Vee@lMHz
4.OV 1.5 0.5 rnA HALT Mode VIN = OV,
Vee @2MHz
5.5V 1.9 rnA HALT Mode VIN = OV,
Vee @2MHz
4.0V 2.0 0.8 rnA HALT Mode VIN = OV,
Vee @4MHz
5.5V 2.4 1.3 rnA . HALT Mode VIN = OV,
Vee @4MHz
INJ. Auto Latch Low 4.0V -7.0 -3.3 pA OV <VIN < Vee
Current
5.5V -7.0 -6.5 pA OV < VIN < Vee
IIlJl Auto Latch High 4.0V 10 -6.0 ~ OV<VIN<Vee
Current
5.5V 15 11.5 pA OV<VIN<Vee
Noles:
(1) Icc. Typ Max Unit Freq
Clock Driven on Crystal 3.0 5.0 rnA 8 MHz
or XTAL Resonator 0.3 5.0 rnA 8 MHz
(2) Vss=CN=GND
128
AC ELECTRICAL CHARACTERISTICS
Clock
\---
IRQ N
'LJL}
Figure 22. Electrical Timing Diagram
AC ELECTRICAL CHARACTERISTICS
Low Noise Mode
129
AC ELECTRICAL CHARACTERISTICS (Continued)
Low Noise Mode
Noles:
[1] Timing Reference uses 0.9 Vee for a logic 1 and 0.1 Vee for a logic 0:
[2] Interrupt request via Port 3 (P31-P33)
130
AC ELECTRICAL CHARACTERISTICS
Standard Mode, Standard Temperature
5 TwTinH Timer Input High Width 4.0V 3TpC 3TpC 3TpC [1]
5.5V 3TpC 3TpC 3TpC [1]
6 TpTin Timer Input Period 4.0V 8TpC 8TpC 8TpC [1]
5.5V BTpG 8TpC BTpG [1]
7 TrTin, Timer Input Rise 4.0V 100 100 100 ns [1]
TtTin and Fall Timer
5.5V 100 100 100 ns [1]
Noles:
[1] Timing Reference uses 0.9 Vcc for a logic 1 and 0.1 Vcc for a logic O.
[21. Interrupt request via Port 3 (P31-P33)
131
Z8 CONTROL REGISTER DIAGRAMS
Imlool~I~lool~lrnlool
o = No Function
I TO Inftial Value
(When Wrftten)
1 = load TO
(Range: 1-256 Decimal
o = Disable TO Count 01-00 HEX)
1 = Enable To Count TO CUrrent Value
(When READ)
0= No Function
1 = load T1
o = Disable T 1 Count
1 = Enable T 1 Count·
Figrue 26. CounterfTimer 0 Register
TIN Modes (F4H: Read/Write)
00 = External Clock Input
01 = Gate Input
10 = T~gger Input
(Non-retrlggerable)
11 = T~gger Input R245PREO
(Rel~ggerab~)
Count Mode
o = TO Single Pass
Figure 23. Timer Mode Register 1 = TO Modulo N
(F1H: ReadIWrite) X
Prescaler Modulo
(Range: 1-64 Decimal
01-00 HEX)
R242T1
Figure 27. Prescaler 0 Register
Imloolool~lool~lrnlool (F5H: Write Only)
I T1 Initial Value
(When Written)
(Range 1-256 Decimal
01-00 HEX)
R246 P2M
T1 Current Value
(When READ)
Imlool~I~lool~lrnlool
I P27 - P20 110 DelinlUon
Figure 24. Counter Timer 1 Register o Defines Bit as OUTPUT
1 Defines Bft as INPUT
(F2H: ReadIWrite)
R247P3M
Count Mode
o =T 1 Single Pass
1 =T1 ModuloN
Clock Source
1 = T1 Intemal o Port 2 Pull-Ups Open Drain
o = T 1 External Timing Input 1 Port 2 Pull-Ups Active
(TIN) Mode
Port 3 Inputs
Prescaier Modulo ODlgttal
(Range: 1-64 Decimal 1 Analog
01-00 HEX)
X
132
R248 POIM
R2511MR
IIDloolool~lool~lrnlool
I ~~ Px03-POOMode
X
DO-Output
01 _Input
Must 00 0
I Enables IROO-IROS
(DO =IROO)
Reserved
I Enables Intenrupts
IIDloolool~lool~lrnlool
L j Interrupt Group P~o~ty UserFlagFI
Reserved = 000
C>A>B=OOI UserFlagF2
A>B>C=OIO HaW Carry Flag
A>C>B=011
B>C>A=IOO Decimal Adjust Flag
C > B>A=IOI
OvertlowRag
B>A>C=IIO
Reserved = III Sign Flag
IROI, IRQ4 P~o~ty (Group CI Zero Flag
0= IROI > IRQ4
I = IRQ4 > IROI Carry Flag
IROO, IR02 P~orlty (Group BI
0= IRQ2 > IROO
I = IROO > IR02
IR03, IR05 P~orlty (Group AI Figure 34. Flag Register
o = IROS > IR03 (FCH: ReadlWrite)
I = IRQ3 > IROS
o
R253 RP
Figure 31. Interrupt Priority Register IIDloolool~lool~lrnlool
R250 IRO
(F9H: Write Only)
I ,---1_ Don'Care
Register Pointer
133
Current 16
(rna)
14
12
10
2 ~--~--~--~--~--~--~--~__~__~~
2 3 4 5 6 7 8 9 10 11 12
Frequency (MHz)
I
I~
---'-L_.t._-+--I--J--t--+--t--t--i-1ICC1
1. . . J=d::-::=b-=t-::1--l-----t---t--l:J Icc1 at 5.5V
at4,OV
2 3 4 5 6 7 8 9 10 11 12
Frequency (MHz)
134
Current 8 1--......--...,...--.,.---..--...,..----.
(rna)
7
4 Icc a14.0V
Figure 39. Typical Icc and Icc. vs Frequency in Low EMI Mode
Current 11 r - -......--...,...--.,----,...,..--,-----.
Icc a15.5V
(rna) 10
8 Icc at 4.0V
2 I----+-
lee1 at 5.5V
b=d==d::::::;:;oF;;;;;::F===t::::===J lee1 a14.0V
Figure 40. Maximum Icc and Icc. vs Frequency in Low EMI Mode
135
Time 80
(Msec)
75 4. OV
70 L--- V--
~
65 ~
60
55
~
--- l.---I----
~
----- ---- l---- I--
4. 5V
I---- ~
5.OV
-----
50
45
l.---
I--
5.5V
~
40 !--
~
Temp
35 r--
_5°C 25°C 75°C
Time 34
(Msec)
4.0V
32
30 ~
V'
----
7
28
26
24
--- -- --- -- --
f,..-- --
/
----
~
4.5V
---
!-- I--
16
l.---
Temp
14 t--
25°C 75°C
136
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags.
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry lIag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Ir Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flags are indicated by:
R Register or working-register address
r Working register address only o Clear to zero
IR Indirect-register or indirect working- 1 Set to one
register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair X Undefined
address
Symbol Meaning
137
CONDITION CODES
138
INSTRUCTION FORMATS
One-Byte Instructions
CLR, CPL, DA, DEC, OPC T MODE ADC, ADD, AND, CP,
1-._;;;;':':;":;'_--1
OR 11
_
11 0 I
_
dsVsre I DECW, INC, INCW,
_ POP, PUSH, RL, RLC, sre OR
LD, OR, SBC, SUB,
TCM, TM,XOR
RR, RRC, SRA, SWAP dst OR
OPC I
I - - -d- s-t ------lOR 11 11 0 I dst
JP, CALL (Indirect)
OPC I MODE ADC, ADD, AND, CP,
dst ORllll0 I dst
LD, OR, SBC, SUB,
TCM, TM,XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC, ADD, AND, cp, sre OR
OR, SBC, SUB, TCM,
dst OR
TM,XOR
I L
dsVCC OPC DJNZ,JR
OPC
DAU
DAL
CALL
FFH STOPIHALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
"---"_ For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
139
INSTRUCTION SUMMARY (Continued)
140
Instruction Address Opcode Flags Instruction Address Opcode Flags
and Operation Mode Byte (Hex) Affected and Operation Mode Byte (Hex) Affected
dst src C Z S V DH dst src C Z S V DH
t 4[ ] - t 2[ ]
OR dst. SIC
dst~dst OR src ** 0 SUB dst. SIC
dst~dst~src ****1*
POP dst R 50 - - - - - - SWAPdst R FO X
** X
- -
dst~@SP; IR 51 tR F1
SP~SP+1 oI
175G
PUSH src R 70 - - - - - -
SP~SP-1; IR 71 TCM dst. src t 6[ ] -
** 0
- -
@SP~src (NOTdst)
AND src
RCF CF 0 - - - - -
C~ TM dst. src t 7[ ] -
** 0 - -
dstAND src
RET AF - - - - - -
PC~@SP; WDH 4F
SP~P+2
WDT 5F
RLdst R 90
****--
~
IR 91 XOR dst. src
dst~dst
t B[ ] -
** 0
XORsrc
RLC dst R
IR
10
11
****- -
L:§:[EjjJ
Address Mode Lower
SBC dst. src t 3[ ]
****1* dst src Opcode Nibble
dst~dst~src~C
[2J
SCF DF - - - --
C~l Ir [3]
- -
SRA dst R
IR
DO
D1
*** 0 R R [4]
~ R IR [5)
SRPdst 1m 31 - - - - -- R 1M (6)
RP~src
IR 1M [7)
STOP 6F - - - - - -
141
apcaDE MAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl rl. r2 rl.lr2 R2, Rl IR2, Rl Rl,IM IR1,IM rl, R2 r2, Rl rl,RA cc. RA rl,IM CC, DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 I--
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl r1,r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IRI.IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 I-
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRl rl. r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 I--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRl 1M rl, r2 rl,lr2 R2, Rl IR2, Rl RI,IM IRUM
4
8.5
DA
8.5
DA
6.5
OR
6.5
OR
10.5
OR
10.5
OR
10.5
OR
10.5
OR
r--:w-
WDH
Rl IRl r1,r2 rl,lr2 R2, Rl IR2,Rl Rl,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
5 POP POP AND AND AND AND AND AND WDT
Rl IRl r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 1,10.5 10.5 10.5 ~
6 COM COM TCM TCM TCM TCM TCM TCM STOP
)( Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
"
:;. 10/12.1 12/14.1 6.5 6.5 10.5 1,10.5 10.5 10.5 '7:0
7 PUSH PUSH TM TM TM TM
..,:c"
TM TM HALT
R2 IR2 rl, r2 rl,lr2 R2, RI IR2, RI Rl,IM IR1,IM
Z 10.5 10.5 &1
:;; 8 DECW DECW 01
Co
Co RRl IRl
::J
6.5 6.5 &1
9 RL RL EI
Rl IRl
A
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 '14:0
INCW INCW CP CP CP CP CP CP RET
RRl IRl r1, r2 r1.1r2 R2, Rl IR2, Rl Rl,IM IRI,IM
6.5 6.5 6.5 6.5 10.5 1,10.5 10.5 10.5 ~
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRI r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
~6.5 6.5 12.0 18.0 10.5 '6.5
C RRC RRC LDC LOCI LD RCF
Rl IRl rl,lrr2 Irl,lrr2 rl,x,R2
D
6.5
SRA
6.5
SRA
20.0
CALL'
20.0
CALL
10.5
LD
r--e:s
SCF
Rl IRl IRRl DA r2,x,Rl
E
6.5
RR
6.5
RR
6.5
LD
10.5
LD
10.5
LD
10.5
LD
10.5
LD
r-e:s
CCF
Rl IRl rl,IR2 R2, Rl IR2, Rl Rl,IM IR1,IM
F
8.5
SWAP
8.5
SWAP
6.5
LD
10.5
LD
rs:o
NOP
Rl IRl Irl, r2 R2,IRl
. .,. l-
V'
l-
T ~
2 3 2 3
Byte~s per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline
Cycle j Cycles
R 1 or r 1 = Dst address
R20r r2= Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
142
PRODUCT SPECIFICA TlON
Z86C09/C19
CMOS Z8® 8-BIT
MICROCONTROLLER
FEATURES
• 8-bit CMOS microcontroller, 18-pin DIP • Two Expanded Register File Control Registers
• Low power consumption-50 mW (typical) • 6vectored, priority interrupts from five different sources
• Fast instruction pointer, 1.0 microseconds @ 12 MHz • Clock speeds 8 and 12 MHz
• All digital inputs are CMOS levels and Schmitt triggered • TwoComparators with programmable interrupt polarity
• 2K, 4 Kbytes of ROM, Z86C09, Z86C19, respectively • On-chip oscillator that accepts a crystal, ceramic
resonator, LC, RC, or external clock drive.
• 124 bytes of RAM
GENERAL DESCRIPTION
The Z86C09 and Z86C19 Consumer Controller Proces- The device applications demand powerful I/O capabilities.
sors (CCPTh'l) introduce a new level of sophistication to The CCP fulfills this with 14 pins dedicated to input and
single-chip architecture. The Z86C09 and Z86C19 are output. These lines are grouped into two ports, and are
members of the Z8 single-chip microcontroller family with configurable under software control to provide timing,
2K and 4K bytes of ROM, respectively, and 124 bytes of status signals, or parallel I/O .
. RAM. The devices are housed in a 18-pin DIP, and are
CMOS compatible. Zilog's CMOS microcontroller offers Three basic address spaces are available to support this
fast execution, more efficient use of memory, more sophis- wide range of configurations; Program Memory, Register
ticated interrupts, input/output bit manipulation capabili- File, and Expanded Register File. The Register File is
ties, and easy hardware/software system expansion along composed of 124 bytes of General-Purpose Registers, two
with low cost and low power consumption. I/O Port registers and fifteen Control and Status registers.
The Expanded Register File consists of two control registers.
The Z86C09/C19 architecture is characterized by Zilog's
8-bit microcontroller core with an Expanded Register File To unburden the program from coping with real-time
to allow access to register mapped peripheral and I/O problems such as counting/timing and input/output data
circuits. The CCP offers a flexible I/O scheme, and a communication, the Z86C09/C19 offers two on-chip
number of ancillary features that are useful in many indus- counter/timers with a large number of user selectable
trial, automotive, and advanced scientific applications. modes, and two on-board comparators that can process
analog signals with a common reference voltage
(Figure 1).
143
GENERAL DESCRIPTION (Continued)
Machine
.-----------.11 Timing & Inst.
Control
ALU
FLAG
Register
Pointer
Register File
124x 8 Bit
1/0
(Bit Programmable)
144
P24 P23
P25 P22
P26 P21
P27 P20
VCC GND
XTAL2 P36
XTAL1 P35
P31 P34
P32 P33
PIN DESCRIPTION
Table 1. Pin Identification XTAL 1. Crystal 1 (time-based input). Tilis pin connects a
parallel-resonant crystal, ceramic resonator, LC or f1C
No Symbol Function Direction network or an external single-phase clock to tile on-ctlip
1-4 P24-7 Port 2 pin 4, 5, 6, 7 In/Output oscillator input.
5 Vee Power Supply Input
XTAL2 Crystal Oscillator Clock Output XTAL2. CrystaI2(time-based output). This pin connects a
6
7 XTAL 1 Crystal Oscillator Clock Input parallel-resonant crystal, ceramic resonator, LC or RC
network to the on-chip oscillator output.
8-10 P31-3 Port 3 pin 1, 2, 3 Fixed Input
11-13 P34-6 Port 3 pin 4, 5, 6 Fixed Output Port 2 P20-P27. Port 2 is an 8-bit, bidirectional, CMOS
14 GND Ground Input compatible I/O port. These 8 I/O lines can be configured
15-18 P20-3 Port 2 pin 0, 1, 2, 3 In/Output under software control to be an input or output, indepen-
dently. Input buffers are Scllmilt-triggered. Bits pro-
grammed as outputs may be globally programmed as
either push-pull or open drain (Figure 3).
145
PIN DESCRIPTION (Continued)
"'"-
Z86CO 9
Port 2 (1/0)
Port 2
Open Drain
Open
Out
In
---------<~~----~----------------------~--~
I ------------ --,
I
Auto Latch
I
I R = 500K!} I
L ______________ I
146
Auto-Latch. The auto-latch puts valid CMOS levels on all standard CMOS inputs and pins P34,P35,and P36 are
CMOS inputs that are not externally d riven. This will reduce push-pull outputs. Two all-board comparators can pro-
excessive supply current flow in the input buffer wilen it is cess analog signals on P31 and P32 Witll reference to tile
not been driven by any source. voltage on P33. Tile analog function is enabled by pro-
gramming Port 3 Mode Register (bit 1). Pins P31 and P32
Port 3 P31-P36. Port 3 is a 6-bit, CMOS compatible port are programmable as falling, rising, or bOtil edge triggered
with three fixed input and three fixed output lines. These 6 interrupts (IRQ register bits 6 and 7). P33 is the comparator
lines consist of tilree fixed input (P31-P33) and tilree fixed reference voltage input. Access to Counter!Timer 1 is
output port (P34-P36) lines. Pins P31 ,P32 and P33 are made througll P31 (Tin) and P36 Clout), (Figure 4).
.
Z86C09 ..
Port 3
(I/O or Control)
- Port 3
R247 = P3M
1 = Analog
0= Digital
P31 (AN1)
. - - - - - - . . DIG. ~ IRQ2, Tin, P31 Data Latch
P33 (REF)
147
PIN DESCRIPTION (Continued)
Comparator Inputs. Port 3, Pin P31 and Pin P32 each have Recovery sources can be used to toggle the P33 bit or
a comparator front end. The comparator reference voltage generate IRQ1. In digital mode, Pin P33 can be used as a
Pin P33 is common to both comparators. In analog mode. P33 register input or IRQ1 source (Figure 13).
the P33 input functions as a reference voltage to the
comparators. The internal P33 register and its correspond- Auto-Latch. The auto-latch puts valid CMOS levels on all
ing IRQ1 is connected to the STOP Mode Recovery source CMOS inputs that are not externally driven. This reduces
selected by the SMA. In this mode, any of the STOP Mode excessive supply current lIow in the input buffer when it is
not being driven by any source.
FUNCTIONAL DESCRIPTION
The Z8 CCP incorporates special functions to enhance the The 2K/4K bytes of Program Memory is mask program-
Z8's application in industrial, scientific research, and ad- mable. A ROM protect feature will prevent "dumping" of
vanced technologies applications. the ROM contents by inhibiting execution of LDC, LOCI,
LDE, and LDEI instructions to program memory in all
RESET. The device is reset in one of the following condi- modes.
tions:
Expanded Register File. The register file has been ex-
• Power-On Reset panded to allow for additional system control registers and
for mapping of additional peripheral devices and inpuV
• Watch-Dog Timer output ports into the register address area. The Z8 register
address space RO through R15 is implemented as 16
• STOP Mode Recovery Source groups of 16 registers per group (Figure 6). These register
groups are known as the ERF (Expanded Register File).
The device does not re-initialize the WDTMR, SMR, P2M, Bits 3:0 of the Register Pointer (RP) select the active ERF
or P3M registers to their reset values on a STOP Mode group. Bits 7:4 of register RP select the working register
Recovery operation. group (Figure 7). Two system configuration registers re-
side in the Expanded Register File address space at
Program Memory. Z86C09/C 19 can address up to 2K/4K bank F. The rest of the Expanded Register addressing
bytes of internal program memory respectively (Figure 5). space is not physically implemented, and is open for future
The first 12 bytes of program memory are reserved for the expansion.
interrupt vectors. These locations contain six 16-bit vec-
tors that correspond to the six available interrupts. Byte 13
to byte 2048/4096 consists of on-chip mask-programmed
ROM.
148
2048/40 96
location of On-Chip
First Byte of ROM
Instruction
Executed ............. -------
After RESET 12 I't...
11 IR05
10 IR05
9 IR04
8 IRQ4
7 IR03
Interrupt
Vector 6 IR03
(lower Byte)
5 .......... IR02
~
~ IR02
Interrupt
Vector 3 IR01
(Upper Byte)
2 IR01
1 IRoo
0 IROO
149
FUNCTIONAL DESCRIPTION (Continued)
ZS STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
REGISTER POINTER
%FF SPL u u u u u u u u
17161514131211101
%FE GPR u u u u u u u u
%FO RP 0 0 0 0 0 0 0 0
Expanded Register
Group Pointer %FC FLAGS U U U U .U U U U
%FB IMR 0 U U U U U U U
%FA IRQ 0 0 0 0 0 0 0 0
%F9 IPR U U U U U U U U
*. %F8 P01M U U U 0 U U U ,U
* %F7 P3M U U U U U U 0 0
* %F6 P2M 1 1 1 1 1 1 1 1
%F5 PREO U U U U U U U 0
%F4 TO U U U U U U U U
Z8 Reg. Ale %F3 PREl U U U U U U 0 0
%FF %F2 Tl U U U U U U U U
%Fl TMR 0 0 0 0 0 0 0 0
%FO Reserved
* % (F) OF WOTMR u u u 0 1 1 0 1
%(F) OE Reserved
% (F) 00 Reserved
%(F)OC Reserved
* % (F) OB SMR 0 0 1 0 0 0 U 0
% (F) OA _Reserved
% (F) 09 Reserved
% (F) 06 Reserved
%(F) 05 Reserved
% (F) 04 Reserved
%(F) 03 Reserved
%(F) 02 /'Ieserved
%(F)01 Reserved
% (F) 00 Reserved
150
and status registers, and two system configuration regis-
R253 RP
ters in tile Expanded Register Group (Figure 6). Tile
instructions can access registers directly or indirectly via
an 8-bit address field. Tilis allows a silort 4-bit register
address using tile Register Pointer (Figure 8). In the 4-bit
mode, the Register File is divided into 16 working register
groups, each occupying 16 continuous locations. Tile
Expanded Register Group
Register Pointer addresses the starting location of tile
Working Register Group
active working-register group.
Note: Default Setting After Reset = 00000000 Caution: D4 of Control Register P01 M (R251) must be "0".
If the Z86C09/19 is emulated by Z86C90, D4 of P01 M has
to change to '0' before submission to ROM code.
Figure 7. Register Pointer Register
GPR. The Z86C09/C19 has one extra General Purpose
Register located at %FE(R254).
Register File. The Register File consists of two I/O port
registers, 124 general purpose registers, and 15 control
R127
R15
-- - - - -
1/0 Ports
- - - - R3
151
FUNCTIONAL DESCRIPTION (Continued)
Stack. The Z86C09/C19 has an 8-bit Stack Pointer (R255) Countermmers. There are two 8-bit programmable counter/
used for the internal stack that resides within the 124 timers (TO-T1), each driven by its own 6-bit programmable
general-purpose registers. prescaler. The T1 prescaler can be driven by internal or
external clock sources, however, the TO prescaler is driven
by the internal clock only (Figure 9).
PREO TO TO
Initial Value Initial Value Current Value
Register Register
6-Blt 8-blt
Down Down
...-~ Internal Counter Counter IRQ4
Clock
1"-----'- TOUT
P3S
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
Tin P31
152
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock divided by four, or an exter-
clock source by any integer number from 1 to 64. Each nal signal input via Port 3. The Timer Mode register config-
prescaler drives its counter, which decrements the value ures the external timer input (P31) as an external clock, a
(1 to 256) that has been loaded into the counter. When the trigger input that can be retriggerable or not-retriggerable,
counter reaches the end of count, a timer interrupt request- or as a gate input for the internal clock. Port 3 line P36
IRQ4 (TO) or IRQ5 (T1), is generated. serves as a timer output (Tout) through which TO, T1 or the
internal clock can be output. The counter/timers can be
The counters can be programmed to start, stop, restart to cascaded by connecting the TO output to tile input of Tl.
continue, or restart from the initial value. The counters can
also be programmed to stop upon reaching zero (single- Interrupts. The Z86C09/Z86C 19 has six different interrupts
pass mode) or to automatically reload the initial value and from five different sources. The interrupts are mask-able
continue counting (modulo-n continuous mode). and prioritized (Figure 10). The five sources are divided as
follows; three sources are claimed by Port 3 lines P31-P33,
The counters, but not the prescalers, can be read at any and two sources in counter/timers. The Interrupt Mask
time without disturbing their value or count mode. The Register globally or individually enables or disables the six
clock source lorT1 is user-definable and can be either the interrupt requests (Table 2).
IROQ IR02
IR01, 3, 4, 5
Interrupt
Edge . .- - IRO(OS, 07)
Select
Global
Interrupt
Enable
Interrupt
Request
Vector Select
153
FUNCTIONAL DESCRIPTION (Continued)
When more than one interrupt is pending, priorities are Table 3. IRQ Register
resolved by a programmable priority encoder that is con-
trolled by the Interrupt Priority register. An interrupt ma- IRQ . Interrupt Edge
chine cycle is activated when an interrupt request is 07 06 P31 . P32
granted. This disables all subsequent interrupts, saves the
Program Counter and Status Flags, and then branches to
o o F F
the program memory vector location reserved for that
o 1 F R
interrupt. All Z86C09/C19 interrupts are vectored through
1 o R F
1 1 R/F R/F
locations in the program memory. This memory location
and the next byte contain the 16-bit starting address of the
Noles:
interrupt service routine lor that particular interrupt re- F = Falling Edge
quest. R = Rising Edge
To accommodate polled interrupt systems. interrupt in- Clock. The Z86C09/C 19 ori-chip oscillator has a high-gain,
puts are masked and the interrupt request register is parallel-resonant amplifier for connection to a crystal, RC,
polled to determine which 01 the interrupt requests needs ceramic resonator, or any suitable external clock source
services. IR03 has no hardware source but can be invoked (XTAL 1 = Input, XTAL2 = Output). The crystal should beAT
by software (write to IR03 Register). cut, 10 KHz to 12 MHz max, with a series resistance (RS)
less than or equal to 100 Ohms.
An interrupt resulting from ANi is mapped into IR02, and
an interrupt from AN2 is mapped into IROO. Interrupts The crystal should be connected across XT AL 1 and XTAL2
IR02 and IROO may be rising, falling, or both edge trig- using the recommended capacitors (C1 is more Ulan or
gered, and are programmable by the user. The software equal to 22 pi) from eacll pin to ground. Tile RC oscillator
may poll to identify the state of the pin, option is mask-programmable, to be selected by the
customer at the time the ROM code is submitted. The RC
The programming bits for the INTERRUPT EDGE SELECT oscillator configuration must be an external resistor con-
are located in the IRO register (R250), bits 07 and 06. The nected from XTAL 1 to XT AL2, with a frequency-setting
configuration is shown in Table 3. capacitor from XTAL 1 to ground (Figure 11). The RC value
vs Frequency curves are shown in Figure 48 and 49.
(Limitation: The RC option is not avaiable in the
12 MHz part.)
154
.--------.'---1 xtal1 .----4f--I xtal1 .-----'t--I xtal1 _. __--., xtal1
C1
L R
Power-On Reset. A timer circuit clocked by a dedicated In order to enter STOP (or HALT) mode, it is necessary to
on-board RC oscillator or by the XTAL oscillator is used for first flush the instruction pipeline to avoid suspending
the Power-On Reset (PaR) timer function. The paR time execution in mid-instruction. To do this, the user must
allows Vcc and the oscillator circuit to stabilize before . execute a Nap (opcode=FFH) immediately before the
instruction execution begins. The paR timer circuit is a appropriate sleep instruction, i.e.:
one-shot timer triggered by one of the three conditions:
FF Nap; clear the pipeline
1. Power fail to Power OK status 6F STOP; enter STOP mode
155
FUNCTIONAL DESCRIPTION (Continued) STOP Mode Recovery Source (02, 03, and 04). Tilese 3
bits of the SMR specify the wake-up source of tile STOP
SMR (FlOB Mode recovery (Figure 13 and Table 4).
Figure 12. STOP Mode Recovery Register STOP Mode Recovery Level Select (06). A 1 in this bit
position indicates that a higil level on anyone of tile
recovery sources wakes tile device from STOP mode. A 0
SCLKfTCLK divide-by-16 select (00). DO of the SMR con- indicates low level recovery. The default is 0 on paR. (See
Figure 13).
trols a divide-by-16 prescaler of SCLK/TCLK. The purpose
of this control is to selectively reduce device power cori-
sumption during normal processor execution (SCLK control)
and/or HALT mode (where TCLK sources the counter/
timers and interrupt logic).
156
D4 03 02
1
SMR
o 0 0
0 0 I
SMR D4 03 02 SMR 04 03 02 SMR D4
03 02 SMR D4 03 02 SMR D4 03 02
y-
010 100 101 I I 0 I I I
o I I
P33 P27
To POR
>------------------r~--------------------------------------_+----------~~~
Stop Mode Recovery Edge
Select (SMR) To P33 Data
Latch and IRal
>------------------r--------------------------------------------4MUX~~--------~
P33 From Pads
Digital/Analog Mode
Select (P3M)
Cold or Warm Start (07). This bit is set by the device upon otherwise. The WDTMR cannot be read and is located in
entering STOP mode. It is active high, and is 0 (cold) on bank F of the Expanded Register Group at address loca-
POR/WDT RESET. This bit is a READ only. It is used to tion OFH. It is organized as follows:
distinguish between cold or warm start.
WOTMR (F)OF
Watch Dog Timer Mode Register (WOTMR). The WDT is a
retriggerable one-shot timer that will reset the Z8 if it Im IOOIOOID4I00I00lmlool
reaches its terminal count. The WDT is initially enabled by
executing the WDT instruction and retriggered on subse-
quent executions of the WDT instruction. The timer circuit
-- I I won",
00
01
''"~ ""=
5
15
512
1024'
10 25 2048
is driven by an on-board RC oscillator or external II 100 8192
XTAL1 pin. WOT Ouring HALT
OFF o
I ON'
The POR clock source is selected with bit 4 of the WDT
L-_ _ _ _ _ WOT Ouring STOP
register. Bit 0 and 1 control a tap circuit that determines the o OFF
timeout period. Bit 2 determines whether the WDT is active I ON·
during HALT and Bit 3 determines WDT activity during XTAl1/lNT RC Selectfor WOT
L--_ _ _ _ _ _
157
FUNCTIONAL DESCRIPTION (Continued)
Internal
RESET
WDTSelect
(WDTMR) WDT TAP SELECT
ClKSburce
Select
(WDTMR)
XTAl 5 mS POR 5mS 15mS 25mS lOOmS
ClK 'WDT/POR Counter Chain
ClR
VDD
2VREF.
From Stop
Mode
Recovery
Source 12 nS Glltph Filter
WDT >--------'
Stop Delay
Select (SMR)
WOT Time Select (01, DO). Selects the WOT time period. WDT During HALT (D2). This bit determines whether or not
It is configured as shown in Table 5. the WOT is active during HALT mode, A 1 indicates active
during HALT, The default is 1.
Table 5. WOT Time Select
WDT During STOP (D3). This bit determines whether or not
Timeout Period the WOT is active during STOP mode. Since XTAL clock is
D1 DO (On-board RC) XTAL1 stopped during STOP mode, the on-board RC has to be
Clock Source Clock Source selected as the clock source to the paR counter. A 1
indicates active during STOP. The default is 1.
0 0 5mSmin XTAL 1/512
0 1 15mSmin XTAL 1/1024
On-Board Power-On-Reset RC or External XTAL1 Oscil-
1 0 25mSmin XTAL 1/2048
latorSelect (D4). This bit determines which oscillator source
1 1 100mS min XTAL 1/8192
is used to clock the internal paR and WOT counter chain.
If the bit is a 1, the internal RC oscillator is bypassed and
Notes:
the paR and WOT clock'source is driven from the external
The default on a WOT initiated RESET is 15 mS.
pin, XTAL 1. The default configuration of this bit is 0, which
See Figures 44 to 47 for details.
selects the RC oscillator.
158
Vee Voltage Comparator. An on-board Voltage Compara- The device will function normally at or above 3.0V under all
tor checks that Vee is at the required level to ensure correct conditions. Below 3.0V, tile device will function normally
operation of the device. Reset is globally driven if Vcc is until the Brown Out Protection trip point (Veo ) is reaclled, for
below the specified voltage (typically 2.1 V). the temperatures and operating frequencies in case 1 and
case 2 above. The device is guaranteed to function nor-
Brown Out Protection (V BO)' The brown outtrip voltage (Veo) mally at supply voltages above the brown out trip point.
will be less than 3 volts and above 1.4 volts under the The actual brown out trip point is a function of temperature
following conditions. and process parameters (Figure 16).
Vee 2.80
(Volts)
2.60
2.40
2.00
1.80
" '" '- ......
V BO (Typical)
1.60
"'~
1.40
-60 -40 -20 o 20 40 60 80
'"' ~
100 120 140
Temperature (OC)
159
ABSOLUTE MAXIMUM RATINGS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. This
Supply Voltage * -0.3 +7.0 V is a stress rating only; operation of the device at any
Storage Temp -65 +150 C condition above those indicated in the operational sections
Oper Ambient Temp t C of these specifications is not implied. Exposure to absolute
maximum rating conditions for extended period may affect
Notes: device reliability.
• Voltage on all pins with respect to GND.
t See Ordering Information
+5V
2.1 KG
From Output
Under Test
150 pf
I
Figure 17. Test Load Configuration
160
DC ELECTRICAL CHARACTERISTICS
Z86C09/C19
Va. Clock Input Low 3.3V Vss-O.3 0.2 Vee Vss-0.3 0.2 Vee 1.6 V Driven by External
Voltage Clock Generator
5.0V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 2.7 V Driven by External
Clock Generator
VIH Input High Voltage 3.3V 0.7 Vee VeetO.3 0.7 Vee VeetO.3 1.8 V
5.0V 0.7 Vee VeetO.3 0.7 Vee VeetO.3 2.8 V
VL Input Low Voltage 3.3V Vss-0.3 0.2Vr;c Vss-0.3 0.2 Vr;c 1.0 V
5.0V Vss-0.3 0.2 Vee Vss-0.3 0.2 Vee 1.5 V
Voo Output High Voltage 3.3V Vr;c-O.4 Vee-O.4 3.1 V 100= -2.0 rnA
5.0V Vee-O.4 Vee-O.4 4.8 V IOH= -2.0 rnA
V0I.1 Output Low Voltage 3.3V 0.8 0.8 0.2 V 101.=+4.0 rnA
5.0V 0.4 0.4 0.1 V 101.=+4.0 rnA
V0I.2 Output Low Voltage 3.3V 1.0 1.0 0.4 V 101.=6 rnA,
3 Pin Max
5.0V 1.0 1.0 0.5 V 10I.=t12mA,
3 Pin Max
VlFFSEI Comparator Input 3.3V 25 25 10 mV
Offset Voltage 5.0V 25 25 10 mV
I'l Input Leakage 3.3V -1.0 1.0 -1.0 1.0 J.IA V,N=OV, Vee
(Input bias current 5.0V -1.0 1.0 -1.0 1.0 J.IA V,N=OV, Vee
of comparator)
101. Output Leakage 3.3V -1.0 1.0 -1.0 1.0 !A V,N = av, Vee
5.0V -1.0 1.0 -1.0 1.0 J.IA VIN = OV, Vee
161
DC ELECTRICAL CHARACTERISTICS (Continued)
Z86C09/C19
Icc1 Standby Current 3.3V 3.0 3.0 1.3 rnA HALT Mode VII = OV, [4,5]
Vcc@BMHz
5.0V 5 5 3.0 rnA HAlT Mode VII = OV, [4,5]
Vcc@BMHz
3.3V 4.5 4.5 2.0 rnA HALT Mode VII = OV, [4,5]
Vcc @12MHz
5.OV 7.0 7.0 ' 4.0 rnA HALT Mode VII = OV, [4,5]
Vcc @12MHz
3.3V 1.4 1.4 0.7 rnA Clock Divide by 16 [4,5]
@BMHz
5.OV 3.5 3.5 2.0 rnA Clock Divide by 16 [4,5]
@BMHz
3.3V 2.0 2.0 1.0 rnA Clock Divide by 16 [4,5]
@12MHz
5.0V 4.5 4.5 2.5 rnA Clock Divide by 16 [4,5]
@12MHz
Icc2 ' Standby Current 3.3V 10 20 1.0 !lA STOP Mode VtI = OV, [6]
VccWDT is not Running
5.0V 10 20 3.0 !lA STOP Mode VtI = OV, [6]
Vcc WDT is not Running
3.3V TBD !lA STOP Mode VIN = OV, [6]
Vcc WOT is Running
5.OV TBD TBD 200 !lA STOP Mode VIN = OV, [6]
Vcc WDT is Running
IAIl Auto Latch Low 3.3V 7.0 14.0 ' 4.0 J.IA OV<V1N<VCC
Current
5.0V 20.0 30.0 10 !lA OV < VIN < Vcc
IIUi Auto Latch High 3.3V -4.0 -B.O -2,0 !lA OV<V1N<V CC
Current 5,OV -9.0 -16.0 -5.0 !lA OV < VIN < Vcc
TPOR Power On Reset 3.3V 7 24 6 25 13 rnS
5.0V 3 13 2 14 7 rnS
VBO Vcc Brown Oul 1.50 2.65 1.2 2.95 2.1 V 2 MHz rnax Ext. CLK Freq. [3]
Voltage
Notes:
[1] Icc 1 Type Max Unit Freq
162
AC ELECTRICAL CHARACTERISTICS
Clod<
CIOck~
Setup
11
~. .~
Source
AC ELECTRICAL CHARACTERISTICS
Z86C09/C19
TpC Input Clock Period 3.3V 125 100,ODO 83 100,ODO 12.5 100,000 83 100,000 ns [1]
5.0V 125 100,ODO 83 100,ODO 125 100,ODO 83 100,ODO ns [1]
2 TrC,TfC Clock Input Rise 3.3V 25 15 25 15 ns [1]
and Fall Times 5.0V 25 15 25 J5 ns [1]
4 TwTinL Timer Input Low Width 3.3V 100 100 100 100 ns [1]
5.0V 70 70 70 70 ns [1]
5 TwTinH Timer Input High Width 3.3V 3TpC 3TpC 3TpC 3TpC [1]
5.0V 3TpC 3TpC 3TpC 3TpC [1]
163
AC ELECTRICAL CHARACTERISTICS (Continued)
Z86C09/C19
7 TrTin, Timer Input Rise 3.3V 100 100 100 100 ns [1]
TtTin and Fall Ti mer
5.0V 100 100 100 100 ns [1]
8 Twll Int. Request Input 3.3V 100 100 100 100 ns [1,2]
low Time
5.0V 70 70 70 70 ns [1,2]
9 TwlH Int. Request Input 3.3V 3TpC 3TpC 3TpC 3TpC [1,2]
High Time
5.0V 3TpC 3TpC 3TpC 3TpC [1,2]
10 Twsm STOP Mode Recovery 3.3V 12 12 12 12 ns
Width Spec
5.0V 12 12 12 12 ns
11 lost Oscillator Startup Time 3.3V 5TpC 5TpC 5TpC 5TpC Reg.
[4]
5.0V 5TpC 5TpC 5TpC 5TpC ns
Twdt Watchdog Timer 3.3V 15 15 12 12 [5]
Refresh Time
5.0V 5 5 3 3 ms 00=0
01 =0
3.3V 30 30 25 25 ms DO=O
5.0V 16 16 12 12 ms 01 =1
3.3V 60 60 50 50 ms DO=O
5.0V 25 25 30 30 ms 01 = 1
3.3V 250 250 200 200 ms 00=1
5.0V 120 120 100 100 ms 01 =1
Noles:
[1) Timing Reference uses 0.9 Vee for a logic "1" and 0.1 Vee for a logic "0".
[2) Interrupt request via Pori 3 (P31-P33)
[3) 5.0V ± 0.5V. 3.3V ± 0.3V
[4) SMR-D5 = 0
[5) Reg. WDTMR
164
EXPANDED REGISTER FILE CONTROL REGISTERS
SMR (F)OB WDTMR (F)OF
Imloolool~looloolmlool
SCLKiTCLK Divide by 16
-- II wm~ ,~~ XTALCLK
o OFF' 00 5 512
1 ON 01 15 1024'
10 25 2048
RESERVED 11 100 8192
Stop Mode Recovery Source
WDT During HALT
000 POROniy'
o OFF
001 POROnly
ION'
010 P31
011 P32 ' - - - - - - - WDT During STOP
100 P33 o OFF
101 P27 1 ON
110 P2 NOR 0:3 1-_ _ _ _ _ _ _ XTAUflNT RC Select for WDT
111 P2 NOR 0:7
o On-Board RC •
Stop Delay 1 XTAL
o OFF 1-_ _ _ _ _ _ _ _ _ _ Reserved
1 ON'
Stop Recovery Level
o low level ...
1 High Level , Default setting after RESET
Stop Flag
o POR'
1 Stop Recovery
Figure 20_ Watchdog Timer Mode Register
, Default setting after RESET
Imloolool~lool~lmlool
I Reserved 0 No Function
1 Load TO
0 Disable T OCount
1 Enable T OCount
Figure 21. Reserved
0 No Function
1 LoadT 1
o Disable T 1 Count
1 Enable T 1 Count
T IN
Modes
00 External Clock Input
01 Gate Input
10 Trigger Input
(Non-retriggerable)
11 Trigger Input
(Retriggerable)
Tour Mode
00 Not Used
01 ToOUT
10 Tl0UT
11 Internal Clock Input
165
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R242T1 R245PREO
Iml~I~IMlool~lrnlool
I T 1 Innlal Value ' Count Mode
(When Written) o To Single Pass
(Range 1-256 Decimal 1 TOModuloN
01-ll0HEX)
X
T1 Current Value
(When READ) Prescaler Modulo
(Range: 1-64 Decimal
01-00 HEX)
Iml~I~I~looID~rnlool
Count Mode
o T 1 Single Pass
1 T 1 Modulo-N
I P2 7 - P20 I/O Definition
o Defines Bit as OUTPUT
Clock Source 1 Defines Bit as INPUT
1 T 1 Internal
o T 1 External Timing Input
(TIN) Mode
Prescaler Modulo Figure 27. Port 2 Mode Register
(Range: 1-64 Decimal (F6H: Write Only)
01-00 HEX)
R247P3M
Figure 24. Prescaler 1 Register
(F3H: Write Only)
o Port 2 Pull-Ups Open Drain
R244 TO 1 Port 2 Pull-Ups Active
X
MuslbeO
X
166
R2491PR R252Flags
--
T I IntelTUpt Group Priority User Flag Fl
000 Reserved
001 C>A> B User Flag F2
010 A>B>C
Half Cany Flag
011 A>C>B
100 B>C>A Decimal Adjust Flag
101 C>B>A
110 B>A>C Overflow Flag
111 Reserved Sign Flag
IR01, 1004 Priority (Group C)
o IROl >IR04 Zero Flag
1 IR04> IROl Cany Flag
IROO, 1RQ2 Priority (Group B)
o IRQ2>IBOO
1 IROO>IR02
IR03,IRQS Priority (Group A) Figure 33. Flag Register
o looS>IR03
1 1RQ3 >1005 (FCH: Read/Write)
o
R253 RP
R250 IRQ
(F9H: Write Only)
I I'---- Expanded Register File Pointer
Working Register Pointer
167
DEVICE CHARACTERISTICS
Graphs Illustrate Device Characteristics
8.0 ~
7.0 ~
5.5V
6.0
.... 3.0V
.... :;:. ~
5.0 ,,-
4.0 ~
3.0 ~
V" 3.0V
-- - --- --
2.0
1.0
o
- 1---
2 4 6 8 10 12 14
Frequency (MHz)
Current 12
(rna)
10
Icc at 3.3V
6 Iccl at 5V
Iccl at5V
4 (SCLK divided by 16)
Iccl at 3.3V
2
Iccl at 3.3V
(SCLK divided by 16)
0
0 2 4 6 8 10 12 14 16
Frequency (MHz)
168
Vee 2.0
(Volts)
1.0
A
C
D
0.0
-60 -40 -20 o 20 40 60 80 100 120 130
Temperature (0C)
Legend:
A = Vii at Vee = 3.3V
B = Vii at Vee = S.SV
C ~ Vol at Vee - 3.0V
0= Voil at Vee = S.SV
169
'DEVICE CHARACTERISTICS (Continued)
Graphs Illustrate Device Characteristics
Vee 8.0
(Volts)
6.0
4.0
2.0
VIH at Vee = 3.0V
1.0
(
o
-60 -40 -20 o 20 40 60 80 100 120 140
Temperature (0C)
170
VOH (Volts)
o 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
o
I
Vcc= 3.0V
Vcc:"5.0V I
Vcc= 5.5V
-1.0
-2.0
-3.0
-4.0
-5.0
I
-6.0 JI
-7.0 /I
-8.0 / J
A B C o EFGHI
IOH
(rna) -9.0 I
Legend:
A = 125°C F = -55°C
B = 25°C G = 125°C
C = -55°C H = 25°C
D = 125°C I = -55°C
E=25°C
171
DEVICE CHARACTERISTICS (Continued)
Graphs Illustrate Device Characteristics
IOL 24.0
(rna)
22.0
D
20.0
18.0 I 1/ I,'
16.0 'J ~
14.0 I / /. ~
12.0 I / </ .E
/~
10.0
8.0
,I//i / / ' . / F
"
2.0
o
o 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8
VOL (Volts)
Legend:
A=-55°C Vcc=5.5V
B=25°C Vcc= 3.0V
C= 125°C
D=-55°C
E=25°C
F= 125°C
172
Time 22.0
(msec)
20.0
A
/
18.0
V
v
..,..",.
16.0
~
~
B
~
14.0 ./ ./
I' ~~
, . /V
c
12.0 V ~
/' ~ 0
. /V
~ ~
10.0 ~ ~ E
8.0
~
~
io""""
I"""
~ v
~
~
-'
~
~
~
-
::--
V
~
t:::: F
6.0
~
~ ~ i-"'"""
~
:::.--
::::::: ~
~
4.0
2.0
o
-60 -40 -20 o 20 40 60 80 100 120 140
Temperature (OC)
Legend:
173
DEVICE CHARACTERISTICS (Continued)
Graphs Illustrate Device Characteristics
40.0 I---+--+---+--+---I'---+--j---+--i-:A--I
35.0 1---I---+----+---I-------1r----+---:;".'F---I---;-----t
B
30.0 I---+--+---+--::;..t-''''"----If---j---j---t.".''''---t----I
c
25.0 1---1----,"""'"1----+---1------:;I;;000-='-+----t-__::;;;;oo4""'--;---1
D
20.0 I---+--~~-+---I-_=....F--j-__:~ot-""--+-__::::I-E
F
10.0 ~--+-~._~~--~--r---r--+---+--~-~
5.0 1---I---+----+---I-------1r----+---t----t---;-----t
Legend:
174
Time 85
(msec) Legend:
80
A - Vee = 3.0V
A B- Vee=3.5V
75
v "" C - Vee =4.0V
0- Vee = 4.5v
70 /" . E - Vee = 5.0V
65
V F - Vee = 5.5V
/
V /'
B
60
55
/" V "
/ ./
V ./
c
50
/ /V /
45
./
v /
,/"
'/
.,/"
0-
40 E-
/" .,/" /
35 / /'" ./ ./ F_
30 ./
V ./
.,/"
./
/
..,.., /
/"
",
V / /
25 ./ ,.. /
~~
/
20
~
15
10
o
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (OC)
175
DEVICE CHARACTERISTICS (Continued)
Graphs Illustrate Device Characteristics
Time 170
(msec) Legend:
160
A A- Vee = 3.0V
./ =
B - Vee 3.5V
150 c- Vcc= 4.0V
140 V D- Vee=4.5v
E - Vee = 5.0V
./
V F - Vee = 5.5V
130
".
120 /' ~
~ B
,/ V
110 , ~ J
,,/
c-
90 /" ~
V """"" ~
~ 0
80 ./
/ ./ V , J / E-
/ / V /
70 ./
~
~ ./ , F
60 ./
,,/
./
~l / ~/
50 ./ / V
V-
t:::: /
40
V
i"""
c:::-
30
20
10
o
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (OC)
176
Time 700
(msec) legend:
650
A- Vcc= 3.0V
./
V F - Vcc = 5.5V
500 B-
450 , ~ V ./
/
V ./
/ ~c
400
",
350
300
"" V
./
./
/
./
/
~
-'"
/
V .,..,
~
D
"", / V'" F
. /, / V
250
200
V / /~
~
"- " ,
~
~
~
~
150
100
V
----",..." ~ """
50
o
-60 -40 -20 0 20 40 60 80 100 1.20 140
Temperature (OC)
177
DEVICE CHARACTERISTICS (Continued)
Graphs Illustrate Device Characteristics
N 100000
l:
~
>- 50000
CJ
I:
III
::I
C"
...III
IL
........... :0-...
10000
........... f""'oo.
....... ..... i'...
j'...
5000
" I"" ~
~~
1000
500
" ~~~
"1'\..'
'"
I I II
100
" ""~ ~I'\..
~
50
'"
"'\.,
'\.
\~
10
5
" ~
" A
B
Legend:
Note: This chart for reference only. Each process will have a different characteristc curve.
178
N 10000
J:
~
5000
"
~ r--
>-
()
C
---
GI
:::J
"'
C'
...GI 1000
,~
u. r--.
500
\" r-------
A
100
r----- B
50 "'- - C
~~ I------- I'-----
-
10
5 i'-- D
Legend:
179
DEVICE CHARACTERISTICS (Continued)
Graphs Illustrate Device Characteristics
I 20
(!LA) Legend:
A - Vcc= 3.0V
15
8 - Vcc=4.5V
10 k-[\ c
C - Vee = 5.0V
D- Vee = 5.5V
MV
8
I 'I I D
I I
I I A
5
IJY ~\
)
I I
I I
I I
0
I I I
./ [/..1 Volts
~
'-- ~I V (V)
-5 ~~
~
-10
-15
-20
1V 2V 3V 4V 5V 6V 7V
25°C
180
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect regisler pair or indirect working- Z Zero flag
register pair ad\1ress S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register aqdress only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
181
CONDITION CODES
182
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD, AND, CP,
ORllll0 I DECW,INC,INCW,
dSlisrel POP, PUSH, RL, RLC, sre OR
LD, OR, SBC, SUB,
TCM,TM,XOR
RR, RRC, SRA, SWAP dst OR
OPC JP, CALL (In<irect)
dst IORl 1110 1 dst OPC J MODE ADC, ADD, AND, CP,
dst OR I 1110 I dst
LD, OR, SBC, SUB,
TCM,TM,XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC, ADD, AND, CP, sre OR
OR, SBC, SUB, TCM,
TM,XOR dst OR
OPC CALL
DJNZ,JR DAU
DAL
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
.. ~ ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
183
INSTRUCTION SUMMARY (Continued)
ADCdst, sre t 1 -
dst(-dst + sre +C
1[
****0 * INCdst
dst(-dst + 1
rE
r = 0- F ***
R 20
ADDdst, sre t O[ 1 **** IR 21
dst(-dst + sre
0 *
1 - - -
INCWdst RR AO -
***- -
ANDdst, sre
dst(-dst AND sre
t 5[ **0 dst(-dst + 1 IR A1
IRET BF
CALLdst DA D6 - - - - - - FLAGS+-@SP; ******
SP(-SP-2 IRR D4 SP(-SP + 1
@SP(-PC, PC(-@SP;
PC(-dst SP(-SP + 2;
IMR(7)(-1
CCF
C(-NOTC
EF
*-- - - -
JP ee, dst DA cD - - - - - -
if ee is true e = 0- F
CLRdst R Be - - - - - - PC(-dst IRR 30
dstf-O IR B1
JRee, dst RA eB - - - - - -
COMdst R 60 - **0 - - if ee is true, e = 0- F
dst(-NOT dst IR 61 PC (-PC + dst
Range: +127,
CP dst, sre t A[ 1 ****- - -128
dst - sre
LD dst, sre 1m rC - - - - - -
DAdst R 40
*** X - - dst(-sre R r8
dst(-DAdst IR 41 R r9
r = 0- F
DECdst
dst(-dst -1
R
IR
00
01
- * * * - -. r
X
X
r
C7
D7
r Ir E3
DECWdst RR 80 - ***-- Ir F3
dst(-dst - 1 IR 81 R R E4
R IR E5
01 8F - - - - - - R 1M E6
IMR(7)f-O IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
r(-r - 1 r= O-F LDCdst, sre Irr C2
ifr .. O
PC(-PC + dst LOCI dst, sre Ir Irr C3
Range: +127, dst....sre
-128 r(-r +1;
rr(-IT + 1
EI 9F - - - - - -
IMR(7)(-1
HALT 7F - - - - - -
184
INSTRUCTION SUMMARY (Continued)
NOP FF STOP 6F
OR dst, src t 4[ ] -
**0 - - SUB dst, src t 2[ ]
****1 *
dstf-dst OR src dstf-dstf-src
PUSH src R 70 - - - - - -
17
25 oI
----------
SPf-SP~ 1; IR 71 TCM dst, src t 6[ ] 0 - -
@SPf-src (NOT dst) **
ANDsrc
RCF CF 0 - - - - -
Cf-O TM dst, src t 7[ ] - ** 0 - -
dstAND src
RET AF - - - - - - ---------
PCf-@SP; XOR dst, src t S[ ] - 0 - -
SPf-SP + 2 dstf-dst **
XOR src
Rldst
&4tS}J
R
IR
gO
91 ****- -
L€Ht5]:J
R
IR
10
11 ****- - in this table, and its value is found in the following table to the left of the
applicable addressing mode pair.
R R [4]
SCF DF 1 - - - - -
Cf-1
R IR [5]
SRA dst R
IR
DO
D1 ***0 - -
R 1M [6]
@ IR 1M [7]
SRPsrc 1m 31 - - - - - -
RPf-src
185
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1, 1M rl, R2 r2, Rl rl, RA ee, RA rl,IM ee,DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRI r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRI r1, r2 rl,lr2 R2, Rl IR2,Rl Rl,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 ~
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRI 1M rl, r2 rl,lr2 R2, Rl IR2,Rl Rl,IM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 -
4 DA DA OR OR OR OR OR OR
Rl IRI rl, r2 rl,lr2 R2, Rl IR2,Rl Rl,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
5 POP POP AND AND AND AND AND AND WDT
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 Cf;:o
6 COM COM TCM TCM TCM TCM TCM TCM STOP
>< Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
'"
;5. 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 ~
7 PUSH PUSH TM TM TM
'"
:c
.c R2 IR2 rl .. r2 rl,lr2
TM
R2, Rl IR2,Rl
TM
Rl,IM
TM
IR1,IM
HALT
Z
~
8
10.5 10.5 ~
DECW DECW
'"
0.
0. RRI IRI
DI
::;)
6.5 6.5 ~
9 RL RL EI
Rl IRI
A
10.5 10.5 6.5 6.5 10.5 10.5 10.5' 10.5 ~
INCW INCW CP CP CP CP CP CP RET
RRI IRl n, r2 rl,lr2 R2, Rl IR2,Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 16.0'
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 6:"5
C RRC RRC LDC LDCI LD RCF
Rl IRl rl,lrr2 Irl,lrr2 rl,x,R2
6.5 6.5 20.0 20.0 10.5 6:"5
D SRA SRA CALL- CALL LD SCF
Rl IRI IRRI DA r2,x,Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
E RR RR LD LD LD LD LD CCF
Rl IRl rl,IR2 R2, Rl IR2,Rl Rl,IM IR1, 1M
F
8.5 8.5
SWAP SWAP
6.5
LD
10.5
LD
r---s:o
NOP
.. Rl IRl
'T
irl, r2
~
R2,IRl
'T
~
'T ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1 or r2= Ost address
Cycles 1 Cycles R 1 or r2 = Src address
Seque!'ce:
Opcode, First Operand,
Mnemonic Second Operand
186
CMOS Z8 ONE-TIME-PROGRAMMABLE
MICROCONTROLLER Z86E19
GENERAL DESCRIPTION FEATURES
•
18-pinDIP
Machine
TIming & Inst
Control
110
(Bit Programmable)
187
PRODUCT SPECIFICATION
~ZiIill
Z86C11
CMOS Z8®
MICROCONTROLLER
FEATURES
• Fast instruction pointer - 1.0 microseconds @ 12 MHz • Two programmable 8-bit Counter/Timers each Witll
6-bit programmable prescaler.
• Two standby modes - STOP and HALT
• Six vectored, priority interrupts from eight different
• 32 input/output lines sources
• All digital inputs are TTL levels • On-Chip oscillator that accepts a crystal, ceramic
resonator, LC or external clock drive.
• Auto Latches
GENERAL DESCRIPTION
The Z86C11 microcontroller (MCU) introduces a new level The Z86C11 architecture is characterized by Zilog·s 8-bit
of sophistication to single-chip architecture. The Z86C11 microcontroller core. The device offers a flexible I/O
is a member of the Z8 single-chip microcontroller family scheme, an efficient register and address space structure,
with 4 Kbytes of ROM and 236 bytes of RAM. multiplexed capabilities between address/data, I/O, and a
numberof ancillary features that are useful in many industrial
The MCU is housed in a 40-pin DIP, 44-pin Leaded Chip- and advanced scientific applications.
Carrier, or a 44-pin Quad Flat Pack, and is manufactured
in CMOS technology. The ROMless pin option is available The device applications demand powerful I/O capabilities.
on the 44-pin versions only. Having the ROM/ROMless . The Z86C 11 fulfills this with 32 pins dedicated to input and
selectivity, the MCU offers both external memory and output. These lines are grouped into four ports. Eacll port
preprogrammed ROM. This enables the Z8 microcontroller consists of eight-lines, and is configurable under software
to be used in high volume applications or where code control to provide timing, status signals, serial or parallel
flexibility is required. I/O with or without handshake, and an address/data bus
for interfacing external memory.
Zilog's CMOS microcontrolleroffers fast execution, efficient
use of memory, sophisticated interrupts, input/output bit There are three basic address spaces available to support
manipulation capabilities, and easy hardware/software this wide range of configuration: Program Memory, Data
system expansion along with low cost and low power Memory and 236 General-Purpose Registers.
consumption.
189
GENERAL DESCRIPTION (Continued) .
To unburden the program from coping with the real-time Note: All Signals with a preceding front slash, "I", are active
problems such as counting/timing and serial data com- Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
munication, the Z86C11 offers two on-chip counter/timers active Low, only).
with a large number of user selectable modes, and an
asynchronous receiver/transmitter (UART - Figure 1).
UART ALU
Counterl FLAGS
Prg. Memory
Timers
4096 x 8-Bit
(2)
Register
Pointer
Interrupt
Control Program
Counter
Port 2
190
PIN DESCRIPTION
vee P36
XTAL2 P31
XTAU P27
P37 P26
P30 P2S
(RESET P24
RlIW P23
IDS P22
(AS P21
Z86C11
P3S P20
DIP
GND P33
P32 P34
POO P17
P01 P16
P02 P15
P03 P14
P04 P13
POS P12
P06 P11
PO? P10
191
PIN DESCRIPTION (Continued)
6 5 4 3 2 1 44 43 42 41 40
IRESET 7 39 N/C
RlIW 8 38 P24
IDS 9 37 P23
lAS 10 36 P22
P35 11 35 P21
GND 12 Z86C11 34 P20
PlCC
P32 13 33 P33
POO 14 32 P34
POl 15 31 PH
P02 16 30 P16
Rl/RL 17 29 P15
18 19 20 21 22 23 24 25 26 27 28
1 Vee Power Supply Input 14-16 POO-P02 Port 0 pin 0,1,2 In/Output
2 XTAL2 Crystal, Oscillator Clock Output 17 R//RL ROM/ROMless control Input
3 XTAL1 Crystal, Oscillator Clock Input 18-22 P03-P07 Port 0 pin 3,4,5,6,7 In/Output
4 P37 Port 3 pin 7 Output 23-27 P10-P14 Port 1 pin 0,1,2,3,4 In/Output
9 /DS Data Strobe Output 34-38 P20-P24 Port 2 pin 0,1,2,3,4 In/Output
10 /AS Address Strobe Output 39 N/C Not Connected Input
11 P35 Port'3 pin 5 Output 40-42 P25-P27 Port 2 pin 5,6,7 In/Output
12 GND Ground, GND Input 43 P31 Port 3 pin 1 Input
13 P32 Port 3 pin 2 Input 44 P36 Port 3 pin 6 Output
192
33 32 31 30 29 28 27 26 25 24 23
IRESET 34 22 GND
RlIW 35 21 P24
IDS 36 20 P23
lAS 37 19 P22
P35 38 18 P21
GND 39 Z86C11
QFP 17 P20
P32 40 16 P33
POO 41 15 P34
POl 42 14 P17
P02
Rl/RL :0 13
12
P16
P15
1 2 3 4 5 6 7 8 9 10 11
193
PIN FUNCTIONS
IROMless. (input. active Low). This pin when connected to signal is latched and held for an internal register count of
GND disables the internal ROM and forces the device to 18 external clocks. or for the duration of the external
function as a Z86C91 ROMless Z8. (Note that, when left IRESET. whichever is longer. During the reset cycle. /DS is
unconnected or pulled high to Vee' the part functions as a held active low while /AS cycles at a rate of TpC/2. When
normal Z86C11 ROM version). This pin isonly available on IRESET is deactivated. program execution begins at lo-
the 44-pin versions of the Z86C11. cation OOOC (HEX). Power-up reset time must be held low
for 50 mS. or until VCC is stable. whichever is longer.
IDS. (output, active Low). Data Strobe is activated once for
each external memory transfer. For a READ operation. PortO. (POO-PO?). Port 0 is an 8-bit, nibble programmable.
data must be available prior to the trailing edge of /DS. For bidirectional. TTL compatible port. These eigtll I/O lines
WRITE operations. the falling edge of IDS indicates that can be configured under software control as a nibble I/O
output data is valid. port. or as an address port for interfacing external memory.
When used as an I/O port. PortO is placed under handshake
lAS. (output, active Low). Address Strobe is pulsed once control. In this configuration. Port 3. lines P32 and P35 are
at the beginning of each machine cycle. Address output is used as the handshake control /DAVO and RDYO (Data
via Port 1 for all external programs. Mernory address available and Ready). Handshake signal assignment is
transfers are valid at the trailing edge of /AS. Under dictated by the I/O direction of the upper nibble P04-PO?
program conirol. lAS can be placed in the high-impedance The lower nibble must have the same direction as the
state along with Ports 0 and 1. Data Strobe. and upper nibble to be under handshake control. For the
Read/Write. ROMlessoption. PortO comes up as A 15-A8 Address lines
after /RESET.. .
XTAL1, ~AL2. Crystal 1. CrystaI2(time-based input and
output, respectively). These pins connect a parallel- For external memory references. Port 0 can provide address
resonant crystal. ceramic resonator. LC. or any external bit A 11-A8 (lower nibble) or A 15-A8 (lower and upper
single-phase clock to the on-chip oscillator and buffer. nibble) depending on the required address space. If tile.
address range requires 12 bits or less. the upper nibble of
RlIW. (output, write Low). The Read/Write signal is low Port 0 can be programmed independently as I/O while tile
when the MCU is writing to the external program or data lower nibble is used for addressing. If one or both nibbles
memory. are needed for I/O operation. they must be configured by
writing to the PortO Mode register. In ROMless mode. after
!RESET. (input, active-Low). To avoid asynchronous and a
a hardware reset, Port lines are defined as address lines
noisy reset problems. the Z86C11 is equipped with a reset A 15-A8. and extended timing is set to accommodate slow
filter of four external clocks (4TpC). If the external/RESET memory access. The initialization routine includes
signal is less than 4TpC in duration. no reset occurs. On the reconfiguration to eliminate this extended timing mode
5th clock after the /RESET is detected. an ihternal RST (Figure 5).
194
Z86C11
}POOO(I~I
MCU
Handshake Controls
} {DAVO and RDVO
I-----t~ (P32 and P35)
OEN
Out
In
r----------.., AutoLatch
I I
I I>Nv I
R~ 500kn
IL __________ ..JI
195
PIN FUNCTION (Continued)
Port 1. (P10-P17). Port 1 is an 8-bit, byte programmable, for the multiplexed Address/Data mode. If more than 256
bidirectional, TTL compatible port. It has multiplexed Ad- external locations are required, Port 0 must output the
dress (A7-AO) and Data (D7-DO) ports. For Z86C11, these additional lines.
eight I/O lines can be programmed as Inputor Output lines
or can be configured under software control as an address/ Port 1 can be placed in high-impedance state along will]
data portfor interfacing external memory. When used as Port 0, /AS, /DS and R/tw, allowing the MCU to share
an I/O port, Port 1 is placed under handshake control. In common resource in multiprocessor and DMA applications.
this configuration, Port 3 lines P33 and P34 are used as the Data transfers can be controlled by assigning P33 as a Bus
handshake controls RDY1 and /DAV1. Acknowledge input, and P34 as a Bus request output
(Figure 6).
Memory locations greater than 4096 are referenced through
Port 1. To interface external memory, Port 1 is programmed
Port 1
(110 or AD7 - ADO)
Z86C11
MCU
.....t - - - -
Handshake Controls
IDAV1 and RDY1
I-----t~ (P33 and P34)
OEN
Out
In
r - - - - - - - - - -, AutoLatch
I I
I I
R~ 500kn
IL __________ JI
196
Port 2. (P20-P27). Port 2 is an 8-bit. bit programmable, 2 may be placed under handsllake control. In this configu-
bidirectional, TTL compatible port. Each of these eight I/O ration, Port 3 lines P31 and P36are used as the handsilake
lines can be independently programmed as an input or controls lines /DAV2 and RDY2. Tile ilandshake signal
output or globally as an open-drain output. Port 2 is always assignment for Port 3 lines P31 and P36 is dictated by tile
available for I/O operation. When used as an I/O port, Port direction (input or output) assigned to P27.(Figure 7).
-
~
Port 2 (1/0)
Z86C1 1
MCU
Handshake Controls
} IDAV2 and RDY2
~ (P31 and P36)
-
Open Drain
OEN
Out
1
1
1
L R~
__ SOak!}
__ _______ 1I
197
PIN FUNCTION (Continued)
Port 3. (P30-P37). Port 3 is an 8-bit, TTL compatible four- output ports. Port 3 pins P30 and P37, when used as serial
fixed input and four-fixed output port. These eight I/O lines I/O, are programmed as serial in and serial out, respec-
have four-fixed (P30-P33) input and four fixed (P34-P37) tively (Figure 8),
Z86C1 1
MCU
- Port 3 (110)
(1/0 or Control)
.
-
Figure 8. pon 3 Configuration
Port 3 is configured under software control to provide the (IROO-IR03); timer input and output signals (TIN and Tour).
following control functions: handshake for Ports O. 1 and 2 and Data Memory Select (lDM),
(IDAV and RDY): four external interrupt request signals
'Noles:
HS = HANDSHAKE SIGNALS'
D = Data Available
R = Ready
198
Port 3 lines P30 and P37, can be programmed as serial milled, regardless of parity selection. If parity is enabled,
I/O lines for full-duplex serial asynchronous receiver/ the eightll bit is the odd parity bit. An interrupt request
transmitter operation. The bit rate is controlled by the (IRQ4) is generated on all transmitted characters.
Counter/Timer O.
Received data must have a start bit, eight data bits and at
The l86C 11 automatically adds a start bit and two slop least one stop bit. If parity is on, bit 7 of the received dala
bits to transmitted data (Figure 9). Odd parity is also is replaced by a parity error flag. Received characters
available as an option. Eight data bits are always trans- generate the IRQ3 interrupt request.
1~1~lmlool~I~looloolrnlool~1 1~lmlool~I~lool~lrnlool~1
L L
T SlariBil Star! Bit
Auto-Latch. The Auto-Latch puts valid CMOS levels on all • Less than 1 mA current consumptions during HALT
CMOS inputs that are not externally driven. This will mode.
reduce excessive supply current flow in the input buffer
when it is not been driven by any source. • The pre-drivers slew rate reduced to 10 ns typical.
Low EMI Option. The l86Cll is available in a low EMI • Low EMI output drivers have resistance of 200 ollms
option. This option is mask-programmable, to be selected typical.
by the customer at the time when the ROM code is
submitted. Use of this feature results in: • Oscillator divide-by-two circuitry is eliminated.
199
FUNCTIONAL DESCRIPTION
Address Space
Program Memory. The Z86C11 can address up to 60 K Data Memory (tOM). The ROM version can address up to
bytes of external program memory (Figure 10). The first 12 60 Kbytes of external data memory space beginning at
bytes of program memory are reserved for the interrupt location 4096. The ROMless version can address up to 64
vectors. These locations contain six 16-bit vectors that Kbytes of extemal data memory. External data memory
correspond to the six available interrupts. For ROM mode, may be included with, or separated from, the external
byte 13 to byte 4095 consists of on-chip ROM. At address program memory space. 10M, an optional 1/0 function that
4096 and greater, the Z86C11 executes external program can be programmed to appear on pin P34, is used to
memory fetches. In the ROMless mode, the Z86C11 can distinguish between data and program memory space
address up to 64 Kbytes of external program memory. (Figure 11). The state of the /OM signal is controlled by the
Program execution begins at external location OOOC (HEX) type instruction being executed. An LOC opcode references
after a reset. PROGRAM (/OM inactive) memory, and an LOE instruction
references OATA (10M active low) memory.
65535 65535
External
ROM and RAM
4096
4095
On-Chip ROM
r - - -------
Looation of
First Byte of
12 .... ~
Instruction 11 IR05
Exeouted
Extemat
After RESET 10 IR05 Data
Memory
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IRC3
(Lower Byte)
5 i"' IR02
Interrupt
Vector
J--- ~ IR02
4096
3 IR01
(Upper Byte) 4095
2 IR01
0 IROO
o
Figure 10. Program Memory Configuration Figure 11. Data Memory Configuration
200
Register File. The Register File consists of four I/O port the Register File is divided into 16 working register groups,
registers, 236 general-purpose registers and 16 control each occupying 16 continuous locations. Tt18 Register
and status registers (Figure 12). The instructions can Pointer addresses the starting location of ttle active working-
access registers directly or indirectly via an 8-bit address register group.
field. The Z86C11 also allows short 4-bit register addressing
using the Register Pointer (Figure 13). In the 4-bit mode, Note: Register Bank EO-EF can only be accessed tllrough
working registers and indirect addressing modes.
LOCATION IDENTIFIERS
244 Timer/Counter 0 TO
242 Timer/Counter 1 Tl
General-Purpose
Registers
4
Port 3 P3
3
2 Port 2 P2
Portl PI
o Port 0 PO
201
FUNCTIONAL DESCRIPTION (Continued)
R239
R15
-- - -1I0PortS
- -,- R3
RAM Protect. The upper portion of the RAM's address The ROM Protect option is mask-programmable, to be
spaces BOH to EFH (excluding the control registers) can selected by the customer at the time when tile ROM code
be protected from reading and writing. The RAM Protect is submitted.
bit option is mask-programmable and is selected by the
customer when the ROM code is submitted. After the mask Stack. The Z86C11 has a 16-bit Stack Pointer (R254-R255)
option is selected, the user can activate from the internal used for extemal stack that resides anywhere in tile data
ROM code to turn off/on the RAM Protect by loading a bit memory for tile ROMless mode, but only from 4096 to
06 in the IMR register to either a 0 or a 1, respectively. A 65535 in the ROM mode. An 8-bit Stack Pointer (R255) is
1 in 06 indicates RAM Protect enabled. used for the internal stack til at resides witllin tile 236
general-purpose registers (R4-R239). The iligll byte of tile
ROM Protect. The first 4 Kbytes of program memory is Stack Pointer (SPH-Bit 8-15) is used as a general purpose
mask programmable. A ROM protect feature prevents register when using internal stack only.
dumping of the ROM contents by inhibiting execution of
LOC, LOCI, LDE, and LDEI instructions to Program Memory
in all modes.
202
Countermmers. There are tw08-bit programmable counter/ also be programmed to stop upon reaching zero (single
limers (TO-T1), each driven by its own 6-bit programmable pass mode) or to automatically reload the inilial value and
prescaler. The T1 prescaler can be driven by internal or continue counting (modulo-n continuous rnode).
external clock sources; however, the TO prescaler is driven
by the internal clock only (Figure 14). The counter, but not the prescalers, can be read at any
time without disturbing their value or count mode. I he
The 6-bit prescalers can divide the input frequency of tile clock source forT1 is user-definable and can be either lile
clock source by any integer number from 1 to 64. Each internal microprocessor clock divided by four, or an external
prescaler drives its counter, which decrements the value signal input via Port 3. The Timer Mode register configures
(1 to 256) that has been loaded into the counter. When both the external timer input (P31) as an external clock, a trigger
the counters and prescaler reach the end of the count, input that can be relriggerable or non-relriggerable, or as
a timer interrupt request, IRQ4 (TO) or IR05 (T1), is a gate input for the internal clock. Port 3 line P36 also
generated. serves as a timer output (TOUT) through Wllich TO, T1 or
tile internal clock can be output. Tile counter/limers are
The counter can be programmed to start, stop, restart to cascaded by connecting the TO output to the input of r 1.
continue, or restart from the initial value. The counters can
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-bit
Down Down
Counter Counter IR04
Internal
Clock Serial If0
Clock
Tout
External Clock P36
Clock
Logic 6-Bit 8-Bit IR05
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P31
203
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86C11 has six different interrupts from To accommodate polled interrupt systems, interrupt in-
eight different sources. The interrupts are maskable and puts are masked and the Interrupt Request register is
prioritized. The eight sources are divided as follows: four polled to determine which of the interrupt requests need
sources are claimed by Port 3 lines P30-P33. one in Serial service. Software initialed interrupts are supported by
Out. one in Serial In, and two in the counter/timers (Figure setting the appropriate bit in the Interrupt Request (IRQ)
. 15). The Interrupt Mask Register globally or individually register. .
enables or disables the six interrupt requests. When more
than one interrupt is pending, priorities are resolved by a Internal interrupt requests are sampled on the falling edge
programmable priority encoder that is controlled by the of the last cycle of every instruction, and the interrupt
Interrupt Priority register. request must be valid 5TpC before the falling edge of tile
last clock cycle of the currently executing instruction.
All Z86C 11 interrupts are vectored through locations in the
program memory. When an interrupt machine cycle is For the ROMless mode, when the device samples a valid
activated, an interrupt request is granted. Thus, this dis- interrupt request. the next 48 (external) clock cycles are
ables all of the subsequent interrupts, saves the Program used to prioritize the interrupt. and push the two PC bytes
Counter and Status Flags, and then branches to the and the FLAG register on tile stack. Tile following nine
program memory vector location reserved for that interrupt. cycles are used to fetch the interrupt vector from external
This memory location and the next byte contain the 16-bit memory. The first byte of the interrupt service routine is
address of the interrupt service routine for that particular fetched beginning on the 58th TpC cycle following the
interrupt request. internal sample paint. which corresponds to the 63rd TpC
cycle following the external interrupt sample point.
IRQO-IRQ5
6
Global
Interrupt
Enable
Interropt
Request
Vector Select
204
Clock. The Z86C11. on-chip oscillator has a high-gain, cut, 1 MHz to 16 MHz max, and series resistance' (RS) is
parallel-resonant amplilier for connection to a crystal, LC, less than or equal to 100 Ohms. The crystal should be
ceramic resonator, or any suitable external clock source connected across XTAL 1 and XTAL2 using the recom-
(XTAL 1=Input, XTAL2 = Output). The crystal should be AT mended capacitors (10 pF < CL < 300 pF) from each pin
to ground (Figure 16).
C2::I:
Ceramic Resonator LC Clock External Clock
or Crystal
HALT. Will turn off the internal CPU clock but not the XTAL In order to enter STOP (or HALT) mode, it is necessary to
oscillation. The counter/timers and the external interrupts first flush the instruction pipeline to avoid suspending
IROO, IRQ1, IR02 and IR03 remains active. The devices execution in mid-instruction. To do this, the user executes
are recovered by interrupts, either externally or internally a NOP(opcode=OFFH) immediately before the appropriate
generated. sleep instruction,. i.e.:
STOP. This instruction turns 011 the intemal clock and FF NOP ; clear the pipeline
external crystal oscillation and reduces the standby cur- 6F STOP ; enter STOP mode
rent to 10 microamperes or less. The Stop mode is termi- or
nated by a reset, which causes the processor to restart the FF NOP ; clear the pipeline
application program at address ClOOC (HEX). 7F HALT ; enter HALT mode
205
ABSOLUTE MAXIMUM RATINGS
9.1 kQ
206
DC CHARACTERISTICS
Iccl Standby Current 6.5 6.5 4 rnA [1] HALT Mode VIN = OV, Vcc@12MHz
7.0 7.0 4.5 rnA [1] HALT Mode VIII = OV,Vcc@16MHz
1CC2 Standby Current 10 20 5 jiI [1,2] STOP Mode VIN = OV,Vcc
Notes:
(1) All inputs driven to either OVor Vcc' outputs floating.
[2)1= requires loading TMR (F1H) with any value prior to STOP execution.
Use this sequence:
LDTMR,#QO
NOP
STOP
207
AC CHARACTERISTICS
External 1/0 or Memory Read or Write Timing Diagram
RlIW
) K
-@--
--®-
PortO, 10M ,
) ).
16
~ 9
Port 1
). A7-AO ~ 07- DO IN
f-0- ----0- - -®
.1
~
lAS }
8 18
~ I--®- 6
IDS Jl'I
(Read)
---® ~
~
Port1 A7-AO
): 07- DO OUT ~
~ ~
IDS
(Write)
, 7
It
17
208
AC CHARACTERISTICS
External I/O or Memory Read or Write Timing Table
Noles:
[1] When using extended memory timing add 2 TpC.
[2] TIming numbers given are for minimum TpC. Clock Dependent Formulas
[3] See clock cycle dependent characteristics table.
Number Symbol Equation
Standard Test Load
All timing references use 2.0V for a logic 1 and O.BV for a logic o. 1 TdA(AS) 0.40TpC + 0.32
2 TdAS(A) 0.59TpC - 3.25
3 TdAS(DR) 2.38TpC + 6.14
4 TwAS 0.66lpC - 1.65
209
AC CHARACTERISTICS
Additional Timing Diagram
Clock
\ Jifu \
TIN
'tJ' \
IRON
\d \
Figure 19. Additional Timing
AC CHARACTERISTICS
Additional Timing Table
No Symbol Parameter TA =O°C to 70°C TA =-40°C to 105°C Units Noles
12MHz 16 MHz 12 MHz 16MHz
Min Max Min Max Min Max Min Max
1 TpC Input Clock Period 83 1000 62.5 1000 83 1000 62.5 1000 ns [1]
2 TrC,TfC Clock Input Rise &Fall Times 15 10 15 10 ns [1]
3 TwG Input Clock Width 35 25 35 25 ns [1)
4 TwTinL Timer Input Low Width 75 75 75 75 ns [2)
5 TwTinH Timer Input High Width 3TpC 3TpC 3TpG 3TpC [2)
6 TpTin Timer Input Peri od BTpC BTpC BTpC BTpC [2)
7 TrTin,TfTin Timer Input Rise &Fall Times 100 100 100 100 ns [2)
8A TwlL Interrupt Request Input Low Times 70 70 70 50 ns [2.4]
BB TwlL Interrupt Request Input Low Times 3TpC 3TpC 3TpG 3TpG [2,5)
9 TwlH Interrupt Request Input High Times 3TpC 3TpC 3TpG 3TpC [2,3)
Notes:
[1] Clock timing references use 3.8V for a logic 1 and 0.8V for a logic O.
[2] Timing references use 2.0V for a logic 1 and 0.8V for a logic O.
[3] Interrupt references request via Port 3.
[4] Interrupt request via Port 3 (P31-P33).
[5] Interrupt request via Port 30.
210
AC CHARACTERISTICS
Handshake Timing Diagrams
ROY
(OUtput)
1 r - - - - - - - - - - - - - 4 } -- - - - - - - - - - - - _.
Data Out Data Out Valid Next Data Out Valid
1 ' - - - - - - - - - - - - - 4 } -- - - - - - - - - - - - -.
IDAV
(OUtput)
ROY
(Input)
AC CHARACTERISTICS
Handshake Timing Table
No Symbol Parameter TA =ooe to 700 e TA=-40oe to 105°e Notes
12 MHz 16 MHz 12 MHz 16 MHz Data
Min Max Min Max Min Max Min Max Direction
211
Z8 CONTROL REGISTER DIAGRAMS
R240S10 R243PRE1
1~loolool~lool~I~lool
I Serial Data (DO _ LSB)
CounlMode
o T1 Single Pass
1 T1 ModuloN
TOllTModes
00 NotUsad Figure 26. CounterlTimer 0 Register
01 TO Out (F4H: ReadIWrite)
10 T1 Out
11 Intemal Clock Out
R245PREO
Figure 23. Timer Mode Register (F1H: ReadIWrite)
Count Mode
R242T1 o TO Single Pass
1 TOModuioN
1~loolool~lool~I~lool Reserved
I T1 Initial Value
Prescaler Modulo
(Rsnge: 1-64 Decimal
(WIlen Written) 01-00 HEX)
(Range: 1-258 Declrnal
01-00 HEX)
T1 Current Value
(WIlen Read)
Figure 27. Prescaler 0 Register (F5H: Write Only)
212
R246P2M R248POIM
Iwl~I~I~looloolrnlool
I P21- P27 1/0 Definillon POI - POI Mode
o Deflnes Bft as Output 00 Output
1 Defines Bit as Input 01 Input
IX AI1-h
Stack Selection
Figure 28. Port 2 Mode Register (F6H: Write Only) o External
1 Internal
P17 - PIa Mode
R247 P3M 00 Byte Output
01 Byte Input
10 A07-ADo
11 High-Irrpedance AD1- DAD,
lAS, IDS, tRlIW, A•• - h,
A.s - A.2, If Selected
o Port20panDrafn
1 Port 2 PUsh-pull External Memory Timing
o Nonnal
Reserwd 1 Extended
o P32-lnput POT - PO. Mode
P3S~OutpU\ 00 Output
P32 = IDAVOIRDYO 01 Input
P3S = ROYO/IDAVO IX A.s-A.2
00 P33=I~
P34-0utput
01 ) P33 =Input
Figure 30. Port 0 and 1 Mode Register
10 P34-IDM (F8H: Write Only)
11 P33 _IDAV1IROYI
P34 _ RDY1/IDAVI
R249lPR
0 P31 = I~ (TIN)
P36 - Output (fOl1T)
P31 _IDAV2IROY2
-r-
P36 _ RDY2IIDAV2
0 P30= Input
T I Interrupt Group Priority
Reserved = 000
P37-0ulput C >A>B=OOI
P30 =Serial In A>B>C=010
P37 =Serial Out A>C>B=Ol1
B>C>A=100
0 Parity Off C>B>A=101
1 Parity On B>A>C= 110
Reserved = 111
213
ZS CONTROL REGISTER DIAGRAMS (Continued)
R250IRO R253 RP
Figure 32. Interrupt Request Register Figure 35. Register Pointer Register
(FAH: ReadIWrite) (FDH: ReadIWrite)
R2511MR
R254SPH
Iwloolool~lool~I~lool
1 Enables IR05-IRoo
I Stack Pointer Upper
(Il!= IROO) Byte (SPI.- SPs)
214
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry lIag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign Ilag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Oecimal-adjuslllag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect Set 10 one
working-register address Set to clear according 10 operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbof Meaning
215
CONDITION CODES
216
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
OPC I MODE
sre OR
dst OR
MODE I OPC LD
sre OR
dsl OR
MODE I OPC LD
dsllsrc I x
ADDRESS
cc I OPC JP
DAU
DAl
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" f- ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
217
INSTRUCTION SUMMARY (Continued)
IRET BF
CALLdst OA 06 - - - - - - FLAGSE-@SP; ******
SPE-SP-2 IRR 04 SPE-SP + 1
@SPE-PC, PCE-@SP;
PCE-dst SPE-SP + 2;
IMR(7)E-1
CCF EF *- - - - -
CE-NOTC JP ee, dst OA cD - - - - - -
if ee is true e=0-F
CLR dst R BO - - - - - - PCE-dst IRR 30
dstE-O IR B1
JR ee, dst RA eB - - - - - -
COMdst R 60 -
** 0
- - if ee is true, e =0- F
dstE-NOT dst IR 61 PCE-PC + dst
Range: +127,
CPdst, src t A[ 1 ****- - -128
dst - sre
LD dst, src 1m rC - - - - - -
DAdst R 40 *** X - - dstE-sre r R r8
dstE-OA dst IR 41 R r9
r=0-F
DEedst
dstE-dst - 1
R
IR
00
01
- ***- - r
X
X
r
C7
07
r Ir E3
DECWdst RR 80 - ***- - Ir F3
dstE-dst - 1 IR 81 R R E4
R IR E5
DI 8F - - - - - - R 1M E6
IMR(7)E-O IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
rE-r - 1 r=0-F LDCdst,src Irr C2
ifr,.O
PCE-PC + dst LDCI dst, sre Ir Irr C3
Range: +127, dstE-sre
-128 rE-r +1;
rrE-rr + 1
EI 9F - - - - -
IMR(7)E-1
HALT 7F - - - - - -
218
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - STOP 6F
OR dst, src t 4[ ] -
** 0
- - SUB dst, src t 2[ ]
****1 *
dstf-dst OR src dstf-dstf-src
PUSH src R 70 - - - - - -
17
2GJ o1
RET AF - - - - - -
PCf-@SP; XOR dst, src t B[ I - ** 0 - -
SPf-SP + 2 dstf-dst
XOR src
RLdst R 90 ****- -
&-4tS}J IR 91
t These instructions h'ave an identical set of addressing modes, which
are encoded for brevity, The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ ]'
RLCdst R
IR
10
11
****- - in this table, and its value is found in the following table to the left of the
lfu=£Ej}J applicable addressing mode pair.
R R [4]
SCF DF 1 - - - - -
Cf-1
R IR [5]
SRA dst R DO
***0 - -
R 1M [6]
~
IR D1
IR 1M [7]
SRP src 1m 31 - - - - - -
RPf-src
219
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C o E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R1 IRI r1. r2 rl.lr2 R2, R1 IR2, RI R1,IM IRI.IM r1, R2 r2. R1 r1. RA ce, RA r1.IM cc. DA r1
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
RLC RLC ADC ADC ADC ADC ADC ADC
R1 IR1 r1, r2 rl,lr2 R2.RI IR2, RI RI,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 RI,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r---
3 JP SRP SBC SBC SBC SBC SBC SBC
IRR1 1M r1, r2 r1,lr2 R2, RI IR2, R1 R1,IM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
R1 IRI rl, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r----
5 POP POP AND AND AND AND AND AND
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 R1.IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
6 COM COM TCM TCM TCM TCM TCM TCM STOP
>< R1 IR1 r1, r2 r1,lr2 R2, R1 1R2, RI R1,IM IR1,IM
'"
;;. 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 1'7.0
7 PUSH PUSH TM TM TM TM TM TM
'"
:c
.c R2 IR2 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IRI,IM
HALT
C
6.5 6.5 12.0 18.0 10.5 ts:5
RRC RRC LDC LOCI LD RCF
R1 IR1 r1,lrr2 Ir1,lrr2 r1,x,R2
0
6.5 6.5 12.0 18.0 20.0 20.0 10.5 ts:5
SRA SRA LDC LOCI CALL' CALL LD SCF
RI IRI r2,lrr1 Ir2,lrr1 IRRI DA r2,x,R1
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
E RR RR LD LD LD LD LD CCF
RI IRI r1,IR2 R2, R1 IR2, R1 RI,IM IR1,IM
F
8.5 8.5
SWAP SWAP
6.5
LD
10.5
LD
r--s:o
NOP
R1 IR1 Irl, r2 R2,IR1
\,
v- A.
V
A.
V ~
2 3 2 3
Byles per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1 or r 2 = Ost address
Cycles 1 Cycles R 1or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
220
PRODUCT SPECIFICATION
~Zirm
Z86C12
Z8® ICE IN-CIRCUIT EMULATOR
FEATURES
_ 8-bit CMOS microcontroller emulator, 84-pin package _ All digital inputs are TTL levels
_ Average instruction execution time of 1 s _ Two programmable 8-bit Counter!Timers eacll willl 6-
bit programmable prescaler.
_ Fast instruction pointer - 0,6 us @ 16 MHz
_ Six vectored, priority interrupt from Eight different
_ Two standby modes - STOP and HALT sources
GENERAL DESCRIPTION
The Z86C12 ICE (In-Circuit-Emulator) introduces a new _ No internal ROM is provided, so that code is developed
level of sophistication to single-chip architecture, in off-chip memory, Five size inputs configure the
memory boundaries,
The ICE is housed in a 84-pin PGA, and is manufactured
in CMOS technology, _ The normally internal ROM address and data lines are
buffered and brought out to external pins to interface
The ICE developrnent device allows users to prototype a with the external memory,
system with an actual hardware device and to develop the
code, This code is eventually mask-programmed into the _ Control lines (fMAS and /DAS) are added to interface
on-chip ROM for anyofthe Z86CXX devices, Development with external program memory,
devices are also useful in emulator applications where the
final system configuration, memory configuration, I/O, in- _ The Timing and Control, I/O ports, and clock pins on
terrupt inputs, etc" are unknown, The ICE development the Z86C12 are identical in function to those on tile
device is identical to its equivalent Z86C21 microcom- Z86C21 ,
puter with the following exceptions:
221
GENERAL DESCRIPTION (Continued)
The ICE architecture is characterized by Zilog's 8-bit There are three basic address spaces available to sllpporl
microcontroller core. The device offers; fast execution, this wide range of configuration: Program Memory, Data
more efficient use of memory, more sophisticated interrupts, Memory, and 236 General Purpose Flegisters.
input/output bit manipulation capabilities, easy hardware/
software system expansion, a flexible I/O scheme,' an To unburden the program from coping with real-lime
efficient register and address space structure, multiplexed problems such as counting/timing and serial data com-
capabilities between addre'ss/data, and a number of an- munication, the ICE offers two on-chip counter/timers with
cillary features that are useful in many industrial and a large number of user selectable modes, and an <lsyn-
advanced scientific applications. chronous receiver/transmitter (UART-Figure 1).
Industrial applications demand powerful I/O capabilities. Note: All Signals with a preceding front slash, "/", are active
The ICE fulfills this with 32-pins dedicated to input and Low, e.g.: BlfIN (WORD is active Low); IBfIN (BYTE is
output. These lines are grouped into four ports. Each port active Low, only).
consists of eight lines, and is configurable under software
control to provide timing, status signals, serial or parallel
I/O with or without handshake, and an address/data'bus
for interfacing external memory.
Machine Timing
and
Instruction Control
ISIZEO
ISIZE1
ALU
ISIZE2
ISIZE3
ICE Control SIZE4
FLAGS Block /lACK
IMAS
IMDS
ISYNC
Register L-__________~---- SCLK
Pointer
Program
Memory
Data
Bus
222
PIN DESCRIPTION
"Timing
and
Control
Xtall
Xtal2
P20
PORTO P21
(Nibble P22
Programmable P23 PORT 2
VOorA15-A8
P24 (Bit Programmable)
P25
P26
P27
P30
PORT 1 P31
(Byte
P32
Programmable PORT 3
VOor P33
Serial and Parallel
A07-AOO) P34
VOControl
P35
P17 P36
DO Z86C12 P37
01 AO
02 Al
Program 03 A2
Memory Data 04 A3
Inputs
05 A4
06 AS
07 A6 Program
ISIZEO A7 Memory
ISIZEl A8 Address
ROM Size Outputs
ISIZE2 A9
Inputs
ISIZE3 Al0
SIZE4 All
/lACK A12
IMAS A13
Status and IMOS A14
Memory Control
ISYNC A15
SCLK VCC
GNO VCCl } Power
GNOl VCC2
GN02
GN03
223
PIN DESCRIPTION (Continued)
2 3 4 5 6 7 8 9 10
A • • • • • • • • • •
B • • • • • • • • • •
c • • • • • • • • • •
o ••• •••
E • • • •••
F • • •
• ••
G • • • • ••
H ••••••••••
J ••••••••••
K • • • • • • • • • •
224
PIN FUNCTIONS
IDS. (output, active Low). Data Strobe is activated once for the lines A 15 - AD. This line is always valid. It is not tri-stated
each external memory transfer. For a READ operation, when /AS is tri-stated.
data must be available prior to the trailing edge of /DS. For
WRITE operations, the falling edge of /DS indicates that IMOS. (Output, TIL compatible) Memory Data Strobe. 1 his
output data is valid. is a timing signal used to enable the external memory to
emulate the on-chip ROM. It is active only during accesses
lAS. (output, active Low). Address Strobe is pulsed once to the on-chip ROM memory space as selected by the
at the beginning of each machine cycle. Address output is configuration of the SIZEn pins.
via Port 1 for all external program. Program or data memory
address transfers are valid at the trailing edge of /AS. ISCLK. (Output, TTL compatible) System Clock. Tilis line
Under program control, /AS can be placed in the high- is the internal system clock..
impedance state along with Ports 0 and 1, Data Strobe,
and Read/Write. ISYNC. (Output, TTL compatible) Sync signal. This signal
indicates the last clock cycle of tile currently executing
XTAl1, XTAL2. Crystal 1, Crystal2(time-based input and instruction.
output, respectively). These pins connect a parallel-
resonant crystal, ceramic resonator, LC, or any external IIACK. (Output, TTL compatible) Interrupt acknowledge.
single-phase clock to the on-chip oscillator and buffer. This output, when low, indicates that the ICE is an interrupt
cycle.
RlI'N. (output, write Low). The Read/Write signal is low
when the ICE is writing to external program or data memory. SIZEO, SIZE1, SIZE2, SIZE3, SIZE4. (Inputs, TTL com-
patible). The SIZEn lines control the emulation mode of tile
IRESET. (input, active-Low). To avoid asynchronous and ICE. The functions are defined as shown in Table 2. Tile
noisy reset problems, the ICE is equipped with a reset filter ICE need not be RESET when the state of tllese lines is
offour external clocks (4TpC). Iflhe external/RESET signal changed.
is less than 4TpC in duration, no reset will occur. On the 5th
clock after the /RESET is detected, an internal RST signal Table 2. Memory Size Configuration
is latched and held for an internal register count of 18
external clocks, or for the duration of the external/RESET, SIZE4 SIZE3 SIZE2 SIZE1 SIZEO Memory
whichever is longer. During the reset cycle, /DS is held 0 1 1 ROMless
active low while /AS cycles at a rate of TpC/2. When 0 1 0 2KROM
/RESET is deactivated, program execution begins at loca- 0 0 1 4KROM
tion OOOC (HEX). Reset time is held low for 50 ms, or until
Vcc is stable, whichever is longer. 0 1 0 8KROM
0 0 1 16K ROM
07-00. (Inputs, TIL compatible) Data bus. These eight 1 1 1 32K ROM
lines provide the input data bus to access external memory,
which is emulating the on-chip ROM. During read cycles in
the internal memory space the data on these lines is Note: The SIZE pins can be configured to make 1I1e
latched in just prior to the rise of the /MDS data strobe. memory control signals (lMAS,/MDS, RI/W, /AS, and /DS)
look like the Z86C91 ROM less device. However, on power-
A15-AO. (Outputs TIL compatible) Address bus. During up or reset. Ports 0 and 1 are configured as inputs, rather
T1 these lines output the current memory address. All than A 15 - A8 and AD7 - ADO, respectively. This means that
addresses, whether internal or external, are output. if ROMless mode is desired, the device is powered up in
ROM mode, and executes a few instructions via the ICE
IMAS. (Output, TIL compatible) Memory Address Strobe. address/data ports. These instructions reconfigure the
This line is active during every T1 cycle. The rising edge of ports as required, and then the SIZE inputs can be set to
this signal is used to latch the current memory address on ROM less mode - but without a RESET.
225
PIN FUNCTIONS (Continued)
1/0 Ports
Port 0 (POO-P07). Port 0 is an 8-bit, nibble programmable, For external memory references, Port 0 provides address
bidirectional, TTL compatible port. These eight I/O lines bit A11-A8 (lower nibble) or A15-A8 (lower and upper
can be configured under software control as a nibble I/O nibble) depending on the required address space. If the
port, or as an address portlor interfacing external memory. address range requires 12 bits or less, the upper nibble of
When used as an I/O port, Port 0 may be placed under Port 0 can be programmed independently as I/O, wllile the
handshake control. In this configuration, Port 3, lines P32 lower nibble is used for addressing. If one or both nibbles
and P35 are used as the handshake control/DAVO and are needed for I/O operation, they must be configured by
RDYO (Data available and Ready). Handshake signal writing tothe PortO Mode registeLln ROMless mode, after
assignment is dictated by the I/O direction of the upper a hardware reset, Port 0 lines are defined as address lines
nibble I:04-P07. The lower nibble must have the same A 15-A8, and extended timing is set to accommodate slow
direction as the upper nibble to be under handshake memory access. The initialization routine can include
control. For the ROM less option, PortO appears as A 15-A8 reconfiguration to eliminate this extended timing mode
Address lines after reset. (Figure 4).
Z86C12
ICE
Handshake Controls
IDAVO and RDYO
(P32 and P35)
OEN --"t--i
OUT
TTL Level Shifter
IN ____ <.~~---------------J
226
Port 1 (P10-P17). Port 1 is an 8-bit, byte programmable, for the multiplexed Address/Data mode. If more than 256
bidirectional, TTL compatible port. It has multiplexed Ad- external locations are required, Port 0 outputs the addi-
dress (A7-AO) and Data (D7-DO)ports. For the ICE, these tionallines.
eight I/O lines can be programmed as Input or Output lines
or the' port can be configured, under software control, as Port 1 can be placed in the high-impedance state along
an address/data port for interfacing extemal memory. with Port 0, /AS, /DS and R//W, allowing tile ICE to share
When used as an I/O port, Port 1 can be placed under common resource in multiprocessor and DMA applications.
handshake control. In this configuration, Port 3 lines Data transfers can be controlled by assigning P33 as a Bus
P33 and P34 are used as the handshake controls RDY1 Acknowledge input, and P34 as a Bus request output
and /DAV1, respectively. (Figure 5).
Port 1
(1/0 or AD7 - ADO)
Z86C12
ICE
Handshake Controls
IDAVl and IRDYl
t---_~ (P33 and P34)
OEN ---+---1
OUT -----------~~---~
TTL Level Shifter
IN ------~~~----------------------------~
227
PIN FUNCTIONS (Continued)
Port 2 (P20-P27). Port 2 is an 8-bit, bit programmable, ration, Port 31ines P31 and P36 are used as the handshake
bidirectional, CMOS compatible port. Each of these eight controls lines /DAV2 and RDY2. The handshake signal
I/O lines can be independently programmed as an input or assignmentfor Port 31ines, P31 and P36, is dictated by the
output or globally as an open-drain output. Port 2 is always di"rection (input or output) assigned to P27
available for I/O operation. When used as an I/O port, Port (Figure 6).
2 may be placed under handshake control. In this configu-
Port2 (VO)
Z86C12
ICE
Handshake Controls
IDAV2 and RDY2
(P31 and P36)
Open Drain - - - - - - - - - ,
OEN--.--I
OUT - - - - - - - -......- - - - 1
IN ----c,
Figure 6. Port 2 Configuration
228
Port 3 (P30-P37). Port 3 is an 8-bit, CMOS compatible four- output ports. Port 3, when used as serial I/O, is
fixed-input and four-fixed output port. These eight I/O lines programmed as serial in and serial out, respectively
have four-fixed (P30-P33) input and four fixed (P34-P37) (Figure 7 and Table 3).
-
--
Z86C 12 Port 3
ICE (110 or Control)
-
Figure 7. Port 3 Configuration
Port 3 is configured under software control to provide tile (IROO-IR03); timer input and output signals Cr'N and Tour);
following control functions: handshake for Ports 0 and 2 Data Memory Select (lDM).
(lDAV and RDY); four external interrupt request signals
Notes:
HS = HANDSHAKE SIGNALS
D = Data Available
R = Ready
229
PIN FUNCTIONS (Continued)
Port 3 lines P30 and P37, can be programmed as serial less of parity selection. If parity is enabled, the eigllth bit is
I/O lines for full-duplex serial asynchronous receiver/trans- the odd parity bit. An interrupt request (IRQ4) is generated
mitter operation. The bit rate is controlled by the Counter/ on all transmitted characters.
TimerO.
Received data must have a slart bit, eigilt data bits and at
The ICE automatically adds a start bit and two stop bits to least one stop bit. If parity is on, bit 7 of the received data
transmitted data (Figure 8). Odd parity is also available as is replaced by a parity error flag. Received cilaracters
an option. Eight data bits are always transmitted, regard- generate the IRQ3 interrupt request.
1~lml~I~I~lool~I~I~lnl
Start Bit L StarlBit
1~lpl~I~I~lool~I~loolnl
Start Bit
Seven Data Bils
Odd Parity
Two Slop Bits
IIL...---_L StarlBit
230
PROGRAMMING
Address Space
Program Memory. The ICE can address up to 64K bytes of Data Memory (10M). External data memory is included
external program memory (Figure 9). The first 12 bytes of with, or separated from, tile external program memory
program memory are reserved for the interrupt vectors. space. 10M, an optional 1/0 function that can be pro-
These locations contain six 16-bit vectors that correspond grammed to appear on pin P34, is used to distinguisll
to the six available interrupts. The 5 SIZEn inputs dictate between data and program memory space (Figure 10).
the amount of ROM being emulated, and for an 8K ROM The state of the 10M signal is controlled by tl18 type
the input is '01011'. Respectively, OOOC to 8191 is the instruction being executed. An LOC opcode references
memory map for the emulated ROM, and 8192 to 65535 is PROGRAM (10M inactive) memory, and an LOE instruction
the remaining program memory for which the ICE executes references DATA (10M active low) memory.llle lower
external memory fetches. unaddressable part of the data memory is in fact ad-
dressable with the ICE chip's/MOS line (as lOS is not active
for internal ROM reads), but tllere Sllould be no need'
65535 for this.
External
S ize ..
t ------- ROM or RAM
- - 65535
Location of Emulation
First Byte of ROM or RAM
Instruction
Executed
After RESET
............ to
12 ~
- - -------
11 IR05
10 IR05
External
9 IR04
Data
8 IR04 Memory
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 ......... IR02
~ IR02
Interrupt
Vector
....!----
3 IR01
(Upper Byte)
2 IR01 .t
Size ..
1 IROO
Not Addressable
0 IROO
o
Figure 9. Program Memory Configuration
231
PROGRAMMING (Continued)
Register File. the Register File consists of four I/O port using the Register Pointer (Figure 12). In the 4-bit mode,
registers, 236 general-purpose registers and 16 control the Register File is divided into 16 working register groups,
and status registers (Figure 11). The instructions can each occupying 16 continuous locations. The Register
access registers directly or indirectly via an 8-bit address Pointer addresses the starting location of the active working-
field. The ICE also allows short 4-bit register addressing register group.
LOCATION IDENTIFIERS
244 Timer/Counter 0 . TO
242 Timer/Counter 1 T1
Not
Implemented
239
General-Purpose
Registers
3 Port 3 P3
2 Port 2 P2
Port1 P1
o PortO PO
232
R255
R239
15
-----------------
110 Ports 3
Stack. The ICE has a 16-bit Stack Pointer (R254-R255) used for the internal stack that resides within the 236
used for an external stack that resides anywhere in the general-purpose registers (R4-R239). TIle higll byte of tile
data memory for the ROMless mode, but only from SIZEn Stack Pointer (SPH-Bit 8-15) can be use as a general
to 65535 in ROM mode. An 8-bit Stack Pointer (R255) is purpose register when using internal stack only.
233
FUNCTIONAL DESCRIPTION
Countermmers. There are two 8-bit programmable counter! also be programmed to stop upon rE!aClling zero (single
timers (TO-T1), each driven by its own 6-bit programmable pass mode) or to automatically reload the initial value and
prescaler. The T1 prescaler is driven by internal or external continue counting (modulo-n continuous mode).
clock sources; the TO prescaler is driven by the internal
clock only (Figure 13). The counter,but not the prescalers, is read at any time
without disturbing its value or count mode. Tile clock
The 6-bit prescalers divide the input frequency of the clock source for T1 is user-definable and can be either the
source by any integer number from 1 to 64. Each prescaler intemal microprocessor clock divided-by-four, or an ex-
drives its counter, which decrements the value (1 to 256) temal signal input via Port 3. The Timer Mode register
that has been loaded into the counter. When both the configures the external timer input (P31) as an external
counters and prescalers reach the end of. the count, clock, a trigger input tilat is retriggerable or non-
a timer interrupt request, IRQ4 (TO) or IRQ5 (T1), is retriggerable, or as a gate input for tile internal clock. Port
generated. 3, line P36, also serves as a timer output (lout) tilrougil
which TO, T1 or the internal clock is output. Tile counter!
The counter can be programmed to start, stop, restart to timers can be cascaded by connecting the TOoutput to tile
continue, or restart from the initial value. The counters can input of n.
I OSC I PREO
Initial Value
TO
Initial Value
TO
Current Value
Registe'r Register Register
6-Bit 8-bit
Down Down
Counter Counter IRQ4
6--_ In~ernal
Clock
External Clock
Clock
Logic 6-Bit 8-Bit
IRQ5
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P31
234
Interrupts. The ICE has six different interrupts from eight. To accommodate polled interrupt systems. interrupt in-
different sources. The interrupts are maskable and priori- puts are masked and the Interrupt Request register is
tized. The eight sources are divided as follows: four sources polled to determine which of the interrupt requests neecj
are claimed by Port 31ines P30-P33. one in Serial Out. one service. Software initialed interrupts are supported by
in Serial In. and two in the counter/timers (Figure 14). The setting the appropriate bit in the Interrupt Request Reg-
Interrupt Mask Register globally or individually enables or ister (IRQ).
disables the six interrupt requests. When more than one
interrupt is pending. priorities are resolved by a pro- Internal interrupt requests are sampled on the falling edge
grammable priority encoder that is controlled by the In- of the last cycle of every instruction. and the interrupt
terrupt Priority register. All ICE interrupts are vectored request is valid 5TpC before the falling edge of tile last
through locations in the program memory. Wilen an interrupt clock cycle of the currently executing instruction.
machine cycle is activated. an interrupt request is granted.
Thus. this disables all of the subsequent interrupts. save For the ROMless mode. when the device samples a valid
the Program Counter and Status Flags. and then branches interrupt request. the next 48 (external) clock cycles are
to the program memory vector location reserved for that used to prioritize the interrupt. and push tile two PC bytes
interrupt. This memory location and the next byte contain and the FLAG register on the stack. Tile following nine
the 16-bit address of the interrupt service routine for that cycles are used to fetch the interrupt vector from external
particular interrupt request. memory. The first byte of the interrupt service routine is
fetched beginning on the 58th TpC cycle following the
internal sample point. This corresponds to tile 63rd TpC
cycle following the external interrupt sample point.
IROO-IR05
Global
Interrupt
Enable
Interrupt
Request
Vector Select
235
FUNCTIONAL DESCRIPTION (Continued)
Clock. The ICE on-chip oscillator has a high-gain, parallel- less than or equal to 100 Ohms. The cryslal should be
resonant amplifier for connection to a crystal, LC, ceramic connected across XTAL 1 and XTAL2 using the recom-
resonator, or any suitable external clock source mended capacitors (10pF < CL < 100pF) from each pin to
(XTAL 1=lnput, XTAL2=Output). The crystal should be AT ground (Figure 15).
cut, 1 MHz to 16 MHz max, and series resistance (RS) is
HALT. This turns off the internal CPU clock but not the mid-instruction. To do this, the user must execute a NOP
XTAL oscillation. The counter/timers and the external inter- (opcode=OFFH) immediately before the appropriate sleep
rupts IROO, IR01, IR02 and IR03 remain active. The instruction. Le.:
devices are recovered by interrupts, either externally or
internally generated. FF NOP ; clear the pipeline
6F STOP ; enter STOP mode
STOP. This instruction turns off the internal clock and or
external crystal oscillation and reduces the standby cur- FF NOP ; clear the pipeline
rent to 10 microamperes or less. The Stop mode is termi- 7F HALT ; enter HALT mode
nated by a reset. which causes the processor to restart the
application program at address OOOC (HEX).
Instruction Cycle Timing
To enter STOP (or HALT) mode, it is necessary to first flush
the instruction pipeline to avoid suspending execution in Figures 16 and 17 show instruction cycle timing for in-
structions fetched from external memory.
236
Ml M2 M3
T2 T3
Clock
PI
AI5-AB 07-00 IN A7-AO 07-00 IN
lAS --"'V Vr--------------V
IDS =.7 '~--.....II
,~_ _ _ _ _ _ _ _ _ _ _ __J~
RlIW =-.J
ISYNC~ V
!.--Fetch Instruction>---J~+l14--Fetch 1st Byte of Next Instruction---.!
Ml M2 MlorM3
Clock
PI
A15-A8 07-00 A7-AO 07-00 A7-AO 07-00
lAS -'---V V V,.----
IDS
I
' ' -_ _J I ''--_..I' ' ' -_ _J r
. .4-
RlIW
For 2-Byte Instr. Only
ISYNC~
, ..
14 Fetch 1st Instruction _14 Fetch 2nd Byte Fetch 3rd Byte
(3-Byte
Instruction)
Fetch 1st Byte
(1 or2 Byte
Instruction)
237
FUNCTIONAL DESCRIPTION (Continued)
The addresses, Address Strobe (lAS) and Read Write Ports 0 and 1; /DS and R//W are inactive. If configured for
(RIIW) are output at the beginning of each machine cycle internal memory only, POrts 0 and 1 are used for I/O,/DS
(Mn). The addresses output via Port 0 (if used) remain outputs, /SYNC; RI/W is inactive.
stable throughout the machine cycle. Addresses output
via Port 1 remain valid only during MnT1. The addresses The exception to the instruction fetch timing is during the
are guaranteed valid at the rising edge of lAS, which is opcode fetch of an instruction following the fetch of a one
used to latch the Port 1 output. Port 1 is placed in an input byte instruction. One-byte instructions require lwomachine
mode at the end of MnT1. The Data Strobe is output during cycles to execute. The pipelining causes the following
MnT2 allowing data to be placed on the Port 1 bus. The Z8 opcode fetch to begin one machine cycle early.
accepts the data during MnT3 and IDS is terminated.
Instruction synchronization pulse ISYNC is output one External Memory or I/O Timing
clock pulse period prior to the beginning of an opcode
fetch machine cycle (M1). This output is directly available When external memory is addressed, Ports 0 and 1 are
on the 64-pin version of the Z8; whereas, on the 40-pin configured to output the required number of address bits.
version, the Data Strobe pin outputs ISYNC only if external Port 1 is used as a multiplexed address/data bus for AD7-
memory is not used. ADO and Port 0 outputs address 'bits A 15-A8. The timing
relationships for addressing external memory and I/O are
Note that all instruction fetch cycles have the same ma- illustrated in Figures 18, 19,20 and 21 . The main difference
chine timing regardless of whether the memory is internal between these figures is that Figures 20 and 21 contain an
or not. If configured for external memory, and internal added timing cycle (Tx) that extends external memory
memory is referenced, the addresses are still output via timing to allow for slower memory. . '
tn=MaChlne Cycle
T3 .. ,
Tl I T2 I
Clock
PO
X A15-A8
Pl
X A7-AO ) c:>--<::
07-00 IN
lAS
V "-
IDS
\ I
R/IW
7
10M
X x::
\4 Read Cycle ~\
238
I" Machine Cycle
Tl I T2 I T3 ·1
Clock
PO
X Al5-A8 x::::
Pl X A7-AO X 07-00 OUT x::::
lAS
'-' "-
IDS \ I
RlIW
~
10M
X x.::
I~ Write Cycle ~I
r Tl
Machine Cycle
T2 Tx T3 ·1
Clock
PO :x A15-A8 x::::
P1
:x A7-AO ) c::>-<::
07-00 IN
Figure 20. Extended External Instruction Fetch, 1/0 or Memory Read Cycle
239
FUNCTIONAL DESCRIPTION (Continued)
r Tl
Machine Cycle
T2 Tx
Clock
IAS~
'--
IDS
wm ~"'
\"' ______'
_________________________
10M JC'--_________________________x::
14~-----'Write cycle----~.I
Address bits A 15-AO are valid on Ports 0 and 1 at the During the write cycle, the address outputs follow the same
trailing edge of lAS for both the read and write memory timing relationships as for the read cycle. However, the
cycles. Because Port 0 is not multiplexed, address bits output data is valid for the entire period IDS is active, and
A15-A8, if used, are present all through the readlwrite R//W is active (Low) during the entire write cycle.
memory cycle.
Interrupt requests are sampled before each instruction
During the read cycle, the input data must be valid on Port fetch cycle (Figure 22). First. external interrupt requests
1 at the trailing edge of the Data Strobe output (IDS). The are sampled four clock periods prior to the active lAS pulse
Data Memory Select output (10M) is used to select external that corresponds to an instruction fetch cycle. Then, internal
data memory or extemal program memory. If selected, interrupt requests are samples one clock period preced-
10M is active during the execution of certain instructions. ing lAS.
240
~ ~ ~ ~
~~I m n n B n n B n
Clock
lAS V V V V V V V
IDS \ I
RlNV I \ I
10M I Intarnallntarrupt \ I
~ Fetch 1st Byte
ReqUests Sampled
''',
~ ~
Extarnallnterrupt
Inputs Sampled
(Data Ignored)
~.
1
Internal _ _
Execution ~a;~::.;; ~I. ~~~~~~J ~I.
Save Flags----+-
On Stack
Next
Instruction-
Fetch
ISYNC
(Z8/64) '---./ '---./
/lACK -------~r-----------
(Z8/64) I ,,'-_ _ __
~
FUNCTIONAL DESCRIPTION (Continued)
I First Machine
Cycle
T1 I
Clock
SCU<
IRESET
lAS
IDS
In addition to their uses in memory transfers, the control IDS' has several alternative uses: as a /CAS (Column
signals /AS, /DS and R//W can be used in the following Address Strobe) for dynamic memory interface; as a Chip
interface applications: Enable for memory and other interface devices; as an
Enable input for 3-state bus drivers/receivers for memory
/AS can be modified to provide the /RAS (Row Address and interface devices.
Strobe) signal for dynamic memory interface./RAS can be
derived from the trailing edge of /DS to the trailing edge R//W can be used as a Write input to memory interfaces,
of /AS. and as an Early Status output to switch the direction of
3-state bus drivers/receivers.
242
ABSOLUTE MAXIMUM RATINGS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. This
Vee Supply Voltage' -0.3 +7.0 is a stress rating only; operation of the device at any
TSTG Storage Temp -65 +150 condition above tilose indicated in the operational sec-
TA Oper Ambient Temp" C tions of these specifications is not implied. Exposure to
absolute maximum rating conditions for an extended pe-
Noles: riod may affect device reliability.
• Voltages on all pins with respect to GND .
•• See Ordering Information
2.1 KQ
150 pF
I
Figure 24. Test Load Diagram
243
DC CHARACTERISTICS
Notes:
1= requires loading TMR (%F1 H) with any value prior to STOP execution.
Use this sequence:
LDTMR,#QO
NOP
STOP
244
AC CHARACTERISTICS
External I/O or Memory Read or Write Timing Diagram
RIIW
) (
--®-
f-®-
PortO,lDM ')r- )
16
Hv- 3
Port 1
)~ A7-AO i 07 - DO IN
~
lAS
V 8 18
~ -®- 6
IDS
\ I
(Read)
f--®
~
Port1 A7-AO
') 07- DO OUT
X
f--®- -®-
7
IDS
I
(Write)
"
Figure 25. External 110 or Memory Read or Write Timing
245
AC CHARACTERISTICS
External 1/0 or Memory Read and Write Timing Table
Notes:
[1) When using extended memory timing add 2 TpC. Standard Test Load
[2) Timing numbers given are for minimum TpC. All timing references use 2.0V for a logic 1 and O.BV for a logic O.
[3) See clock cycle dependent characteristics table.
246
AC CHARACTERISTICS
Additionql Timing Diagram
Clock
\'---
TIN
IRON
AC CHARACTERISTICS
Additional Timing Table
5 TwTinH Timer Input High Width 3TpC 3TpC 3TpC 3TpC [2]
6 TpTin Timer Input Period 8TpC 8TpC 8TpC 8TpC [2]
7 TrTin,TlTin Timer Input Rise & Fall Times 100 100 100 100 ns [2]
8A TwlL Interrupt Request Input Low Times 70 50 70 50 ns [2,4]
8B TwlL Interrupt Request Input Low Times 3TpC 3TpC 3TpC 3TpC [2,5]
9 TwlH Interrupt Request Input High Times 3TpC 3TpC 3TpC 3TpC [2,3]
Notes:
[1] Clock timing references use 3.SV for a logic 1 and O.SV for a logic O.
[2] Timing references use 2.0V for a logiC 1 and O.SV for a logic O.
[3] Interrupt references request via Port 3.
[4] Interrupt request via Port 3 (P31-P33),.
[5] Interrupt request via Port 30.
247
AC CHARACTERISTICS
Handshake Timing Diagram
--,. Ir-----~ __----\~' ........................................................
Data In Data In Valid Next Data In Valid
- - - ' 1 ' - - - - - - - - ' 1 '--4~·.······.·····.········ ... ·· ... ·..... · .................. '
ROY
(Output)
Ir----'---------~}- - - - - - - - - - - - - --
Data Out Data Out Valid Next Data Out Valid
I'------------~}- - - - - - - - - - - - - --
ROY
(Input)
AC CHARACTERISTICS
Handshake Timing Table
No Symbol Parameter TA = O°C to 70°C TA = -40°C to 105°C Noles
12 MHz 16MHz 12 MHz 16MHz (Data
Min Max Min Max Min Max Min Max Direction)
5 TdDAVld(RDY) DAV Rise to RDY Rise Delay 115 115 115 115, IN
6 TdDO(DAV) RDY Rise to DAV Fall Delay 0 0 0 0 IN
7 TcLDAVO(RDY) Data Out to DAV Fall Delay TpC TpC TpC TpC OUT
8 TcLDAVO(RDY) DAV Fall to RDY Fall Delay 0 0 0 0 OUT
9 TdRDYO(DAV) RDY Fall to DAV Rise Delay 115 115 115 115 OUT
10 TwRDY RDY Width 110 110 110 110 OUT
11 TdRDYOd(DAV) RDY Rise to DAV Fall Delay 115 ,115 115 115 OUT
248
Z8 CONTROL REGISTER DIAGRAMS
R240 R244 TO
Iwlool~I~lool~lrnlool Iwlool~I~lool~lrnlool
I Reserved I TO Initial Value
(When Written)
(Range: 1-256 Decimal
Figure 29. Serial 110 Register (FOH: Read/WrJte) 01-00 HEX)
TO CUrrent Value
(When Read)
R241 TMR
0 No Function
1 LoadTl Count Mode
0 Disable Tl Count
o
TO Single Pass
1 TOMo<!ulo-n
1 Enable T1 Count
TINModes Reserved
00 External Clock Input Prescaler Modulo
01 Gate Input (Range: 1-64 Decimal
10 Trigger Input 01-00 HEX)
(Non-retriggerable)
11 Triggerlnput
(Retrisgerable)
TOUT Modes
Figure 34. Prescaler 0 Register (F5H: Write Only)
00 NotUsed
01 TO Out
10 Tl0ut R246 P2M
11 Intemal Clock Out
Iwlool~I~lool~lrnlool
Figure 30. Timer Mode Register (F1H: ReadlWrite)
I P20 - P27 110 Definition
o Defines Bit as Output
1 Defines Bit as Input
R242Tl
Iwlool~I~lool~lrnlool
Figure 35. Port 2 Mode Register (F6H: Write Only)
I T1 Initial Value
(WhenWrilten)
(Range: 1-256 Decimal R247 P3M
Iwlool~I~I~I~lrnlool
01-00 HEX)
T1 Current Value
(When Read)
-- o Port 2 Pull-Ups Open Drain
Figure 31. CounterfTimer 1 Register 1 Port 2 PUll-Ups Active
(F2H: ReadlWrite) o P31, P32 Digital Mode
1 P31, P32 Analog Mode
R243 PREl o P32 = Input
P3S =Oulput
1 P32 = /DAVO/RDYO
P3S = RDYO/IDAVO
Figure 32. Prescaler 1 Register (F3H: Write Only) , Figure 36. Port 3 Mode Register (F7H: Write Only)
249
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R248 POIM R250IRO
T
IROO P32 Input
00 Qulput IROI P33 Input
01 Input IRQ2 P31 Input
IX AII·AS IR03 P30 Input
IRQ4 TO
Stack Selection IRQ5 TI
o Ex"'mal
1 Internal InterE!'Ige
P31! P32! ~ 00
PIO • P17 Mode P31! P32f ~ 01
00 Byte Qulput P31 f P32! ~ 10
01 Byte Input P31 UP32U~ II
10 AD7·ADO
II High·lmpedance MJ7 • ADO,
IAS,'IDS,IRlIW, A11 • AS,
A15 • AI 2, If Selected
Figure 39. Interrupt Request Register
(FAH: ReadIWrite)
External Memory liming
o Normal
I Extended
R25IIMR
P04 • P07 Mode
00 Qulput
01 Input
IX A15·A12
I Enables IROO·IRQ5
(00= IROO)
Figure 37, Ports 0 and 1 Mode Register I Enables RAM Protect
(FSH: Write Only) I Enables Interrupts
R2491PR
Reserved
Figure 41, Flag Register (FCH: Read/Write)
Figure 3S. Interrupt Priority Registe '
(F9H: Write Only) R253 RP
Iwloolool~lool~I~IDOI
I 1 - - 1-
Expanded Register File
Working Register Pointer
250
R254SPH R255SPL
Imloolool~lool~lrnlool Imloolool~lool~lrnlool
I Stack Pointer Upper I Stack Pointer Lower
Byte (SP8 - SP15) Byte (SPO - SP7)
Figure 43. Stack Pointer Register (FEH: ReadIWrite) Figure 44. Stack Pointer Register (FFH: Read/Write)
Addressing Modes_ The following notation is us~d to de- . Flags. Control register (R252) contains the lollowing six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
251
CONDITION CODES
252
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
MODE I OPC LD
src OR
dsl OR
MODE I OPC LD
dslisrc I x
ADDRESS
cc I OPC JP
DAU
DAL
OPC CAll
DJNZ,JR DAU
DAL
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" f- ", For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
253
INSTRUCTION SUMMARY (Continued)
IRET BF
CALLdst OA 06 - - - - - - FLAGSf-@SP; ******
SPf-SP - 2 IRR 04 SPf-SP + 1
@SPf-PC, PCf-@SP;
PCf-dst SPf-SP + 2;
IMR(7)f-1
CCF
Cf-NOTC
EF
*-- - - -
JP ee, dst OA cO - - - - - -
if ee is true e =O-F
CLR dst R BO - - - - - - PCf-dst IRR 30
dstf-O IR B1
JRee, dst RA eB - - - - - -
COMdst R 60 - * * 0
- - if ee is true, e = O-F
dstf-NOT dst IR 61 PCf-PC + dst
Range: +127,
CP dst. sre
dst - sre
t A[ 1 ****-- -12B
LD dst. sre 1m rC - - - - - -
DAdst
dstf-OAdst
R
IR
40
41
*** X
- - dstf-sre
R
R rB
r9
r = 0- F
DECdst
dstf-dst - 1
R
IR
00
01
-
***- -
X
X
r
C7
07
r Ir E3
DECWdst
dstf-dst -1
RR
IR
80
B1
-
***-- Ir
R
r
R
F3
E4
R IR E5
DI 8F - - - - - - R 1M E6
IMR(7)f-0 IR 1M E7
IR R F5
DJNZr. dst RA rA - - - - - -
rf-r - 1 r=0-F LDC dst, sre Irr C2
if r;t 0
PCf-PC + dst LOCI dst, sre Ir Irr C3 - - - -
Range: +127, dstf-sre
-128 rf-r +1;
rrf-rr + 1
EI 9F - - - - - -
IMR(7)H
HALT .7F - - - - - -
254
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - STOP 6F
OR dst, src
dsh-dst OR src
t 4[ ] -
** 0 - - SUB dst, src
dst(-dst(-src
t 2[ ]
** :I:
* 1 :I:
PUSH src R 70 - - - - - -
17
5G o1
~
IR 91
t These instructions have an identical set of addressing modes. which
are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ ]'
RLC dst R 10 - -
l0=itS}J IR 11 **** in this table, and its value is found in the following table to the left of the
applicable addressing mode pair.
R R [4]
SCF OF 1 - - - - -
C(-l
R IR [5]
SRA dst R DO
*** 0 - - R 1M [6]
~
IR 01
IR 1M [7]
SRP src 1m 31 - - - - - -
RP(-src
255
OPCODEMAP Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C o E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12110.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM r1, R2 r2, R1 r1, RA ee, RA r1,IM ee, DA r1
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
RLC RLC ADC ADC ADC ADC ADC ADC
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5
-
2 INC INC SUB SUB SUB SUB SUB. SUB
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRR1 1M r1, r2 r1,lr2 R2, R1 IR2, Rl Rl,IM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
R1 IR1 r1, r2 rl,lr2 R2, Rl IR2, R1 Rl,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
5 POP POP AND AND AND AND AND AND
R1 IR1 rl, r2 r1,lr2 R2, R1 IR2, Rl Rl,IM IR1,IM
6
6.5
COM
6.5 6.5 6.5 10.5 10.5 10.5 10.5 t--s:o
COM TCM TCM TCM TCM TCM TCM STOP
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 Rl,IM IR1,IM
10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 ~
7 PUSH PUSH TM TM TM TM TM TM HALT
R2 IR2 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
10.5 10.5 12.0 18.0 6"1
8 DECW DECW LDE LOB JB5 01
RR1 IR1 rl,Irr2 Ir1,lrr2
6.5 6.5 12.0 18.0 6"1
9 RL RL LDE LOB B
Rl IR1 r2,lrr1 Ir2,lrr1
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 14.'0
A INCW INCW CP CP CP CP CP CP RET
RR1 IR1 rl, r2 r1,lr2 R2, R1 IR2, R1 Rl,IM IR1,IM
B
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 - r--w:o
CLR CLR XOR XOR XOR XOR XOR XOR IRET
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 '6:5
C RRC RRC LDC LOCI LD RCF
R1 IR1 r1,lrr2 Ir1,lrr2 rl,x,R2
6.5 6.5 12.0 18.0 20.0 20.0 10.5 ~
..
x 0 SRA
R1
SRA
IR1
LDC
r2,lrr1
LOCI
Ir2,lrr1
CALL'
IRR1
CALL
DA
LD
r2,x,R1
SCF
..
;S
:c E
6.5
RR
6.5
RR
6.5
LD
10.5
LD
10.5
LD
10.5
LD
10.5
LD
~
CCF
.0
Z R1 IR1 r1,IR2 R2, R1 IR2, R1 R1,IM IR1,IM
.
~
Q,
Q,
F
8.5 8.5
SWAP SWAP
6.5
LD
10.5
LD
r-s.o
NOP
~ R1 IR1 Irl, r2 R2,IR1
\.
.,. A .,.. A.
.,.. ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1 or r 2 = Ost address
Cycles 1 Cycles R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
256
PRODUCT SPECIFICATION
Z86C21
CMOS Z8®
MICROCONTROLLER
FEATURES
_ 8-bit CMOS microcontroller, 40- or 44-pin package _ RAM and ROM protect
_ Fast instruction pointer - 1.0 microsecond @ 12 MHz _ Two programmable 8-bit Counter/Timers each with
6-bit programmable prescaler.
_ Two standby modes - STOP and HALT
_ Six vectored, priority interrupts from eight dilferent
_ 32 input/output lines sources
_ All digital inputs are TTL levels _ On-Chip oscillator that accepts a crystal, ceramic
resonator, LC or external clock drive.
_ Auto Latches
GENERAL DESCRIPTION
The Z86C21 microcontroller introduces a new level of The Z86C21 architecture is cilaracterized by Zilog's 8-bit
sophistication to single-chip architecture. The Z86C21 is a microcontroller core. The device offers a flexible I/O
member of the Z8 single-chip microcontroller family with scheme, an efficient register and address space structure,
8 Kbytes of ROM and 236 bytes of RAM. multiplexed capabilities between address/data, 110, and a
number of ancillary features til at are useful in rnany industrial
The MCU is housed in a 40-pin DIP, 44-pin Leaded Chip- and advanced scientific applications.
Carrier, or a 44-pin Quad Flat Pack, and is manufactured
in CMOS technology. The ROMless pin option is available The device applications demand powerful I/O capabilities.
on the 44-pin versions only. Having the ROM/ROM less The Z86C21 fulfills this with 32 pins dedicated to input and
selectively, the MCU offers both external memory and output. These lines are grouped into four ports. Each port
preprogrammed ROM which enables this Z8 microcontroller consists of eight lines, and is configurable under software
to be used in high volume applications or where code control to provide timing, status signals, serial or parallel
flexibility is required. I/O with or without handshake, and an address/data bus
for interfacing external memory.
Zilog's CMOS microcontroller offers fast execution, efficient
use of memory, sophisticated interrupts, input/output bit There are three basic address spaces available to support
manipulation capabilities, and easy hardware/software this wide range of configuration: Program Memory, Data
system expansion along with low cost and low power Memory and 236 General-Purpose Registers.
consumption.
GENERAL DESCRIPTION (Continued)
To unburden the program from coping with the real-time Note: All Signals with a preceding front slash, "r, are active
problems such as counting/timing and serial data com- Low, e.g.: B/fW (WORD is active Low); IBfW (BYTE is
munication, the Z86C21 offers two on-chip counter/timers active Low, only).
with a large number of user selectable modes, and a
Asynchronous Receiver/Transmitter (UART-Figure 1).
~ ~
ALU
FLAGS
Register
Pointer
258
PIN DESCRIPTION
vee P36
XTAL2 P31
XTAL1 P27
P37 P26
P30 P25
IRESET P24
RIIW P23
IDS P22
lAS P2l
Z86C21
P35 P20
DIP
GND P33
P32 P34
POO P17
POl P16
P02 P15
P03 P14
P04 P13
P05 P12
P06 Pll
P07 Pl0
259
PIN DESCRIPTION (Continued)
6 5 4 3 2 1 44 43 42 41 40
IRESET 7 N/C
RlIW 8 P24
IDS 9 P23
lAS P22
P35 P21
GND
Z86C21 P20
PLCC
P32 P33
POO P34
P01 P17
P02 P16
RlIRL P15
18 19 20 21 22 23 24 25 26 27 28
1 Vcr; Power Supply Input 14-16 POO-P02 Port 0 pin 0,1,2 In/Output
2 XTAL2 Crystal, Oscillator Clock Output 17 RIIRL ROM/ROMless control Input
3 XTAL1 Crystal, Oscillator Clock Input 18-22 P03-P07 Port 0 pin 3,4,5,6,7 In/Output
4 P37 Port 3 pin 7 Output 23-27 P10-P14 Port 1 pin 0,1,2,3,4 In/Output
9 /DS Data Strobe Output 34-38 P20-P24 Port 2 pin 0,1,2,3,4 In/Output
10 /AS, Address Strobe Output 39 N/C Not Connected Input
11 P35 Port 3 pin 5 Output 40-42 P25-P27 Port 2 pin 5,6,7 In/Output
12 GND Gr,ound Input 43 P31 Port 3 pin 1 Input
13 P32 Port 3 pin 2 Input 44 P36 Port 3 pin 6 Output
260
33 32 31 30 29 28 27 26 25 24 23
IRESET 34 22 GND
PJIW 35 21 P24
IDS 36 20 P23
lAS 37 19 P22
P35 38 18 P21
13ND 39
Z86C21
QFP 17 P20
P32 40 16 P33
POO 41 15 P34
POl 42 14 P17
P02
PJ/RL :0 2 3 5 8 10
13
12
P16
P15
1 4 6 7 9 11
1-5 P03-P07 Port 0 pin 3,4,5,6,7 In/Output 31 XTAL1 Crystal, Oscillator Clock Input
6 GND Ground Input 32 P37 Port 3 pin 7 Output
7-14 P10-P17 Port 1 pin 0,1,2,3,4,5,6,7 In/Output 33 P30 Port 3 pin 0 Input
15 P34 Port 3 pin 4 Output 34 /RESET Reset Input
261
PIN FUNCTIONS
IROMless. (input, active Low). This pin, when connected to signal is latched and held for an internal register count of
GND, disables the internal ROM and forces the device to 18 external clocks, or for the duration of the external
function as a Z8pC91 ROMless Z8. (Note that, when left /RESET,whichever is longer. During the reset cycle. /DS is
unconnected or pulled high to Vcc' the part functions as a held active lowwhile /AS cycles at a rate of TpC/2. When
normal Z86C21 ROM version). This pin is only available on /RESET is deactivated, program execution begins at loca-
the 44-pin versions of the Z86C21. tion OOOC (HEX). Reset time must be held low for 50mS, or
until Vcc is stable, whichever is longer.
IDS. (output, active Low). Data Strobe is activated once for
each external memory transfer. For a READ operation, Port O. (POO-PO?). Port 0 is an 8-bit, nibble programmable,
data must be available prior to the trailing edge of /DS. For bidirectional, TTL compatible port. These eight I/O lines
WRITE operations, the falling edge of /DS indicates that can be configured under software control as a nibble I/O
output data is valid. port, or as an address port for interfacing external memory.
When used as an I/O port, Port 0 may be placed under
lAS. (output, active Low). Address Strobe is pulsed once handshake control. In this configuration, Port 3, lines P32
at the beginning of each machine cycle. Address output is and P35 are used as the handshake control /DAVO and
via Port 1 for all external programs. Memory address RDYO (Data Available and Ready). Handshake signal
transfers are valid at the trailing edge of /AS. Under assignment is dictated by the I/O direction of tile upper
program control, /AS is placed in the high-impedance nibble P04-PO? The lower nibble must llave tile same
state along with Ports 0 and 1, Data Strobe, and Read/ direction as the upper nibble to be under handshake
Write. control. For the ROMless option, Port 0 comes up as A 15-
A8 Address lines after /RESET.
XTAL1, XTAL2. Grysla/t, Grysla/2(time-based input and
output, respectively). These pins connect a parallel- For external memory references, PortO can provide address
resonant crystal, ceramic resonator, LC, or any external bits A 11-A8 (lower nibble) or A 15-A8 (lower and upper
single-phase clock to the on-chip oscillator and buffer. nibble) depending on the required address space. If the
address range requires 12 bits or less, the upper nibble of
RI/W. (output, write Low). The Read/Write Signal is low Port 0 is programmed independently as I/O while tile lower
,when the MCU is writing to the external program or data nibble is used for addressing. II one or both nibbles are
memory . needed for I/O operation, they must be configured by
writing to the Port 0 Mode register. In ROMless mode, alter
IRESET. (input, active-Low). To avoid asynchronous and a hardware reset, Port 0 lines are defined as address lines
noisy reset problems, the Z86C21 is equipped with a reset A 15-A8, and extended timing is set to accommodate slow
filter of four external clocks (4TpC). If the external/RESET memory access. The initialization routine can include
signal is less than 4TpC in duration, no reset occurs·.on the rec6nfiguration to eliminate this extended timing mode
5th clock after the /RESET is detected, an internal RST (Figure 5). .
262
} Po. 0 (VO)
Z86C91
MCU
Handshake Controls
} IDAVO and RDYO
1----..- (P32 and P35)
OEN
Out
In
1 ----------,
Auto Latch
1 1
1
1 R~ 500kO 1
..... - - - - - - - - - - 1
263
PIN FUNCTIONS (Continued)
Port 1. (P10-P17). Port 1 is an 8-bit, byte programmable, for the multiplexed Address/Data mode. If more than 256
bidirectional, TTL compatible port. It has multiplexed Ad- external locations are required, Port 0 must output the
dress (A7-AO) and Data (07-00) ports. For Z86C21, these additional lines.
eight 110 lines can be programmed as Input or Output lines
or can be configured under software control as an addressl Port 1 can be placed in a high-impedance state along with
data port for interfacing external memory. When used as Port 0, lAS, IDS and R/IW, allowing the MCU to share
an 110 port, Port 1 can be placed under handshake control. common resource in multiprocessor and DMA applica-
In this configuration, Port 3 line P33 and P34 are used as tions. Data transfers are controlled by assigning P33 as a
the handshake controls RDY1 and IDAV1. Bus Acknowledge input, and P34 as a Bus request output
(Figure 6).
Memory locations greater than 8192 are referenced through
Port 1. To interface external memory, Port 1 is programmed
Z86C91 Port 1
MCU (110 or AD7 - ADO)
OEN
Out
In
r ---------
Auto Latch
I I
I
I__________
R S't$ 501]( n 1I
264
Port 2. (P20-P27). Port 2 is an 8-bit, bit programmable, Port 2 may be placed under Ilandshake conlrol. In III is
bidirectional, CMOS compatible port. Each of these eight configuration, Port 3 lines P31 and P36 are used as Ille
I/O lines can be independenlly programmed as an input or handshake control lines /DAV2 and RDY2. The handshake
output or globally as an open-drain output. Port 2 is always signal assignment for Port 3 lines P31 and P36 is dictated
available for I/O operation. When used as an I/O port. by the direction (input or output) assigned to P27
(Figure 7).
Z86C9 1
MCU
Handshake Controls
} IDAV2 and RDY2
(P3l and P3S)
-
Open Drain
OEN
Out
r----------.
I I Auto Latch
I 'M I
I1- R~ 500kn
_________ -1I
265
PIN FUNCTIONS (Continued)
Port3. (P30-P37). Port 3 is an 8-bit, CMOS compatible four- (P34-P37) ports. Port 3, when used as serial 1/0, is pro-
fixed-input and four-fixed-output port. These eight 1/0 lines grammed as serial in and serial out, respectively (Figure 8
have four-fixed input (P30-P33) and four fixed output and Table 4).
-
Z86C21 Port 3 (110)
MCU (110 or Control)
Port 3 is configured under software control to provide the (IROO-IR03); timer input and output signals (TIN and Tour)'
following control functions: handshake for Ports 0 and 2 and Data Memory Select (lDM).
(lDAV and RDY); four external interrupt request signals
Notes:
HS = HANDSHAKE SIGNALS
D = Data Available
R=Ready
266
Port 3 lines P30 and P37. are be programmed as serial Received data must have a start bit, 8 data bits and at least
I/O lines for full-duplex serial asynchronous receiver/ one stop bit. If parity is on. bit 7 of the received data is
transmitter operation. The bit rate is controlled by the replaced by a parity error flag. Received characters gen-
Counter/Timer O. erate the IRQ3 interrupt request.
The Z86C21 automatically adds a start bit and two stop Auto-Latch. Tile Auto-Latch puts valid CMOS levels on all
bits to transmitted data (Figure 9). Odd parity is also CMOS inputs lilat are not externally driven. Tilis reduces
available as an option. Eight data bits are always trans- excessive supply current flow in tile input buffer wilen il is
mitted. regardless 01 parity selection. II parity is enabled. not been driven by any source.
the eighth bit is the odd parity bit. An interrupt request
(IRQ4) is generated on all transmitted characters.
Low EMI Option. The Z86C21 is available in a low EMI II Less than 1 mA current consumptions during HALT
option. This option is mask-programmable, to be selected mode.
by the customer at the time when the ROM code is
submitted. Use of this leature results in: II The pre-drivers slew rate reduced to 10 ns typical.
267
FUNCTIONAL DESCRIPTION
Address Space
Program Memory. The Z86C21 can address up to 56K Data Memory (/DM). The ROM version can address up to
bytes of external program memory (Figure 10). The first 12 56K bytes of external data memory space beginning at
bytes of program memory are reserved for the interrupt location 8192. The ROMless version can address up to
vectors. These locations contain six 16-bit vectors that 64K bytes of external data memory. External data memory
correspond to the six available interrupts. For ROM mode, can be included with, or separated from, the external
byte 13 to byte 8191 consists of on-chip ROM. At ad- program memory space. 10M, an optional 1/0 function that
dresses 8192 and greater, the Z86C21 executes external can be programmed to appear on pin P34, is used to
program memory fetches. In the ROMless mode, the distinguish between data and program memory space
Z86C21 can address up to 64K bytes of external program (Figure 11). The state of the 10M signal is controlled by the
memory. Program execution begins at external location type instruction being executed. An LOC opcode refer-
OOOC (HEX) after a reset. ences PROGRAM (10M inactive) memory, and an LOE
instruction references DATA (10M active low) memory.
65535 65535
Extemal
ROM and RAM
8192
8191
On-Chip ROM
------- --
Location of
~
First Byte of
Instruction ~11 IR05 External
Executed Data
After RESET 10 IR05
Memory
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 ...... IR02
~
~
IR02
Interrupt 8192
Vector 3 IR01
(Upper Byte) 8191
2 IR01
Not Addressable
1 IROO
0 IROO o
Figure 10. Program Memory Configuration Figure 11. Data Memory Configuration
268
Register File. The Register File consists of four I/O port mode, the Register File is divided into 16 working register
registers, 236 general-purpose registers and 16 control groups, each occupying 16 continuous locations. lhe
and status registers (Figure 12). The instructions can Register Pointer addresses the starting location of the
access registers directly or indirectly via an 8-bit address active working-register group.
field. The Z86C21 also allows short 4-bit register address-
ing using the Register Pointer (Figure 13). In the 4-bit Note: Register Bank EO-EF can only be accessed through
working registers and indirect addressing modes.
LOCATION IDENTIFiERS
244 Timer/Counter 0 TO
242 Timer/Counter 1 T1
239
General-Purpose
Registers
4
3 Port 3 P3
2 Port 2 P2
Port1 P1
o PortO PO
269
FUNCTIONAL DESCRIPTION (Continued)
R239
R15
- - - lioports- - - - R3
RAM Protect. The upper portion of the RAM's address The ROM Protect option is mask-programmable, to be
spaces 80FH to EFH (excluding. the control registers) can selected by the customer at the time when the ROM code
be protected from reading and writing. The RAM Protect bit is submitted.
option is mask-programmable and is selected by the
customer when the ROM code is submitted. After the mask Stack. The Z86C21 has a 16-bit Stack Pointer (R254-
option is selected, the user activates from the intemal ROM R255) used for external stack that resides anywhere in the
code to. turn off/on the RAM Protect by loading a bit D6 in data memory for the ROMless mode, but only from 8192
the IMR register to either a 0 or a 1, respectively. A 1 in 06 to 65535 in the ROM mode. An 8-bit Stack Pointer (R255)
indicates RAM Protect enabled. is used for the internal stack that resides within the 236
general-purpose registers (R4-R239). The high byte of the
ROM Protect. The first 8 Kbytes of program memory is Stack Pointer (SPH-Bit 8-15) is used as a general-purpose
mask programmable. A ROM protect feature prevent register when using internal stack only.
dumping of the ROM contents by inhibiting execution of
LOC, LOCI, LDE. and LOEI instructions to Program Memory
in all modes.
270
CounterfTimers. There are two 8-bit programmable counter/ also be programmed to stop upon reaching zero (single
timers (TO-T1). each driven by its own 6-bit programmable pass mode) or to automatically reload the inilial value and
prescaler. The T1 prescaler is driven by internal or external continue counting (modulo-n continuous mode).
clock sources; however. tile TO prescaler is driven by tfle
intemal clock only (Figure 14). The counter. but not the prescalers. can be read at any
time without disturbing their value or count mode. lile
The 6-bit prescalers divides the input frequency of the clock source for T1 is user-definable and can be eitiler tile
clock source by any integer number from 1 to 64. Eacll internat microprocessor clock divided by four. or an exter-
prescaler drives its counter. which decrements the value (1 nat signal input via Port 3. The Timer Mode register config-
to 256) that has been loaded into the counter. When both ures the external timer input (P31) as an external clock. a
the counter and prescaler reach the end of the count. trigger input tilat is retriggerable or non-retriggerabte. or
a timer interrupt request. IRQ4 (TO) or IRQ5 (T1). is as a gate input for the internal clock. Port 3. line'P36. atso
generated. serves as a timer output (TOUT) through whicll TO. T1 or tile
internal clock is output. The counter/timers are cascaded
The counter can be programmed to start. stop. restart to by connecting the TO output to tile input of T 1.
continue. or restart from the initial value. The counters can
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-bit
Down Down
Counter Counter
Internal
Clock
Exterl')al Ctock
Clock
Logic
6-Bit 8-Bit IRQ5
Down Down
Counter Counter
tnternat Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register . Register Register
TIN P31
271
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86C21 has six different interrupts from To accommodate polled interrupt systems, interrupt in-
eight different sources. The interrupts are maskable and· puts are masked and the Interrupt Request register is
prioritized. The eight sources are divided as follow: four polled to determine which of the interrupt requests need
sources are claimed by Port 3, lines P30-P33; one in Serial service. Software initialed interrupts are supported by
Out, one in Serial In, and two in the counter/timers (Figure setting the appropriate bit in the Interrupt Request Register
15). The Interrupt Mask Register globally or individually (IRQ). .
enables or disables the six interrupt requests. When more
than one interrupt is pending, priorities are resolved by a Internal interrupt requests are sampled on the falling edge
programmable priority encoder that is controlled by the of the last cycle of every instruction, and the interrupt
Interrupt Priority register. request must be valid 5TpC before the falling edge of the
last clock cycle of the currently executing instruction.
All Z86C21 interrupts are vectored through locations in the
program memory. When an interrupt machine cycle is For the ROMless mode, when the device samples a valid
activated, an interrupt request is granted. Thus, this dis- interrupt request. the next 48 (extemal) clock cycles are
ables all of the subsequent interrupts, sal(e the Program used to prioritize the interrupt. and push the two PC bytes
Counter and Status Flags, and then branches to the and the FLAG register on the stack. The following nine
program memory vector location reserved forthat interrupt. cycles are used to fetch the interrupt vector from external
This memory location and the next byte contain the 16-bit memory. The first byte of the interrupt service routine is
address of the interrupt service routine for that particular fetched beginning on the 58th TpC cycle following the
interrupt request. internal sample pOint, which corresponds to the 63rd TpC
cycle following the external interrupt sample point.
IRQO-IRQS
6
Global
Interrupt
Enable
Interrupt
Request
Vector Select
Z72
Clock. The Z86C21 on-chip oscillator has a high-gain, cut, 1 MHz to 16 MHz max, and series resistance (RS) is
parallel-resonant amplifier for connection to a crystal, LC, less than or equal to 100 Ollms. The crystal Sllould be
ceramic resonator, or any suitable external clock source connected across XT AL 1 and XT AL2 using tile recom-
(XTAL 1=Input, XTAL2=Outpul). The crystal should be AT mended capacitors (10 pF < CL < 300 pF) from eacll pin
to ground (Figure 16).
C24= C24=
Ceramic Resonator LC Clock Extemal Clock
or Crystal
HALT. Turns off the internal CPU clock but not the XTAL In order to enter STOP (or HALT) mode, it is necessary 10
oscillation. The counter/timers and the external interrupts first flush the instruction pipeline to avoid suspending
IROO, IR01, IR02 and IR03 remain active. The devices execution in mid-instruction. To do this, the user musl
are recovered by interrupts, either extemally or internally execute a NOP (opcode=OFFH) immediately before IIle
generated. appropriate sleep instruction. I.e.:
STOP. This instruction turns off the internal clock and FF NOP : clear the pipeline
external crystal oscillation and reduces the standby cur- 6F STOP : enter STOP mode
rent to 10 microamperes or less. The Stop mode is termi- or
nated by a reset which causes the processor to restart the FF NOP : clear the pipeline
application program at address OOOC (HEX). 7F HALT : enter HALT mode
273
ABSOLUTE MAXIMUM RATINGS
274
DC CHARACTERISTICS
ICCI Standby Current 6.5 6.5 4 rnA [1] HALT Mode VIN = OV. Vee@12 MHz
7.0 7.0 4.5 rnA [1] HALT Mode VIN = OV.Vee@16MHz
Iccz Standby Current 10 20 5 til [1.2] STOP Mode VIN = OV.Vee
Notes:
(1) All inputs driven to either OV or Vee. outputs floating.
[2)1= requires loading TMR (%F1H) with any value prior to STOP execution.
Use this sequence:
LDTMR.#OO
Nap
STOP
275
AC CHARACTERISTICS
External I/O or Memory Read or Write Timing Diagram
RlfIN
) K
~
~
ponO,IOM
): )/"
16
-@+ 3
Pon 1
) A7·AO 07- DO IN
--<D- ~ - -®
~
lAS
~ 8 18
~ -®+ 6
IDS
~ I
(Read)
f---®
-®:
Port1 A7-AO
)~ 07-00 OUT
~~
~ ~
7
IDS
(Write) ~ ~
17
276
AC CHARACTERISTICS
External I/O or Memory Read or Write Timing Table
Noles:
[1] When using extended memory timing add 2 TpC.
Clock Dependent Formulas
[2] Timing numbers given are for minimum TpC.
[3] See clock cycle dependent characteristics table.
Number Symbol Equation
Standard Test Load 1 TdA(AS) 0.401 pC + 0.32
All timing references use 2.0V for a logic 1 and O.SV for a logic O.
2 TdAS(A) 0.591pC - 3.?5
3 TdAS(DR) 2.38TpC + 6.14
4 TwAS 0.66TpC - 1.65
6 TwDSR 2.331pC - 10.56
7 TwDSW 1.271pC + 1.67
8 TdDSR(DR) 1.97TpC - 42.5
10 TdDS(A) O.81pC
15 TdDS(DW) 0.88TpC - 19
16 TdA(DR) 4TpC - 20
17 TdAS(DS) 0.91TpC - 10.7
18 TsDI(DS) 0.8TpC - 10
19 TdDM(AS) 0.9TpC - 26.3
277
AC CHARACTERISTICS
Additional Timing Diagram
Clock
\ JiI1w 2 • 2 3
\
\
TIN
'LJ
IRQ N
hi L
Figure 19. Additional Timing
AC CHARACTERISTICS
Additional Timing Table
No Symbol Parameter T. = ooe to 70°C T. = -40°C to 105°C Units Notes
12 MHz 16 MHz 12 MHz 16 MHz
Min Max Min Max Min Max Min Max
1 TpC Input Clock Peri ad 83 1000 62.5 1000 83 1000 62.5 1000 ns [1]
2 TrC,TfC Clock Input Rise & Fall Times 15 10 15 10 ns [1]
3 TwC Input Clock Width 35 25 35 25 ns [1]
4 TwTinL Timer Input Low Width 75 75 75 75 ns [2]
5 TwTinH Timer Input High Width 3TpC 3TpC 3TpC 3TpC [2]
6 TpTin Timer Input Period 8TpC 8TpC 8TpC 8TpC [2]
7 TrTin,TfTin Timer Input Rise & Fall Times 100 100 100 100 ns [2]
Noles:
[1] Clock timing references use 3.BV for a logic 1 and O.BV for a logic O.
[2] Timing references use 2.0V for a logic 1 and O.BV for a logic O.
[3] Interrupt references request via Port 3.
[4] Interrupt request via Port 3 (P31-P33).
[5] Interrupt request via Port 30.
278
AC CHARACTERISTICS
Handshake Timing Diagrams
r---\}-----------------------------------------------------.
Data In Data In Valid . . Next Data In Valid
~-'I}-----------------------------------------------------.
RDY
(Output)
1 I - - - - - - - - - . , - - - - - - - 1 } -- - - - - - - - - - - - --
DataOUl Data Out Valid Next Data Out Valid
~-----------\}---------------
RDY
(Input)
AC CHARACTERISTICS
Handshake Timing Table
No Symbol Parameter TA =O°C to 70°C TA =·40°C to 105°C Notes
12MHz 16MHz 12MHz 16 MHz Data
Min Max Min Max Min Max Min Max Direction
279
Z8 CONTROL REGISTER DIAGRAMS
R240S10 R243 PREI
Imloolool~loolmlmlool
I Serial Data (DO a LSB) Count Mode
o T1 Single Pass
1 Tl ModuloN
Figure 22. Serial I/O Register (FOH: Read/Write) Clock Source
1 T1 Internal
o T1 Extemalliming Input
(T..) Mode
o Disable TO Count
1 Enable TO Count
R244 TO
o No Function
1 Load T1
Imlool~I~loolmlmlool
o Disable T1 Count
1 Enable T1 Count
TI\IModes
I TO Initial Value
(When WriHen)
00 Extemal Clock Input (Range: 1-256 Decimal
01 Gate Input 01-00 HEX)
10 Trigger Input TO CUrrent Value
(Non-retrlggerable) (When Read)
11 Trigger Input
(Retrlggerable)
R245 PREO
Figure 23. Timer Mode Register (F1H: ReadIWrite)
Count Mode
R242Tl o ro Single Pass
1 TO Modulo N
Imloolool~loolmlmlool Reserved
I T1 Initial Value
Prescaler Modulo
(Range: 1-64 Decimal
(When Written) 01-00 HEX)
(Range: 1-256 Decimal
01-00 HEX)
T1 Cunent Value
(When Read)
Figure 27. Prescaler 0 Register (F5H: Write Only)
280
R246P2M R248P01M
Iwlool~I~lool~lmlool
I P2> - P27 110 Deftnltlon
o Deftne. B~ as Output
Plb - Plb Mode
00 Oulput
1 Deftne. Bit as Input 01 Input
lX AI1-'"
Stack Selection
Figure 28. Port 2 Mode Register (F6H: Write Only) o Extemal
1 Internal
P17 - Pl0 Mode
00 Byte Oulput
01 Byte Input
R247 P3M 10 AD1· ADo
11 High~mpedanoe AD7 • DAD.
lAS. IDS. IRlIW. A•• - "",
A.s- A'2,1f Selected
00 P33 = Input
P34 = Output
Figure 30. Port 0 and 1 Mode Register
01 } P33 = Input (F8H: Write Only)
10 P34 =IDM
11 Reserved
0 P30= Input
Interrupt Group Priority
P37 = Output Reserved = 000
P30 = Serial In C>A>B=OOl
P37 = Serial Out A>B>C=010
A>C>B=Oll
0 PerityOff
B>C>A=100
1 Parity On C>B>A=101
B>A>C=110
Reserved = 111
281
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R250IRO R253 RP
Figure 32. Interrupt Request Register Figure 35. Register Pointer Register
(FAH: ReadIWrlte) (FDH: ReadIWrite)
R2511MR R254SPH
Iwloolool~lool~lrnlool
I stack Pointer Upper
Byte (SP,.· SPa) •
R252FLAGS Iwloolool~looloolrnlool
I Slack Pointer Lower
Byte (SP7 • SPa)
User Flag Fl
User Flag F2
HaH Cany Flag Figure 37. Stack Pointer Register (FFH: ReadIWrite)
Decimal Adjust Flag
Overilow Flag
Sign Flag
ZeroAag
Csny Flag
282
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
283
CONDITION CODES
284
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD, AND, cp,
ORl1110 I DECW,INC,INCW,
dSlisrel POP, PUSH, RL, RLC, sre OR
LD, OR, SBC, SUB,
TCM,TM,XOR
RR, RRC, SRA, SWAP dsl OR
OPC JP, CALL (Inarect)
cls1 lOR 1111 0 I dsl OPC I MODE ADC, ADD, AND, cp,
dsl OR I 1110 1 dsl
LD, OR, SBC, SUB,
TCM,TM,XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC, ADD, AND, CP, sre OR
OR, SBC, SUB, TCM,
TM,XOR clsl OR
FFH STOPIHALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" f-- ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
285
INSTRUCTION SUMMARY (Continued)
1
ADC dst, src
dstf-dst + sre +C
t 1[
**** 0
* INCdst
dstf-dst + 1
rE
r = 0 --F ***-
R 20
t 1
ADDdst, sre
dstf-dst + sre
O[
**** 0 * IR 21
INCWdst RR AO - ***- -
AND dst, sre_
dstf-dst AND sre
t 5[ 1 -
** 0
- - dstf-dst + 1 IR A1
IRET BF
CALLdst OA 06 - - - - - - FlAGSf--@SP; ******
SPf-SP - 2 IRR 04 SPf--SP + 1
@SPf-PC, PCf-@SP;
PCf-dst SPf-SP + 2;
IMR(7)f-1
CCF
Cf-NOTC
EF *- - - - -
JPee, dst OA cD - - - - - -
if ee is true e = 0- F
CLR dst R BO - - - - - - PCf-dst IRR 30
dstf--D IR B1
JR ee, dst RA eB - - - - - -
COMdst
dstf-NOT dst
R
IR
60
61
-
** 0
- - if ee is true,
PCf-PC + dst
e = 0- F
Range: +127,
t 1 -
CP dst, sre
dst - sre
A[
****- -128
LD dst, sre 1m rC - - - - - -
DAdst R 40
*** X - - dstf-sre r R r8
dstf-DA dst IR 41 R r9
r= 0- F
DECdst R 00 - ***-- r X C7
dstf-dst - 1 IR 01 X r 07
r Ir E3
DECWdst RR 80 - ***- - Ir F3
dstf-dst - 1 IR 81 R R E4
R IR E5
DI 8F - - - - - - R 1M E6
IMR(7)f-0 IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
rf-r - 1 r= 0- F LDC dst, sre Irr C2
ifr .. O
PCf-PC + dst LDCI dst, sre Ir Irr C3
Range: +127, dstt-sre
-128 rf-r +1;
rrf-rr + 1
EI 9F - - - - - -
IMR(7)f-1
HALT 7F - - - - - -
286
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - STOP 6F
PUSH src R 70 - - - - - -
17
53 o1
SP+-SP-1;
@SP+-src
IR 71 TCM dst, src
(NOT dst)
t 6[ ] - * *0 - -
ANDsrc
RCF CF 0 - - - - -
c+-o TM dst, src
dstAND src
t 7[ ] -
**0 - -
RET AF - - - - - -
PC+-@SP;
SP+-SP + 2
XOR dst, src
dst+-dst
t 8[ ] -
** 0
- -
XOR src
RLdst R 90 ** * * - -
~
IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ ]'
RLCdst R 10
* * **- -
in this table. and its value is found in the following table to the left of the
~
IR 11 applicable addressing mode pair.
L:04EijJ
Address Mode Lower
dst src Opcode Nibble
RRCdst R CO
** **- -
L..tIH7 ofJ IR C1
[2]
SBe dst, src t 3[ ] ****1 *
Ir [3]
dst+-dst+-src+-C
DF 1 - - - - - R R [4]
SCF
C+-1
R IR [5]
SRA dst R DO
*** 0
- -
R 1M [6]
@ IR D1
IR 1M [7]
SRP src 1m 31 - - - - - -
RP+-src
287
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C o E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
RI IR1 r1. r2 rl,lr2 R2, RI IR2, RI R1,IM IRI,IM rl, R2 r2, RI rl, RA cc. RA rl,IM ee, DA r1
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
RLC RLC ADC ADC ADC ADC ADC ADC
R1 IRI rl, r2 rl, Ir2 R2, RI IR2, RI RI,IM IRI,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
RI IRI r1, r2 rl,Ir2 R2, Rl IR2, Rl RI,IM IRI,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRR1 1M rl, r2 r1,Ir2 R2, RI IR2, RI RI,IM IRI,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
R1 IRI r1, r2 rl, 1r2 R2, RI IR2, RI RI,IM IRI,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
5 POP POP AND AND AND AND AND AND
RI IRI rl, r2 rl,Ir2 R2, RI IR2, Rl RI,IM IRI,IM
6
6.5
COM
6.5
COM
6.5
TCM
6.5
TCM
10.5
TCM
10.5 10.5 10.5 '6:0
TCM TCM TCM STOP
xII)
R1 IRI rl, r2 rl,Ir2 R2, RI IR2, RI R1,IM IRI,IM
e- 7
10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 ~
li) PUSH PUSH TM TM TM TM TM TM HALT
:c
.t:J R2 IR2 rl, r2 rl,Ir2 R2, RI IR2, RI RI,IM IRI,IM
Z 10.5 10.5 12.0 18.0 '6T
~
II) 8 DECW DECW LDE LDEI 01
D.
D. RRI IRI rl,lrr2 Irl,Irr2
:;:)
9
6.5
RL
6.5
RL
12.0
LDE
18.0
LDEI
'6T
EI
RI IRI r2,lrrl 1r2,lrrl
A
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 '14:0
INCW INCW CP CP CP CP CP CP RET
RRI IRI rl, r2 rl,Ir2 R2, RI IR2, RI RI,IM IRI,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
RI IRI rl, r2 rl,Ir2 R2, RI IR2, RI RI,IM IRI,IM
C
6.5
RRC
6.5
RRC
12.0
LDC
18.0
LOCI
10.5
LD
ts:s
RCF
RI IRI r1,lrr2 Irl,Irr2 rl,x,R2
6.5 6.5 12.0 18.0 20.0 20.0 10.5 ~
0 SRA SRA LDC LOCI CALL' CALL LD SCF
RI IR1 r2,lrrl Ir2,Irr1 IRRI DA r2,x,RI
E
6.5 6.5 6.5 10.5 10.5 10.5 10.5 t--s.s
RR RR LD LD LD LD LD CCF
AI IRI rl,IR2 R2, RI IR2, Rl RI,IM IRI,IM
F
8.5 8.5
SWAP SWAP
6.5 10.5 ts:o
LD LD NOP
RI IRI Ir1, r2 R2,IRI
\,
,. A
V '" V ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = a-bit address
Nibble r = 4-bit address
Execution Pipeline R I or r 2 = Dst address
Cycles 1 Cycles R I or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
288
PRODUCT SPECIFICATION
~ZiIm
Z86E21
CMOS Z8® OTP
MIGROGONTROLLER
FEATURES
_ 8-bit CMOS microcontroller, 40- or 44-pin package _ High voltage protection on higll voltage inputs
_ Fast instruction pointer - 1.0 microseconds @ 12 MHz _ 256 bytes of RAM (236 for general purpose)
_ Two standby modes - STOP and HALT _ Two programmable 8-bit Counter(fimers eacil witll
6-bit programmable prescaler.
_ 32 input/output lines
_ Six vectored, priority interrupts from eight different
_ Full-Duplex UART sources.
_ All digital inputs are TTL levels _ Clock speeds 12 and 16 MHz
GENERAL DESCRIPTION
The Z86E21 microcontroller (MCU) introduces the next bit manipulation capabilities, and easy hardware/software
level of sophistication to single-chip architecture. The system expansion along wi til low cost and low power
Z86E21 is a member of the Z8 single-chip microcontroller consumption.
family with 8 Kbytes of EPROM and 236 bytes of general
purpose RAM. The Z86E21 architecture is based on Zilog's 8-bit
microcontroller core. The device offers a flexible I/O
TheZ86E21 is a pin compatible, One-Time-Programmable scheme, an efficient register and address space structure,
(OTP) version of the Z86C21. The Z86E21 contains 8 multiplexed capabilities between address/data, I/O, and a
Kbytes of EPROM memory in place of the 8 Kbyte of ROM number of ancillary features that are useful in many industrial
on the Z86C21 . and advanced scientific applications.
The MCU is housed in a 40-pin DIP, 44-pin Leaded Chip- The device applications demand powerful 1/0 capabilities.
Carrier, or a 44-pin Quad Flat Pack, and is manufactured The Z86E21 fulfills this with 32-pin dedicated to input and
in CMOS technology. The ROMless pin option is available output. These lines are grouped into four ports. Each port
on the 44-pin versions only. The MCU can address both consists of eight lines, and is configurable under software
external memory and preprogrammed ROM which enables control to provide timing, status signals, serial or parallel
this Z8 microcomputer to be used in high volume appli- I/O with or without handshake, and an address/data bus
cations or where code flexibility is required. for interfacing external memory.
289
GENERAL DESCRIPTION (Continued)
There are three basic address spaces available to support with a large number of user selectable modes, and an
this wide range of configuration: Program Memory, Data asynchronous receiver/transmitter (UART) (Figure 1).
Memory and 236 General-Purpose registers.
Note: All Signals with a preceding front slash, "I", are active
To unburden the program from coping with real-time Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
problems such as counting/timing and serial data com- active Low, only); INIIS (NORMAL and SYSTEM are both
munication, the Z86E21 offers two on-chip counter/timers active Low).
~ ~
Machine Timing and
Instruction Control
ALU
FLAGS
Register
Pointer
290
PIN DESCRIPTION
Standard Mode
vcc P36
XTAl2 P3l
XTAL1 P2?
P3? P26
P30 P25
IRESET P24
RlIW P23
IDS P22
lAS P2l
P35 P20
GND P33
P32 P34
POO Pl?
POl P16
P02 P15
P03 P14
P04 P13
P05 P12
P06 Pll
PO? Pl0
291
PIN DESCRIPTION (Continued)
Standard Mode
6 5 4 3 2 1 44 43 42 41 40
IRESET 7 N/C
RlIW 8 P24
IDS 9 P23
lAS P22
P35 P21
Z86E21
GND P20
PLCC
P32 P33
POO P34
POl 31 P17
P02 P16
Rl/RL P15
18 19 20 21 22 23 24 25 26 27 28
9 /DS Data Strobe Output 34-38 P20-P24 Port 2 pin 0,1,2,3,4 In,Output
10 /AS Address Strobe Output 39 N/C Not Connected Input
11 P35 Port 3 pin 5 Output 40-42 P25-P27 Port 2 pin 5,6,7 In/Output
12 GND Ground, GND Input 43 P31 Port 3 pin 1 Input
13 P32 Port 3 pin 2 Input 44 P36 Port 3 pin 6 Output
292
33 32 31 30 29 28 27 26 25 24 23
IRESET 34 22 GND
RlIW 35 21 P24
IDS 36 20 P23
lAS 37 19 P22
P35 38 18 P21
GND 39
Z86E21
QFP 17 P20
P32 40 16 P33
POO 41 15 P34
POl 42 14 P17
P02
Rl/RL :0 1 2 3 4 5 6 7 8 9 10 11
13
12
P16
P15
1-5 P03-P07 Port 0 pin 3,4,5,6,7 In/Output 31 XTAL2 Crystal, Oscillator Clock Input
6 GND Ground, GND Input 32 P37 Port 3 pin 7 Output
7-14 P10-P17 Port 1 pin 0,1,2,3,4,5,6,7 In/Output 33 P30 Port 3 pin 0 Inpul
15 P34 Port 3 pin 4 Output 34 /RESET Reset Input
293
PIN DESCRIPTION (Continued)
EPROM Mode
vcc NfC
NfC IOE
XTAL1 IPGM
NfC NfC
ICE NfC
IRESET A12
NfC All
NfC Al0
NfC A9
NfC AS
GNO vpp
EPM NfC
AO 07
Al 06
A2 05
A3 04
A4 03
A5 02
AS 01
A7 DO
294
:; ::;;
u w u w
zx~ Uz U
Q !?:: ~ ~
(!)
z ~
U U
> z
6 5 4 3 2 1 44 43 42 41 40
IRESET 7 39 NlC
N/C 8 38 A12
NlC 9 37 All
NlC 10 36 Al0
NlC 11 35 A9
Z86E21
GNO 12 34 A8
PlCC
EPM 13 33 VPP
AO 14 32 N/C
Al 15 31 07
A2 16 30 D6
NlC 17 29 D5
18 19 20 21 22 23 24 25 26 27 28
295
PIN DESCRIPTION (Continued)
EPROM Mode
33 32 31 30 29 28 27 26 25 24 23
IRESET 34 22 N/C
NlC 35 21 A12
N/C 36 20 All
N/C 37 19 Al0
N/C 38
Z86E21 18 A9
GNO 39 QFP 17 A8
EPM 40 16 VPP
AO 41 15 N/C
Al 42 14 07
A2
NlC :0 1 2 3 4 5 6 7 8 9 10 11
13
12
06
05
'"
~ :t 10 co ....
c c ~
« « !< c0 is Nc '"
296
PIN FUNCTIONS
ROMless. (input, active Low). This pin when connected to port. or as an address port for interfacing external memory.
GND disables the internal ROM and forces the device to When used as an I/O port. Port 0 may be placed under
function as a Z86C91 ROMless Z8 (note that, when left handshake control. In this configuration. Port 3. lines P32
unconnected or pulled high to Vcc. the part will function as and P35 are used as the handshake control/DAVO and
a normal Z86E21 EPROM version). This pin is only avail- RDYO (Data Available and Ready). Handshake signal
able on the 44-pin version of the Z86E21. assignment is dictated by the I/O direction of the upper
nibble P04-P07. The lower nibble must have the same
IDS. (output, active Low). Data Strobe is activated once for direction as the upper nibble to be under handshake
each external memory transfer. For a READ operation. control. For the ROMless option. Port 0 comes up as A 15-
data must be available prior to the trailing edge of IDS. For A8 Address lines after IRESET.
WRITE operations. the falling edge of IDS indicates that
output data is valid. For external memory references. Port 0 can provide ad-
dress bits A 11-A8 (lower nibble) or A 15-A8 (lower and
lAS. (output, active Low). Address Strobe is pulsed once upper nibbles) depending on the required address space.
at the beginning of each machine cycle. Address output is If the address range requires 12 bits or less. the upper
via Port 1 for all external programs. Memory address nibble of Port 0 can be programmed independently as 1/0
. transfers are valid at the trailing edge of lAS. Under while the lower nibble is used for addressing. If one or bolll
program control. /AS can be placed in the high-imped- nibbles are needed for I/O operation. they must be conlig-
ance state along with Ports 0 and 1. Data Strobe. and ured by writing to the Port 0 Mode register. In ROMless
Read/Write. mode. after a hardware reset, Port 0 lines are defined as
address lines A 15-A8. and extended timing is set to
XTAL1, XTAL2. Crystal 1. CrystaI2(time-based input and accommodate slow memory access. The initialization rou-
output, respectively). These pins connect a parallel-reso- tine can include reconfiguration to eliminate this extended
nant crystal. ceramic resonator. LC. or any external single- timing mode (Figure 8).
phase clock to the on-chip oscillator and buffer.
Port 1 P10-P17. Port 1 is an 8-bit, byte programmable.
RI/W. (output, write Low). The Read/Write signal is low bidirectional. TTL compatible port. It has multiplexed Ad-
when the MCU is writing to the external program or data dress (A7-AO) and Data (07-00) ports. For Z86E21. 1I1ese
memory. eight I/O lines can be programmed as Input or Output lines
or are configured under software control as an address/
IRESET. (input, active-Low). To avoid asynchronous and data port for interfacing external memory. When used as
noisy reset problems. the Z86E21 is equipped with a reset an I/O port. Port 1 can be placed under handshake control.
filter of four external clocks (4TpC). If the external /RESET In this configuration. Port 3 lines. P33 and P34. are used as
signal is less than 4TpC in duration. no reset occurs. the handshake controls RDY1 and /DAV1.
On the 5th clock after the /RESET is detected. an internal Memory locations greater than 8192 are referenced through
RST signal is latched and held for an internal register count Port 1. To interface external memory. Port 1 must be
of 18 external clocks. or for the duration of the external programmed for the multiplexed Address/Data mode. If
/RESET. whichever is longer. During the reset cycle. /DS is more than 256 external locations are required. Port 0 must
held active low while /AS cycles at a rate of TpC/2. When output the additional lines.
/RESET is deactivated. program execution begins at loca-
tion OOOC (HEX). Reset time must beheld low for 50 mS. or Port 1 can be placed in higll-impedance state along with
until Vcc is stable. whichever is longer. Port O. /AS. /DS and R/tw. allowing the MCU to share
common resources in multiprocessor and DMA applica-
Port 0 POO-P07. Port 0 is an 8-bit, nibble programmable. tions. Data transfers are controlled by aSSigning P33 as a
bidirectional. TTL compatible port. These eight I/O lines Bus Acknowledge input, and P34 as a Bus request output
can be configured under software control as a nibble I/O (Figure 9).
297
PIN FUNCTIONS (Continued)
Z86E21
MCU
Handshake Controls
} IDAVO and RDYO
I - - -....~ (P32 and P3S)
OEN
Out
r
I Auto latch
II R=SOOKn I
_____________ J
298
-
A
~"'I 8 "" Port 1
(110 or AD7-ADO)
I/'
Z86E21
MCU
Handshake Controls
IDAV1 and RDY1
(P33 and P34)
-
OEN
Out
r
I I Auto Latch
IL ____
R=500Kn I
.:... ______ ...J
299
PIN FUNCTIONS (Continued)
Port 2 P20-P27. Port 2 is an 8-bit, bit programmable, configuration, Port 3 lines P31 and P36 are used as the
bidirectional, CMOS compatible port. Each of these eight handshake contrbllines /DAV2 and RDY2. The handshake
I/O lines can be independently programmed as an input or signal assignmentfor Port 3lines, P31 and P36, is dictated
output, or globally as an open-drain output. Port 2 is always by the direction (input or output) assigned to P27
available for I/O operation. When used as an I/O port, (Figure 10 and Table 7).
Port 2 can be placed under handshake control. In this
Z86E2 1
MCU
Handshake·Controls
} IDAV2 and RDY2
(PSl and P36)
-
Open Drain
OEN
OUI
In
r --------- .,
I I Auto Latch
IL.. ___________
R=500Kn I
J
300
Port 3 P30-P37. Port 3 is an 8-bit, CMOS compatible four output ports. Port 3, when used as serial 1/0, is pro-
fixed input and four fixed output port. These 8 1/0 lines grammed as serial in and serial out, respectively
have four-fixed (P33-P30) input and four fixed (P37-P34) (Figure 11).
Z86E21 Port 3
MCU (1/0 or Control)
Port 3 is configured under software control to provide the (IROO-IR03); timer input and output signals (TIN and Tour)'
following control functions: handshake for Ports 0 and 2 Data Memory Select (lDM) and EPROM control signals
(/DAV and RDY); four external interrupt request signals (P30=/CE, P31=IOE, P32=EPM and P33=Vpp).
Notes:
HS = Handshake Signals
D = Data Available
R = Ready
301
PIN FUNCTIONS (Continued)
Port 3 lines P30 and P37, are programmed as serial I/O ted, regardless of parity selection. If parity is enabled, the
lines for full-duplex serial asynchronous receiver/trans- eighth bit is the odd parity bit. An interrupt request (IRQ4)
mitter operation. The bit rate is controlled by Counter/ is generated on all transmitted characters.
Timer O.
Received data must have a start bit, 8 data bits, and at least
The Z86E21 automatically adds a start bit and two stop one stop bit. If parity is on, bit-7 of the received data is
bits to transmitted data (Figure 12). Odd parity is also replaced by a parity error flag. Received characters gen-
available as an option. Eight data bits are always transmit- erate the IRQ3 interrupt tequest.
I~I pl~I~I~lool~lrnlool~1
Start BR
Odd Parity
Two Slop Bits
11,---- _L
Start Bit
Auto-Latch. The auto-latch puts valid CMOS levels on all Note: P30-P33 inputs differ from the Z86C21 because there
CMOS inputs that are not externally driven. This reduces is no clamping diode to Vcc due to the EPROM high voltage
excessive supply current flow in the input buffer when it is detection circuits. Exceeding the V1H maximum specifica-
not driven by any source. tion during standard operating mode may cause the device
to enter EPROM mode
ADDRESS SPACE
Program Memory. The Z86E21 can address 56 Kbytes of to byte 8191 consists of on-chip EPROM. At addresses
external program memory (Figure 13). The first 12 bytes of 8192 and above, the Z86E21 executes external program
program memory are reserved for the interrupt vectors. memory fetches. In ROMless mode, the Z86E21 can ad-
These locations contain six 16-bit vectors that correspond dress up to 64K bytes of program memory. Program
to the six available interrupts. For EPROM mode, byte 13 execution begins at external location OOOC (HEX) after
a reset.
302
access registers directly or indirectly via an 8-bit address
65535
field. The Z86E21 also allows short 4-bit register address-
External
ing using the Register Pointer (Figure 16). In ttle 4-bit
ROM and RAM
8 192
mode, the Register File is divided into 16 working regisler
groups, each occupying 16 continuous locations. Tile
8 191
Register Pointer addresses the starting location of tile
On-Chip PROM active working-register group.
7 IR03
Interrupt 65535
Vector 6 IR03
(Lower Byte)
5 ...... IR02
303
ADDRESS SPACE (Continued)
LOCATION . IDENTIFIERS
244 Timer/Counter 0 TO
242 Timer/Counter 1 T1
239
General-Purpose
Registers
3 Port 3 P3
2 Port 2 P2
Port1 P1
o Port 0 PO
304
R255
-__~f 0 0 0
R253
1 - - - - - - - - - ' - - - - 1 R240
0
R239
15
f-- - - 1/0-Ports
- - - - 3
305
FUNCTIONAL DESCRIPTION
Countermmers. There are two 8-bit programmable counter! be programmed to stop upon reaching zero (single pass
timers (TO-T1), each driven by its own 6-bit programmable mode) or to automatically reload the initial value and
prescaler. The T1 prescaler is driven by internal or external continue counting (modulo-n continuous mode).
clock sources; however, the TO prescaler is driven by the
internal clock only (Figure 17). The counter, but not the prescalers, are read at any lime
without disturbing their value or count mode. The clock
The 6-bit prescalers can divide the input frequency of the source for T1 is user-definable and is either the internal
clock source by any integer number from 1 to 64. Each microprocessor clock divided by four, or an external signal
prescaler drives its counter, which decrements the value input via Port 3. The Timer Mode register configures the
(1 to 256) that has been loaded into the counter. When both external timer input (P31) as an external clock, a trigger
the counters and prescalers reach the end of the count, input that can be retriggerable or non-retriggerable, or as
a timer interrupt request, IR04 (TO) or IR05 (T1), is a gate input for the internal clock. Port 3 line P36 also
generated. serves as a timer output (Tour) through which TO, T1, or tile
internal clock can be output. The counter/timers are cas-
The counter is programmed to start, stop, restart to con- caded by connecting the TO output to the input of T 1.
tinue, or restart from the initial value. The counters can also
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-bit
Down Down
. . - - - Internal
Counter L-~c~o~un~m~r~-t-r--- IR04
Clock ..--.-. SerialllO
Clock
TOUT
External Clock P36
Clock
Logic
6-Blt 8-Bit t -.....-.-.IR05
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIn P31
306
Interrupts. The Z86E21 has six different interrupts from To accommodate polled interrupt systems, interrupt in-
eight different sources. The interrupts are maskable and puts are masked and the Interrupt Request register is
prioritized. The 8 sources are divided as follows: four polled to determine which of the interrupt requests need
sources are claimed by Port 3 lines P30-P33, one in Serial service. Software initialed interrupts are supported by
Out, one in Serial In, and two in the counter/timers (Figure setting the appropriate bit in the Interrupt Request Reg-
18). The Interrupt Mask Register globally or individually ister (IRQ).
enables or disables the six interrupt requests. When more
than one interrupt is pending, priorities are resolved by a Internal interrupt requests are sampled on the falling edge
programmable priority encoder that is controlled by the of the last cycle of every instruction, and the interrupt
Interrupt Priority register. request must be valid 5TpC before the falling edge of the
last clock cycle of the currently executing instruction.
All Z86E21 interrupts are vectored through locations in the
program memory. When an interrupt machine cycle is For the ROMless mode, when the device samples a valid
activated, an interrupt request is granted. Thus, this dis- interrupt request, the next 48 (external) clock cycles are
ables all of the subsequent interrupts, saves the Program used to prioritize the interrupt, and push tile two PC bytes
Counter and Status Flags, and then branches to the and the FLAG register on the stack. The following nine
program memory vector location reserved for that interrupt. cycles are used to fetch the interrupt vector from external
This memory location and the next byte contain the 16-bit memory. The first byte of the interrupt service routine is
address of the interrupt service routine for that particular fetched beginning on the 58th TpC cycle following the
interrupt request. internal sample point, which corresponds to the 63rd TpC
cycle following the external interrupt sample point.
IRoo-IRQ5
6
Global
Interrupt
Enable
Interrupt
Request
Vector Select
307
FUNCTIONAL DESCRIPTION (Continued)
Clock. The Z86E21 on-chip oscillator has a high-gain, than or equal to 100 Ohms. The crystal should be con-
parallel-resonant amplifier for connection to a crystal, LC, nected across XTAL 1 and XT AL2 usi ng the recommended
ceramic resonator, or any suitable external clock source capacitors (10 pF < CL < 100 pF) from each pin to ground
(XTAL 1=lnput, XTAL2=Output). The crystal should be AT (Figure 19).
cut, 1 MHz to 16 MHz max; series resistance (RS) is less
C2~ C2:J;
HALT. Turns off the internal CPU clock but not the XTAL In order to enter STOP (or HALT) mode, it is necessary to
oscillation. The counter/timers and external interrupts IROO, first flush the instruction pipeline to avoid suspending
IR01, IR02 and IR03 remain active. The devices are execution in mid-instruction. To do this, the user must
recovered by interrupts, either externally or internally execute a NOP (opcode=OFFH) immediately before the
generated. appropriate sleep instruction. Le.:
STOP. This instruction turns off the internal clock and FF NOP ; clear the pipeline
external crystal oscillation, and reduces the standby cur- 6F STOP ; enter STOP mode
rent to 10 microamperes or less. The Stop mode is termi- or
nated by a reset, which cause the processor to restart the FF NOP ; clear the pipeline
application program at address OOOC (HEX). 7F HALT ; enter HALT mode
PROGRAMMING
The Z86E21 uses separate AC timing cycles for the differ- User MODE 2 EPROM Program
ent User Modes available. Table 8 shows the Z86E21 User The Z86E21 Program function conforms to the Intelligent
Modes. Table 9 shows the timing of the programming programming algorithm. The device is programmed with
waveforms. Vee at 6.0V and Vpp = 12.5V. Programming pulses are
applied in 1 msec increments to a maximum of 25 pulses
User MODE 1 EPROM Read before proper verification. After verification, a program-
The Z86E21 EPROM read cycle is provided so thatthe user ming pulse of three times the duration of the cycles
may read the Z86E21 as a standard 2764A EPROM. This necessary to program the device is issued to insure proper
is accomplished by driving the IEPM pin (P32) to VH and programming. After all addresses are programmed, a final
activating ICE and /OE./PGM remains inactive. This mode data comparison is executed and the programming cycle
is not valid after execution of an EPROM protect cycle. is complete. Timing for the Z86E21 programming cycle is
Timing for the EPROM read cycle is shown in Figure 20. shown in Figure 21.
308
User MODE 3 EPROM Verify User MODE 6 4K/SK Size Selection
The Program Verify cycle is used as part of the Intelligent The Z86E21 allows the user to select tile internal ROM size.
programming algorithm to insure data integrity under This feature is useful in that once programmed, the Z86E21
worst-case conditions. It differs from the EPROM read knows at Wllicll address boundary to "go external." rile Z8
cycle in that VPI' is active and Vee must be driven to 6.0V. distinguishes internal and external fetches using tile data
Timing is shown in Figure 21. strobe (/DS). If prograrnrned lor 4K ROM, fetcll cycles
include IDS beginning at location 4096 (indicating an
User MODES 4 AND 5 EPROM and RAM Protect external memory letcll). 11 programrned lor 8K ROM, IDS
To extend program security. EPROM and RAM protect remains inactive until location 8192 is reaclled. Once tile
cycles are provided for the Z86E21. Execution of the 4K ROM size option is selected, tile upper 4K of address
EPROM protect cycle prohibits proper execution of the space is unusable in tile Z86E21.
EPROM Read. EPROM Verify. and EPROM programming
cycles. Execution of the RAM protect cycle disables ac- The timing of the 4K/8K size selection cycle is similar to tile
cesses to the upper 128 bytes of register memory (excluding EPROM and RAM protect cycles. Note tilat tile 4K/8K size
mode and configuration registers). but first the user's selection cycle requires that address 03 be indicated on
program must set bit-6 of the IMR (R251). Timing is shown the address bus during execution. Timing is shown in
in Figure 22. Figure 22.
Notes:
v... = 12.S±0.SV
Vee = 6.0 during programming
VH = 12.S± 0.5 V
X = irrelevant
VIH = 5.0 V
V'- =OV
• If not programmed, the EPROM size is BK.
309
PROGRAMMING (Continued)
VIH
VH
EPM
---_..#
VIL
VCC
5V
VIH
ICE
VIL
VIH
IOE VIL
Note: ,
VPP is Irrelevant
PGMis atVIH
310
VIH
Address
VIL
Address Stable
>C
VIH
Data
VIL
Vpp
Vpp
VIH
6V
Vee
VIH
VIH
ICE
VIL
VIH
IPGM
VIL
VIH
IOE
VIL
311
PROGRAMMING (Continued)
ViH
Address Irrelevant Address 003
ViL
ViH
VPp
Vee
ICE
IOE
EPM
IPGM
312
00 21 31 AO 10 00
P10 P20 AO 00 11
01 22 32 A1 9 01
P11 P21 A1 01 12
02 23 33 A2 8 13 02
P12 P22 A2 02
03 24 A3 7
P13 P23 34 A3 03 15 03
04 25 P14 P24 35 A4 6 A4 04 16 04
05 26 36 v A5 5 05 17 05
P15 P25 A5
06 27 37 A6 4 A6 18 06
P16 P26 06
07 28 38 A7 3 19 07
P17 P27 A7 07
Z86E21 25 A8 TO 2764
Socket Socket
AO 13 5 24
POO P30 A9
A1 14 39 21
P01 P31 A10
A2 15 12 EPM 23
P02 P32 A11
A3 16 30 vPP 2
P03 P33 A12
A4 17 29 v 27
P04 P34 PGM
A5 18 10
P05 P35 1KOhm" 2'2r
A6 19 40 " v es
P06 P36 vee
A7 20 4 1KOhmA ,~
P37 OE f--
P07 v GNO VPP
7 RlIW 1 vee
"- vee
9 11 -=:k:-
v 8
lAS
lOS
GNO
XTAL1
I---
3
I---
I
I
*
1KOhm 10KOhm_ 0.01 ft1
,--2-c IRESET XTAl2 ~ A A../V'v-;D Extemal
~
Power
-
T O.1ftl 12.5 Volt
Supply
(Recommended
-...::::.... Voltage: 12.5 Volts)
1- .1
Figure 23. Z86E21 Z8 OTP Programming Adapter
313
PROGRAMMING (Continued)
314
ABSOLUTE MAXIMUM RATINGS
315
DC CHARACTERISTICS
. IIR Reset Input Current -50 -50 J.U\ Vcc= +5.25V, VRL = OV
lee Supply Current 50 50 25 rnA @12MHz
60 60 35 rnA @16MHz
, Notes:
1= requires loading TMR (%F1H) with any value prior to STOP execution,
Use this sequence:
LDTMR,#QO
NOP
STOP
316
AC CHARACTERISTICS
External I/O or Memory Read or Write Timing Diagram
RIIW
) (
--®-
~
PortO, 10M
) )
16
~ 3
Port 1
) A 7- A 0 0 7 - DOIN
kD- f--®-- - ~
~
lAS
Ii 8 18
1--0-- ~ 6
IDS
(Read)
I--® " Ii
~
Port 1 A 7- A 0
) 0 7 - DO OUT
~ ~
7
IDS
(Write)
" Ii
317
AC CHARACTERISTICS
External I/O or Memory Read and Write Timing Table
Notes:
[1] When using extended memory timing add 2 TpC. Ctock Dependent Formulas
[2j Timing numbers given are for minimum TpC.
[3] See clock cycle dependent characteristics table. Number Symbol Equation
Standard Test Load 1 TdA(AS) 0.40TpC + 0.32
2 TdAS(A) 0.59TpC - 3.25
All timing references use 2.0V for a logic 1 and O.BV for a logic O.
3 TdAS(DR) 2.38TpC + 6.14
4 TwAS 0.66TpC - 1.65
6 TwDSR 2.33TpC - 10.56
7 TwDSW 1.27TpC + 1.67
8 TdOSR(OR) 1.97TpC - 42.5
10 TdOS(A) . 0.8TpC
318
AC CHARACTERISTICS
Additional Timing Diagram
Clock
\ Jifu \----
V \----
h{ \----
Figure 27. Additional Timing
AC CHARACTERISTICS
Additional Timing Table
Noles:
[1] Clock timing references use 3,8V for a logic 1 and O,8V for a logic 0,
[2] Timing references use 2,OV for a logic 1 and O,8V for a logic 0,
[3] Interrupt references request via Port 3,
[4] Interrupt request via Port 3 (P31-P33),
[5] Interrupt request via Port 30,
319
AC CHARACTERISTICS
Handshake Timing Diagrams
ROY
(Output)
II------.,....---------'Jr- - - - - - - - - - - - - - _.
Data Out Data Out Valid Next Data Out Valid
I ' - - - - - - - - - - - - - ' l r - - - - - - - - - - - - - - _.
ROY
(Input)
320
AC CHARACTERISTICS
Handshake Timing Table
321
Z8 CONTROL REGISTER DIAGRAMS
R240S10 R243 PREI
IIDlool~I~loolmlrnlool
I Serlal DaIa (DO _ LSB)
Count Mode
o TI Single Pass
1 TI ModuloN
R245 PREO
Figure 31. Timer Mode Register
(F1H: ReadlWrlte)
Count Mode
R242T1 o TO Slngle.Pass
I TO Modulo N
IIDlool~I~loolmlrnlool Reserved
I TI Initial Value
Prescaler Modulo
(Range: 1·64 Decimal
(When Written) 01-00 HEX)
(Range: 1-256 DecImal
. TI ~~:'::~lue
(When Read) Figure 3S. Prescaler 0 Register
(FSH: Write Only)
Figure 32. CounterlTlmer 1 Register
(F2H: ReadlWrite)
322
R246P2M R248P01M
Iwlool~I~lool~lrnlool
I PaJ - P27 1/0 Dellnklon
o Dellnes Bit as Output
POI - POI Mode
00 Output
1 Dennes Bit as Input 01 Input
1X Ali-lIB
Stack Selection
Figure 36. Port 2 Mode Register o External
1 Internal
(F6H: Write Only)
P17 - Pl. Mode
00 Byle Output
01 Byle Input
R247 P3M 10 AD7 - ADo
11 High-hr"edance AD7 - DAB.
Iwloolrel~lool~lrnlool lAS. IDS. IRim. A •• - "".
A.s- A.2, If Selecled
-r-
o Port 2 Pul~Ups Open Drain External Memory Timing
1 Port 2 Pul~Ups Active o Normal
1 Extended
Reserved
POl - PO. Mode
o P32 -Input 00 Output
P35 _Output 01 Input
P32 -/DAVOIRDYO 1X A15-A12
P35 _ RDYO/IDAVO
00 P33 - Input
P34 - Output Figure 38. Port 0 and 1 Mode Register
01 ) P33 _ Input (F8H: Write Only)
10 P34_/DM
11 P33 _IDAV1IRDYl
P34 _ RDY1/1DAVl
R2491PR
o P31 -Input (TIN)
P36 - Output (TOUT)
P31 -/DAV2JRDY2
P36 _ RDY2I/DAV2
323.
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R250IRO R253 RP
Figure 40. Interrupt Request Register Figure 43. Register Pointer Register
(FAH: ReadlWrite) (FDH: ReadlWrite)
R2511MR
R254SPH
1~1~1~1~lool~lrnlool
I Enables IR05~Roo
I Stack Pointer Upper
(Do = IROO) Byte (SP,.- SPa)
R252FLAGS 1~loolool~lool~lrnlool
I Slack Pointer Lower
Byte (SP7 - SPIl)
User Flag FI
User Flag F2
HaH Carry Flag Figure 45. Stack Pointer Register
Decimal Adjust Flag (FFH: Read/Write)
OVerilowFIag
Sign Flag
Zero Flag
Canry Flag
324
ICC (mA)
40
A
.........
v B
v
30
- - -- .........
V'
c
.,.... -- - --
V ......... V ~
......... V V
....V ~
-
20
V V l....- I----
"." .......V
./ ~ v-::::f-- ~
::::::: v
10
~~
~ V"
o 2 4 6 8 10 12 14 16 18 20
Frequency (MHz)
Legend:
A- Vcc=5.6V
B- Vcc=5.0V
c- Vcc= 4.4V
325
ZS CONTROL REGISTER DIAGRAMS (Continued)
I CC1(mA)
12
:
A
,/
10 ./
B
V .,/
V V
8 .,/ V ./
C
/' V V
./ .,/ ./
",
/' ,/'"
6 ./ ,., V ,., .-/
/'
VV ./ V
I-'
V
4 ./ ~ ./'" V
~~
/
./
/
2 & ~V
ld ~
V
~
o 2 4 6 8 10 12 14 16 18 20
Frequency (MHz)
legend:
A- Vcc= 5.6V
B- Vcc= 5.0V
C - Vcc= 4.4V
326
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
327
CONDITION CODES
328
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
CLR. CPL. DA. DEC. OPC J MODE ADC. ADD. AND. cPo
OR 1111 0 I dsVsrc I DECW.INC.INCW.
POP. PUSH. RL. RLC. src OR
LD. OR. SBC. SUB.
TCM.TM.XOR
RR. RRC. SRA. SWAP dst OR
OPC JP. CALL (Indirect)
dst lOR 1111 0 I dst OPC I MODE ADC. ADD. AND. CPo
dst OR 1111 0 I dst
LD. OR. SBC. SUB.
TCM. TM.XOR
OPC SRP VALUE
VALUE
MODE I OPC lO
ADC. ADD. AND. CPo src OR
OR. SBC. SUB. TCM. 1---+---1
TM.XOR dst OR L--'---L_ _..J
OPC CALL
DJNZ. JR DAU
DAL
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" f-- ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
329
INSTRUCTION SUMMARY (Continued)
t 1
ADC dst, sre
dstf-dst + sre +C
1[
**** 0
* INC dst
dstf-dst + 1
rE
r = 0- F
-
***-
R 20
ADDdst, sre t 1
dstf-dst + sre
O[
**** 0 * IR 21
- -
AND dst, sre t 5[ 1 - ** - -
INCWdst
dstf-dst + 1
RR
IR
AO
A1
***-
0
dstf-dst AND sre
IRET BF
CALLdst DA D6 - - - - - - FLAGSf-@SP;
* *.* * * *
SPf-SP-2 IRR D4 SPf-SP + 1
@SPf-PC, PCf-@SP;
PCf-dst SPf-SP + 2;
IMR(7)f-1
CCF EF *- - - - -
Cf-NOTC JP ee, dst DA cD - - - - - -
if ee is true e = 0- F
CLRdst R BO - - - - - - PCf-dst IRR 30
dstf-O IR B1
JRee, dst RA eB - - - - - -
COMdst R 60 -
** 0
- - if ee is true, e=O-F
dstf-NOT dst IR 61 PCf-PC + dst
Range: +127,
CP dst, sre
dst - sre
t A[ 1
****-- -128
LD dst, sre 1m rC - - - - - -
DAdst . R 40
*** X
- - dstf-src r R r8
dstf-DA dst IR 41 R r9
r=O- F
DEC dst
dstf-dst -1
R
IR
00
01
- * *. * - - r
X
X
r
C7
D7
r Ir E3
DECWdst RR SO - ***- - Ir F3
dstf-dst -1 IR 81 R R E4
R IR E5
DI 8F - - - - - - R 1M E6
IMR(7)f-O IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
rf-r - 1 r= 0- F LDCdst, sre Irr C2
ifr ,.0
PCf-PC + dst LDCI dst, sre Ir Irr C3
Range: +127, dstf-sre
-128 rf-r +1;
rrf-rr + 1
EI 9F - - - - - -
IMR(7)f-1
HALT 7F - - - - - -
330
INSTRUCTION SUMMARY (Continued)
NOP FF STOP 6F
OR dst, src
dstf-dst OR src
t 4[ ] -
** 0
- - SUB dst, src
dstf-dstf-src
t 2[ ]
**** 1
*
POP dst R 50 - - - - - - SWAP dst R FO X
** X
- -
dstf-@SP; IR 51 IR F1
SPf-SP + 1
PUSH src R 70 - - - - - -
17
6 o1
SPf-SP-1;
@SPf-src
IR 71 TCM dst, src
,(NOT dst)
t 6[ ] - ** 0
- -
AND src
RCF CF 0 - - - - -
Cf-O TM dst, src
dstANDsrc
t 7[ ] - ** 0
- -
RET AF - - - - - -
PCf-@SP;
SPf-SP + 2
XOR dst, src
dstf-dst
t B[ ] - ** 0
- -
XOR src
RLdst R 90
****- -
~
IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevily, The first opcode nibble is found in the instruction
set table above, The second nibble is expressed symbolically by a '[ r
RLC dst R
IR
10
11
****- - in this table, and its value is found in the following table to the left of the
~ applicable addressing mode pair.
R R [4]
SCF DF 1 - - - - -
Cf-1
R IR [5]
SRA dst R DO
*** 0
- -
R 1M [6]
~
IR D1
IR 1M [7]
SRP src 1m 31 - - - - - -
RPf-src
331
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 678 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R1 IR1 r1, r2 r1,lr2 R2,R1 IR2, R1 R1,IM IR1,IM rl, R2 r2. R1 rl,RA CC, RA r1,IM cc, DA rl
6.5 6.5 6.5 6.5. 10.5 10.5 10.5 10.5 r---
RLC RLC ADC ADC ADC ADC ADC ADC
R1 IR1 r1. r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r---
2 INC INC SUB SUB SUB SUB SUB SUB
R1 IR1 r1, r2 r1,lr2 R2. Rl IR2, R1 R1,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRR1 1M r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
R1 IR1 r1, r2 r1,lr2 R2, R1 IR2. R1 R1,IM IR1.IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
5 POP POP AND AND AND AND AND AND
R1 IR1 r1, r2 r1, Ir2 R2, R1 IR2, R1 R1,IM IR1,IM
6
6.5
COM
6.5
COM
6.5
TCM
6.5 10.5 10.5 10.5 10.5 t--s:o
TCM TCM TCM TCM TCM STOP
x
CI)
R1 IR1 r1, r2 r1,lr2 R2. R1 IR2. R1 R1,IM IR1,IM
~
7
10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 r---uJ
CI) PUSH PUSH TM TM TM TM TM TM HALT
:0
,Q R2 IR2 r1, r2 r1, Ir2 R2, R1 IR2. R1 R1,IM IR1,IM
Z
~
10.5 10.5 12.0 18.0 ~
CI) 8 DECW DECW LDE LDEI DI
c. RR1 IR1 r1,lrr2 Ir1.lrr2
C.
::l
6.5 6.5 12.0 18.0 ~
9 RL RL LDE LOEI EI
R1 IR1 r2,Irrl Ir2,lrr1
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
A INCW INCW CP CP CP CP CP CP REf
RR1 IR1 r1, r2 r1,lr2 R2, R1 IR2, R1 R1,IM IR1,IM
B
6.5
CLR
6.5
CLR
6.5
XOR
6.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
r--w.o
IREf
R1 IR1 r1, r2 r1,lr2 R2. R1 IR2. R1 R1,IM IR1.IM
C
6.5
RRC
6.5
RRC
12.0
LDC
18.0
LOCI
10.5
LD
t-s:s
RCF
R1 IR1 r1,Irr2 Ir1,lrr2 r1,x.R2
D
6.5
SRA
6.5
SRA
12.0
LDC
18.0
LOCI
20.0
CALL'
20.0
CALL
10.5 t-s:s
LD SCF
R1 IR1 r2.lrr1 Ir2,lrr1 IRR1 DA r2,x.R1
E
6.5 6.5 6.5 10.5 10.5 10.5 10.5 r---s.5
RR RR LD LD LD LD LD CCF
R1 IR1 r1.IR2 R2, R1 IR2, R1 R1,IM IR1,IM
F
8.5 8.5
SWAP SWAP
6.5
LD
10.5
LD
r---s:o
NOP
R1 IR1 Ir1. r2 R2.IR1
... T " ".
A-
T ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline
Cycles 1 Cycles
R 1 or r 2 = Ost address
R 1 or r2= Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
332
PRODUCT SPECIFICATION
~ZiI.m
Z86C30
CMOS Z8® 8-BIT
MICROCONTROLLER
FEATURES
• 3.0 to 5.5 volt operating range • Six vectored, priority interrupts from six dillerent sources
• 24 inputloutput lines (two with comparator inputs) • Two comparators with programmable interrupt polarity
• All digital inputs CMOS levels, Schmitt-triggered • On-chip oscillator that accepts a crystal, ceramic
resonator, LC, RC or external clock drive.
ill 4 Kbytes of ROM
• ROM and RAM protect
• 236 bytes of RAM
GENERAL DESCRIPTION
The Z86C30 CCfY'M Consumer Controller Processor intro- ancillary features that are useful in many industrial, auto-
duces a new level of sophistication to single-chip architec- motive, and advanced scientific applications.
ture. The Z86C30 is a member of the Z8 single-chip
microcontroller family with 4 Kbytes of ROM and 236 bytes The device applications demand powerlull{O capabilities.
of RAM. The device is housed in a 28-pin DIP, and is The CCP fulfills IIlis with 24 pins dedicated to input and
manufactured in CMOS technology. Zilog's CMOS output. These lines are grouped into three ports, eight lines
microcontroller offers fast execution, efficient use of per port, and are configurable under software control to
memory, sophisticated interrupts, inputloutput bit ma- provide timing, status signals, and parallel I/O with or
nipulation capabilities, and easy hardware/software sys- without handshake.
tem expansion along with low cost and low power con-
sumption. There are three basic address spaces available to support
this wide range of configurations: Program Memory,
The Z86C30 architecture is characterized by Zilog's 8-bit Register File, and Expanded Register File. The Register
microcontroller core with an Expanded Register File to File is composed of 236 bytes of general purpose regis-
allow easy access to register mapped peripheral and I/O ters, three I/O port registers and 15 control and status
circuits. The CCP offers a flexible I/O scheme, an efficient registers. The Expanded Register File consists of two
register and address space structure, and a number of . Control registers.
333
GENERAL DESCRIPTION (Continued)
To unburden the program from coping with the real-time Note: All Signals with a preceding front slash, ",., are active
problems such as counting/timing and input/output data Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
communication, the Z86C30 offers two on-chip cOl-lnter/ active Low, only); INIIS (NORMAL and SYSTEM are both
timers with a large number of user selectable modes, and active Low).
on-board comparators to process analog signals with a
common reference voltage (Figure 1).
Machine
.--'--------,,'1 Timing & Inst.
Control
RESET
WDT, POR
ALU
FLAG
Register
Pointer
Register File
236 x a-Bit
I/O
(Bit Programmable)
334
PIN DESCRIPTION
P34 P35
Note: Power connections follow
Conventional descriptions below
XTAL1. Crystal 1 (time-based input). This pin connects a programmed as POO-P03 input/output and P04-P07 inpuV
parallel-resonant crystal, ceramic resonator, LC or RC output, separately. All input buffers are Schmitt-triggered
network or external single-phase clock to the on-chip and output drivers are push-pull. It can also be used as a
oscillator input. handshake I/O port.
XTA12. CrystaI2(time-based output). This pin connects a Port 3 lines P32 and P35 are used as handshake control
parallel-resonant crystal, ceramic resonator, LC or RC lines. The handshake direction is determined by tile con-
network to the on-chip oscillator output. figuration (input or output) assigned to port D's upper
nibble. The lower nibble must have the same direction as
Port 0 POQ-P07. Port 0 is an 8-bit, bidirectional, CMOS the upper nibble (Figure 3).
compatible I/O port. These eight I/O lines can be nibble
335
PIN DESCRIPTION (Continued)
Port 0 (1/0)
Handshake Controls
IOAVO and ROY 0
(P32 and P35)
OEN
Out
r ----------
I Auto Latch
I I
I_ _
R=500Kn '
_ _ _ _ _ _ _ _ _ _ _ ...1
336
Port 2 P20-P27. Port 2 is an 8-bil, bidirectional, CMOS Port 2 may be placed under handshake control. In this
compatible I/O port. These eight I/O lines can be config- configuration, Port 3 lines P31 and P36 are used as the
ured under software control as an input oroutpul, indepen- handshake control lines. The handshake signal assign-
dently. Input buffers are Schmitt-triggered. Bits pro- ment for Port 3 lines P31 and P36 is dictated by the
grammed as outputs may be globally programmed as direction (input or output) assigned to bit 7, Port 2
either push-pull or open drain. When used as an I/O porI, (Figure 4).
Port2 (110)
Handshake Controls
1DAV2 and RDY2)
(P3 1 and P3 S )
Open Drain
OEN
Out
IL ___________
R=500KO I
...l
337
PIN DESCRIPTION (Continued)
Auto-Latch. The Auto-Latch puts valid CMOS levels on all comparators can process analog signals on P31 and P32
CMOS inputs that are not externally driven. This reduces with reference to the voltage on P33. The analog function
excessive supply current flow in the input buffer when not is enabled by programming the Port 3 Mode Register
being driven by any source (Figure 46). (bit 1). P30 and P33 are falling edge interrupt inputs. P31
and P32 are programmable as falling, rising, or both edge
Port 3 P30-P37. Port 3 is an 8-bit, CMOS compatible port triggered interrupts (IRQ register bits 6 and 7). P33 is the
with four fixed input and four fixed output. Port 3 consists comparator reference voltage input.
of four fixed inputs (P30-P33) and four fixed outputs (P34-
P37), and can be configured under software for interrupt Access to Counter/Timer 1 is made through P31 (T'N and
and port handshake functions. Port 3, pin 0 input is P36 (Tour)' Handshake lines for Ports 0 and 2 are available
Schmitt-triggered. Pins P31, P32 and P33 are standard on P3 pin 1 through 6 (Figure 5).
CMOS inputs and the outputs are push-pull. Two on-board
Z86C3 D Port 3
MCU (1/0 or Control)
~
... -------------------~ AutoLatch
I I
I I
P3D )
~ •
P300ala
LalchlR03
R247=P3M
I = Analog
O=Digltai
P31 (ANI)
. . - - - - - - - - . DIG. ~ ~I"- _ _ _ _"'" IR02, TIn, P31 Dala Lalch
,
I
I
I
I
P33(REF)
t
From Slop M~od:;e--------a...'"o-----:"'" IROI, P33 Dala Latch
Recovery Source D
)
338
Table 2. Pin Assignments Comparator Inputs. Port 3 Pin P31 and P32 each have a
comparator front end. The comparator reference voltage
Pin 1/0 CTC1 AN In Int. POHS P2HS Pin P33 is common to both comparators. In analog mode,
P30 IN the P31 and P32 are the positive inputs to the comparators
IR03
P31 IN Tin AN1 IR02 D/R and P33 is the reference voltage supplied to both com-
P32 IN AN2 IROO D/R parators. In digital mode, pin P33 can be used as a P33
P33 IN REF IR01 register input or IR01 source.
P34 OUT
P35 OUT RID
P36 OUT Tout RID
P37 OUT
Notes:
HS = Handshake Signals
D=DAV
R=RDY
339
FUNCTIONAL DESCRIPTION
The Z8 CCP incorporates special functions to enhance the The 4K bytes of program memory is mask programmable.
Z8's application in industrial, scientific research and ad- A ROM protect feature prevents "dumping" of the ROM
vanced technologies applications. contents by inhibiting execution of LDC and LDCI
instructions to program memory in ALL modes.
Reset. The device is reset in one olthe following conditions:
The ROM protect option is mask-programmable, and
• Power-On Reset is selected by the customer when the ROM code is
submitted.
• Watch-Dog Timer
Expanded Register File. The register file has been
• STOP Mode Recovery sOurce expanded to allow for additional system control registers,
mapping of additional peripheral devices and input/output
• Brown-Out Recovery ports into the register address area. The Z8 register
address space RO through R 15 is implemented as
The Z86C30 does not re-initialize WDTMR, SMR, P2M, and 16 groups of 16 registers per group (Figure 7). Tilese
P3M registers to their reset values on a STOP Mode register groups are known as the ERF (Expanded
Recovery operation. Register File).
Program Memory. The Z86C30 can address up to 4K bytes Bits 3:0 of the Register Pointer (RP) select tile active ERF
of internal program memory (Figure 6). The first 12 bytes of group. Bits 7:4 of register RP select the working register
program memory are reserved for the interrupt vectors. group (Figure 8). Two system configuration registers
These locations contain six, 16-bit vectors that correspond reside in the Expanded Register File at bank F. The rest of
lothe six available interrupts. Byte 13 to byte 4095 consists the Expanded Register is not physically implemented and
of on-chip mask programmed ROM. is open for future expansion.
i..ocation of On-Chip
First Byte of ROM
Instruction
Executed
After RESET
............
12
...:: -- - - - - -
11 IR05
10 IR05
9 iR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 r--... IR02
~ i-P"
IR02
Interrupt
Vector 3 IR01
(Upper Byte)
2 IR01
1 IROO
0 IROO
340
ZS STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
%FF SPL u u u u u u u u
REGISTER POINTER
%FE Reserved u u u u u u u u
17161514131211101
%FD RP 0 0 0 0 0 0 0 0
Working RegiS~~
Group Pointer I Expanded Register
Group Pointer
%Fe
%FB
FLAGS
IMR
U
0
U
U
U
U
U
U
U
U
U
U
U
U
U
U
%FA IRQ 0 0 0 0 0 0 0 0
%F9 IPR U U U U U U U U
%F8 P01M 0 1 0 0 1 1 0 1
·· %F? P3M 0 0 0 0 0 0 0 0
/ %F6 P2M 1 1 1 1 1 1 1 1
---------
%F5 PREO U U U U U U U 0
ZSReg. File %F4 TO U U U U U U U U
%FF %Fa PREI U U U U U U 0 0
%Fa
%F2 T1 U U U U U U U U
'%F1 TMR 0 0 0 0 0 0 0 0
%FO Reserved
%7F · % (F) OF
%(F)OE
WDTMR
Reserved
U U U 0 1 1 0 1
%(F)OD Reserved
%(F)OC Reserved
· %(F)OB
%(F)OA
SMR
Reserved
0 0 1 0 0 0 U 0
%(F)D3 Reserved
% (F) 02 Reserved
%(F)01 Reserved
%(F)OO Reserved
%(0)03 P3 1 1 1 1 U U U U
%(0)02 P2 U U U U U U U U
%(0)01 Reserved U U U U U U U U
%(0)00 PO U U U U U U U U
U _ UnI<nown
* Will not be reset with a STOP Mode Recovery
341
FUNCTIONAL DESCRIPTION (Continued)
R253 RP Register File. The register file consists of three I/O port
registers, 236 general purpose registers and 15 control
and status registers (RO-R3, R4-239 and R240-R255, re-
spectively), and two system configuration registers in the
expanded register group (See Figure 7). The instructions
can access registers directly or indirectly via an 8-bit
Expanded Register Group address field. This allows a short 4-bit regisler address
Worl<ing Register Group using the Register Pointer (Figure 9). In the 4-bit mode, the
register file is divided into 16 working register groups,
DelauH sefllng alter RESET = 00000000
each occupying 16 continuous locations. rhe r~egister
Pointer addresses the starting location of the active
Figure 8. Register Pointer Register working register group.
R230
,-
R15
-- - - 110-Ports
- - - - R3
342
RAM Protect. The upper portion of the RAM's address Stack. An 8-bit Stack Pointer (R255) is used for the intemal
spaces %7F to %EF (excluding the control registers) can stack that resides within the 256 general purpose
be protected from reading and writing. The RAM Protect registers.
bit option is mask-programmable and is selected by the
customer when tile ROM code is submitted. After the mask Countermmers. Tilere are two 8-bit programmable counter/
option is selected, tile user can acti~ate from the internal timers (TO-Tl), each driven by its own 6-bit programmable
ROM code to turn off/on the RAM Protect by loading a bit prescaler. The Tl prescaler can be driven by internal or
06 in the IMR register to eitiler a 0 or aI, respectively. external clock sources; ilowever, tile TO prescaler is driven
A 1 in 06 indicates RAM Protect enabled. by the internal clock only (Figure 10).
PREO TO TO
tnitial Value Initial Value Current Value
Register Register Register
6-Bit 8-bit
Down Down
~-... Internal Counter Counter IR04
Clock
1---- TOUT
External Clock
P3 6
Clock
Logic
6-Blt 8-Bit IR05
Down Down
Counter Counter
tnternal Clock
Gated Clock PREl Tl Tl
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
Tin P31
343
FUNCTIONAL DESCRIPTION (Continued)
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock divided-by-four, or an exter-
clock source by any integer number from 1 to 64. Each nal signal input via Port 3. The Timer Mode register config-
prescaler drives its counter, which decrements the value ures the extemal timer input (P31) as an external clock;
(1 to 256) that has been loaded into the counter. When the a trigger inputthat can be retriggerable or not-retriggerable;
counter reaches the end of count, a timer interrupt request- or as a gate input for the internal clock. Port 3 line P36
IRQ4 (TO) or IRQ5 (T1) is generated. serves as a timer output (Tout) through which TO, T1 or the
internal clock are output. The counter/timers can be cas-
The counters can be programmed to start, stop, restart to caded by connecting the TO output to the input of T1.
continue, or restart from the initial value. The counters can
also be programmed to stop upon reaching zero (single Interrupts. The Z86C30 has six different interrupts from six
pass mode) or to automatically reload the initial value and different sources. The interrupts are maskable and priori-
continue counting (modulo-n continuous mode). tized (Figure 11). The six sources are divided as follows;
four sources are claimed by Port 3 lines P30-P33 and two
The counters, but not the prescalers, can be read at any in counter/timers. The Interrupt Mask Register globally or
time without disturbing their value or count mode. The individually enables or disables the six interrupt
clock source for T1 is user-definable and can be either the requests (Table 3).
IRQO IRQ2
IRQ1,3,4,5
Interrupt
Edge IRQ(DS,D7)
Select
Interrupt
Request
Vector Select
344
Table 3. Interrupt Types, Sources, and Vectors
When more than one interrupt is pending. priorities are Clock. Tile Z86C30 on-chip oscillator has a Iligh-gain.
resolved by a programmable priority encoder that is con- parallel-resonant amplifier for connection to a crystal. RC.
trolled by the Interrupt Priority register. An interrupt ma- LC. ceramic resonator. or any suitable external clock
chine cycle is activated when an interrupt request is source (XTAL 1 = Input, XTAL2 = Output). The crystal
granted. Thus. disabling all subsequent interrupts saves should be AT cut, 10 KHz to 12 MHz max .. with a series
the Program Counter and Status Flags. and then branches resistance (RS) less than. or equal to. 100 Ohms.
to the program memory vector location reserved for that
interrupt. All Z86C30 interrupts are vectored through loca- The crystal should be connected across XTAL 1 and XTAL2
tions in the program memory. This memory location and using the recommended capacitors (capacitance is more
the next byte contain the 16-bit starting address of the than or equal to 22pf) from each pin to ground. Tile RC
interrupt service routine for that particular interrupt oscillator option is mask-programmable. to be selected by
request. the customer at the time ROM code is submitted. Tile RC
oscillator configuration must be an external resistor con-
To accommodate polled interrupt systems. interrupt in- nected from XTAL 1 to XTAL2. willl a frequency-selling
puts are masked and the interrupt request register is capacitor from XTAL 1 to ground (Figure 12). The RC value
polled to determine which of the interrupt requests need vs. Frequency curves are shown in Figures 46 to 48. (Note:
service. The RC option is not available in the 12 MHz part.)
An interrupt resulting from AN1 is mapped intolR02. and Power-On Reset (PaR). A timer circuit clocked by a dedi-
an interrupt from AN2 is mapped into IROO. Interrupts cated on-board RC oscillator is used for the Power-On
IR02 and IROO may be rising. falling or both edge trig- Reset (POR) timer function. The POR timer allows Vee and
gered. and are programmable by the user. The software tile oscillator circuit to stabilize before instruction
can poll to identify the state of the pin. execution begins.
Programming bits for the Interrupt Edge Select are located The POR timer circuit is a one-shot timer triggered by one
in the IRO Register (R250). bits 07 and 06. The configura- of three conditions:
tion is shown in Table 4.
1. Power-fail to Power-OK status
Table 4. IRQ Register 2. STOP mode recovery (if 05 of SMR=1)
3. WOT timeout
IRQ Interrupt Edge
D7 D6 P31 P32 The POR time is a nominal 5 mS. Bit 5 of the Stop Mode
register determines whether the POR timer is bypassed
o 0 F F
after STOP mode recovery (typical for external clock. and
o 1 F R
RC/LC oscillators with fast start up time).
1 0 R F
1 1 R/F R/F
HALT. Turns off the internal CPU clock. but not the XT AL
oscillation. The counter/timers and external interrupt IROO.
Noles:
IR01. and IR02. remain active. The device may be
F = Falling Edge
R = Rising Edge recovered by interrupts. either external or internal
generated. .
345
FUNCTIONAL DESCRIPTION (Continued)
~
C1][
'::"J;S)
XTAL1 C1][
XTAL2
~XTAL1
'::" L
. XTAL2
f1j
C1][
1
'::" R
XTAL1
XTAL2
Xi-AL1
.
XTAL2
C2~ C2~
STOP. This instruction turns off the internal clock and of this control is to selectively reduce device power con-
external crystal oscillation and reduces the standby cur- sumption during normal processor execution (SCLK con-
rent to 10 rnicroamps or less. The Stop mode is terminated trol) and/or HALT mode (TCLK sources, counter/timers,
by a RESET only, either by WDT timeout, paR, or SMR and interrupt logic). .
recovery. This causes the processor to restart the applica-
tion program at address OOOC (HEX). In order to enter STOP Mode Recovery Source (02, 03, and 04). These three
STOP (or HALT) mode, it is necessary to first flush the bits of the SMR specify the wake up source of the STOP
instruction pipeline to avoid suspending execution in mid- Mode recovery (Figure 14).
instruction. Tp do this, the user must execute a Nap
(opcode=FFH) immediately before the appropriate sleep SMR (F)OB
RESERVED
FF Nap ; clear the pipeline Stop Mode Recovery Source
7F HALT ; enter HALT mode 000 POROnly"
001 POROnly
010 P31
Stop Mode Recovery Register (SMR). This register selects 011 P32
100 P33
the clock divide value and determines the mode of STOP 101 P27
mode recovery (Figure 13). All bits are Write only, except 110 P2NORO:3
111 P2NORO:7
Bit 7 which is a Read.only. Bit 7 is a flag bilthat is hardware L -_ _ _ _ _ _ _ Stop Delay
set on the condition of STOP Recovery and reset by a . o OFF
1 ON"
power- on cycle. Bit 6 controls whether a low level or high L -_ _ _ _ _ _ _ _ Stop Recovery Level
level is required from the recovery source. Bit 5 controls the o Low Level·
reset delay after recovery. Bits 2. 3. and 4 of the SMR L -_ _ _ _ _ _ _ _ _ Stop Flag
1 High Level
SCLKfTCLK Oivide-by-16 Select (~O). DO of the SMR con- Figure 13. STOP Mode Recovery Register
trols a divide-by-16 prescaler of SCLK/TCLK. The purpose
346
L
SMR 040302
000
SMR 04 03 02 SMR 04 03 02 SMR 04 03 02 SMR 0403 02 SMA 04 03 02
001 100 101 1 1 0 1 1 1
voo o 1 0
o 1 1
P30
P31 P33 P27
P32
To POR
)----------------i--------------------------------------r---------1~
Stop Mode Recovery Edge
Select (SMR) To P33 Data
Latch and IRQ1
Table 5. Stop Mode Recovery Source recovery sources wakes the Z86C30 from STOP Mode.
A 0 indicates low level recovery. The default is 0 on pall
SMR Operation (Figure 14).
D4 D3 D2 Description of action
paR recovery only Cold or Warm Start (D7). This bit is set by the device upon
0 0 0
entering STOP Mode. A 0 in this bit (cold) indicates that the
0 0 1 P30 transition
1 P31 transition device will be reset by paR RESET. A 1 in this bit (warm)
0 0
1 1 P32 transition indicates that the device awakens by a SMR source.
0
0 0 P33 transition Walch Dog Timer Mode Register (WDTMR). The WOT is a
0 1 P27 transition retriggerable one-shot timer that will reset the Z8 if it
1 0 Logical NOR of Port 2 bits 0:3 reaches its terminal count. The WOT is initially enabled by
1 1 Logical NOR of Port 2 bits 0:7 executing the WOT instruction and refreshed on subse-
quent executions of the WOT instruction. The WOT cannot
be disabled after it has been initially enabled. The WOT
STOP Mode Recovery Delay Select (D5). This bit disables circuit is driven by an on-board RC oscillator or external
the 5 mS RESET delay after STOP Mode Recovery. The oscillator from XTAL 1 pin. The paR clock source is se-
default condition of this bit is 1. If the "fast" wake up is lected with bit 4 of the WOT register.
selected, the STOP Mode Recovery source needs to be
kept active for at least 5 TpC. WDTTime Selecl (DO, D1). Bits 0 and 1 control a tap circuit
that determines the timeout period. Table 6 shows the
STOP Mode Recovery Level Select (D6). A 1 in this bit different values that can be obtained. The default value of
position indicates that a high level on anyone of the DO and 01 are 1 and 0, respectively.
347
FUNCTIONAL DESCRIPTION (Continued) Since the on-board OSC is stopped during STOP mode,
the WOT clock source has to select the on-board RC OSC
Table 6. Timeout Period of the WDT for the WOT to recover from STOP mode. The default is 1.
Timeout of Timeout of Clock source for WOT (04). This bit determines which
01 DO Internal RC OSC XTALciock oscillator source is used toclock the internal paR and WOT
counter chain. If the bit is a 1, the internal RC oscillator is
0 0 5ms min 256TpC
bypassed and the paR and WOT clock source is driven
0 1 15 msmin 512TpC
from the external pin, XTAL 1. The default configuration of
1 0 25 ms min 1024 TpC
this bit is 0, which selects the RC oscillator.
1 1 100msmin 4096 TpC
Bits 5 through 7 are reserved. The WOTMR register is ac-
Noles:
TpC = XTAL clock cycle
cessible only during the first 64 processor cycles (128
The default on reset is 15 ms. XTAL clock cycles) from the execution of the first instruc-
See Figures 50 to 53 for details. tion after Power-On Reset, watch dog reset or a SlOP
mode recovery. After this paint, the register cannot be
WOT During HALT (02). This bit determines whether or not modified by any means, intentional or otherwise. The
the WOT is active during HALT Mode. A 1 indicates active WOTMR cannot be read and is located in bank F of the
during HALT. The default is 1. Expanded Register Group at address location OFH
(Figure 15).
WOT During STOP (03). This bit determines whether or not
the WOT is active during STOP mode. A 1 indicates active
during STOP. A 0 will disable the WOT during STOP mode.
WDTMR (F)OF
Imlool~I~lool~lmlool
-~ I I _n~
00
,~,,=
01"
10
5 ms
~, ..
256 TpC
15ms
25 ms
512TpC
1024 TpC
11 100 ms 4096 TpC
WDT During HALT
o OFF
ION"
L..-_ _ _ _ WDT During STOP
o OFF
ION"
L..-_ _ _ _ _ _ XTALlnNTRCSelectforWDT
o
On-Board RC •
1 XTAL
L..-_ _ _ _ _ _ _ _ Reserved
348
Brown Out Protection. An on-board Voltage Comparator minimum operating voltage varies with temperature and
checks that Vee is at the required level to ensure correct operating frequency, while the brownout voltage (VBo)varies
operation of the device. Reset is globally driven if Vee is with temperature only.
below the referenced voltage (Brown Out Voltage). The
Internal
RESET
WOTSelect
(WOTMR)
CK Source
Select
(WOTMR)
5mSPOR
XTAl
CK WOTIPOR Counter Chain
ClR
From Stop
Mode
Recovery
Source
12 nS G6lch Filter
WOT)----------~
Stop Delay
Select (SMR)
349
The brown-out trip voltage (VBO) is less than 3 volts and The device functions normally at or above 3.0V under all
above 1.4 volts under the following conditions. conditions. Below3.0V, the device is guaranteed to function
normally until the Brown-Out Protection trip point (VBO ) is
Maximum (Vao) Conditions: reached for the temperatures and operating frequencies
in case 1 and case 2 above. The actual brown-out trip point
Case1 TA = -40°C to + 105°C, Internal Clock is a function of temperature and process parameters
Frequency equal or less than 1 MHz (Figure 17).
Case 2 TA = -40°C to + 85°C, Internal Clock ROM Protect. ROM protect is mask-programmable. It is
Frequency equal or less than 2 MHz selected by the customer at the time the ROM code is
submitted. The selection of ROM protect will disable the
Note: The internal clock frequency runs at half the external lDC and lDCI instructions in ALL modes.
clock frequency.
Vcc 2.80
(Volts)
2.60
.~ ............
2.40
2.20
1'\ I
2.00
1'\
1.80
1'\
1.60
1.40
-60 -40 -20 20 40
"
60 80
-i'--.
100
.....
120
Temperature
(Oc)
140
350
STANDARD TEST CONDITIONS
CAPACITANCE
TA = 25°C, Vce = GND = OV, f = 1.0 MHz, Unmeasured pins to GND.
Parameter Max
Input capacitance 12 pF
Output capacitance 12 pF
I/O capacitance 12 pF
351
DC ELECTRICAL CHARACTERISTICS
Z86C30
Symbol Parameter Vee T. = OOC to 70°C T. =-40°c to 105°C Typical Units Conditions Notes
Note (3) Min Max Min Max at 25°C
VeA Clock Input High Voltage 3.3V 0.7 Vee VeetO.3 0.7 Vee VeetO.3 1.3 V Driven by External
Clock Generator
S.OV 0.7 Vee VeetO.3 0.7 Vee VeetO.3 2.5 V Driven by External
Clock Generator
Va. Clock Input Low Voltage 3.3V V.,-0.3 0.2 Vee V..-O.3 0.2 Vee 0.7 V Driven by External
Clock Generator
S.OV V..-0.3 0.2 Vee V..-O.3 0.2 Vee 1.5 V Driven by External
Clock Generator
V'H Input High Voltage 3.3V 0.7 Vee VeetO.3 O.7Vec VcctO.3 1.3 V
S.OV 0.7 Vee VeetO.3 0.7 Vee VeetO.3 2.5 V
V~ Input Low Voltage 3.3V V..-O.3 0.2 Vee V..-0.3 0.2 Vee 0.7 V
S.OV V..-0.3 0.2 Vee V..-0.3 0.2 Vee 1.5 V
VrJf Output High Voltage 3.3V Vee-004 Vee-OA 3.1 V 10L = -2.0 mA
S.OV Vee-OA Vee-004 4.8 V 101. =-2.0 mA
V0I.1 Output Low Voltage 3.3V 0.6 0.6 0.2 V I", =f4.0mA
5.0V 0.4 004 0.1 V 10L = f4.0 mA
V",2 Output Low Voltage 3.3V 1.2 1.2 0.3 V 101. =-HJ rnA,
3 Pin Max
5.0V 1.2 1.2 0.3 V 10L =+12 mA,
3 Pin Max
V", Reset Input High Voltage 3.3V .8Vec Vec .8 Vee Vee 1.5 V
5.0V .8 Vee Vee .8 Vee Vee 2.1 V
Vm Reset Input Low Voltage 3.3V V..-0.3 0.2 Vee V..-O.3 0.2 Vee 1.1
5.0V V,,-O.3 0.2 Vee V,,-O.3 0.2 Vee 1.7
352
DC ELECTRICAL CHARACTERISTICS (Continued)
Z86C30
lee1 Standby Current 3.3V 3 3 rnA HALT Mode VIN =OV, [4,5]
Vee @8MHz
5.0V S 5 2.4 rnA HALT Mode Y'N =OV, [4,5]
Vee @8MHz
3.3V 4 4 1.5 rnA HALT Mode Y'N =OV, [4,5]
Vee @12MHz
5.0V 6 6 3.2 rnA HALT Mode Y'N =OV, [4,S]
Vee @12MHz
3.3V 2 2 0.8 rnA Clock Divide by [4,S]
16@8MHz
5.0V 4 4 1.8 rnA Clock Divide by [4.5]
16@8MHz
3.3V 3 1.2 rnA Clock Divide by [4,5]
16@12MHz
S.OV 5 2.5 rnA Clock Divide by [4,5]
16@12MHz
lee2 Standby Current 3.3V 8 15 JJA STOP Mode Y'N =OV, [6]
Vee WDT is not Running
5.0V 10 20 2 IlA STOP Mode VIN =OV, [6]
Vee WDT is not Running
3.3V 500 600 310 JJA STOP Mode Y'N =OV, [6]
Vee WDT is Running
5.0V 800 1000 600 JJA STOP Mode Y'N =OV, [6]
Vee WDT is Running
1AU< Auto Latch High Current 3.3V -5 -7 -3 JJA OV<V,N < Vee
5.0V -8 -10 -6 JJA OV < V,N < Vee
Noles:
[1] ICCl Type Max UnH Freq
Clock Driven on Crystal 3.0mA 5 mA 8MHz
or XTAL Resonator O.3mA 50 mA 8 MHz
[2] Vss=OV=GND.
[3] 5.0V ± 0.5V, 3.3 V ± 0.3V. The Veo increases as the temperature decreases.
[4] All outputs unloaded, 1/0 pins floating, inputs at r\lil.
[5] CL 1=CL2=100 pF.
[6] Same as note [4] except inputs at Vee.
353
AC ELECTRICAL CHARACTERISTICS
Additional Timing Diagram
Clock
Clock
Setup
11
Stop
Mode
Recoveoy
Source
354
AC ELECTRICAL CHARACTERISTICS
Additional Timing Table
No Symbol Parameter Vee T.= O°C to 70°C T. = 40°C to 105°C Units Notes
Note[6] BMHz 12MHz BMHz 12 MHz
Min Max Min Max Min Max Min Max
TpC Input Clock Period 3.3V 125 100000 83 100000 125 100000 83 100000 ns [lJ
5.0V 125 100000 83 100000 125 100000 83 100000 ns [1]
2 TrC,TlC Clock Input Rise & Fall Times 3.3V 25 15 25 15 ns [1]
5.0V 25 15 25 15 ns [lJ
TwTfnH Timer Input High Width 3.3V 3TpC 3TpC 3TpC 3TpC [1J
6 TpTin Timer Input Period 3.3V 8TpC 8TpC 8TpC 8TpC [lJ
5.0V 8TpC 8TpC 8TpC STpC [1]
7 TrTin Timer Input Rise & Fall Timers 3.3V 100 100 100 100 ns [1]
5.0V 100 100 100 100 ns [1]
8A TwlL Int. Request Low Time 3.3V 100 100 100 Hio ns [1,2]
5.0V 70 70 70 70 ns [1,2]
S8 TwlL Int. Request Low Time 3.3V 3TpC 3TpC 3TpC 3TpC [1,3]
5.0V 3TpC 3TpC 3TpC 3TpC [1,3J
TwlH Int. Request Input High Time 3.3V 3TpC 3TpC 3TpC 3TpC [1,2]
5.0V 3TpC 3TpC 3TpC 3TpC [1,2]
11 Tost Oscillator Startup Time 3.3V 5TpC 5TpC 5TpC STpC [4]
5.0V 5TpC STpC 5TpC 5TpC [4]
Noles:
[1] Timing Reference uses 0.9 Vee for a logic "1" and 0.1 Vee for a logic "0".
[2] Interrupt request via Port 3 (P31-P33).
[3] Interrupt request via Port 3 (P30).
[4] SMR-05 = O.
[5] Reg. WOTMR.
[6] 5.0V ± 0.5V, 3.3V ± 0.3V.
355
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Table
_ _--'t~ .......................................................... .
Data In Data In Valid Next Data In Valid
'----'t~ .......................................................... .
I r - - - - - - - - - - - - - - - ' l t - - - Next
- - -Data
- -Out
- -- - - --
Valid
Data Out Data Out Valid
I'----------------'Jt ---------------
IDAV
(Output)
ROY
(Input)
356
AC ELECTRICAL CHARACTERISTICS (Continued)
Handshake Timing Table
No Symbol Parameter V ~
T. = O°C to 70°C T. = ·40°C to 105°C Notes
Note[l] 8MHz 12MHz 8MHz 12MHz
Min Max Min Max Min Max Min Max
Note:
[1] 5.0 V ± 0.5V, 3.3V ± 0.3V.
357
EXPANDED REGISTER FILE CONTROL REGISTERS
SMR (FIOB WDlMR (F) OF
11D±5ID4ID3IDL21~1
SClKfTCLK Divide by 16 ~ WDTTAP INTRCOSC XTALCLK
o OFF" 00 5 ms 256 TpC
1 ON 01" 15 ms 512 TpC
10 25 ms 1024 TpC
RESERVED 11 100ms 4096TpC
Slop Mode Reooveoy Souroe , WDT During HALT
000 POR Only" o OFF
001 P30 1 ON'
010 P31 L-_ _ _ _ _ WDT During STOP
011 P32
100 P33 o OFF
101 P27 1 ON'
110 P2 NOR 0:3 ' - - - - - - - XTAL1I1NT RC Selee! forWDT
111 P2NORO:7 o On·Board RC '"
Slop Delay 1 XTAL
o OFF ' - - - - - - - - - - Reserved
1 ON"
' - - - - - - - - - - Slop Reooveoy Level ... OefauH seHing after RESET
o low·
1 High
'-------------
oSropA~
POR" Figure 23. Watchdog Timer Mode Register
1 Slop Recoveoy
358
Z8 CONTROL REGISTER DIAGRAMS
R240 R243 PRE 1
1~lool~I~loolool~lool
I Reserved Count Mode
o Tl Single Pass
1 Tl Modulo N
TIN Modes
00 External Clock Input
I TO Inttlal Value
(When Written)
01 Gate Input (Range: 1-256 Decimal
lOTriggerlnput 01-00 HEX)
(Non-retriggerable) TO Current Value
11 Trigger Input .(When Read)
(Retriggerable)
TOUT Modes
00 NotUsed Figure 28. CounterlTimer 0 Register
01 TO Out (F4H: ReadIWrite)
1~ ~le~!ICIOCkOut
R245PREO
1~loolool~lool~I~lool
Reserved
Prescaler Modulo
(Range: 1-64 Decimal
I Tl Initial Value
(When Wrillen)
01-00 HEX)
359
ZS CONTROL REGISTER DIAGRAMS (Continued)
R247 P3M
Iml~I~I~looloolrnlool
-r--
II i ; ~:~~~~"_
1 P32 = IDAVOIRDYO P3S = RDYOIIDAVO I
-r--
POo - pOo Mode
00 = QulpUt
T I Interrupt Group Priority
Reserved = 000
01 = Input C>A>B=OOl
1X = Reserved A>B>C=010
Stack selection A>C>B=011
1 = Internal B>C>A=l00
C>B>A=101
Reserved - B>A>C=110
External Memory llmlng Reserved = 111
O=Normal IR01, IRQ4 Priority (Group C)
o = IROl > IRQ4
PO 4 - P07 Mode. 1 = IRQ4 > IROl
00 = Oulput
01 -Input IROO, IR02 Priority (Group B)
lX= Reserved 0= IR02 > IROO
1 =IROO > IR02
IR03, IROS Priority (Group A)
0= IROS > IR03
1 = IR03 > IROS
Figure 32. Port 0 and 1 Mode Register
Reserved
(F8H: Write Only)
360
R250IRO R253 RP
Iwlool~I~lool~I~lool
R2511MR I Stack Pointer Upper
Byte (SPa· SP 15 )
1 Enables IRQ5.IROO
(DO =IROO) Figure 38. Reserved
1 Enables RAM Protect
1 Enables Interrupts
R255SPL
Figure 35. Interrupt Mask Register
(FBH: ReadlWrite) Iwlool~I~lool~I~lool
I Stack Pointer Lower
R252 FLAGS Byte (SP7 - SPo )
361
DEVICE CHARACTERISTICS
ICC (mA) 13
"A
12
11 /
10 /
9 /
8 /
7
V
/ B
6
/ /
5
/ V
4 ~ L
/'
3
/' ./
~
/'
~
--
2
~
".,-
Legend:
A- Vcc=5.0V
B- Vcc=3.5V
362
I CC1(mA) 4
/
3 / 1:1
I
/ /" /
//
2 / / V"
c
// /'
----
~
---- ~
~
./
r-
//
. /'"
-----"
0
r-- - ~
Frequency (KHz)
Legend:
A - Vcc1 = 5.0V
B - Vcc1 = 5.0V (SCLK Divided by 16)
C - Vcc1 = 3.5V
D - Vcc1 = 3.5V (SCLK Divided by 16)
363
DEVICE CHARACTERISTICS (Continued)
IOH -40
(ma)
t - - - I-A ...
1'-0..
.......
-30 - 1'-0..
r-B ... .......
I".... .......
" ......
e ... ~
-20
........... ......
""" ,
........... ......
.............
~
......
.......
............ .............. r...., ......
..." , '"
-10
l'-........ ~
, ~....... r-...
-.......;
~ "-
o ~
2.0 3.0 4.0 5.0
VOH(Volts)
a. vee =5.0V
IOH -12
(ma) A\
-10
1\
-8
-8
-
B
I-e
,
,
", \
~
\ \
,\ \
-4 '\ \\
'\'
-2
o
2.0
~~
1\\
3.0
, 4.0 5.0
VOH(Volts)
b. vee =3.3V
Legend:
A=-55°C
B= 25°C
C = 125°C
364
IOL 16
(rna)
~A
14
/
12
/
V B-
/ ./
10
V v
8 ,/ /
V '"
/
C-
6 / ./ ./
~ ~ /
'f" '"
4 ./ V /
~ / ./
2 1// /
~~
0
"",.
0.1 0.2 0.3 0.4
VOL (Volts)
a. VCC=5.0V
IOL 12
(rna)
10 A_
-:/
8 ./
~
~ B_
6
/' ",
17 ~7 C
..,,-
4 ./ -' ~ --""
./ '.-~
. / ,,-
'.,., ":.,......
..,-
..;
2
~ ::;;....--'"
A=-5S0C
B= 2SoC
C = 12SoC
365
DEVICE CHARACTERISTICS (Continued)
1\..
,,'\.
3
" '\..
'\.
~'\.. '\ ~
2 "''
'" '"
,,~
'
.'\..'\.
~'\..'\.
'\..'\ ~
~ ~
1
"''''
"'~ '"'\..~
~"'~
-- F
" "
E
0-
~~' C
B
A
Temperature (OC)
Legend:
366
Time 22.0
(msec)
20.0
18.0 .- ~A
~
~
16.0 ~
~
~
14.0
~
~
~
~ -- ~B
12.0
~
I.--"'"
~
V
.". - ~c
~~ ~ ~D
....
~ ---- ~
10.0
I--- ~
.-..--
-
--::::::- --------------- --
~ E
~ ...............
8.0
~ --- --- --- ~
I-F
6.0
~
4.0
2.0
o
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
Legend:
367
DEVICE CHARACTERISTICS (Continued)
I ALL
(J.lA) 15 ___E _
__ _E _
10
C
B
5
o
--55 -25 +125
Temperature (0C)
a. Typical Auto Latch Low Current vs Temperature
IALH 10 ~~~~--~~~--r-~~~--~-r~--~
(J.lA)
F
E -
D
5 -
C
B
-A -
o
-55 -25 +125
Temperature (0C)
b. Typical Auto Latch High Current vs Temperature
Legend:
368
Frequency' 10000
(KHz)
sooo
,
........
~ ~II .... .J. I . - I III I I I
.............
~ r.... .... ~
1000
-...... r..... r--.
soo ......... 1"-
...... ........
I"\. "\.
~,~
100 ~
,
I'\~
so
10
" """ I' '"~
~ l\.
'\
5
"'"
~
A
c
Resistance (kohms)
Legend:
A - Vcc = S.OV C = 33 pF
B - Vcc = 3.3V C = 33 pF
Note: • The internal clock frequency is one half the external clock frequency.
This chart for reference only. Each process will have a different characteristc curve.
369
DEVICE CHARACTERISTICS (Continued)
Internal 10000
Frequency'
(KHz) 5000
,--
1000
600 "" ~~
i'I,
~
"- "- ........
100
r-.....
~r-.......
......
['......
-
-
i"""'-- ...... ........
i'r....., ........
~
10
............ ............ A
........ i'oo..
6
........ B
o
1 100 1000
Resistance (kohms)
Legend:
A-C=100pF
B -C = 181 pF
Note: • The internal clock frequency is one half the external 'clock frequency.
This chart for reference only. Each process will have a different characterlstc curve.
370
Internal 10000
Frequency'
(KHz) --
"-
_.._-
5000 1\
1\ - - -_. -
......
" 1-- ---
1000
"" ....... r--.. ..........
"'r........ r-......~ - r- io-.
"
1' .....
......
.........
"'~
'I'.
L1_
" ~ ~
"'
-
.
A·
500
" ........... r--.... r--.
I I I f--- r---
Ll f--- --- B
100 ~
o
5 10 20 60 100 150 200 300
Capacitance (pF)
Legend:
A-C=100pF
B-C=1B1 pF
Note: • The internal clock frequency is one half the external clock frequency.
This chart for reference only. Each process will have a different characterlstc curve.
R = 1 kohrn
371
DEVICE CHARACTERISTICS (Continued)
Time 40r---~----~--~----~--~~---r----~---T----'
(msec)
35~---+----+---~----~--~r----r--~~~-+--~
30~---+----+---~~~4---~~--~----~---+~~
25~---+----+----+----~~~~~~----b---~-r~
~--~----~--~----~--~----~--------~--~
o-60 -40 o
-20 20 40 60 80 100 120
Temperature (OC)
Legend:
372
Time 80
(msec)
70
60
50
40
30
20 ~--~~---+-----r----1-----r---~-----+-----r----~
10 ~--~----~--~----~~~----~----~--~--~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
Legend:
373
DEVICE CHARACTERISTICS (Continued)
Time150r---~----~--~----~--~~--~----~--~~--'
(msec)
125~---+----+---~----~--~~~~----r----+----i
100~---+----+---~----~~~~--~----~---t~~
25~---+----+----+----+---~-----r----r---~--~
O~--~--~----~--~--~----~--~--~~~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
Legend:
374
Time 500
(msec) A
450
/" ...-
B
,/'
~
400 V ~
~
C
350 ./
:/ ".,.......
~
/' ~
300
:/ ......
./ ~ .......... ~
D
--- ---
~ I- E
~ ~
~ L--- ~ F
---- ----
250
l...-- ~
~
,-- ~
200
~ - ~
~
....- ----
150
~
100
-60 -40 -20 o 20 40 60 80 100 120
Temperature (DC)
Legend:
375
INSTRUCTION SET NOTATION
Addressing Modes. The following ,notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary,
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overllow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
376
CONDITION CODES
3n
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
MODE I OPC
r-----,---, LD
sre OR
dsl OR
MODE I OPC LD
dsllsrc I x
ADDRESS
cc I OPC JP
DAU
DAL
6FH
FFH
7FH
STOP/HALT
rn DAU
DAL
CALL
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol The notation "addr (n)" is used to refer to bit (n) of a given
" ~ ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location.
378
INSTRUCTION SUMMARY (Continued)
Range: +127,
CP dst, sre t All
****- - -128
dst - sre
lD dst, sre 1m rC - - - -
DAdst R 40
*** X
- - dstl-sre r R r8
dstl-OA dst IR 41 R r9
r= 0- F
DEC dst R 00 - ***- - X C7
dstl-dst - 1 IR 01 X r 07
r Ir E3
DECWdst
dstl-dst -1
RR
IR
80
81
- ***- - Ir
R R
F3
E4
R IR E5
DI 8F - - - - - - R 1M E6
IMR(7)+-O IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
rl-r - 1 r = 0- F lDCdst, sre Irr C2
if r .. O
PCl-PC + dst lDCI dst, sre Ir Irr C3
Range: +127, dstl-sre
-128 rl-r+1;
rrl-rr + 1
EI 9F - - - - - -
IMR(7)l-1
HALT 7F - - - - - -
379
INSTRUCTION SUMMARY (Continued)
NOP FF STOP 6F - - - -
PUSH src R 70 - - - - - -
17
2J o1
SPf-SP - 1;
@SPf-src
IR 71 TCMdst, src
(NOTdst)
t 6[ ] -
** 0
- -
AND src
RCF CF 0 - - - - -
Cf-O TM dst, src
dst AND src
t 7[ ] -
** 0
- -
RET AF - - - - -
PCf-@SP; XOR dst, src t B[ ] -
** 0
- -
SPf-SP + 2 dstf-dst
XORsrc
RLdst R gO
****- -
~- IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevily. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ ]'
-
RLC dst R
IR
10
11
****- in this table, and its value is found in the following table to the left of the
lfu=iEij:J applicable addressing mode pair.
R R [4]
SCF DF 1 - - - - -
Cf-l
R IR [5]
-
SRA dst R DO
***0 -
R 1M [6]
~
IR D1
IR 1M [7]
SRP src 1m 31 - - - - - -
RPf-src
380
OPCODEMAP
lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
RI IRI r1, r2 rl, Ir2 R2, RI IR2, Rl RI,IM IRI,IM rl, R2 r2, RI rl, RA cc, RA rl,IM ce, DA rl
6,5 6.5 6.5 6,5 10,5 10.5 10,5 10.5
-
RLC RLC ADC ADC ADC ADC ADC ADC
RI IRI rl, r2 rl,lr2 R2, RI IR2, RI RI,IM IRI,IM
6.5 6,5 6,5 6.5 10.5 10,5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
RI IRI rl, r2 rl,lr2 R2, Rl IR2, RI RI,IM IRI,IM
B.O 6.1 6.5 6,5 10.5 10,5 ~
10.5 10.5
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRI 1M rl, r2 rl,lr2 R2, RI IR2, RI RI,IM IRI,IM
B,5 8.5 6.5 6,5 10.5 10,5 10.5 10.5 ~
4 DA DA OR OR OR OR OR OR WHD
RI IRI rl, r2 rl,lr2 R2,Rl IR2, RI Rl,IM IRI,IM
5
10.5
POP
10.5
POP
6.5
AND
6.5
AND
10.5
AND
10.5
AND
10,5
AND
10,5 t--s:o
AND WDT
RI IRI rl, r2 rl,lr2 R2, RI IR2, RI RI,IM IRI,IM
6
6.5
COM
6,5
COM
6.5
TCM
6.5
TCM
10,5
TCM
10.5
TCM
10,5
TCM
10.5
TCM
t--s:o
STOP
><OJ RI IRI rl, r2 rl,lr2 R2, Rl IR2, RI RI,IM IRI,IM
;;. 10/12.1 12/14,1 6,5 6.5 10.5 10.5 10,5 la,s IJ:O
OJ 7 PUSH PUSH TM TM TM TM TM TM HALT
:0 R2 IR2 r1, r2 rl,lr2 R2, RI IR2, RI RI,IM IR1,IM
.0
Z 10.5 10,5 '6:1
:;; 8 DECW DECW DI
c.
c. RRI IRI
::>
6.5 6.5 '6:1
9 RL RL EI
RI IRI
10,5 10.5 6.5 6.5 10.5 10,5 10.5 10.5 ~
A INCW INCW CP CP CP CP CP CP RET
RRI IRI rl, r2 rl,lr2 R2, RI IR2, RI RI,IM IRI,IM
6.5 6.5 6.5 6.5 10.5 10,5 10.5 10,5 ~
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
RI IRI rl, r2 rl,lr2 R2, RI IR2, RI RI,IM IRI,IM
C
6,5 6,5 12,0 18.0 10.5 r---s:5
RRC RRC LDC LDCI LD RCF
RI IRI rl,lrr2 Irl,lrr2 rl,x,R2
D
6.5 6.5 20.0 20.0 10.5 ts:s
SRA SRA CALL" CALL LD SCF
RI IRI IRRI DA r2,x,RI
6,5 6.5 6,5 10.5 10,5 10.5 10.5 f---&s
E RR RR LO LO LD LO LO CCF
RI IRI rl,IR2 R2, RI IR2, RI RI,IM IRI,IM
8.5 8.5 6.5 10.5 ~
F SWAP SWAP LO LO NOP
.RI IRI
'Y'
Irl, r2
A
R2,IRI
T
A
'Y' ~
2 3 2 3
Bytes per Instruction
lower legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline
Cycles 1 Cycles
R 1 or r 2 = Ost address
R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
381
PRODUCT SPECIFICATION
~ZiIID
Z86E30
CMOS Z8® alP
CCPTh! MICROCONTROLLER
FEATURES
_ 8-bit CMOS microcomputer, 28-pin DIP _ All digital inputs, CMOS levels, Schmitt triggered
_ Software programmable low EMI mode _ Three Expanded Register File control registers
_ Pull-Up Active/Open Drain programmable _ Two programmable 8-bit Counter/Timers each with a
on Ports 0 and 2 6-bit programmable prescaler.
- EPROM protect programmable _ Six vectored, priority interrupts from six different sources
RC oscillator programmable
_
_
Clock speeds up to 12 MHz
Watchdog Timer
_
Two Comparators
-
resonator, LC, RC or external clock drive.
24 input/output lines
GENERAL DESCRIPTION
The Z86E30 CCP (Consumer Controller Processor) intro- easy access to register mapped peripheral and I/O cir-
duces the next level of sophistication to single-chip archi- cuits. The CCP offers a flexible I/O scheme, 'an efficient
tecture. The Z86E30 is a member of the Z8 single-chip register and address space structure, and a number of
microcontrolier family with 4 Kbytes of EPROM and 236 ancillary features that are useful in many industrial, high
bytes of RAM. The device is housed in a 28-pin DIP, and volume, automotive, peripheral types, and advanced sci-
is manufactured in CMOS technology. The device offers entific applications.
easy software development and debug, prototyping, and
small production runs not economically desirable with a The device applications demand powerful I/O capabilities.
masked ROM version. The CCP fulfills this with 24 pins dedicated to input and
output. These lines are grouped into three ports, eight lines
The Z86E30 architecture is characterized by Zilog's 8-bit per port, and are configurable under software control to
microcontrolier core with an expanded register file to allow provide timing, status signals, and parallel I/O with or
without handshake.
383
GENERAL DESCRIPTION (Continued)
There are three basic address spaces available to support To unburden the program from coping with the real-time
this wide range of configurations: Program Memory, problems such as counting/timing and input/outpul data
Register File, and Expanded Register File (ERF). The communication, the Z86E30 offers two on-chip counterl
Register File is composed of 236 bytes of general-purpose timers with a large number of user s!,!lectable modes, and
registers, three I/O port registers and 15 control and status two on-board comparators to process analog signals with
registers. The Expanded Register File consists of three a common reference voltage (Figures 1 and 2).
control resisters.
r,
Note: All Signals with a preceding front slash· are active
Low, e.g.: BIIW (Word is active Low); IBIW (BYTE is active
Low, only).
Machine
.....--------v1Timing & Inst.
Control
RESET
Counterl WDT, POR
Timers (2) ALU
FLAG
Interrupt Prg. Memory
Control 4096 X8Bit
Register
Pointer
Two Analog
Comparators Program
Register File Counter
256 x 8-Bit
Port 2
110
(Bit Programmable)
384
07 - 0
AD 11- 0...
Z8MCU
AD 11- 0
17
MSN Address I--
Port 3 MUX t-
07 -0
4K Data
AD 11- 0
-"
EPROM ... p- MUX
I'"
128 Bytes .007 -0 .. Z8
TEST ROM
Z8 PORT2
'I ....
Port 0 ROM PROT
RAM PROT
RCOsc
, PGM + Test
Mode Logic
J
vpp
P33
IOE
EPM IPGM P31
P32 P30
ICE
XT1
385
PIN DESCRIPTION
386
PIN FUNCTIONS
07-00. Data Bus. Tile data can be read from or written to XTAL 1. Crystal 1 (time-based input). This pin connects a
the EPROM through the data bus. parallel-resonant crystal, ceramic resonator, LC, RC net-
work or external single-phase clock to the on-cllip oscilla-
A11-AO. Address Bus. During programming, the EPROM tor input.
address is written to the address bus.
XTAL2. CrystaI2(time-based o~tPut). This pin COllilects a
Vee' Power Supply. This pin has to supply 5V during the parallel-resonant crystal, ceramic resonator, LC or RC
EPROM read mode and 6V during other modes. network to tile on-chip oscillator output.
ICE. Chip Enable (active Low). This pin is active during Port 0 (p00-P07). Port 0 is an 8-bit, bidirectional, CMOS
EPROM Read Mode, Program Mode and Program Verify compatible I/O port. Tilese eigllt I/O lines can be nibble
Mode. programmed as POO-P03 input/output and P04-P07 input!
output, separately. The input buffers are Scllmitt triggered
IOE. Output Enable (active Low). This pin drives tile direc- and nibbles programmed as outputs can be globally
tion of the Data Bus. When this pin is low, the Data Bus is programmed as either push-pull or open drain. Low EMI
output. When high, the Data Bus is input. output buffers can be globally programmed by the soft-
ware. Port 0 can also be used as a handsllake I/O port.
EPM. EPROM Program Mode. This pin controls the differ-
ent EPROM Program Mode by applying different Voltages. In Handshake Mode, Port 31ines P32 and P35 are used as
Ilandshake control lines. The Ilandsllake direction is deter-
Vpp- Program Voltage. This pin supplies tile program mined by the configuration (input or output) assigned to
voltage. Port O's upper nibble. The lower nibble must have tile same
direction as the upper nibble (Figure 5).
IPGM. Program Mode (active Low). When this pin is
low, the data is programmed to the EPROM through the
Data Bus.
387
PIN FUNCTIONS (Continued)
Port 0 (I/O)
Z86E30
Handshake Controls
1DAVO and RDYO
(P3 2 and P3 S )
Open Drain
OEN
Out
In
~-------C~~----~~-----------------.----~
----------,
I Auto
I Latch
I R~SOOkn I
1 - - - - - ______ 1
388
Port 2 (P2Q-P27). Port 2 is an 8-bit, bidirectional, CMOS In Handshake Mode, Port 31ines P31 and P36 are used as
compatible I/O port. These eight I/O lines can be config- handshake control lines. The handshake direction is deter-
ured under software control as an input or output, indepen- mined by the configuration (input or output) assigned to bit
dently. All input buffers are Schmitt triggered. Bits pro- 7 of Port 2 (Figure 6).
grammed as outputs can be globally programmed as
either push-pull or open drain. Low EMI output buffers can
be globally programmed by the software. When used as
an I/O port, Port 2 can be placed under handshake control.
Port 2 (1/0)
Z86E3 0
MCU
. Handshake Controls
1DAV2 and RDY2
(P3 1 and P3 6 )
-
Open Drain
OEN
Out
_In________~~~~----~--------------------_.~------~
I ------------.
1 Auto latch
1 1
1
1 R soc:: 500kll I
'------ ______ 1
389
PIN FUNCTIONS (Continued)
Port 3 (P30-P37). Port 3 is an 8-bit, CMOS compatible port The analog function is enabled by selling the D1 of Port 3
with four fixed inputs and four fixed outputs. Port 3 consists Mode Register (P3M). For the interrupt function, P30 and
of four fixed inputs (P30-P33) and four fixed outputs (P34- P33 are falling edge triggered interrupt inputs. P31 and
P37), and can be configured under software for interrupt P32 can be programmed as falling, rising or both edge
and handshake control functions. Port 3, Pin 0 is Schmitt triggered interrupt inputs (Figure 7). Access to
triggered. Pins P31, P32 and P33 are standard CMOS Counter/Timer 1 is made through P31 (TIN) and P36 (TOUT)'
inputs (no Auto-Latches) and Pins P34, P35, P36 and P37 Handshake lines for Ports 0 and 2 are also available on Port
are push-pull output lines. Low EMI output buffers can be 3 (Table 3).
globally programmed by software. Two on-board com-
parators can process analog signals on P31 and P32 with Note: P30-P33 inputs differ from the Z86C30 because
reference to the voltage on P33. there is no clamping diode to Vee due to the EPROM high
voltage detection circuits. Exceeding the VIH maximum
specification during standard operating mode may cause
the device to enter EPROM mode.
-
Z86E30 Port 3
MCu (110 or Control)
-
,r - - - - - - - - - - - - - - - - - -,,, AutoLatch
,
L __________________
,I
, RRt 500kn '
P3DData
P3D Latch 'ROO
R247-P3M
1011 11 -Analog
1...._ _ _ _ _ _.........1.;;.;&.......... D-Dlgital
,,,
,
From Stop ~Mod;;"- - - - - - " '......_ _ _ _ IRQ1, P33 Data Latch
Recovery Source 0
390
Table 3. Pin Assignments of Port 3 A valid CMOS level, rather than a floating node, reduces
excessive supply current flow in the input buffer.
Pin 110 CTC1 ANIN Int. POHS P2HS
P30 IN IR03 Low EMI Emission. The Z86E30 can be programmed to
P31 IN AN1 IR02 DIR operate in a low EMI emission mode in the PCON register.
TIN
P32 IN AN2 IROO DIR The oscillator and all 110 ports can be programmed as low
P33 IN REF IR01 EMI emission mode independently. Use of this feature
results in:
P34 OUT
P35 OUT RID • Less than 1.5 mA (typical) current consumption during
P36 OUT ToUT RID HALT mode.
P37 OUT
• The pre-drivers slew rate reduced to 10 ns typical.
Comparator Inputs. Port 3, pins P31 and P32 each have a • Low EM'I output drivers have resistance of 200 ohms
comparator front end. The comparator reference voltage (typical).
(Pin P33) is common to both comparators. In analog mode,
P31 and P32 are the positive inputs of the comparators and • Oscillator divide-by-two circuitry is eliminated.
P33 is the reference voltage of the comparators.
• Internal SLCK/TCLK operation limited to a maximum of
Auto-Latch. The Auto-Latch puts valid CMOS levels on all 4 MHz - 250 ns cycle time.
CMOS inputs (except P31-P33) that are not externally
driven. Whether this is zero or one, cannot be determined.
FUNCTIONAL DESCRIPTION
The Z8 CCP incorporates special functions to enhance the power-on reset circuit. The reset time is 5 ms (typical) plus
Z8's applications in industrial, scientific research, and 18 clock cycles. The Z86E30 does not re-initialize WDTMR,
advanced technologies. SMR, P2M, and P3M registers to their reset values on a
STOP Mode Recovery operation.
RESET. The device is reset in one of the following condi-
tions: Program Memory. The Z86E30 can address up to 4 Kbytes
of internal program memory (Figure 8). The first 12 bytes of
• Power-On Reset program memory are reserved for the interrupt vectors.
These locations contain six 16-bit vectors that correspond
• WatCh-Dog Timer to the six available interrupts. Address 12 (OOOCH) to
address 4095 (OFFFH) are reserved for the user program.
• STOP Mode Recovery Source After reset. the program counter pOints at the address
OOOCH which is the starting address of the user program.
Having the Auto Power-on Reset circuitry built in, the
Z86E30 does not need to be connected to an external
391
FUNCTIONAL DESCRIPTION (Continued)
4 095
location of On-Chip
Rrst Byte of One lime PROM
Instruction
Executed
After RESET ~ r'. - - - - - ---
l1 IRQ5
10 IRQ5
9 IRQ4
8 IRQ4
7 IRQ3
Interrupt
Vector 6 IRQ3
(lower Byte)
5 ......... IRQ2
~
~
IRQ2
Interrupt
Vector 3 IRQ1
(Upper Byte)
2 IRQ1
1 IRoo
0 IRoo
EPROM Protect. The 4 Kbytes program memory is a one The rest of the Expanded Register is not physically imple-
time PROM. An EPROM protect feature prevents "dump- mented and is reserved for future expansion.
ing" of the ROM contents by inhibiting execution of LOC
and LOCI instructions (LOE and LDEI instructions are not Register File. The 256 byte register file consists of 3 1/0
available in Z86E30) to program memory in all modes. In port registers, 236 general-purpose registers, and 15
EPROM protect mode, the instructions of LOC and LOCI control and status registers (R3 and R240 are reserved),
are disabled. and three system configuration registers in the expanded
register group (Figure 9). The instructions can access
Expanded Register File. The register file has been ex- registers directly or indirectly via an 8-bit address field.
panded to allow for additional system control registers, This allows a short 4-bit register address using Ihe Ilegis-
mapping of additional peripheral devices, and inpuVout- ter Pointer (Figures 10, 11). In the 4-bit mode, the register
put ports into the register address ar~a. The Z8 register file is divided into 16 working register groups, each oc-
address space RO through R15 is implemented as 16 cupying 16 continuous locations. The Register Pointer
groups of 16 registers per group (Figure 9). These register addresses the starting location of the active working-
groups are known as the ERF (Expanded Register File). register group.
The low nibble (00-03) of the Register Pointer (RP) selects
the active ERF group, and the high nibble (04-07) of Note: Register Bank EOH-EFH can only be accessed
register RP selects the working register group (Figure 10). through working registers and indirect addressing modes.
392
Z8 STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
%FF SPL u u u u u u u u
REGISTER POINTER
%FE Reserved u u u u u u u u
171 S IS1413121'1 0 1 %FO RP 0 0 0 0 0 0 0 0
Working Register
Group Pointer I I Expanded Register
Group Pointer
"10 Fe
"IoFB
FLAGS
IMR
u u u u u u u .u
0 u u u u u u u
%FA IRQ 0 0 0 0 0 0 0 0
%F9 IPR u u u u u u u u
%F8 P01M 0 1 0 0 1 1 0 1
·· %F7 P3M 0 0 0 0 0 0 0 0
/ %FG
%FS
P2M
PREO
1
U
1
U
1
U
1
U
1
U
1
U
1
U
1
-----------
Z8 Reg. File %F4 TO U U U U U U U U
%FF %F3 PRE1 U U U U U U 0 0
%FO
%F2 Tl u u u u u u u u
"!of1 TMR 0 0 0 0 0 0 0 0
%FO Reserved
%7F · % (F) OF
% (F) OE
WOTMR
Reserved
u u u 0 1 1 0 1
% (F) 00 Reserved
%(F)OC Reserved
· %(F)OB
%(F)OA
SMR
Reserved
0 0 1 0 0 0 u 0
% (F) 09 Reserved
Reserved
% (F) 08 Reserved
%(F) 07 Reserved
%OF
%00 % (F) OS Reserved
% (F) 05 Reserved
% (F) 04 Reserved
% (F) 03 Reserved
%(F) 02 Reserved
%(F)01 Reserved
% (F) 00 PCON 1 1 1 1 1 1 1 0
%(0)03 P3 1 1 1 1 U U U U
%(0)02 P2 U U U U U U U U
%(0)01 Reserved U U U U U U U U
%(0)00 PO U U U U U U U U
U .. Unknown
'* Will not be reset with a STOP Mode Recovery
393
FUN9TIONAL DESCRIPTION (Continued) .
R253 RP
_~ Ir====::..,r-------.
Ir7 r6 I
r5 r4 r3 r2 r 1 ro
R255
R253
R240
R239
.....-----------1 R15
VO Ports R3
394
RAM Protect. The upper portion of the RAM's address prescaler drives its counter, which decrements the value
space 80H to EFH (excluding the control registers) can be (1 to 256) that has been loaded into the counter. When the
protected from reading and writing. This option can be counter reaches the end of count, a timer interrupt request-
selected in EPROM Programming Mode. 06 of the IMR IRQ4 (TO) or IRQ5 (T1) is generated.
Control Register (R251) is used to turn on or turn off the
RAM protect. The RAM protect is turned on by setting the The counters can be programmed to start, stop, restart to
06 of the IMR Control Register (06= 1) and turned off by continue, or restart from the initial value. The counters can
resetting this bit (06=0). also be programmed to stop upon reaching zero (single
pass mode) or to automatically reload the initial value and
Stack. An 8-bit Stack Pointer (R255) is used for the internal continue counting (modulo-n continuous mode).
stack that resides within the 256 general-purpose
registers. The counters, but not the prescalers, can be read at any
time without disturbing their value or count mode. The
CounterfTimers. There are tw08-bit programmable counter/ clocksourceforT1 is user-definable and can be eitherthe
timers (TO and T1), each driven by its own 6-bit program- internal microprocessor clock divided-by-four, or an exter-
mable prescaler. The T1 prescaler can be driven by na signal input via Port 3. The Timer Mode register con-
internal or external clock sources; however, the TO prescaler figures the external timer input (P30) as an external clock,
i~ driven by the internal clock only (Figure 12). a trigger input that can be retriggerable or not-retriggerable,
or as a gate input for the internal clock. Port 3 line P36
The 6-bit prescalers can divide the input frequency of the serves as a timer output (TOUT) through which TO, T1 or the
clock source by any integer number from 1 to 64. Each internal clock is output. The counter/timers are cascaded
by connecting the TO output to the input of T1.
~
SC
01 (SMR)
Internal Data Bu.
+2
L~~--1,--- IRQ4
t - -__ TOUT
P3 S
IRQS
Internal Clock
Gated Clock
Triggered Clock
Tin P3l
395
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86E30 has six different interrupts from six in counter/timers. The Interrupt Mask Register globally or
different sources. The interrupts are maskable and priori- individually enables or disables the six interrupt requests
tized (Figure 13). The six sources are divided as follow: (Table 4).
four sources are claimed by Port 3 lines P30-P33. and two
IROO IR02
IR01. 3. 4. 5
IRO(06.07)
IntellUpt
Request
Vector Select
396
When more than one interrupt is pending, priorities are Table 5. IRQ Register Configuration
resolved by a programmable priority encoder that is con-
trolled by the Interrupt Priority register. An interrupt ma- IRQ Interrupt Edge
chine cycle is activated when an interrupt request is 07 06 P31 P32
granted. Thus, disabling all subsequent interrupts, saves o o F F
the Program Counter and Status Flags, and then branches
o 1 F R
to the program memory vector location reserved for that 1 o R F
interrupt. All Z86E30 interrupts are vectored through loca- 1 1 li/F
R/F
tions in the program memory. This memory location and
the next byte contain the 16-bit starting address of the
Noles:
interrupt service routine for that particular interrupt F=Falling Edge
request. R=Rising Edge
To accommodate polled interrupt systems, interrupt in- Clock. The Z86E30 on-chip oscillator has a high-gain,
puts are masked and the interrupt request register is parallel-resonant amplifier for connection to a crystal, RC,
polled to determine which of the interrupt requests need ceramic resonator, or any suitable external clock source
service. (XTAL 1 =Input, XTAL2 =Output). Tile crystal stlould be AT
cut, 10 kHz to 12 MHz max, with a series resistance (RS)
An interrupt resulting from ANI is mapped into IR02, and less than or equal to 100 Ohms.
an interrupt from AN2 is mapped into IROO. Interrupts
IR02 and IROO may be rising, falling or both edge trig- The crystal should be connected across XT AL 1 and XT AL2
gered, and are programmable by the user. The software using the recommended capacitors (10 pF to 100 pF) from
may poll to identify the state of the pin. each pin to ground. The RC oscillator option is selected in
the programming mode. The RC oscillator configuration
Programming bits for the Interrupt Edge Select are located must be an external resistor connected from XT AL 1 to
in bits D7 and D6 of the IRO Register (R250). The configu- XT AL2, with a frequency-setting capacitor from XTAL 1 to
ration is shown in Table 5. ground (Figure (4).
L R
397
FUNCTIONAL DESCRIPTION (Continued)
Power-On Reset (POR). A timer circuit clocked by a dedi- current to 10 microamperes or less. The Stop mode is
cated on-board RC oscillator is used for the Power-On terminated by one of the following resets: WOT timeout.
Reset (PaR) timer function. The paR timer allows Vee and paR, or Stop Mode Recovery Source which is defined by
'the oscillator circuit to stabilize before instruction execu- SMR register. This causes the processor to restart the
tion begins, application program at address OOOC (HEX) ..Inorder to
enter STOP (or HALT) mode, it is necessary to first flush the
The paR timer circuit is a one-shot timer triggered by one instruction pipeline to avoid suspending execution in mid-
of three conditions: instruction. To do this, the user must execute a Nap
instruction (opcode=FFH) immediately before the appro-
1. Power bad to Power OK status priate sleep instruction. For example:
2. STOP mode recovery (if 05 of SMR=O)
3, WOT timeout FF Nap ; clear the pipeline
6F STOP ; enter STOP mode
The paR time is a nominal 5 ms, Bit 5 of the Stop Mode or
Register (SMR) determines whether the paR timer i~ FF Nap ; clear the pipeline
bypassed after STOP mode recovery (typical for external 7F HALT ; enter HALT mode
clock, and RC/LC oscillators with fast start up time),
Port Configuration Register (PCON). The PORT Conligu-
HALT. Turns off the internal CPU clock, but not the XTAL ration Register (PCON) configures the port's individually
oscillation. The counter/timers and external interrupts IROO, for comparator output on Port 3, Open Drain on Port 0, low
IR01, and IR02 remain active. The device is recovered by EMI noise on Port's 0, 2, and 3, and 10wEMI noiseoscillalor.
interrupts, either externally or internally generated. The PCON Register is located in the Expanded Register
File at bank F, location 00 (Figure 15).
STOP. This instruction turns off the internal clock and
external crystal oscillation and reduces the standby Note: PCON is no! available in Z86C30
PCON (F)OO
398
Comparator Output Port 3 (~O). Bit 0 controls the com- Low EMI OSC (07). This bit of the peON Register controls
parator use in Port 3. A 1 in this location brings the the low EMI noise oscillator. A 1 in this location configures
comparator outputs to P34 and P35 and a 0 releases the the oscillator with standard drive, while a 0 configures tile
Port to its standard I/O configuration. . oscillator with low noise drive.
Port 0 Open Drain (01). Port 0 is configured as an Open- Stop Mode Recovery Register(SMR). This register selects
drain by resetting this bit (01 = 0) and configured as Pull- the clock divide value and determines ttle mode of STOP
up Active by setting 01 = 1. The default value is 1. mode recovery(Figure 16). All bits are Write only except Bit
7 which is a Read only. Bit 7 is a flag bit IIlat is hardware set
LowEMI Port 0 (03). Port 0 is configured as a Low EMI Port on the condition of STOP Recovery and reset by a power-
by resetting this bit (03 =0) and configured as a Standard on cycle. Bit 6 controls whether a low or high level is
Port by setting 03 =1. The default value is 1. required from the recovery source. 6it5 controls the reset
delay after recovery. Bits 2, 3, and 4 of the SMR register
Low EMI Port 2 (05). Port 2 is configured as a Low EMI Port specify the STOP Mode Recovery Source. (Table 7). The
by resetting this bit (05 = 0) and configured as a Standard SMR is located in bank F of the Expanded Register Group
Port by setting 05 = 1. The default value is 1. at address OBH.
SMR (F)OB
SCLKfTCLK Divide by 16
o OFF'
1 ON
External Ctock Divide by 2
o SCLKfTCLK =XTAU2'
1 SCLKfTCLK =XTAL
Stop Mode Recovery Source
000 POR Only'
001 P30
010 P31
011 P32
100 P33
101 P27
110 P2NORO:3
111 P2 NOR 0:7
1--_ _ _ _ _ _ _ Stop Delay
o OFF
lON'
1--_ _ _ _ _ _ _ _ _ Stop Recovery Level
o Low'
1 High
Stop Flag
o POR'
1 Stop Recovery
399
FUNCTIONAL DESCRIPTION (Continued)
SCLKfTCLK divide-by-16 Select (~O). This bit of the SMR external clock frequency divided by two. The SCLK/TCLK
controls a divide-by-16 prescaler of SCLK{fCLK. The is equal to the external clock frequency when this bit is set
purpose of this control is to selectively reduce device (01 = 1). Using this bit, together with 07 of PCON, further
power consumption during normal processor execution helps lower EMI [Le., 07 (PCON) = 0,01 (SMR) = 1]. The
(SCLK control) and/or HALT mode (where TCLK sources default setting is O.
counter/timers and interrupt logic).
STOP Mode Recovery Source (02.03. and 04). These 3
ExtemalClock Divide By 2 (01). This bit can eliminate the bits of the SMR register specify the wake-up source of the
oscillator divide-by-two circuitry. When this bit is 0, SCLK STOP Mode recovery (Figure 17). Table 6 shows tile SMR
(System Clock) and TCLK (Timer Clock) are equal to the source selected with the setting of 02 to 04. P31-P33
cannot be used to wake up from STOP mode when
programmed as analog inputs.
SMR 04· 03 02
~
vo~ 0 SMR SMR 04 03 02 SMR 0403 02 SMR 040302
1 0 1 1 1 0 1 1 1
P30
P31 P33
P32
P27
ToPOR
~~~~~~~__+-__________________________________~________~DRES~
Stop Mode Recovery Edge
Select (SMR)
To P33 Data
Latch and lRQ1
P33 From Pads
DigitaVAnalog Mode
Select (P3M)
:Table 6. Stop Mode Recovery Source programming this bitto a zero. A 1 in this bit causes a 5 ms
RESET delay after STOP Mode Recovery. The default
04 03 02 SMR Source selection condition of this bit is 1. If the fast wake up mode is
0 POR recovery only selected, the STOP Mode Recovery source must be kept
0 0
1 P30 transition active for at least 5 TpC.
0 0
0 1 0 P31 transition (Not in analog mode)
STOP Mode Recovery Level Select (06). A 1 in this bit
0 1 1 P32 transition (Not in analog mode)
defines that a high level on anyone of the recovery sources
0 0 P33 transition (Not in analog mode) wakes the Z86E30 from STOP Mode. A 0 defines the low
0 1 P27 transition level recovery. The default value is O.
1 0 Logical NOR of Port 2 bits 0:3
1 1 Logical NOR of Port 2 bits 0:7 Cold or Warm Start (07). This bit is set by the device upon
entering STOP Mode. A 0 in this bit indicates that the
device has been reset by POR (cold). A 1 in this bit
STOP Mode Recovery Delay Select (05). The 5 ms RESET indicates the device was awakened by a SMR source
delay after STOP Mode Recovery is disabled by (warm).
400
Watch Oog Timer Mode Register (WOTMR). The WDT is WOT Ouring the HALT Mode (02). This bit determines
a retriggerable one-shot timer that resets the Z8 if it whether or not the WDT is active during HALT mode. A 1
reaches terminal count. The WDT is disabled after Power- indicates that the WDT is active during HALT. A Odisables
On Reset and initially enabled by executing the WDT the WDT in HALT mode. The default value is 1.
instruction. It is refreshed on subsequent executions of the
WDT instruction. The WDT cannot be disabled when it has WOT Ouring STOP Mode (03). This bit determines
been enabled. The WDT is driven either by an on-board RC whether or not the WDT is active during STOP mode. AI
oscillator or external oscillator from XTAL 1 pin. The POR indicates active during STOP. A 0 disables tile WDT
clock source is selected with bit-4 of the WDT register. during STOP mode. Since the on-board OSC is stopped
during STOP mode, the WDT clock source has to select
WOT Timeout Period (00 and 01). Bits 0 and 1 control a the on-board RC OSC for the WDT to recover from STOP
tap circuit that determines the timeout periods that can be mode. Tile default is 1.
obtained. Table 7 shows the timeout period. The default
value of DO and Dl are 1 and 0, respectively. Clock Source For WOT (04). This bit determines whicll
oscillator source is used to clock the internal POR and WDT
Table 7. Timeout Period of the WOT counter chain. If the bit is aI, the internal RC oscillator is
bypassed and the POR and WDT clock source is driven
Timeout of Timeout of from the external pin, XTAL 1. The default configuration of
01 00 Intemal RC OSC the Crystal Clock the bit is 0, which selects the RC oscillator.
0 0 5ms 256TpC
Bits 5 through 7 are reserved. The WDTMR register is ac-
0 1 .15 ms 512TpC
cessible only during the first 64 processor cycles (128
1 0 25ms 1024TpC
XTAL clock cycles) from the execution of the first instruc-
1 1 100 ms 4096TpC
tion after Power-On Reset, watch dog reset, or a STOP
mode recovery. After this point, the register cannot be
Notes:
TpC = crystal clock cycle
modified by any means, intentional or otilerwise. The
The default setting is 15 ms. WDTMR cannot be read and is located in bank F of tile
Expanded Register Group at address location OFH.
WDTMR (F) OF
1~looIMI~lool~I~lool
I I WDTTA' INT RC OSC Extemal Clock
00
01 *
10
5ms
15 ms
25 ms
256TpC
512TpC
1024 TpC
11 lOOms 4096TpC
WDT During HALT
o OFF
1 ON *
' - - - - - - - WDT During STOP
o OFF
1 ON *
' - - - - - - - - - XTAL lfiNT RC Select for WDT
o On-Board RC *
1 XTAL
1-._ _ _ _ _ _ _ _ _ _ Reserved
401
FUNCTIONAL DESCRIPTION (Continued)
Internal
RESET
(WDTMR)
WDTSelee! )-----f-----+-[::!~]E!~~]
WDT TAP SELECT
CKSource
Selee!
(WDTMR)
VDD~'-1"111~~~
2VREF.
From Stop
Mode
Recovery
Source
12 ns Glitch Filter
WDT>------~
Stop Delay
Select (SMR)
402
Auto Reset Voltage. An on-board Voltage Comparator
checks that Vee is at the required level to ensure correct
operation of the device. Reset is globally driven if Vee is
below VRST (Auto Reset Voltage - Figure 26).
Vee
2.80
(Volts)
2.60
2.40
2.20
"'""- ...
""'l1lI
2.00
1.60
1.40
403
FUNCTIONAL DESCRIPTION (Continued)
Notes:
Vpp = 12.5V ± O.5V
VH = 12.5V ± O.5V
X = TIL Level (irrelevant)
V",=5.0V
VL =OV
404
VIH
VIH
Data
VIL
VH
EPM
VIL
VCC
5V
VIH
ICE
VIL
VIH
--~J\----
IDE
VIL
Note:
VPP is Irrelevant
PGMis atVIH
405
FUNCTIONAL DESCRIPTION (Continued)
VIH
Address Address Stable V--
~---"---
VIL
VIH
Data
VIL
VPP
VPP
VIH
6V
Vee
5V
VIH
ICE
VIL
VIH
IPGM
VIL
VIH
IOE VIL
14----:--Program Cycle----toi4---Verlfy Cycle
406
VIH
Address Irrelevant
VIL
VIH
Data _V~I=L__-J~~________________________________I_rre_le_v_ant_________________________________
VPP
VPP
VIH
6V
VCC
5V
VH
ICE
VIH
IOE + ____
_V~I:..:.H_ _ _ _ _ _ ~
VIL
VH
EPM _V.;.;I.;.;H___
VIL
VIH
IPGM
VIL
Figure 23. Timing Diagram of EPROM Protect, RAM Protect, and RC OSC Modes
407
FUNCTIONAL DESCRIPTION (Continued)
408
Ul U2
DO 24 AD 10
P20 AO
Dl 25 Al 9
P21 Al
D2 26 A2 8 A2
P22
D3 27 A3 7
P23 A3
D4 28 A4 6
P24 A4
D5 1 18 A5 5 11 DO
P25 P30 A5 00
D6 2 11 A6 4 12 Dl
P26 P31 A6 01
D7 3 12 EPM A7 3 02 13 D2
P27 P32 A7
P33 13 UPP A8 25 03 15 D3
A8
AO 19 14 A8 A9 24 16 D4
POO PM A9 04
Al 20 15 A9 Al0 21 05 17 D5
POl P35 Al0
A2 21 P36 17 Al0 All 23 06 18 D6
P02 All
A3 23 16 All 19 D7
P03 P37 ~ A12 07
A4 4 22 GND 27
P04 IPGM
A5 5
P05
8 vee lK" R2 20 GND 14 GND
A6 6
P06 XTAL1
10 I v-=- les
vee
28 vee
lK"Rl 22
A7 7 10D 1
P07 XTAL2 ~ v upp upp
Z86E30 2764A
le~
T·Ol~f
28 PIN ZIF Socket PINS
LGND
EPM Rl Rl
e2
.1¢
GND 12.5V
Note: The programming address has to be set to OOOOH -OFFFH ( lower 4K byte memory)
409
STANDARD TEST CONDITIONS
+5V
The characteristics listed below apply for standard test
conditions as noted. All voltages are referenced to GND.
Positive current flows into the referenced pin (Figure 26).
2.1 kn
CAPACITANCE
TA = 25°C; Vee = GND = OV; f = 1.0 MHz; unmeasured pins to GND.
Parameter Max
Input capacitance 12 pF
Output capacitance 12 pF
I/O capacitance 12 pF
Vee SPECIFICATION
4.3V± 0.3V
5.0V± 0.5V
410
DC ELECTRICAL CHARACTERISTICS
Vru Output High Vollge 4.0V Vee-O.4 3.8 V 1011 =-2.0 rnA
5.0V Vee-O.4 4.8 V 1011 =-2.0 rnA
V0l1 Output Low Voltage 4.0V 0.4 0.2 V 1011 =+4.0 rnA
5.0V 0.4 0.1 V 10l = +4.0 rnA
411
DC ELECTRICAL CHARACTERISTICS (Continued)
Icc, Standby Current 4.0V 4.0 2.0 rnA HALT Mode VIN =OV, [4,5]
(Slandard Mode) Vcc @8MHz
5.0V 6.0 3.5 rnA HALT Mode VIN =OV, [4,5]
Vee @8MHz
4.0V 5.0 2.5 rnA HALT Mode VIN =OV, [4,5]
Vcc @12MHz
5.0V 7.5 4.5 rnA HALT Mode VIN =OV, [4,5]
Vcc @12MHz
4.0V 2.0 1.25 rnA Clock Divide by 16 [4,5]
@BMHz
5.0V 3.0 1.50 rnA Clock Divide by 16 [4,5]
@BMHz
4.0V 2.0 1.35 rnA Clock Divide by 16 [4,5]
@12MHz
5.0V 3.0 1.70 rnA Clock Divide by 16 [4,5]
@12MHz
412
Symbol Parameter Vee TA =O°C Typical Units Conditions Notes
Note[3] to +70°C at 25°C
Min Max
Noles:
(1) Ice, Typ Max Unit Freq
Clock Driven on Crystal 3.0mA 5.0 mA 8MHz
or XT AL Resonator 0.3mA 5.0 mA 8MHz
[2] V",,=OV=GND.
(3) 5.0V ± 0.5V, 4.0V
(4) All outputs unloaded, I/O pins floating, inputs at rail.
(5) CL 1=Cl2=100 pF.
(6) Same as note (4) except inputs at Vee'
413
AC ELECTRICAL CHARACTERISTICS
Additional Timing Diagram (Standard Mode)
Clock
IRON
Clock
Setup
11
Stop
Mode
, Recovery
Source
~. @ ¥
Figure 27. Additional Timing
AC ELECTRICAL CHARACTERISTICS
Additional Timing Table (Standard Mode)
414
AC ELECTRICAL CHARACTERISTICS
Additional Timing Table (Standard Mode - Continued)
Notes:
[1) Timing Reference uses 0.9 Vcc for a logic 1 and 0.1 Vee for a logic O.
[2) Interrupt request via Port 3 (P31-P33).
[3) Interrupt request via Port 3 (POO).
[4) SMR-05 = O.
[5) Reg. WOTMR.
[6) S.OV ± O.SV, 4.0V
[7) Reg. WDTMR 01 =0, DO=O
[8) Reg. WOTMR 01=0, 00=1
[9) Reg. WOTMR 01=1, 00=0
(10) Reg.WDTMR 01=1,00=1
415 .
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Diagrams
RDY
(Oulput)
-~ Ir----------~~---------------
DalaOut Data Out Valid Next Data Oul Valid
--' I'---------------'l~ - - - - - - - - - - - - - --
IDAV
(Oulput)
RDY
(Inpul)
416
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Table - Standard Mode
Nole:
[1] S.OV ± D.SV, 4.DV.
Standard operating temperature range DOC to +700C.
417
EXPANDED REGISTER FILE CONTROL REGISTERS
R240
SMR (F)OB
Irolool~I~lool~lmlool
I Reserved
L o
SCLKlTCLK Divide by 16
o OFF,'
1 ON
No Function
Stop Delay LoadT 1
o OFF
1 ON' o DI_le T 1 Count
1 Eneble T 1 Count
Stop Recovery Level
o low· T,N Modes
00 External Clock Input
1 High
01 Gate Input
Stop Flag 10 Trigger Input
" o POR' (Non-retrlggerable)
1 Stop Recovery 11 Trigger Input
(Retrlggerable)
, Defau~ setting after RESET
TOUT Modes
00 NotUsed
01 TO Out
418
R245 PREO
R242T1
1~lool~I~looloolrnlool
I T1 Inftlal Value Count Mode
(When Written) o TO Single Pass
(Range: 1-256 Decimal 1 TO ModuloN
01-00 HEX)
Reserved
T1 Current Value
(When Read) Prescaler Modulo
(Range: 1~64 Decimal
01-00 HEX)
R246 P2M
Count Mode
1~loolool~looloolrnlool
o T 1 Single Pass
1 T1 Modulo N I P27 - P20 I/O Delinaion
Clock Source o
Delines Ba as Output
1 T1 Internal 1 Defines Bit as Input
o T L External TIming Input
(liN) Mode
Prescaler Modulo Figure 39. Port 2 Mode Register
(Range: 1-64 Decimal
01-00 HEX)
(F6H: Write Only)
R247P3M
Figure 36. Prescaler 1 Register
(F3H: Write Only) 1~lool~I~looloolrnlool
-.--
~;
Port 2 Open Drain
Port 2 Push-pull
R244TO
P31, P32 Digital Mode
1~lool~I~looloolrnlool P31, P32 Analog Mode
o P32=lnput
I TO Initial Value
P35 = output
P32 = IDAVo/RDVO
(WhenWrilten) P35 = RDVO/IDAVO
(Range: 1-256 Decimal.
01-00 HEX) 00 P33 = Input
TO CUrrent Value P34=Output
(When Read)
o P31 = Input (TIN)
P36 = OUlput (T0Ul)
1 P31 = /DAV2IRDV2
P36 = RDV2I/DAV2
Figure 37. Counterrrtmer 0 Register
(F4H: ReadIWrite) o P30 = Input
P37 =Oulput
Reserved
419
EXPANDED REGISTER FILE CONTROL REGISTERS (Continued)
R248 P01M
R251IMR
Imloolool~looloolrnlool
P04 • POO Mode
OO-Output
01 -Input
lX c Reserved
Stack Selection
1 -Intarnal
Reserved
o Reserved
11------- 1 Enables IR05-IROO
(DO _IROO)
1 Enables RAM Protect
1 Enables Interrupts
R252FLAGS
Figure 41. Pan 0 and 1 Mode Register
(F8H: Write Only)
R2491PR Use, Flag Fl
Use, Flag F2
R250lRO , 7
420
R254SPH R255SPL
1~lool~lwloolool~lool 1~lool~lwloolool~lool
I Reserved I Stack Pointer Lower
Byte (SP7 - SPo)
Figure 47. Reserved Figure 48. Stack Pointer
(FFH: Read/Write)
421
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
dst Destination location or contents
src Source location or contents
cc Condition code
@ Indirect address prefix
SP Stack Pointer
PC Program Counter
FLAGS Flag register (Control Register 252) .
RP Register Pointer (R253)
IMR Interrupt mask register (R251)
422
CONDITION CODES
423
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE .--_-,-_ _,. ADC, ADD, AND, CP,
DECW, INC, INCW, LD, OR, SBC, SUB,
ORl11101 dst/srcl POP, PUSH, RL, RLC, sre OR
I - - - + - - - f TCM, TM, XOR
RR, RRC, SRA, SWAP dst OR
OPC JP, CAlL (In<ireel)
dst lOR 1111 0 I dst OPC I MODE ADC, ADD, AND, CP,
dst OR 1111 0 I dst
LD, OR, SBC, SUB,
TCM,TM,XOR
OPC SRP VALUE
VAlliE
MODE I OPC
r---,---, LD
ADC, ADD, AND, CP, sre OR
OR, SBC, SUB, TCM,
TM,XOR dst OR
OPC CAll
DJNZ,JR DAU
DAL
6FH
FFH
7FH_
j' STOP/HALT
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
.. r ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand ..
data and the result is stored in the destination location. The
424
INSTRUCTION SUMMARY (Continued)
IRET BF
CALLdst DA D6 - - - - - - FLAGS+--@SP; ******
SP+--SP - 2 IRR D4 SP+--SP + 1
@SPE-PC, PCE-@SP;
PCE-dst SPE-SP + 2;
IMR(7)+--1
CCF EF *- - - - -
CE-NOTC JP ce, dst DA cD - - - - - -
if cc is true c = 0- F
CLR dst R BO - - - - - - PC+--dst IRR 30
dstE-O IR B1
JR ce, dst RA cB - - - - - -
COMdst R 60 -
** 0
- - if ec is true, e =0- F
dst+--NOT dst IR 61 PCE-PC + dst
Range: + 127,
CP dst, src
dst - src
t A[ 1 ****-- -128
LD dst, src 1m rC - - - -
-
DAdst
dstE-DA dst
R
IR
40
41
*** X
- dstE-src
R
R r8
r9
r= 0- F
DECdst R 00 - ***- - r X C7
dst+--dst - 1 IR 01 X r D7
r Ir E3
DECWdst
dstE-dst - 1
RR
IR
80
81
-
***- - Ir
R R
F3
E4
R IR E5
01 8F - - - - - - R 1M E6
IMR(7)+--O IR 1M E7.
IR R F5
DJNZr, dst RA rA - - - - - -
rE-r - 1 r =O-F LDC dst, src Irr C2
ifr .. O
PCE-PC + dst LOCI dst, sre Ir Irr C3 - - - -
Range: +127, dstE-sre
-128 rE-r +1;
rrE-rr + 1
EI 9F - - - - - -
IMR(7)+--1
HALT 7F - - - - - -
425
INSTRUCTION SUMMARY (Continued)
NOP FF STOP 6F
- **0 - -
OR dst, src
dst+-dst OR src
t 4[ ] SUB dst, src
dst+-dst+-src
t 2[ ]
**** 1 *
POP dst
dst+-@SP;
R
IR
50
51
- - - - - - SWAPdst R
IR
FO
F1
X
** X - -
SP+-SP + 1
PUSH src R 70 - - - - - -
17 6 01
SP+-SP -1;
@SP+-src
IR 71 TCMdst, src
(NOT dst)
t 6[ ] - ** 0
- -
ANO src'
ReF CF 0 - - - - - ,
c+-o TM dst, src
dstANOsrc
t 7[ ] -
** 0
- - ,
RET AF - - - - - -
PC+-@SP; WOT 5F
SP+-SP + 2
XOR dst, src t B[ ] -
** 0
RLdst R 90
****- - dst+-dst
&-4tSj:J IR 91 XOR src
RLCdst R 10
****- - t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
~
IR 11
set table above. The second nibble is expressed symbolically by a '[ ]'
in this table, and its value is found in the following table to the left of the
applicable addressing mode pair.
RR dst R
IR
EO
E1
****-- For example, the opcode of an ADC instruction using the addreSsing
~y7 oj.! modes r (destination) and Ir (source) is 13.
RRC dst R
IR
CO
C1
****- - Address Mode Lower
~7 ofJ dst src Opcode Nibble
SBCdst, src t 3[ ]
**** 1 * [2]
dst+-dst+-src+-C
Ir [3]
SCF OF 1 - - - - -
C+-1
R R [4]
SRA dst R DO
*** 0
- -
R IR [5]
~
IR 01
R 1M [6]
SRP src 1m 31 - - - - - -
IR 1M [7]
RP+-src
426
OPCODEMAP
lower Nibble (Hex)
o 2 3 5 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM rl, R2 r2, Rl rl, RA cc, RA rl,IM cc, DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t--
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r---
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 t--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRI 1M rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 t--
4 DA DA OR OR OR OR OR OR
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r---
5 pop pop AND AND AND AND AND AND
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t-"(;:o
6 COM COM TCM TCM TCM TCM TCM TCM STOP
)( Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
:=." 7
10/12.1 12/14.1
PUSH PUSH
6.5
TM
6.5
TM
10.5
TM
10.5
TM
10.5
TM
10.5
TM
~
"
:0
.Q
R2 IR2 rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IRl, 1M
HALT
A
10.5
INCW
10.5
INCW
6.5
CP
6.5
CP
10.5
CP
10.5
CP
10.5
CP
10.5
CP
r--uo
RET
RRI IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
B
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t"J6:o
CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 ~
C RRC RRC lDC LDCI LD RCF
Rl IRI rl,lrr2 Irl,lrr2 rl,x,R2
D
6.5 6.5 12.0 18.0 20.0 20.0 10.5 1---&5
SRA SRA LDC LDCI CALL' CALL LD SCF
Rl IRI r2,lrrl Ir2,lrrl IRRI DA r2,x,Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
E RR RR LD LD LD LD LD CCF
Rl IRl rl,IR2 R2, Rl IA2, Al Al,IM IA1,IM
8.5 8.5 6.5 10.5 ~
F SWAP SWAP LD LD NOP
AI IRl Irl, r2 A2,IAl
\" A A
'Y T T ~
2 3 2 3
Bytes per Instruction
lower legend:
Opcode R ; a-bit address
Nibble r ; 4-bit address
Execution
Cycles 1 Pipeline
Cycles
R 1 or r 2; Dst address
R 1 or r 2; Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
427
PRODUCT SPECIFICATION
Z86C40
CMOS Z8® CCpTM
CONSUMER CONTROLLER PROCESSOR
FEATURES
• Low cost
• 6-bit programmable prescaler
GENERAL DESCRIPTION
The Z86C40 CCP (Consumer Controller Processor) intro- The Z86C40 architecture is characterized by Zilog's 8-bit
duces a new level of sophistication to single-chip architec- microcontroller core with an Expanded Register File to
ture. The Z86C40 is a member of the Z8 single-chip allow access to register mapped peripheral and I/O cir-
microcontroller family with 4 Kbytes of ROM (Z86C40) and cuits. The CCP offers a flexible I/O scheme, an efficient
236 bytes of general purpose RAM. The CCP is housed in register and address space structure, and a number of
a 40-pin DIP, 44-pin Leaded Chip Carrier, and a 44-pin ancillary features that are useful in many industrial, auto-
Quad Flat Pack, and is CMOS compatible. Having the motive, computer peripherals, and advanced scientific
ROM/ROMless selectively, the CCP offers both external applications.
memory and pre-programmed ROM which enables this Z8
microcomputer to be used in high volume applications or The CCP applications demand powerful I/O capabilities.
where code flexibility is required. Zilog's CMOS micro- The Z86C40 fulfills this with 32 pins dedicated to input and
computer offers fast execution, efficient use of memory, output. These lines are grouped into four ports. Each port
sophisticated interrupts, input/output bit manipulation ca- consists of eight lines, and is configurable under software
pabilities, and easy hardware/software system expansion control to provide timing, status signals, parallel I/O with or
along with low cost and low power consumption. without handshake, and address/data bus for interfacing
external memory.
429
GENERAL DESCRIPTION (Continued)
There are four basic address spaces available to support tion, the Z86C40 offers two on-chip counter/timers with a
this wide range of configurations: Program Memory, Reg- large number of user selectable modes. Also, two on-
ister File, Data Memory, and Expanded Register File. The board comparators which process analog signals with a
Register File is composed of 236 bytes of general purpose common reference voltage (Figure 1).
registers, four I/O port registers, and 15 control and status
registers. The Expanded Register File consists of two Note: All Signals with a preceding front slash, "I", are active
control registers. Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
active Low, only).
To unburden the program from coping with the real-time
problems, such as counting/timing and data communica-
Machine Timing
&
Instruction Control
RESET
ALU WDT,POR
FLAGS
Register
Pointer
430
PIN DESCRIPTION
RlfIN IDS
P25 P24
P26 P23
P27 P22
P04 P21
P05 P20
P06 P03
P14 P13
Z86C40
P15 P12
DIP
P07 GND
vee P02
P16 P11
P17 P10
XTAL2 P01
XTAL1 POO
P31 P30
P32 P36
P33 P37
P34 P35
lAS IRESET
10 P07 Port 0 pin 7 In/Output 26-27 POO-1 Port 0 pin 0,1 In/Output
11 Vee Power Supply Input 28-29 P10-1 Port 1 pin 0,1 In/Output
12-13 P16-7 Port 1 pins 6,7 In/Output 30 P02 Port 0 pin 2 In/Output
14 XTAL2 Crystal, Oscillator Clock Output 31 GND Ground, GND Input
15 XTALI Crystal, Oscillator Clock Input 32-33 P12-3 Port 1 pin 2,3 In/Output
16-18 P31-3 Port 3 pins 1,2,3 Input 34 P03 Port 0 pin 3 In/Output
19 P34 Port 3 pin 4 Output 35-39 P20-4 Port 2 pin 0,1,2,3,4 In/Output
20 /AS Address Strobe Output 40 /DS Data Strobe Output
21 /RESET Reset Input
431
PIN DESCRIPTION (Continued)
6 5 4 3 2 1 44 43 42 41 40
P2.1 7 39 P30
P22 8 38 P36
P23 9 37 P37
P24 10 36 P35
IDS 11 35 IRESET
Nle 12 Z86C40 34 Rl/RL
PLCC
RlIW 13 33 lAS
P25 14 32 P34
P26 15 31 P33
P27 16 30 P32
P04 17 29 P31
18 19 20 21 22 23 24 25 26 27 28
432
33 32 31 30 29 28 27 26 25 24 23
P21 34 22 P30
P22 35 21 P36
P23 36 20 P37
P24 37 19 P35
IDS 39
Z86C40 18 !RESET
Nle 39 QFP 17 RlIRL
RlIW 40 16 lAS
P25 41 15 P34
P26 42 14 P33
P27
P04 :0 1 2 3 4 5 6 7 8 9 10 11
13
12
P32
P31
II)
:g .... II) !:; 0 0 CD "- ~ ::::;
0
11. 11. iL iL 11. g g iL iL
~ ~
1-2 P05-6 Port 0 pins 5,6 In/Output 21 P36 Port 3 pin 6 Output
3-4 P14-5 Port 1 pins 4,5 In/Output 22 P30 Port 3 pin 0 Input
5 P07 Port 0 pin 7 In/Output 23-24 POO-1 Port 0 pins 0,1 In/Output
6-7 Vee Power Supply Input 25-26 P10-1 Port 1 pins 0,1 In/Output
8-9 P16-7 Port 1 pins 6,7 In/Output 27 P02 Port 0 pin 2 In/Output
10 XTAL2 Crystal, Oscillator Clock Output 28-29 GND Ground, GND Input
11 XTAL1 Crystal, Oscillator Clock Input 30-31 P12-3 Port 1 pins 2,3 In/Output
12-14 P31-3 Port 3 pins 1,2,3 Input 32 P03 Port 0 pin 3 In/Output
15 P34 Port 3 pin 4 Output 33-37 P20-4 Port 2 pins 0,1,2,3,4 In/Output
16 /AS Address Strobe Output 38 /DS Data Strobe Output
433
PIN FUNCTIONS
434
Port 0
(VOor A15 - AS)
Z86C40
MCU
Handshake Controls
IDAVO and RDYO
(P32 and P35)
OEN
Out
1.5 _ 2.3V Hysteresis
In --------~c~~----._----------------------~~~
1 -----------
: 1 Auto Latch
1 R=500Kn 1
- - - - - - - - ______ 1
435
PIN FUNCTIONS (Continued)
Port 1. (P10-P17). Port 1 is an 8-bit. bidirectional, CMOS handshake controls RDY1 and /DAV1 (Ready and Data
compatible port (Figure 6). It has multiplexed Address Available). Memory locations greater than 4096 are refer-
(A7-AO) and Data (07-00) ports. For the Z86C40 ROM enced through Port 1. To interface external memory, Port
device, these eight 1/0 lines are programmed as inputs or 1 must be programmed for the multiplexed AddresslData
outputs, or can be configured under software control as an mode. If more than 256 external locations are required,
AddresslData port for interfacing external memory. The Port 0 outputs the additional lines.
input buffers are Schmitt triggered and the output drivers
are push-pull. Port 1 can be placed in the high-impedance state along
with Port 0, lAS, IDS and R//W, allowing the Z86C40 to
Port 1 may be placed under handshake control. In this share common resources in multiprocessor and DMA
configuration, Port 3, lines P33 and P34 are used as the applications.
Port 1
(I/O or AD7 - ADO)
Z86C40
MCU
Handshake Controls
IDAVl and RDYl
(P33 and P34) .
OEN --"t--t
Out -----------------+-------i
1.5 _ 2.3V Hysteresis
In --------~~~--~~--------------------~~
r
I Auto Latch
IL ___________
R=500Kn
...JI
436
Port 2. (P20-P27). Port 2 is an 8-bit, bidirectional, CMOS Port 2 may be placed under handshake control. In this
compatible I/O port. These eight I/O lines are configured configuration, Port 3 lines P31 and P36 are used as the
under software control as an input or output, indepen- handshake controls lines /DAV2 and RDY2. The hand-
dently. Port 2 is always available for I/O operation. The shake signal assignment for Port 3 lines P31 and P36 is
input buffers are Schmitt triggered. Bits programmed as dictated by the direction (input or output) assigned to bit 7,
outputs may be globally programmed as either push-pull Port 2 (Figure 7).
or open-drain.
-
-.
. Port2 (1/0)
Z86C40
MCU
"""- ..
.. Handshake Controls
IDAV2 and RDY2
(P31 and P36)
-
Open Drain - - - - - - - - - - - .
OEN--+--i
O~ --------~~--~
1.5 . . . . . 2.3 Hysteresis
In -----C·~~--.-------------._-4
r -----------
Auto Latch
I I
I
I______________
R=500KO JI
437
PIN FUNCTIONS (Continued)
Port 3. (P30-P37). Port 3 is an 8-bit, CMOS compatible four Access to CounterfTimers 1 is made through P31 (TIN) and
fixed input and four fixed output. Port 3 consists of four P36 (Tour)' Handshake lines for ports 0, 1 and 2 are
fixed inputs (P30-P33) and four fixed outputs (P34-P37). It available on P31 through P36.
is configured under software control for InpuVOutput,
Counter/Timers, interrupt, port handshake and Data Port 3 also provides the following control functions:
a
Memory functions. Port 3, pin input is Schmitt triggered, handshake for Ports 0, 1 and 2 (/DAV and ROY); four'
. and pins P31, P32, and P33 are standard CMOS inputs; external interrupt request signals (IROO-IR03); timer input
outputs are push-pull. and output signals (TIN and Tour); Data Memory Select
(10M - Figure 8).
Twoon-board comparators can process analog Signals on
P31 and P32 with reference to the voltage on P33. The Auto-,Latch. The Auto-Latch puts valid CMOS levels on all
analog function is enabled by programming Port 3 Mode CMOS inputs (except P31-P33) that are not externally
a
Register (bit 1). Port 3 pin and pin 3 are falling edge driven. Whether this level is zero or one, cannot be deter-
interrupt inputs. P31 and P32 are programmable as rising, mined. A valid CMOS level, rather than a floating node,
falling or both edge triggered interrupts (IRO register bits reduces excessive supply current flow in the input buffer.
6 and bit 7). P33 is the comparator reference voltage input.
P30 IN IR03
P31 IN Tin AN1 IR02 D/R
P32 IN AN2 IROO D/R
P33 IN REF IR01 D/R
P34 OUT RID OM
P35 OUT RID
P36 OUT Tout RID
P37 OUT
Noles:
HS = Handshake Signals
D=DAV
R=RDY
Comparator Inputs. Port 3, Pins P31 and P32 each have a After the POR time, IRESET is a Schmitt triggered input. To
comparator front end. The comparator reference voltage, avoid asynchronous and noisy reset problems, the Z86C40
Pin P33, is common to both comparators. In analog mode, , is equipped with a reset filter of four external clocks
the P31 and P32 are the positive inputs to the comparators (4TpC). If the external reset signal is less than 4TpC in
and P33 is the reference voltage supplied to both com- duration, no reset occurs. On the fifth clock after the reset
parators. In digital mode, pin P33 can be used as a P33 is detected, an internal RST signal is latched and held for
register input or IR01 source. an internal register count of 18 external clocks, or for the
duration of the external reset, whichever is longer. During
IRESET. (input, active-Low). Initializes the MCU. Reset is the reset cycle, IDS is held active low while lAS cycles at
accomplished either through Power-On, Watch Dog Timer a rate of TpC/2. Program execution begins al location
reset, STOP Mode Recovery , or external reset. During OOOC (HEX), 5-10 TpC cycles afterthe RST is released. For
Power-On Reset and Watch Dog Reset, the internally Power-On Reset, the reset oulputlime is 5 ms. The Z86C40
generated reset is driving the reset pin low for the POR does not reset WDTMR, SMR, P2M, and P3M registers on
time. Any devices driving the reset line must be open-drain a STOP Mode Recovery operation.
to avoid damage from a possible conflict during reset
conditions. Pull-up is provided internally.
438
-
-
---
"
Z86C40 Port 3
MCU
-.. > (110 or Control)
.....
,.. )
-
~-------------------'
I I AUlo Latch
I
I
I R=500Kn I
P30 ______-4_L_-_-_-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~~1_~ P30 Data
Latch IR03
R247=P3M
1 = Analog
o = Dig~aI
439
FUNCTIONAL DESCRIPTION
The Z8 CCP incorporates special functions to enhance the Program Memory. The Z86C40 addresses up to 4 Kbytes
Z8's application in industrial, scientific research and ad- internal program memory and 60 Kbytes external memory
vanced technologies applications. (Figure 9). The first 12 bytes of program memory are
reserved for the interrupt vectors. These locations contain
Reset. The device is reset in one of the following conditions: six 16-bit vectors that correspond to the six available
interrupts. For ROM mode, byte 13 to byte 4095 consists
• Power-On Reset of on-chip mask-programmed ROM. At addresses 4096
and greater, the Z86C40 executes external program
• Watch-Dog Timer memory fetches.
• Brown-out Recovery
• External Reset
65535
External
ROM and RAM
4096
Location of On-Chip
First Byte of
Instruction
Executed
AflerRESET
...........
12
,- - - ROM
- ----
11 IR05
10 IR05
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5
'"' IR02
Interrupt
Vector
> 3
;r IR02
IR01
(Upper Byte)
2 IR01
1 IROO
0 IROO
440
65535
External
Data
Memory
4096
Not Addressable
The 4 Kbyte program memory is mask programmable. A tion being executed. An LOC opcode references PRO-
ROM protect feature prevents "dumping" of the ROM GRAM (10M inactive) memory, and an LOE instruction
contents by inhibiting execution of LOC, LOCI, LOE, and references data (10M active Low) memory.
LDEI instructions to Program Memory in all modes.
Expanded Register File. The register file has been ex-
The ROM Protect option is mask-programmable, to be panded to allow for additional s'ystem control registers,
selected by the customer at the time when the ROM code and for mapping of additional peripheral devices along
is submitted. with I/O ports into the register address area. The Z8
register address space RO through R15 has now been
Data Memory (10M). The Z86C40 ROM version can ad- implemented as 16 groups of 16 registers per group
dress up to 60 Kbytes of external data memory beginning (Figure 11). These register groups are known as the ERF
at location 4096 (Figure 10). External data memory may be (Expanded Register File). Bits 7-4 of register RP select the
included with, or separated from, the external program working register group. Bits 3-0 of register RP select the
. memory space. tOM, an optional I/O function that can be expanded register group (Figure 12). Two system con-
programmed to appear on pin P34, is used to distinguish figuration registers reside in the Expanded Register File at
between data and program memory space (Figure 8). The Bank F. The rest of the Expanded Register is not physically
state of the /OM signal is controlled by the type of instruc- implemented and is open for future expansion.
441
FUNCTIONAL DESCRIPTION (Continued)
ZS STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
%FF SPL u u u u u u u u
REGISTER POINTER
%FE SPH u u u u u u u u
17161SH312111 0 1
%FD RP 0 0 0 0 0 0 0 0
Working RegiS~~
Group Pointer I Expanded Register
Group Pointer
%FC
%FB
FLAGS
IMR
U
0
U
U
U
U
U
U
U
U
U
U
U
U
U
U
%FA IRQ 0 0 0 0 0 0 0 0
%FQ IPR U U U U U U U U
t %FB P01M 0 1 0 0 1 1 0 1
%F7 P3M 0 0 0 0 0 0 0 0
*
PREO
TO
1
U
U
1
U
U
1
U
U
1
U
U
1
U
U
1
U
U
1
U
U
1
0
U
---- ~
%FF %F3 PREl U U U U U U 0 0
%FO
%F2 T1 U U U U U U U U
%F1 TMR 0 0 0 0 0 0 0 0
%FO Reserved
* % (F) OF WDTMR u u u 0 1 1 0 1
%7F
%(F)OE Reserved
%(F)OD Reservod
%(F)OC Reserved
* %(F)OB SMR 0 0 1 0 0 0 U 0
%(F)OA Reserved
%(F)OQ Reserved
Reserved
% (F) 08 Reserved
%(F)07 Reserved
%OF
%00 %(F)06 fl eservod
% (F)OS Resorved
%(F)04 Reserved
% (F) 03 Reservod
%(F)02 Reserved
%(F)01 Reserved
%(F)OO Reserved
%(0)03 P3 1 1 1 1 U U U U
%(0)02 P2 U U U U U U U U
%(0)01 Resorved U U U U U U U U
%(0)00 PO U U U U U U U U
U .. Unknown
t • For Z86COO!C89 (ROMless) Reset condition :-10110110·
* Will nol be reset with a STOP Mode Recovery
442
R253 RP Register File. The register file consists of four I/O port
registers, 236 general purpose registers and 15 control
and status registers (RO-R3, R4-239 and R240-R255, re-
spectively), plus two system configuration registers in the
expanded register group. Tile instructions access regis-
ters directly or indirectly via an 8-bit address field. This
Expanded Register Group allows a short, 4-bit register address using the Register
Working Register Group Pointer (Figure 13). In the 4-bit mode, the register file is
divided into 16 working register groups, each occupying
Dofau~ 60lling aftor RESET =00000000
16 continuous locations. The Register Pointer addresses
the starting location of the active working register group.
Figure 12. Register Pointer Register Note: Register Bank EO-EF is only accessed through
working register and indirect addressing modes.
R255
-..( I r7 r6 r5 r4 I r3 r2 r1 to I R253
R240
R230
R15
roo - - -I/O-Ports- - - - R3
443
FUNCTIONAL DESCRIPTION (Continued)
RAM Protect. The upper portion of the RAM's address The 6-bit prescalers can divide the input frequency of the
spaces %80F to %EF (excluding the control registers) are clock source by any integer number from 1 t6 64. Each
protected from reading and writing. The RAM Protect bit prescaler drives its counter, which decrements the value
option is mask-programmable and is selected by the (1 to 256) that has been loaded into the counter. When the
customer when the ROM code is submitted. After the mask counter reaches the end of the count, a timer interrupt
option is selected, the user activates from the internal ROM request, IR04 (TO) or IR05 (T1), is generated.
code to turn off/on the RAM Protect by loading a bit D6 in
the IMR register to either a 0 or a 1, respectively. A 1 in D6 The counters can be programmed to start, stop, restart to
indicates RAM Protect enabled. continue, or restart from the initial value. The counters can
also be programmed to stop upon reaching zero (single
Stack. The Z86C40 external data memory or the internal pass mode) or to automatically reload the initial value and
register file is used for the stack. The 16-bit Stack Pointer continue counting (modulo-n continuous mode).
(R254-R255) is used for the external stack which can
reside anywhere in the data memory for ROM less mode, The counters, but not the prescalers, are read at any lime
but only from 4096 to 65535 in ROM mode. An 8-bit Stack without disturbing their value or count mode. The clock
P.ointer (R255) is used for the internal stack that resides source for T1 is user-definable and is either the internal
within the 236 general purpose registers (R4-R239). SPH microprocessor clock divided by four, or an external signal
is used as a general purpose register when using internal input via Port 3. The Timer Mode register configures the
stack only. external timer input (P31) as an external clock, a trigger
input that can be retriggerable or non-retriggerable, or as
Countermmers. There are twoB-bit programmable counter/ a gate input for the internal clock. The counter/timers
timers (TO-T1), each driven by its own 6-bit programmable can be cascaded by connecting the TO output to the
prescaler. The T1 prescaler is driven by internal or external input of T1.
clock sources; however, the TO prescaler is driven by the
internal clock only (Figure 14).
444
Internal Data Bus
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit B-bit
Down Down
+--.. Internal Counter Counter IR04
Clock
External Clock
1--_. TOUT
P36
Clock
Logic
6-Bit 8-Bit IROS
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P31
445
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86C40 has six different interrupts from six in counter/timers (Table 5). The Interrupt Mask Register
different sources. The interrupts are maskable and priori- globally or individually enables or disables the six interrupt
tized (Figure 15). The six sources are divided as follows; requests.
four sources are claimed by Port 3 lines P30-P33, and two
IROO IR02
IR01, 3,4, 5
Interrupt
Edge IRO(D6,07)
Select
Global
Interrupt
Enable
Interrupt
Request
Vector Select
446
When more than one interrupt is pending, priorities are Table 6. IRQ Register
resolved by a programmable priority encoder that is con-
trolled by the InterruptPriorilyregister. An interrupt machine IRQ Interrupt Edge
cycle is activated when an interrupt request is granted. P31
D7 D6 P32
Thus, this disables all subsequent interrupts, saves the o o F F
Program Counter and Status Flags, and then branches to
the program memory vector location reserved for that
o 1 F R
interrupt.
1 o R F
1 1 R/F R/F
Cl~
L R
C2~ C2~
447
FUNCTIONAL DESCRIPTION (Continued)
Power-On-Reset (POR). A timer circuit clocked by a dedi- by a reset only, either by WDT timeout, paR, SMR recovery
cated on-board RC oscillator is used for the Power-On or external reset. This causes the processor to restart the
Reset (PaR) timer function. The paR time allows Vee and application program at address DOOC (HEX). In order to
the oscillator circuit to stabilize before instruction execu- enter STOP (or HALT) mode, it is necessary to first flush the
tion begins. instruction pipeline to avoid suspendin'g execution in mid-
instruction. To do this, the user must execute a Nap
The paR timer circuit is a one-shot timer triggered by one (opcode=FFH) immediately before the appropriate sleep
of three conditions: instruction, i.e.:
SMR (F)OB
IIDI~lrel~lool~lrnlool
I II -~-~"
o OFF"
1 ON
RESERVED
Slop Mode Recovery Source
000 POR Only'"
001 P30
010 P31
011 P32
100 P33
101 P27
110 P2 NOR 0-3
111 P2NORO·7
' - - - - - - - - - Slop Delay
o OFF
1 ON"
' - - - - - - - - - - Slop Recovery Level
o 1.Dw"
1 High
L -_ _ _ _ _ _ _ _ _ Slop Flag
o POR"
1 Stop Recovery
448
SCLKfTCLK divide-by-16 Select (~O). DO of the SMR STOP Mode Recovery Source (02, 03, and 04). These three
controls a divide-by-16 prescaler of SCLK{fCLK. The bits of the SMR specify the wake-up source of the STOP
purpose of this control is to selectively reduce device recovery (Figure 18 and Table 7).
power consumption during normal processor execution
(SCLK control) and/or HALT mode (where TCLK sources
counter/timers and interrupt logic).
SMR D4 03 02
0 0
ToPOR
~~~~----~---r-------------------------------------+--------~~
Stop Mode Recovery Edge
Select (SMR)
~
To P33 Data
Latch and IRQ1
P33 From Pads
Digital/Analog Mode
Select (P3M)
Table 7. STOP Mode Recovery Source STOP Mode Recovery Edge Select (06). A 1 in this bit
position indicates that a high level on anyone of the
SMR:432 Operation recovery sources wakes the Z86C40 from STOP Mode. A
04 03 02 Description of Action o indicates low level recovery. The default is 0 on paR
(Figure 18).
o o o paR and/or external reset recovery
o o 1 P30 transition
Cold or Warm Start (07). This bit is set by the device upon
o 1 o P31 transition
entering STOP Mode. A 0 in this bit (cold) indicates that the
o 1 1 P32 transition
device resets by POR/WOT RESET. A 1 in this bit (warm)
o o P33 transition indicates that the device awakens by a SMR source.
o 1 P27 transition
1 o Logical NOR of P20 through P23 Watch-Dog-Timer Mode Register (WOTMR). The WOT is a
1 1 Logical NOR of P20 through P27 retriggerable one-shot timer that resets the Z8 if it reaches
its terminal count. The WOT is initially enabled by executing
the WOT instruction and refreshed on subsequent ex-
STOP Mode Recovery Oelay Select (05). This bit, if high, ecutions of the WOT instruction. The WOT circuit is driven
disables the 5 ms /RESET delay after STOP Mode Recovery. by an on-board RC oscillator or external oscillator from the
The default configuration of this bit is one. If the "fast" wake XTAL 1 pin. The paR clock source is selected with bit-4 of
up is selected the STOP Mode Recovery source is kept the WDT register (Figure 19).
active for at least 5 TpC.
449
FUNCTIONAL DESCRIPTION (Continued)
WDTMR (F)OF
1~1~1~1~lool~I~lool
-,-
II _ 00
W ,~"'~
5ms
External ctock
256TpC
01" ISms 512TpC
10 25 ms 1024 TpC
11 lOOms 4096TpC
WDT Durlng HALT
o OFF
1 ON"
' - - - - - - - WDT During STOP
o OFF
1 ON"
1.-_ _ _ _ _ _ XTAL1/1NTRCSelecllorWDT
o On-Board RC "
1 XTAL
1.-_ _ _ _ _ _ _ _ _ Reserved
Internal
RESET
WDTSelect _ _ _ _ _ _
(WDTh1R)
+_____ ~--[::~~~~!~!I
CKSource
Select
(WDThlR)
XTAl
WDT/POR Counter Chain
ClR
VDD
2VREF.
From Stop
Mode
Recovery
Source 12 ns G&tch FiRer
W D T - - - - - -....
Stop Delay
Select (SMR)
450
WOT Time Select. (00,01). Selects the WOT time period. Brown Out Protection. An on-board Voltage Comparator
It is configured as shown in Table 8. cllecks that Vee is at the required level to ensure correct
operation of the device. Reset is globally driven if Voc is
Table 8. WOT Time Select below the specified voltage (Brown Out Voltage). The
minimum operating voltage is varying with the temperature
Timeout of Timeout of and operating frequency, while the brown out voltage (VBO )
D1 DO Internal RC OSC XTALciock varies with temperature only.
b 0 5 ms min 256 TpC
The brown out trip voltage (VBO ) is less tllen 3 volts and
0 1 15msmin 512 TpC
above 1.4 volts under the following conditions.
1 0 25 ms min 1024 TpC
1 1 100ms min 4096 TpC
Maximum (VBO ) Conditions:
Notes:
TpC = XTAL clock cycle
Case 1: TA =-40°C, + 105°C, Internal Clock Frequency
The default on reset is 15 ms. equal or less than 1 MHz
See Figures 55 to 58 for details.
Case 2: TA= -40°C, + 85°C, Internal Clock Frequency
WDTMR During HALT (02). This bit determines whether or equal or less than 2 MHz
not the WOT is active during HALT Mode. A 1 indicates
active during HALT. The default is 1. Note: The internal clock frequency is one-half the external
clock frequency.
WDTMR During STOP (D3). This bit determines whether or
not the WOT is active during STOP Mode. Since XTAL The device functions normally at or above 3.0V under all
clock is stopped during STOP Mode, the on-board RC has conditions. Below 3.0V, the device functions normally until
to be selected as the clock source to the POR counter. A the Brown Out Protection trip point (VBO) is reached, for the
1 indicates active during STOP. The default is 1. temperatures and operating frequencies in case 1 and
case 2, above. The device is guaranteed to function
Clock Source for WDT (D4). This bit determines which normally at supply voltages above the brown out trip point.
oscillator source is used to clock the internal POR and WOT The actual brown out trip point is a function of temperature
counter chain. If the bit is a 1, the internal RC oscillator is and process pararneters (Figure 21).
bypassed and the POR and WOT clock source is driven
from the external pin, XTAL 1. The default configuration of
this bit is 0 which selects the RC oscillator.
Vee 2.80
(Volts)
2.60
2.40 '-
2.20
'" ......
.....
2.00
1.80
1.60
" ""' ~
~
Veo (Typical)
.........
1.40
~
-60 -40 ·20 o 20 ~ M M 100 120 1~
Temperature ("e)
451
ABSOLUTE MAXIMUM RATINGS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. This
Vee Supply Voltage (*) -0.3 +7.0 V is a stress rating only; operation of the device at any
TSTG Storage Temp -65 +150 C condition above those indicated in the operational sections
TA Oper AmbientTemp C of these specifications is not implied. Exposure to absolute
Power Dissipation 2.2 W maximum rating conditions for an extended period may
affect device reliability.
Notes:
• Voltage on all pins with respect to GND.
See Ordering Information.
150 pF
I
Figure 22. Test Load Diagram
CAPACITANCE
TA = 25°C, Vcc = GND = OV, f = 1.0 MHz, Unmeasured pins to GND
Parameter Max
Input capacitance 12 pF
Output capacitance 12 pF
I/O capacitance 12 pF
452
DC ELECTRICAL CHARACTERISTICS
Icc1 Standby Current 3.3V 3 3 1 rnA HALT Mode VIN = nv, Vee@8MHz [4,5]
5.nV 5 5 2.4 rnA HALT Mode VIN = OV, Vee @8MHz [4,5]
3.3V 4 4 1.5 rnA HALT Mode VIN = OV, Vee @12 MHz [4,5]
5.0V 6 6 3.2 rnA HALT Mode VIN = OV, Vee @12 MHz [4,5]
3.3V 2 2 0.8 rnA Clock Divide by 16 @8 MHz [4,5]
5.0V 4 4 1.8 rnA Clock Divide by 16 @8 MHz [4,5]
3.3V 3 3 1.2 rnA Clock Divide by 16@12MHz [4,5]
5.0V 5 5 2.5 rnA Clock Divide by 16@12MHz [4,5]
ICCl Standby Current 3.3V 8 15 IIA STOP Mode VIN = nv, [6]
Vec WDT is not Running
5.0V 10 20 2 IIA STOP Mode VIN = OV, [6]
Vce WDT is not Running
453
DC ELECTRICAL CHARACTERISTICS (Continued)
3.3V 500 600 310 IiA STOP Mode VIN = OV, [6]
Vcc WDT is Running
5.0V BOO 1000 600 IiA STOP Mode VIN = OV, [6]
Vcc WDT is Running
Nole:
[11 1= Typ Max Unit Freq
Clock Driven on Crystal or 3.0mA 5 mA 8 MHz
XTAL Resonator 0.3mA 50 mA 8 MHz
[2) GND=OV.
[3) 5.0V ± 0.5V.3.3V ± 0.3V.
[4) All outputs unloaded. 1/0 pins floating. inputs at rail.
[51 CL I=CL2=I00pF
[6) Same as note [4) except inputs at Vee'
[7) The V80 increases as the temperature decreases.
454
AC CHARACTERISTICS
External I/O or Memory Read and Write Timing Diagram
RI/W
) K
f-®- r--®-
Port 0, 10M
) )
16
-@- 3
Port 1
) A7-AO 07- DO IN
--cD- f--®- - ~
~
lAS
~
" ~
8
8
18
IDS
~ It
(Read)
f--®
f--®-:
Port1 A7-AO
) 07-00 OUT )(
f----®-- ~
IDS
(Write)
, 7
455
AC CHARACTERISTICS
External I/O or Memory Read and Write Timing Table
456
AC CHARACTERISTICS
External I/O or Memory Read and Write Timing Table (Continued)
Notes:
[1) When using extended memory timing add 2 lpC.
[2)llming numbers given are for minimum lpC.
[3)S.OV ± O.SV, 3.3V ± 0.3V.
457
AC ELECTRICAL CHARACTERISTICS
Additional Timing Diagram
Clock
TIN
IRON
Clock
Setup ,
11
Slop
------~~~.~,~------~-®-~---------~~~----
Mode
Recovery
Source
458
AC ELECTRICAL CHARACTERISTICS
Additional Timing Table
TpG Input Glock Period 3.3V 125 100000 B3 100000 125 100000 B3 100000 ns [1J
5.0V 125 100000 B3 100000 125 100000 B3 100000 ns [1J
2 TrG,TlG Glock Input Rise & Fall Times 3.3V 25 15 25 15 ns [1J
5.0V 25 15 25 15 ns [1J
3 TwG Input Glock Width 3.3V 37 26 37 26 ns [1J
5.0V 37 26 37 26 ns [1J
4 TwTinL Timer Input Low Width 3.3V 100 100 100 100 ns [1J
5.0V 70 70 70 70 ns [1]
5 TwTinH Timer Input High Width 3.3V 3TpG 3TpG 3TpG 3TpG [1J
5.0V 3TpG 3TpG 3TpG 3TpG [1J
6 TpTin Timer Input Period 3.3V BTpG BlpG BTpG BlpG [1J
5.0V BlpG BTpG BlpG BlpG [1J
7 TrTin, Timer Input Rise & Fall Timer 3.3V 100 100 100 100 ns [1J
Tmn 5.0V 100 100 100 100 ns [1J
BA TwlL Int. Request Low Time 3.3V 100 100 100 100 ns [1,2]
5.0V 70 70 70 70 ns [1,2J
BB TwlL Int. Request Low Time 3.3V 3TpG 3TpG 3TpG 3lpG [1,3J
5.0V 3TpG 3lpG 3lpG 3TpG [1,3J
9 TwlH Int. Request Input High Time 3.3V 3TpG 3TpG 3TpG 3lpG [1,2]
5.0V 3TpG 3TpG 3lpG 3lpG [1,2]
10 Twsm STOP Mode Recovery Width Spec 3.3V 12 12 12 12 ns
5.0V 12 12 12 12 ns
3.3V 5TpG Reg. SMR
- 05=0
5.0V 5TpG Reg. SMR
- 05=1
11 Tost Oscillator Startup Time 3.3V 5TpG 5TpG 5TpG 5lpG [4J
5.0V 5lpG 5TpG 5TpG 5TpG [4J
12 Twdt Watchdog Timer Delay Time 3.3V 10 10 10 10 ms 00= 0 [5J
5.0V 5 5 5 5 ms 01=0[5J
3.3V 30 30 30 30 ms 00= 1 [5]
5.0V 15 15 15 15 ms 01 =0 [5J
3.3V 50 50 50 50 ms 00=0[5]
5.0V 25 25 25 25 ms 01 = 1[5]
3.3V 200 200 200 200 ms 00= 1 [5]
5.0V 100 100 100 100 ms 01 = 1 [5]
Notes:
[1] Timing Reference uses 0.9 Vee for a logic 1 and 0.1 Vcc for a logic O.
[2] Interrupt request via Port 3 (P31-P33).
[3] Interrupt request.via Port 3 (P30).
[4] SMR-D5 = O.
[5] Reg. WDlMR.
[6] 5.0V ± 0.5V, 3.3V ± 0.3V.
459
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Diagrams
,.--~~ ...............................................:...........
Data In Data In Valid Next Data In Valid
'--~~ ...........................................................
{DAV Delayed D A V . .-
(Input) 1'-----11 ..........................~f· ... ·,.........../
Data Out
Ir-----------~~-----
Data Out Valid
........................... -
Next Data Out Valid
I'----..:.--------~~' .......................................... -
{DAV
(Output)
ROY
(Input)
460
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Table
9 TdRDYO(DAV) RDY Fall 10 DAV Rise Delay 3.3V 160 160 160 160 OUT
5.0V 115 115 115 115 OUT
10 TwRDY RDYWidlh 3.3V 110 110 110 110 OUT
5.0V 80 80 80 80 OUT
11 TdRDYOd(DAV) RDY Rise 10 DAV Fall Delay 3.3V 110 110 110 110 OUT
5.0V 80 80 80 80 OUT
Noles:
[1] 5.0V± O.5V, 3.3V± O.3V.
461
EXPANDED REGISTER FILE CONTROL REGISTERS
SMA (F)OB
SCLKfTCLK Divide by 16
o OFF"
1 ON
RESERVED
Stop Mode Recoveoy Source
000 POROnIy"
001 P30
010 P31
011 P32
100 P33
101 PZ7
110 P2 NOR 0-3
111 P2NOR0-7
Stop Delay
o OFF
1 ON"
Stop Recoveoy Lavel
o Low"
1 High
L..._ _-'-_ _ _ _ _ _ _ Stop Flag
o POR"
1 Slop Recoveoy
WDTMR (F)OF
IIDloolool~lool~lmlool
-roo-
II -,~ ,~~~
5 ms
00
01"
10
11
15m.
25 ms
100ms
External Clock
256TpC
512TpC
1024 TpC
4096TpC
WDT During HALT
o
OFF
1 ON"
L..._ _ _ _ _ WDT Durlng STOP
o OFF
"1 ON"
L-_ _ _ _ _ _ XTAL1RNTRCSelectforWDT
o On-Board RC "
1 XTAL
L -_ _ _ _ _ _ _ _ _ Reserved
462
Z8 CONTROL REGISTERS
R240 R243 PRE1
Imloolool~lool~lmlool
I RESERVED Count Mode
o T1 Single Pass
1 T1 Modulo N
o No Function R244 TO
Imloolool~lool~lmlool
1 Load T1
o Disable Tl Count
1 Enable T1 Count
TIN Modes
I TO Initial Value
00 External Clock Input (When Writlen)
01 Gate Input (Range: 1~256 Decimal
10 Trigger Input 01-00 HEX)
(Non·retriggerable) TO Current Value
11 Trigger Input (When Read)
(Retriggerable)
TOUT Modes
00 Not Used Figure 33. CounterlTimer 0 Register
01 TO Out
10 T10ut (F4 H:Read/Write)
11 Internal Clock Out
R245 PREO
Figure 30. Timer Mode Register
(F1 H:ReadIWrite)
Count Mode
R242T1 o TO Single Pass
Imloolool~lool~lmlool
1 TO Modulo N
Reserved
I T1 Initial Value
Prescaler Modulo
(Range: 1-64 Decimal
(When Written) 01-ll0 HEX)
(Range: 1-256 Decimal
01-00 HEX)
T1 Current Value
(When Read)
Figure 34 .. Prescaler 0 Register
(F5H:Write Only)
Figure 31. CounterlTimer 1 Register
(F2H:ReadIWrite)
Z8 CONTROL REGISTERS (Continued)
R246 P2M R2491PR
1~lool~I~loolmlrnlool
I P20 - P27 I/O DeflnRlon
o DeHnes Bft as Oulput
Intenupt Group Priority
000 Reserved
1 Deflnes Bit as Input
001 C>A>B
010 A>B>C
011 A>C>B
Figure 35. pon 2 Mode Register 100 B>C>A
101 C>B>A
. (F6H : Write Only) 110 B>A>C
111 Reserved
R247 P3M
IRQ1, IRQ4 Priority (Group C)
o IRQl >IRQ4
1 IRQ4> IRQl
lRoo, IROO Priority (Group B)
o Port 2 Pull-Ups Opsn Drain
o IRQ2>IRoo
1 IRoo>IROO
1 Port 2 Pull-Ups ActIve
IRoo, IROS Priority (Group A)
o P31. P32 DIgReI Mode o IROS>IRQ3
1 P31, P32 Analog Mode 1 IRoo>IROS
o P32=lnput Reserved
P35=Output
1 P32 = IDAVOIRDYO
P35 = RDYOIIDAVO
Figure 38. Interrupt Priority Register
00 P33 = Input
P34 = Output
(F9 H:Wrlte Only)
o P31 = Input (TIN)
P3S = Output (TOUT) R250IRQ '
1 P31 = IDAV2IRDY2
P3S = RDY2I/DAV2
o P30=lnput
P37 = Output
IRoo = P32 Input
Reserved IRQl = P33 Inpul
IRQ2 = P3l Input
IRQ3 = P30 Input
IRQ4=TO
Figure 36. pon 3 Mode Register IROS=Tl
Pl0 - PH Mode
00 Byte Oulput
01 Byte Input 1 Enables IROO-IROS
10 AD7-AOO (OO=IRQO)
11 Hlgh-llT1Jl<Id'!nce AD7 - AOO,
IAS,IDS,IRIIW, All-M, 1 Enables RAM Protecl
A15 - A12, If Selected 1 Enables Interrupts
External Memory T1mlng
o Normal
1 Extended Figure 40. Interrupt Mask Register
P04 , P07 Mode (FBH:ReadIWrlte)
00 OUlput
01 Input
lX A15-A12
464
R252FLAGS R254SPH
IIDloolool~lool~lrnlool
User Flag Fl I Stack Pointer Upper
Byte (SPO - SPI5)
User Flag F2
Half Carry Flag
Decimal Adjust Flag Figure 43. Stack Pointer High
Overflow Flag (FEH:ReadIWrite)
Sign Flag
Zero Flag R255SPl
465
DEVICE CHARACTERISTICS
'cc(mA) 13
A
12
11 /
10 /
9 V
8 L
7 / B
V
6
/ L
5
/ /
4
/ /'
/'
3
/'
/' ./
~ /'
-
2
- 10--"""
~
-
640 1000 2000 4000 8000 12090 16000
Frequency (KHz)
Legend:
A· Icc = 5.0V
B·lcc=3.5V
466
ICC! (rnA) 4
/
3 / B
/ L'
// V
2 / / io'
c
...........v / /'
--- .".-
~ - --- ----
/'
-
V/,
V
/ "" o
~ - ----
640 1000 2000 4000 8000 12000 16000
Frequency (KHz)
Legend:
A - Iccl = 5.0V
=
B - Iccl 5.0V (SCLJ( Divided by 16)
C - Iccl = 3.5V .
D - Iccl = 3.5V (SCLJ( Divided by 16)
467
DEVICE CHARACTERISTICS (Continued)
-
\.
~'\.
3 ~ '\."
2
."
I\.~ '\ [\.
""
~" ~'\.'\.
'\.
,,~'\ ~
"'''''" "''''
~'" ~
,,~~
~~~
~F
'"
E
'""'"'
0_
C
B
A
-40 ·20 o 25 55 80 105
Temperalure (OC)
Legend:
~r---------------;
A-Vcc=3.0V D - Vcc= 4.SV
B· Vcc=3.SV E - Vcc= S.OV
c- Vcc= 4.0V F - Vcc= S.SV
468
IOH -40
(rna)
I------ I-A,
'" ........
-30 I------ I-B,
'" '" .......
-20
e, " t'...... '"
.......... ......
......
~
.......
"-.......
......
............ ['-...
, r-... . . . . ,
............ ......
~
IOH -12
(rna) A\
-10
-8
-6
f - f-e
B ..
,
1\
\
, \. ~
,
\\ \
-4 \. \\
\\.'
~~
-2
0
2.0 3.0
\\ , 4.0 5.0
VOH(Volls)
b. vee =3.3V
Legend:
A=-65°C
B = 25°C
C = 125°C
469
DEVICE CHARACTERISTICS (Continued)
IOL 16
(rna)
~A
14
./
12 /
/
10
~
./ , ./
B-
6
i~
./ , ./
./
/-
4 ./ V ./
././ " /
./ -' ;/
2
A~
0
'" 0.1 0.2
a. VCC=5.0V
0.3 0.4
VOL (Volls)
IOL 12
(rna)
10 A_
-'
8 , ./
6
/'
~
,- B_
./' / e
4 -' , "" ...,.". !-""""
./ ./ ~
........ io""'.........
~~
"
'-
..-
2
~ V'"
~
.....
o
0.1 0.2 0.3 0.4
VOL (Volts)
b. vee = 3.3V
Legend:
A=-5S0C
B = 25°C
C = 125°C
470
Time 22.0
(Msec)
20.0
..",.
... A
18.0
~ ""
16.0 ~
V
~
14.0 ~ ..... ... B
~ ".,
~
12.0 ~ ..... "'C
~
V" ~ ""
~ _ 0
10.0 ~ ~ .--"
1-"-"- ~
---
""..",.... _ E
-------
~
1-""- ""..",....
----
..",.... ~
8.0 _ F
~
~ ~- ~
6.0 ..--~
t:::=- ~ I-"-"
4.0
2.0
o
-GO -40 -20 o 20 40 GO 80 100 120
Temperature (OC)
Legend:
A-Vcc=3.0V O-Vcc=4.5V
B-Vcc=3.5V E - Vcc= 5.0V
C-Vcc=4.0V F-Vcc=5.5V
471
DEVICE CHARACTERISTICS (Continued)
I ALL
(jIA) 15 - £~ --- ---1-- - - -- ----- - - - - - --- ---
.......
IALH -10~~~~~--~~~~~~--~~~~~
(J.lA)
F"""",
- - - - I - - - - - 1 - --1--- -----
~ r--..~ --r--..Ioo.. r-- ---- --- --- --
r:=r-.. . r::~r-....... . . ~~"""'r-o;;.;.
- -0- --- --
-5 ___ --
,. ~ -r---. ~:::::: _
B -r--__
- - A -
--
Legend:
472
Frequency' 10000
(KHz)
5000
...........
..........
........... ........ ...... r-.",
~
1000
..............
500 ~ r--... ......
"" ...... "
"
.'"
....
100
' '".' '\
I"~
50
Legend:
A - Vcc = 5.0V C = 33 pF
B - Vee = 3.3V C = 33 pF
Note: • The internal clock frequency Is one half the external clock frequency.
This chart for reference only. Each process will have a different characteristc curve.
473
DEVICE CHARACTERISTICS (Continued)
Internal 10000
Frequency·
(KHz) 5000
1000
~
500
~ t-........
"' ["'-.
100 "I'"'" i'
~
50 "' ~ ~
......
"
......
r.......... r--..... .........
i"'- ....... r-....... .......
r--r..........
10
.............. ............ A
r-....... ....
5
...... B
o
1 100 1000
Resistance (kohms)
Legend:
A-C=100pF
B -C = 181 pF
Note: • The internal clock frequency Is one half the external clock frequency.
This chart for reference only. Each process will have a different characteristc curve.
474
Internal 10000
Frequency·
(KHz)
5000
'"1\
1\ I' 1 - --
....... ..........
-
..... r--.... r-...
1000
..............
"
..............
.....
:--10-.
-
"
......
.... :.....,
~ ...... ~
~-
" ""
.......
,~
~
A
o
5 10 20 60 100 150 200 300
Capacitance (pF)
Legend:
A- C = 100 pF
B-C=181 pF
Note: • The internal clock frequency is one half the external clock frequency.
This chart for reference only. Each process will have a different characterlstc curve.
R=lkohm
475
DEVICE CHARACTERISTICS (Continued)
Time 40r---~----~--~----~--~~--~----~--~----'
(msec)
A
35~---+----+---~----1---~~--~--~~~~----1
30~---+----+---~~~1---~~--~----r----+~8--1
25~---+----+---~----;-~~~---r----~---+~~
D
20~---+-~~+---~----1-~~~--~--~~~~-E
O~------------------~--------~------------~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
legend:
476
Time 80
(msec)
A
70
60
B
50
D
40
E
F
30
20
10 ~--~----~--~----~--~~--~----~--~--~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
Legend:
477
DEVICE CHARACTERISTICS (Continued)
Time150r---~----~--~----~--~~---r----r---~~~
(msec) A
125~---+----+----+----~--~~~~----r----+--~
B
100~---+----+----+----~~~=----r----r----t~~
o
75~---+----+---~~~~--~~--~~~r----+-=E--i
50~--~§§~~;;~~==9=~~~::~::==t----+~F~
25~---+----+---~----~--~r----r----~---+--~
O~--~--~----~--~--~~--~--~----~--~
-60 -40 ·20 o 20 40 60 80 100 120
Temperature (OC)
Legend:
A· Vee=3.0V D· Vee=4.5V
B· Vee=3.5V E • Vee .; 5.0V
c· Vee = 4.0V F· Vee = 5.5V
478
Time 500
(msec) A
450
./ ..-
B
V
•400 / ....- ..-..- ~
C
V ~
350
V
/' ..-..-
./
~ ~
~
.".,.
.".,.
D
300
..-..-
------.------- --------
~
i-"'" E
~ ~
250 ~ k-:: F
~
~
l....--- ~
---
200 ,.... ....-
150
~
100
-60 -40 -20 o 20 40 60 80 100 120
Temperature (OC)
Legend:
479
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flag.es are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
dst Destination location or contents
src Source location or contents
cc Condition code
@ Indirect address prefix
SP Stack Pointer
PC Program Counter
FLAGS Flag register (Control Register 252)
RP Register Pointer (R253)
IMR Interrupt mask register (R251)
480
CONDITION CODES
481
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
OR
CLR, CPL, DA. DEC,
1 1 1 1 0 I. dstlsre .1 POP,
DECW, INC, INCW,
OPC I MODE
sre OR
,...----r--.... ADC, ADD, AND, CP,
LD, OR, SBC, SUB,
1-_=;;;;"'_-'. PUSH, RL, RLC, I-..;..;.~......:::.:...-I TCM, TM, XOR
RR, RRC, SRA, SWAP dst OR
OPC' I
I - - -d-s-t --lOR 11 11 0 I dst
JP, CALL (In<ireel)
OPC I MODE ,--_-,._ _, ADC, ADD, AND, CP,
dst OR 1111 0 I dst
L.:.":""':'.:..J.-:::::""..J
LD, OR, SBC, SUB,
TCM, TM, XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC, ADD, AND, cp, sre OR
OR, SBC, SUB, TCM,
TM,XOR dst OR
FFH STOPIHALT
6FH I 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (11) of a given
" ~ ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
482
INSTRUCTION SUMMARY (Continued)
HALT 7F - - - - - -
483
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - STOP 6F
PUSH src R 70 - - - - - -
11
5G 01
SPf--SP - 1;
@SPf--src
IR 71 TCM dst, src
(NOTdst)
t 6[ ) -
** 0
- -
AND src
RCF CF 0 - - - - -
Cf--O TM dst, src t 7[ ) - ** 0
- -
dstAND src
RET AF - - - - - -
PCf--@SP; XOR dst, src t B[ ) -
** 0
- -
SPf--SP + 2 dstf--dst
XOR src
RLdst R 90
****--
~
IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ ]'
RLC dst R
IR
10
11
****- - in this table, and its value is found in the following table to the left of the
l€HEj}J applicable addressing mode pair.
R R [4)
SCF OF 1 - - - - -
Cf--1
R IR [5)
SRA dst R DO
*** 0
- - R 1M [6)
~
IR 01
IR 1M [7)
SRP src 1m 31 - - - - - -
RPf--src
484
OPCODE MAP
Lower Nibble (Hex)
o 2 3 4 5 678 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl r1, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM rl, R2 r2, Rl rl. RA ce, RA rl.IM cc, DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRl 1M rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
5 POP POP AND AND AND AND AND AND
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 '6:0
6 COM COM TCM TCM TCM TCM TCM TCM STOP
)( Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
ell
~ 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 ty:o
ell 7 PUSH PUSH TM TM TM TM TM TM HALT
:c.0 R2 IR2 rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
Z
~
10.5 10.5 12.0 18.0 ts:1
ell 8 DECW DECW LDE LDEI DI
0. rl,Irr2 Irl,Irr2
0. RRl IRl
:J
6.5 6.5 12.0 18.0 ts:1
9 RL RL LDE LDEI EI
Rl IRl r2,Irrl Ir2,Irrl
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 t-:;::u)
A INCW INCW CP CP CP CP CP CP RET
RRl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 IJM
B CLR CLR XOR XOR XOR XOR XOR XOR IRET.
Rl IRl rl, r2 r1,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 12.0 18.0 10.5 t----s:5
C RRC RRC LDC LOCI LD RCF
Rl IRl rl,Irr2 Irl,Irr2 rl,x.R2
6.5 6.5 12.0 18.0 20.0 20.0 10.5 t----s:5
D SRA SRA LDC LDCI CALL' CALL LD SCF
Rl IRl r2,Irrl Ir2,Irrl IRRl DA r2,x,Rl
E
6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--s.s
RR RR LD LD LD LD LD CCF
Rl IRl rl,IR2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 10.5 Iful
F SWAP SWAP LD LD NOP
Rl IRl Irl, r2 R2,IRl
... .... .... .... A,
.... ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline
Cycles 1 Cycles
R 1 or r 2 = Dst address
R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
485
PRODUCT SPECIFICATION
Z86E40
CMOS Z8® OTP
CCPn.< MICROCONTROLLER
FEATURES
_ 8-bit CMOS microcontroller _ Digital inputs CMOS levels, Schmitt triggered
_ 4.0 to 5.5 volt operating range _ Three Expanded Register File control Registers
_ Software programmable low EMI mode. _ Two programmable 8-bit Counter!Timers each with a
6-bit programmable prescaler
_ Pull-up Active/Open Drain programmable on Port 0,
Port 1 and Port 2 . _ Sixvectored,priorityinterruptsfromsixdifferentsources
_ Fast instruction pOinter - 0.6 microseconds _ On-chip oscillator that accepts a crystal, ceramic
resonator, LC, RC or extemal clock drive.
_ Two standby modes - STOP and HALT
_ 32 input/output lines
GENERAL DESCRIPTION
The Z86E40 Consumer Controller Processor (CCP) intro- cuits. The CCP oflers a flexible I/O scheme, an efficient
duces a new level of sophistication to single-chip architec- register and address space structure, and a number of
ture. The Z86E40 is a member of the Z8 single-chip ancillary features that are useful in many industrial, con-
microcontroller family with 4 Kbytes of EPROM and 236 sumer, automotive, peripheral types, and advanced sci-
bytes of RAM. The device is housed in a 40-pin DIP, 44-pin entific applications.
Plastic Leaded Chip Carrier, and a 44-pin Quad Flat Pack,
and is manufactured in CMOS technology. The device The device' applications demand powerfulI/O capabilities.
of!erseasysoftware development and debug, prototyping, The CCP fulfills this with 32-pins dedicated to input and
and small production runs not economically desirable with output. These lines are grouped into four ports, eight lines
a masked ROM version. per port, and are configurable under software control to
provide timing, status signals, and parallel I/O with or
The Z86E40 architecture is characterized by Zilog's 8-bit without handshake, and address/data bus for interfacing
microcontroller core with an expanded register file to allow extemal memory.
easy access to register mapped peripheral and I/O cir-
487
GENERAL DESCRIPTION (Continued)
There are four basic address spaces available to support communication, the Z86E40 offers two on-chip counter/
this wide range of configurations: Program Memory, Data timers with a large number of user selectable modes, and
Memory, Register File, and Expanded Register File (ERF). two on-board comparators to process analog signals with
The Register File is composed of 236 bytes of general- a common reference voltage (Figures1 and 2).
purpose registers, four I/O port registers and 15 control
and status registers. The Expanded Register File consists Note: All Signals with a preceding front slash, .1", are active
of three control resisters. Low, e.g.: B/IW (WORD is active Low); /BIW (BYrE is
active Low, only).
To unburden the program from coping with the real-time
problems such as counting/timing and inpuVoutput data
J J ....
1
~
Machine Timing
Port 3
i'r- . )
&
!t -
- Instruction Control
~
Counter! RESET
ALU WDT,POR
Timers (2)
Interrupt II-
FLAGS 1
4096 x 8-Bit
Control '\r- OTP
Register
Pointer
f-
5
Two Analog
Comparators
<= Register File
256 x 8-Bit ~
Program
Counter
f~ I~
..; {} ~
~ -"-
Port 2 Port 0
... .. Port 1
110
I
,
(Bit Programmable)
°E
V
4
Address or I/O
4
(Nibble Programmable)
7' t
Address/Data or 110
(Byte Programmable)
488
07-0
•
AD 11-0...
Z8MCU
AD 11-0
--
!7
MSN Address
Port 3 MUX
07-0
4K Data
AD 11-0 . EPROM ... '"
MUX
PGM+ Test
Mode Logic
1
A
vpp
P33
IDE
EPM IPGM P31
P32 P30
ICE
XTl
489
PIN IDENTIFICATION
RlIW IDS
P25 P24
P26 P23
P27 P22
P04 P2l
P05 P20
P06 P03
P14 P13
P15 P12
P07 GND
vee P02
P16 Pll
P17 Pl0
XTAl2 POl
XTALl POO
P3l pao
P32 P36
P33 P37
P34 P35
lAS IRESET
490
0 0
n: n: an.
0
C\I
n. n. '" '"n: n:
0
C\I
z z
el el
C\I
0
n.
0 0
0
n.
6 5 4 3 2 44 43 42 41 40
P21 7 39 P30
P22 8 38 P36
P23' 9 37 P37
P24 10 36 P35
IDS 11 35 IRESET
Z86E40
N/C 12 PLCC 34 RIIRL
RlIW 13 33 lAS
P25 14 32 P34
P26 15 31 P33
P27 16 30 P32
P04 17 29 P31
18 19 20 21 22 23 24 25 26 27 28
~ ~
Figure 4. 44-Pin PLCC Pin Assignments (Standard Mode)
Table 2. 44-Pin Plastic Leaded Chip Carrier Pin Identification (Standard Mode)
Pin# Symbol Function Direction Pin# Symbol Function Direction
491
PIN IDENTIFICATION (Continued)
3332313029282726252423
P21 34 22 P3D
P22 35 21 P36
P23 36 20 P37
P24 37 19 P3S
IDS 38
Z86E40 18 IRESET
Nle 39 QFP 17 RlIRL
RlIW 40 16 lAS
P25 41 15 P34
P26 42 14 P33
P27
P04 :0 1 2 3 45678 9 10 11
13
12
P32
P31
1-2 P05-6 Port 0 pin 5,6 In/Output 21 P36 Port 3 pin 6 Output
3-4 P14-5 Port 1 pin 4,5 In/Output 22 P30 Port 3 pin 0 Input
5 P07 PortO pin 7 In/Output 23-24 POO-1 Port 0 pin 0,1 In/Output
6-7 Vee Power Supply Input 25-26 P10-1 Port 1 pin 0,1 In/Output
8-9 P16-7 Port 1 pin 6,7 In/Output 27 P02 PortO pin 2 . In/Output
10 XTAL2 Crystal Oscillator Output 28-29 GND Ground, Vss Input
11 XTAL1 Crystal Oscillator Input 30-31 P12-3 Port 1 pin 2,3 In/Output
12-14 P31-3 Port 3 pin 1,2,3 Input 32 P03 Port 0 pin 3 In/Output
15 P34 Port 3 pin 4 Output 33-37 P20-4 Port 2 pin 0,1,2,3,4 In/Output
16 /AS Address Strobe Output 38 /DS Data Strobe Output
17 Rf/RL ROM/ROMless select Input 39 N/C No Connection
18 /RESET Reset Input 40 RI/W Read/Write Output
19 P35 Port 3 pin 5 Output 41-43 P25-7 Port 2 pin 5,6,7 In/Output
20 P37 Port 3 pin 7 Output 44 P04 Port 0 pin 4 In/Output
492
N/C N/C
05 04
06 03
07 02
A4 01
A5 DO
A6 A3
N/C N/C
N/C N/C
A7 GNO
VCC A2
N/C N/C
N/C N/C
N/C Al
ICE AO
IOE IPGM
EPM Al0
VPP All
AS A9
N/C N/C
Table 4. 40-Pin Dual In-Line Package Pin Identification (EPROM Programming Mode)
493
PIN IDENTIFICATION (Continued)
6 5 4 3 2 1 44 43 42 41 40
01 7 39 IPGM
02 8 38 Al0
03 9 37 All
04 10 36 A9
N/C 11 35 N/C
Z86E40
N/C 12 PLCC 34 NlC
N/C 13 33 N/C
DIS 14 32 A8
06 15 31 VPP
07 16 30 EPM
A4 17 29 IOE
18 19 20 21 22 23 24 25 26 27 28
!:;!~QQ~()()QQ()W
zz ~~zzzQ
Table 5. 44·Pin Leaded Chip carrier Pin Identification (EPROM Programming Mode)
494
~
33 32 31 30 29 28 27 26 25 24 23
01 34 22 IPGM
02 35 21 Al0
03 36 20 All
04 37 19 A9
N/C 38 18
Z86E40 N/C
N/C 39 QFP 17 N/C
N/C 40 16 N/C
0/5 41 15 A8
06 42 14 VPP
07
A4
43
44 0
1 2 3 4 5 6 7 8 9 10 11
13
12
EPM
IOE
z z z ~
_
~ ~ Q Q ~ 0 0 Q Q Q
z z g g
Figure 8. 44-Pin QFP Pin Assignments (EPROM programming mode)
495
PIN FUNCTIONS
07-00. Data Bus. The data can be read from or written to IOE. Output Enable (active Low). This pin drives the direc-
external memory through the data bus. tion of the Data Bus. When this pin is low, ihe Data Bus is
output. When high, the Data Bus is input.
A11-AO. Address Bus. During programming, the EPROM
address is written to the address bus. EPM. EPROM Program Mode. This pin controls the differ-
ent EPROM Program Mode by applying diflerent voltages.
Vee' Power Supply. This pin has to supply 5V during the
EPROM read mode and 6V during other modes. Vpp- Program Voltage. This pin supplies the program
voltage. .
ICE. Chip Enable (active Low). This pin is active during
EPROM Read Mode, Program Mode and Program Verify IPGM. Program Mode (active Low). When this pin is low,
Mode. the data is programmed to the EPROM through the Data
Bus.
XTAL. Crystal 1 (time-based input). This pin connects a Power-On Reset, the reset output time is 5 ms. The Z86E40
parallel-resonant crystal, ceramic resonator, LC, RC net- does not reset WDTMR, SMR, P2M, and P3M registers on
work or extemal single-phase clock to the on-chip osc.illator a STOP Mode Recovery operation.
input.
Port 0 (POO-P07). Port 0 is an 8-bit, bidirectional, CMOS
XTAL2. CrystaI2(time-based output). This pin connects a compatible 1/0 port. These eight 1/0 lines can be config-
parallel-resonant crystal, ceramic resonator, LC or RC ured under software control as a nibble 1/0 port, or as an
network to the on-chip oscillator output. address port for interfacing external memory. The input
buffers are Schmitt triggered and nibble programmed.
RI/W. Read/Write (output, write Low). The R//W signal is Either nibble output that can be globally programmed as
low when the CCP is writing to the external program or data push-pull or open drain. Low EMI output buffers can be
memory. globally programmed by the soltware. Port 0 can be
placed urider handshake control. In Handshake Mode,
IRESET. Reset(input, active-Low). Reset will initialize the Port 3 lines P32 and P35 are used as handsllake conlrol
MCU. Reset is accomplished either through Power-On, lines. The handshake direction is determined by the con-
Watch Dog Timer reset, STOP Mode Recovery, or external figuration (input or output) assigned to Port O's upper
reset. During Power-On Reset and Watch Dog Timer nibble. The lower nibble must have the same direction as
Reset, the internally generated reset drives the reset pin the upper nibble.
low for the POR time. Any devices driving the reset line
must be open-drain in order io avoid damage from a For external memory references, Port 0 provides address
possible conflict during reset conditions. Pull-up is provided bits A11-A8 (lower nibble) or A15-A8 (lower and upper
internally. After the POR time,lRESET is a Schmitt triggered nibble) depending on the required address space. If the
input. address range requires 12 bits or less, the upper nibble of
Port 0 can be programmed independently as 1/0 while the
To avoid asynchronous and noisy reset problems, the lower nibble is used lor addressing. II one or both nibbles
Z86E40 is equipped with a reset filter of four external are needed lor 1/0 operation, they must be configured by
clocks (4TpC). If the external reset signal is less than 4TpC writing to the Port 0 mode register. In ROMless mode, after
in duration, no reset occurs. On the fifth clock after the a hardware reset, Port 0 is configured as address lines
reset is detected, an internal RST signal is latched and held A 15-A8, and extended timing is set to accommodate slow
for an internal register countof 18 external clocks, or for the memory access. The initialization routine can include
duration of the external reset, whichever is longer. During reconliguration to eliminate this extended timing mode. In
the reset cycle, IDS is held active low while lAS cycles at ROM mode, Port 0 is defined as input after reset.
a rate of TpC/2. Program execution begins at location
OOOCH, 5-10 TpC cycles after IRESET is released. For Port 0 can be set in the high-impedance mode if selected
as an address output state, along with Port 1 and the
control signals lAS, IDS and R//W (Figure 9).
496
Port 0 (I/O)
Handshake Controls
IDAVO and RDVO
(P32 and P35)
Open Drain
OEN
Out
r----------
I Auto Latch
I I
I
R~500kn
I_ _ _ _ _ _ _ _ _ _ _ _ ..JI
497
PIN FUNCTIONS (Continued)
Port 1 (P10-P17). Port 1 is an 8-bit, bidirectional, CMOS controls RDY1 and /DAV1 (Ready and Data Available). To
compatible port. It has multiplexed Address (A7-AO) and interface external memory, Port 1 must be programmed for
Data (07-00) ports. These eight I/O lines can be pro- the multiplexed Address/Data mode. If more than 256
grammed as inputs or outputs or can be configured under external locations are required, Port 0 outputs the addi-
software control as an Address/Data port for interfacing tiona I lines (Figure 10).
external memory. The input buffers are Schmitt triggered
and the output buffers c&n be globally programmed as Port 1 can be placed in the high-impedance state along
either push-pull or open drain. Low EMI output buffers can with Port 0, /AS, /OS and R//W, allowing the Z86E40 to
be globally programmed by the software. Port 1 can be share common resources in multiprocessor and DMA
placed under handshake control. In this configuration, applications.
Port 3, lines P33 and P34 are used as the handshake
Port 1
(1/0 or AD7 - ADO)
Z86E40
MCU
Handshake Controls
IDAV1 and RDY1
(P33 and P34)
Open Drain
OEN
Out
IL... R=500k.Q I
__________ I
498
Port 2 (P20-P27). Port 2 is an 8-bit, bidirectional, CMOS In Handshake Mode, Port 31ines P31 and P36 are used as
compatible I/O port. These eight I/O lines can be config- handshake control lines. The handshake direction is de-
ured under software control as an input or output, inde- termined by the configuration (input or output) assigned to
pendently. All input buffers are Schmitt triggered. Bits bit 7 of Port 2 (Figure 11).
programmed as outputs can be globally programmed as
either push-pull or open drain. Low EMI output buffers can
be globally programmed by the software. When used as
an I/O port, Port2 can be placed under handshake control.
Port 2 (I/O)
Z86E40
MCU
Handshake Controls
IDAV2 and RDY2
(P31 and P36)
-
Open Drain
OEN
Out
In
---------<~~--------.-------------------t_~
r ---------,
I I Auto Latch
I Wv I
R~ SOOkn
IL __________ JI
499
PIN FUNCTIONS (Continued)
Port 3 (P30-P37). Port 3 is an 8-bit, CMOS compatible port For the interrupt function, P30 and P33 are falling edge
with four fixed input and four fixed output. Port 3 consists triggered interrupt inputs. P31 and P32 can be programmed
of four fixed input (P3Q..P33) and four fixed output (P34- as falling, rising or both edges triggered interrupt inputs
P37), and can be configured by software for interrupt and (Figure 12). Access to CounterfTimer 1 is made through
handshake control functions. Port 3, Pin 0 is Schmitt P31 (TIN) and P36 (Tour)' Handshake lines for Port 0, Port 1,
triggered. Pins P31, P32 and P33 are standard CMOS and Port 2 are also available on Port 3 (Table 7).
inputs (no Auto-Latches) and Pins P34, P35, P36 and P37
are push-pull output lines. Low EMI output buffers can be Note: P30-P33 differs from the Z86C40 because there is no
globally programmed by the software. Two on-board com- clamping diode to Vcc due to the EPROM high voltage
parators can process analog signals on P31 and P32 with circuits. Exceeding the VIH maximum specification during
reference to the voltage on P33. The analog function is standard operating mode may cause the device to enter
enabled by setting the D1 of Port 3 Mode Register.(P3M). EPROM mode.
-
Z86E40 Port 3
MC u (I/O or Control)
-
r----------------- -I AutoLatch -
1 1
1 1
1 R_ 500knJ 1
L _________________
P30 Daia
Pao LatchlRQ3
R247~P3M
_ _ _ _ _ _ _ _.&.;;.;.......
_ 1O_DIgItal
1 -Analog
,
1
500
Table 7. Pin Assignments of Port 3
P30 IN IR03
P31 IN TIN AN1 IR02 DIR
P32 IN AN2 IROO DIR
P33 IN REF IR01 DIR
Comparator Inputs. Port 3 pins P31 and P32 each has a The oscillator and all 110 ports can be programmed as low
comparator front end. The comparator reference voltage EMI emission mode independently. Use of this feature
Pin P33 is common to both comparators. In analog mode, results in:
P31 and P32 are the positive input of the comparators and
P33 is the reference voltage of the comparators. • Less than 1.5 mA typical consumption during HALT
mode.
Auto-Latch. The Auto-Latch puts valid CMOS levels on all
CMOS inputs (except P31-P33) that are not externally • The pre-drivers slew rate is reduced to 10 ns typical.
driven. Whether this level is zero or one, cannot be deter-
mined. A valid CMOS level, rather than a floating node, • Low EMI output drivers have resistance of 200 ohms
reduces excessive supply current flow in the input buffer. (typical).
Auto-Latches are available on Port 0, Port 2 and P30.
There are no Auto-Latches on P31, P32, and P33. • Oscillator divide-by-two circuitry is eliminated.
Low EMI Emission. The Z86E40 can be programmed to • Internal SLCK/TCLKoperation limited to amaximum of
operate in a low EMI emission mode in the PCON register. 4 MHz - 250 ns cycle time.
501
FUNCTIONAL DESCRIPTION
The Z8 CCP incorporates special functions to enhance the 18 clock cycles. The Z86E40 does not re-initialize WDTMR,
Z8's applications in industrial, scientific research, and SMR, P2M, and P3M registers to their reset values on a
advanced technologies applications. STOP Mode Recovery operation.
RESET. The device is reset in one of the following condi- Program Memory. The Z86E40 can address up to 4 Kbytes
tions: of internal program memory (Figure 13). The first 12 bytes
of program memory are reserved for the interrupt vectors.
• Power-On Reset These locations contain six 16-bit vectors that correspond
to the six available interrupts. For EPROM mode, byte 12
• Watch-Dog Timer (OOOCH) to address 4095 (OFFFH) consists of program-
mable EPROM. After reset. the program counter paints at
• STOP Mode Recovery Source the address OOOCH which is the starting address of the
user program. In ROM less mode, the Z86E40 can address
Having the Auto Power-on Reset circuitry built-in, the up to 64 Kbytes of external program memory. The ROMI
Z86E40 does not need to be connected to an external ROM less option is only available on the 44-pin devices.
power-on reset circuit. The reset time is 5 ms (typical) plus
EPROM ROMless
65535
External
ROM and RAM
4 096
External
4 095 On-Chip One Time PROM ROM and RAM
Location of
.,,-- - - - - - - - -
First Byte of
Instruction ~ 11 IRQ5 IRQ5
Executed
After RESET 10 IRQ5 IRQ5
9 IRQ4 IRQ4
8 IRQ4 IRQ4
7 IRQ3 IRQ3
Interrupt
Vector 6 IRQ3 IRQ3
(Lower Byte)
5 r-... IRQ2 IRQ2
Interrupt
Vector
>. ~
3
IRQ2
IRQ1
IRQ2
IRQ1
(Upper Byte)
2 IRQ1 IRQ1
1 IRQO IROO
0 IRQO IRQO
502
EPROM Protect. The 4 Kbytes of program memory is a address up to 64 Kbytes of data memory. External data
one-time PROM. An EPROM protect feature prevents memory may be included with, or separated from, the
dumping of the ROM contents by inhibiting execution of external program memory space. 10M, an optional 1/0
LOC, LOCI, LOE, and LOEI instructions to program memory function that can be programmed to appear on pin P34, is
.in all modes. used to distinguish between data and program memory
space (Figure 14). Tile state of tile 10M signal is controlled
Data Memory (10M). In EPROM mode, the Z86E40 can by tile type of instruction being executed. An LOC opcode
address up to 60 Kbytes of external data memory begin- references PROGRAM (10M inactive) memory, and an
ning at location 4096. In ROMless mode, the Z86E40 can LOE instruction references data (10M active Low) memory.
EPROM ROMless
65535
External External
Data Data
Memory Memory
4096
4095
Not Addressable
Expanded Register File. The register file has been ex- The low nibble (03-00) of the Register Pointer (RP) select
panded to allow for additional system control registers, the active ERF group, and the high nibble (07-04) of
mapping of additional peripheral devices and input/output register RP select the working register group (Figure 16).
ports into the register address area. The Z8 register Three system configuration registers reside in the Ex-
address space RO through R15 is implemented as 16 panded Register File at bank FH: PCON, SMR, and WOTMR.
groups of 16 registers per grou'p (Figure 15). These regis- The rest of the Expanded Register is not pilysically imple-
ter groups are known as the Expanded Register File (ERF). mented and is reserved for future expansion.
503
FUNCTIONAL DESCRIPTION (Continued)
Z8 STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
'YoFF SPL u u u u u u u u
REGISTER POINTER
,,"FE Reserved u u u u u u u u
1718151413121'101 ,,"FO RP 0 0 0 0 0 0 0 0
Working Regis~
Group Pointer I Expanded Register
Group Pointer
""Fe
%FB
FLAGS
IMR
U
0
U
U
U
U
U
U
U
U
U
U
U
U
U
U
%FA IRQ 0 0 0 0 0 0 0 0
,,"F9 IPR U U U U U U U U
t %F8 POIM 0 1 0 0 1 1 0 1
·· %F7 P3M 0 0 0 0 0 0 0 0
U
1
U
1
0
---
%F4 TO U U U U U U U U
,,"FF %F3 PREI U U U U U U 0 0
1IoFO
%F2 Tl U U U U U U U U
~
%Fl TMR 0 0 0 0 0 0 0 0
%FO Reserved
%7F · %(F)OF
% (F)OE
WDTMR
Reserved
u u u 0 1 1 0 1
%(F)OO Reserved
... (F) OC Reserved
· ""(F)OB
% (F) OA
SMR
Reserved
0 0 1 0 0 0 U 0
% (F) 09 Reserved
Reserved
% (F) 09 ReselVed
% (F) 07 Reserved
%OF
%00 %(F)O. Res8IVed
% (F) 05 Reserved
%(F)04 Reserved
% (F) 03 Reserved
% (F) 02 Reserved
""(F)01 Reserved
% (F) 00 peON 1 1 1 1 1 1 1 0
%(0)03 P3 1 1 1 1 U U U U
%(0)02 P2 U U U U U U U U
%(0)01 PI U U U U U U U U
%(0)00 PO U U U U U U U U
U_Unknown
t For Z8SE40 (ROMIess) reset condition: ·10110110"
,.. Win not be reset with a STOP Mode Recovery
504
R253 RP Register File. The 256 byte register file consists of 4 I/O
port registers, 236 general-purpose registers and 15 con-
trol and status registers (R240 is reserved). The instruc-
tions can access registers directly or indirectly via an 8-bit
address field. This allows short 4-bit register addresses
using the Register Pointer (Figures 16 and 17). In tile 4-bit
Expanded Register Group
mode, the register file is divided into 16 worl\ing register
Working Register Group groups, each occupying 16 continuous locations. The
Register Pointer addresses the starting location of 1I1e
Default setting after RESET = 00000000
active working-register group.
R255
-~ I r7 r6 r5 r4 I r3 r2 r1 rO R253
R240
R239
R15
~- --- - - - - -
I/O Ports R3
505
FUNCTIONAL DESCRIPTION (Continued)
RAM Protect. The upper portion of the RAM's address The 6-bit prescalers can divide the input frequency of the
spaces SOH to EFH (excluding the control registers) can clock source by any integer number from 1 to 64. Each
be protected from reading and writing. This option can be prescaler drives its counter, which decrements the value
selected during the EPROM Programming Mode. Afterthis (1 to 256) that has been loaded into the counter. When the
option is selected, the user can activate this feature from counter reaches the end of count, a timer interrupt request,
the internal EPROM. 06 of the IMR control register (R251) IRQ4 (TO) or IRQ5 (T1), is generated.
is used to turn off/on the RAM protect by loading a 0 or 1,
respectively. A 1 in 06 indicates RAM Protect enabled. The counters can be programmed to start, stop, restart to
continue, or restart from the initial value. The counters can
Stack. The Z86E40 external data memory or the internal also be programmed to stop upon reaching zero (single
register file can be used for the stack. The 16-bit Stack pass mode) or to automatically reload the initial value and
Pointer (R254-R255) is used for the external stack which continue counting (modulo-n continuous mode).
can reside anywhere in ,the data memory for ROMless
mode, but only from 4096 to 65535 in ROM mode. An 8-bit The counters, but not the prescalers, can be read at any
Stack Pointer (R255) is used for the internal stack that time without disturbing their value or count mode. The
resides within the 236 general purpose registers (R4- clock source for T1 is user-definable and can be eitherthe
R239). SPH can be used as a general purpose register internal microprocessor clock divided-by-four, or an ex-
when using internal stack only. ternal signal input via Port 3. The Timer Mode register
configures the external timer input (P31) as an external
Countermmers. There are two 8-bit programmable counter/ clock, a trigger input that can be retriggerable or non-
timers (TO and T1), each driven by its own 6-bit program- retriggerable, or as a gate input for the internal clock. Port
mable prescaler. The T1 pres caler is driven by internal or 31ine P36 serves as a timer output (Tour) through which TO,
external clock sources; however, the TO prescaler is driven T1 or the internal clock can be output. The counter/timers
by the internal clock only (Figure 18), can be cascaded by connecting the TO output to the input
ofT1.
506
Internal Data Bus
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-bit
Down Down
Counter Counter IRQ4
~-_ Internal
Clock
t----TOUT
External Clock P36
Clock
Logic
6-Bit 8-Bit IRQ5
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register
Tin P31
'3)7
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86E40 has six different interrupts from six in counter/timers. The Interrupt Mask Register globally or
different sources. The interrupts are maskable and priori- individually enables or disables the six interrupt requests
tized (Figure 19). The six sources are divided as follows: (Table 8).
four sources are claimed by Port 3 lines P30-P33, and two
IRoo IR02
IR01, 3,4, 5
Interrupt
Edge IRO(D6,D7)
Select
Global
Interrupt
Enable
Interrupt
Request
Vector Select
IROO
IRO 1
/DAVO, IRO
IRO 1
° 0,1
2, 3
External
External
(P32),
(P33),
Rising/Falling Edge Triggered
Falling Edge Triggered
IR02 /DAV 2, IRO 2, T'N 4,5 External (P31), Rising/Falling Edge Triggered
IR03 IR03 6,7 External (P30), Falling Edge Triggered
IR04 TO 8,9 Internal
IR05 TI 10, 11 Internal
508
When more than one interrupt is pending. priorities are Table 9. IRQ Register Configuration
resolved by a programmable priority encoder that is con-
trolled by the Interrupt Priority Register (IPR). An interrupt IRQ Interrupt Edge
machine cycle is activated when an interrupt request is 07 06 P3l P32
granted. Thus. disabling all subsequent interrupts. saves
the Program Counter and Status Flags. and then branches
o o F F
to the program memory vector location reserved for that
o 1 F R
interrupt. All Z86E40 interrupts are vectored through loca-
1 o R r
1 1 RtF RtF
tions in the program memory. This memory location and
the next byte contain the 16-bit starting address of the
Notes:
interrupt service routine for that particular interrupt re- F=Falling Edge
quest. R=Rising Edge
To accommodate polled interrupt systems. interrupt in- Clock. The Z86E40 on-chip oscillator has a higI1-gain.
puts are masked and the interrupt request register is parallel-resonant amplifier for connection to a crystal. RC.
polled to determine which of the interrupt requests need ceramic resonator. or any suitable external clock source
service. (XTAL 1 = Input. XTAL2 = Output). The crystal should beAT
cut. 10 kHz to 12 MHz max. with a series resistance (RS)
An interrupt resulting from AN1 is mapped into IR02. and less than or equal to 100 Ohms.
an interrupt from AN2 is mapped into IROO. Interrupts
IR02 and IROOmay be rising. falling or both edge triggered. The crystaLshould be connected across XTAL 1 and XT AL2
and are programmable by the user. The software may poll using the recommended capacitors (capacitance is from
to identify the state of the pin. 10 pF to 100 pF) from each pin to ground. The RC oscillator
option can be selected in the programming mode. The RC
Programming bits forthe Interrupt Edge Select are located oscillator configuration must be an external resistor con-
in bits 07 and 06 of the IRO Register (R250). The con- nected from XTAL 1 to XT AL2. with a frequency-selting
figuration is shown in Table 9. cap,acitor from XTAL 1 to ground (Figure 20).
C2~ C2~
509
FUNCTIONAL DESCRIPTION (Continued)
Power-On Reset (POR). A timer circuit clocked by a dedi- by one of the following resets.: eitherbyWDT timeout, POR,
cated on-board RC oscillator is used for the Power-On a Stop Mode Recovery Source which 'is defined by the
Reset (POR) timer function. The POR timer allows Vee and SMR register or external reset.. This causes the processor
the oscillator circuit to stabilize before instruction execu- to restart the application program at address OOOCH. In
tion begins. order to enter STOP (or HALT) mode, it is necessary to first
flush the instruction pipeline to avoid suspending execu-
The POR timer circuit is a one-shot timer triggered by one tion in mid-instruction. To do this, the user executes a NOP
of three conditions: instruction (opcode=FFH) immediately before the appro-
priate sleep instruction. For example:
1. Power fail to Power OK status
2. STOP mode recovery (if 05 of SMR=O) FF NOP clear the pipeline
3. WDT timeout 6F STOP enter STOP mode
or
The POR time is a nominal 5 ms. Sli 5 of the Stop Mode FF NOP clear the pipeline
Register (SMR) determines whether the POR timer is 7F HALT nter HALT mode
bypassed after STOP mode recovery (typical for an external
clock and RC/LC oscillators willl fast start up times). Port Configuration Register (PCON). The PCON register
configures the ports individually; comparator output on
HALT. Turns off the internal CPU clock, but not the XTAL Port 3, Open Drain on Port 0 and Port 1, low EMI on Port's
oscillation. The counter/timers and external interrupt IROO, 0, 1, 2 and 3, and low EMI oscillator. The PCON register is
IR01, and IR02 remain active. The device is recovered by located in the expanded register file at bank F,location 00
interrupts, either externally or internally generated. (Figure 21).
510
Comparator Output Port 3 (~O). BitO controls the compara- Low EMI Port 3 (D6). Port 3 can be configured as a Low EMI
tor use in Port 3. A 1 in this location brings the comparator Port by resetting this bit (06=0) or configured as a Stan-
outputs to P34 and P35, and a 0 releases the Port to its dard Port by setting this bit (D6= 1). The default value is 1.
standard I/O configuration.
Low EMI OSC (D7). This bit of the PCON Register controls
Port 0 Open Drain (01). Port 0 can be configured as an the low EMlnoise oscillator. A 1 in this location configures
Open-drain by resetting this bit (01=0) or configured as the oscillator with standard drive, while a 0 configures the
Push-pull Active by setting this bit (01 =1). The default oscillator Witll low noise drive. The low EMI mode will
value is 1. reduce the drive of tile oscillator (OSC).
Port 1 Open Drain (02). Port 1 can be configured as an Stop Mode Recovery Register (SMR). This register selects
Open-drain by resetting this bit (02=0) or configured as the clock divide value and determines the mode of STOP
Push-pull Active by setting this bit (02=1). The default mode recovery (Figure 22). All bits are Write only except Bit
value is 1. 7 which isa Read only. Bit7 is a flag bitthat is hardware set
on the condition of STOP Recovery and reset by a power
Low EMI Port 0 (03). PortO can be configured as a Low EMI on cycle. Bit 6 controls whether a low or high level is
Port by resetting this bit (03=0) or configured as a Stan- required from the recovery source. Bit 5 controls the reset
dard Port by setting this bit (03=1). The default value is 1. delay after recovery. Bits 2, 3, and 4 of the SMR register
specify the STOP Mode Recovery Source. The SMR is
LowEMIPort1 (04). Port 1 can be configured asaLowEMI located in bank F of the Expanded Register Group at
Port by resetting this bit (04=0) or configured as a Stan- address OBH.
dard Port by setting this bit (04=1). The default value is 1.
SMR (F) OB
SCLKlTCLK Divide by 16
o OFF'
1 ON
External Clock Divide by 2
o SCLKlTCLK=XTAU2*
1 SCLKlTCLK =XTAL
Stop Mode Recovery Source
000 POR and/or External Reset'
001 P30
010 P31
011 P32
100 P33
101 P27
110 P2 NOR 0:3
111 P2NORO:7
' - - - - - - - - - - Stop Delay
o OFF
lON'
Stop Reoovery Level
o Low'
1 High
Stop Flag
o POR'
1 Stop Reoovery
, Default setting after RESET
511
FUNCTIONAL DESCRIPTION (Continued)
SCLKffCLK divide-by-16 Select (00). This bit of the SMR TCLK is equal to the external clock frequency when this bit
controls a divide-by-16 prescaler of SCLK{fCLK. The is set (01=1). Using this bit together with 07 of PCON
purpose of this control is to selectively reduce device further helps 10werEMI (i.e. 07 (PCON) = 0,01 (SMR) = 1).
power consumption during normal processor execution The default selting is zero.
(SCLK control) and/or HALT mode (where TCLK sources
counter/timers and interrupt logic). STOP Mode Recovery Source (02, 03, and 04). These
three bits of the SMR register specify the wake up source
External Clock Oivide By 2 (01). This bit can eliminate the of the STOP Mode recovery (Figure 23). Table 10 shows
oscillator divide-by-two circuitry. When this bit is 0, the the SMR source selected with the setting of D2to 04. P31-
System Clock (SCLK) and Timer Clock (TCLK) are equal to P33 cannot be used to wake up from STOP mode when
the external clock frequency divided by two. The SCLK/ programmed as analog inputs.
SMR 040302
~
. 0vo: 0 SMR D4 D3 02 SMR D4 03 02 SMR 04 03 02 SMR 040302 SMR 040302
'001 100 101 1 1 0 1 1 1
o 1 0
o 1 1
P30
P31 P33 P27
P32
ToPOR
-----------------+--------------------------------------+---------~~
Stop Mode Recovery Edge
Select (SMR)
~
ToP33 Data
Latch and IRQ1
DlgitaVAnalog Mode
Select (P3M)
Table 10. Stop Mode Recovery Source STOP Mode Recovery Oelay Select (05). The 5 ms RESET
, delay after STOP Mode Recovery is disabled by program-
04 03 02 . SMR Source selection ming this bit to a zero. A 1 in this bit will cause a 5 ms RESET
delay after STOP Mode Recovery. The default condition of
o o 0 paR recovery only
this bit is 1. If the fast wake up mode is selected, the STOP
o o 1 P30 transition
Mode Recovery source heeds to be kept active for at least
o 1 0 P31 transition (Not in analog mode)
5 TpC. .
o 1 1 P32 transition (Not in analog mode)
1 o 0 P33 transition (Not in analog mode)
STOP Mode Recovery Level Select (06). A 1 in this bit
1 o 1 P27 transition
defines that a high level on anyone of the recovery sources
1 1 0 Logical NOR of Port 2 bits 0:3
wakes the Z86E40 from STOP Mode. A 0 defines low level
1 1 1 Logical NOR of Port 2 bits 0:7
recovery. The default value is O.
512
Cold or Warm Start (07). This bit is set by the device upon WOT During HALT Mode (02). This bit determines whether
entering STOP Mode. A 0 in this bit indicates that the or not the WDT is active during HALT mode. A 1 indicates
device has been reset by POR (cold). A 1 in this bit that the WDT is active during HALT. A 0 disables tile WDT
indicates the device was awakened by a SMR source in HALT mode. Tile default value is 1.
(warm).
WOT During STOP Mode (03). This bit determines wheliler
Watch Oog Timer Mode Register (WOTMR). The WDT is a or not the WDT is active during STOP mode. A 1 indicates
retriggerable one-shot timer that resets the Z8 if it reaches active during STOP. A 0 disables the WDT during STOP
its terminal count. The WDT is disabled after Power On mode.
Resetand initially enabled by executing the WDT instruction
and refreshed on subsequent executions of the WDT Clock Source For WOT (04). This bit determines which
instruction. The WDT cannot be disabled when it has been oscillator source is used to clock the inlernal paR and WDT
enabled. The WDT is driven either by an on-board RC counter chain. If the bit is a 1, Ihe internal RC oscillator is
oscillator or an external oscillator from XTAL 1 pin. The paR bypassed and the POR and WDT clock source is driven
clock source is selected with bit 4 of the WDT register. from the external pin, XTAL 1. The default configuration of
this bit is 0, which selects the RC oscillator.
WOTTimeout Period (00 and 01). Bits 0 and 1 control a tap
circuit that determines the timeout periods that can be Bit 5 through Bit 7 are reserved. The WDTMR register is
obtained (Table 11). The default value of DO and 01 are 1 accessible only during the first 64 processor cycles (128
and 0, respectively. external XTAL clock cycles) from the execution of the first
instruction after Power-On Reset. Watch Dog reset or a
Table 11. Timeout Period of the WDT STOP Mode Recovery (Figures 24 and 25). After this point,
the register cannot be modified by any means, intentional
Timeout of the Timeout of the or otherwise. The WDTMR cannot be read and is located
01 00 internal RC OSC external clock in bank F of the Expanded Register Group at address
location OFH.
·0 o 5ms 256TpC
o 1 15 ms 512TpC
1 o 25ms 1024TpC
1 1 100 ms 4096TpC
Noles:
TpC = External clock cycle.
The default selling is 15 ms.
WDTMR (F)OF
1~loolool~looloolmlool
I I won",
00
01 *
10
1NT RC OSC External Clock
5ms
15ms
25 ms
256TpC
512TpC
1024 TpC
11 lOOms 4096TpC
WDT During HALT
o
OFF
1 ON *
L..._ _ _ _ _ WDT During STOP
o OFF
1 ON *
" - - - - - - - - XTAL1/1NT RC Select for WDT
o On-Board RC *
1 XTAL
1---------- Reserved
513
FUNCTIONAL DESCRIPTION (Continued)
/Reset
Clear 18 Clock RESET
.......;..;;;;.;......1 ..- - - - I ClK Generator RESET
Intemal
RESET
WDTSelect
(WDTMR) WDT TAP SELECT
ClKSource
Select
(WDTMR)
VDD
2VREF.
From Stop
Mode
Recovery
Source
12 ns Glitch RIter
WDT
Stop Delay
Select (SMR)
514
Auto Reset Voltage. An on-board Voltage Comparator
checks that Vee is at the required level to ensure correct
operation of the device. Reset is globally driven if Vee is
below VAS"( (Auto Reset Voltage - Figure 26).
Vee
2.S0
(Volts)
2.60
,~
2.40
2.20
2.00
'"' ~.......
~ ~
1.S0
1.60
'"" ~ ""'III
.....
1.40
-60 -40 -20 o 20 40 60 so
'"' ~
100 120 140
Temperature
(0C)
515
EPROM Programming Mode
Table 12 shows the programming voltages of each pro- Algorithm,which is compatible with 2764A EPROM (Z86E40
gramming mode. Table 13, Figures 27,28 and 29 show the is 4K EPROM, 2764A is8K EPROM). Since the EPROM size
programming timing of each programming mode. Figure of Z86E40 differs from 2764A, the programming address
30 shows the circuit diagram of a Z86E40 programming range has to be set from OOOOH to OFFFH. Otherwise, the
adaptor which adapts from 2764A to Z86E40. Figure 31, upper 4K of data (1OOOH-1FFFH) will overwrite the lower
shows the flow-chart of an Intelligent Programming 4K of data.
PROGRAM VERIFY Vpp X V1l V1l V1H Addr Data Out 6.0V
EPROM PROTECT Vpp VH VH V1H V1l X X 6.0V
RAM PROTECT Vpp V1H VH V1l V1l X X 6.0V
RC OSCILLATOR Vpp V1l VH V1H V1l X X 6.0V
Noles:
Vpp = 12.5V ± O.5V
VH = 12.5V ± O.5V
X = TTL Level (irrelevant)
V,H = 5.0V
VL =OV
516
VIH
VIH
Data
VIL
VH
EPM
VIL
VCC
5V
VIH
ICE
VIL
VIH
_---4$\----
IOE
VIL
Note:
Vpp is Irrelevant
PGM isatVIH
517
VIH
Address
VIL Address Stable
>C
VIH
Data
VIL
VPP
VPP
VIH
6V
VCC
5V
VIH
ICE
VIL
VIH
IPGM
VIL
VIH
IOE
VIL
14----Program Cycle-~-~~--Verify Cycle
518
VIH
Address Irrelevant
VIL
VIH
Drua _V_I_L__ -J~~________________________________lrr_e_lev_a_nt___________________________________
Vpp
Vpp VIH
"':'::':""--.1
6V
Vee
5V
VH
fCE
VIH
VH
EPM _V_I_H___
VIL
VIH
fPGM
VIL
Figure 29. Timing Diagram of EPROM Protect, RAM Protect and RC OSC Modes
519
FUNCTIONAL DESCRIPTION (Continued)
Ul U2
AO 10
00 35 P20 Pl0
~ AO
01 36 P21 Pll ~ Al 9
Al
D2 37 P22 P12
~ A2 8
A2
03 38 P23 P13 ~ A3 7
39 P24 P14
D4
---Lx A4 6
A3
05 2 P25 P15 ~ A4
00
06 3 P26 P16 ~ A5 5
A5 00
11
07 4 P27 P17 ~ A6 4 01 12 01
".6
A7 3 13 02
AO 26 POO P30 25 IPGM A7 02
Al 27 POl P31 16 IOE A8 25 15 03
A8 03
A2 30 P02 P32 17 EPM A9 24 16 04
A9 04
A3 34 P03 P33 18 VPP
Al0 21 17 05
Al0 05
A4 5 P04 P34 19 A8
All 23 18 06
A5 6 P05 P35 22 A9 All 06
19 07
A6 7 P06 P36, 24 Al0 ~ A12 07
A7 10 P07 P37 23 All 27
IPGM
~ RIW 31 GNO
R2 GNO
14 GNO
lK A 20
~ lAS 11 VCC
v ICS 28
~ lOS XTAL1 15 ICE I Rl VCC
VCC
lK 1\ 22 1
GNO~ IRESET XTAL2
~ v v IOE VPP VPP
lCl
Z86E40 2764A
T·Ol~F
40 Pin ZIF Socket PINS
LGNO
R4 R3
EPM
C2
.1~
GNO +12.5V
Pl
Note: The programrring address has to be set to OOOOH -OFFFH ( lower 4 Kbyte memory)
520
Apply new
Address
521
ABSOLUTE MAXIMUM RATINGS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. This
Vee Supply Voltage (*) -0.3 +7.0 V is a stress rating only; operation of tile device at any
TSTG Storage Temp -65° +150° C condition above those indicated in the operational sec-'
TA Oper Ambient Temp t t C tions of these specifications is not implied. Exposure to
Power Dissipation 2.2 W absolute maximum rating conditions for an extended pe-
'riod may affect device reliability.
Notes:
• Voltage on all pins with respect to GND.
t See Ordering Information.
150pF
I
Figure 32. Test Load Diagram
CAPACITANCE
TA = 25°C; Vee = GND = OV; f = 1.0 MHz; unmeasured pins to GND.
Parameter Max
Input capacitance 12 pF
Output capacitance 12 pF
I/O capacitance 12 pF
vcc SPECIFICATION
Low Vee 4.3V ± 0.3V
High Vee 5.0V ± 0.5V
522
DC ELECTRICAL CHARACTERISTICS
Voo Output High Voltge 4.0V Vee-OA 3.8 V too = -2.0 rnA
5.0V Vee-OA 4.8 V 100= -2.0 rnA
523
DC ELECTRICAL CHARACTERISTICS (Continued)
Icci Standby Current 4.0V 4.0 2 rnA HALT Mode VIN = av, Vee@8MHz [4,5]
(Standard Mode) 5.0V 6.0 3.5 rnA HALT Mode VIN = av, Vcc @8 MHz [4,5]
4.0V 5.0 2.5 rnA HALT Mode VIN = av, Vee@12MHz [4,5]
5.0V 75 4.5 rnA HALT Mode VIN = OV, Vcc@12MHz [4,5]
IAIl Auto latch low Current 4.0V -10 -5 I!A av <VIN < Vee
5.OV -10 -5 I!A av<vlN<vcc
IIIJl Auto latch High Current 4.OV 20 10 I!A av < VIN < Vee
5.0V 20 10 I!A av <VIN<VCC
Notes:
[1) 1"", Typ Max Unit Freq
Clock Driven on Crystal 3.0 5.0 rnA 8MHz
or XTAL Resonator 0.3 5.0 rnA 8MHz
[2) Vss=OV=GND
[3) 5.0V ± 0.5V.4.0V
[4) All outputs unloaded. I{O pins floating. inputs at rail.
[5) CL 1=CL2=100 pF
[6) Same as note [4) except inputs at V"".
524
AC ELECTRICAL CHARACTERISTICS
External I/O or Memory Read/Write Timing Diagrams (Standard Mode)
RlIW
)
~
~
PortO,lOM
) )
16
~ 3
Port 1
)~ A7-AO 07-00 IN
.k0+ ~
, - -cD
.1
~
lAS
8 ~
1--0--
IDS
(Read)
-®-
---®-------
.31\
6
,
~
Port1 A7-AO
) 07-00 OUT
-®-- -®--
IDS
(Write)
, 7
525
AC ELECTRICAL CHARACTERISTICS
External I/O or Memory Read/Write Timing (Standard Mode)
15 TdDS(DW) IDS Rise to Write Data Not Valid Delay 4.0V 70 45 ns [2]
5.0V 80 55 ns [2)
16 TdA(DR) Address Valid to Read Data
Req'd Valid 4.0V 475 310 ns [1,2)
5.0V 475 310 ns [1,2)
Noles:
[I] When using extended memory timing add 2TpC.
[2] Timing numbers given are for minimum TpC.
[3] S.OV ± O.SV, 4.0V
Standard Test Load
All timining references use 0.9Vee for a logic 1 and 0.1 Vee for a logic O.
Standard operating temperature range O"C to 7O"C.
526
AC ELECTRICAL CHARACTERISTICS
Additional Timing Diagrams (Standard Mode)
Clock
TIN
IRON
Clock
Setup
11
Stop
--------->f~-.~---------~@-or~---------~J<~-----
Mode
Recovery
SOurce
7 TrTin,TITin Timer Input Rise & Fall Timers 4.0V 100 100 ns [lJ
5.0V 100 100 ns [lJ
8A TwlL Int. Request Low Time 4.0V 100 100 ns [1,2J
5.0V 70 70 ns [1,2J
8B TwlL Int. Request Low Time 4.0V 3TpC 3TpC [1,3J
5.0V 3TpC 3TpC [l,3J
9 TwlH Int. Request Input High Time 4.0V 3TpC 3TpC [1,2J
5.0V 3TpC 3TpC [1,2J
10 Twsm . STOP Mode Recovery Width Spec 4.0V 12 12 ns
5.0V 12 12 ns
4.0V 5TpC 5TpC [10J
5.0V 5TpC 5TpC [llJ
11 Tosl Oscillator Startup Time 4.0V 5TpC 5TpC [4J
5.0V 5TpC 5TpC [4J
12 Twdt Watchdog Timer Delay Time 4.0V 10 10 ms [6J
5.0V 5 5 ms [6J
4.0V 20 20 ms [7J
5.0V 15 15 ms [7J
4.0V 35 35 ms [8J
5.0V 25 25 ms [8J
4.0V 175 175 ms [9J
5.0V 100 100 ms [9J
Noles:
[1] Timing Reference uses 0.9 Vee for a logic 1 and 0.1 Vee for a logic O.
[2] Interrupt request via Port 3 (P31-P33)
[3] Interrupt request via Port 3 (P30)
[4] SMR-05 = 0
[5] 5.0V ± 0.5V, 4.0V
[6] Reg. WOTMR 01=0,00=0
[7] Reg. WDTMR 01=0,00=1
[8] Reg. WDTMR 01=1,00=0
[9] Reg. WDTMR 01=1,00=1
[10] Reg. SMR-D5=0. No Oelay
[11] Reg. SMR·05=1. With Oelay
528
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Diagrams
,---\~ .........................................................,
Data In Data In Valid Next Data In Valid
----\~ .........................................................,
RDY
(Output)
Ir--------------'J~ - - - - - - - - - - - - - _.
Data Out Data Out Valid Next Data Out Valid
.---------------'J~ - - - - - - - - - - - - - _.
RDY
(Input)
529
AC ELECTRICAL CHARACTERISTICS
Handshake Timing Table - (Standard Modes)
Noles:
[1]5.0 V ± O.5V, 4.0V
Standard operating temperature range O·C to +70"C
530
EXPANDED REGISTER FILE CONTROL REGISTERS
PCON (FH) OOH SMR (FH) OB
III 'o~orrparator
output Port 3
o P34, P35 Standard'
1 P34, P35 Comparator Output
SCLKfTCLK Divide by 16
o OFF'
1 ON
External Clock Divide by 2
Port 0 Open Drain
o SCLK/TCLK =XTAlJ2'
Port 0 Push-pull Active·
1 SCLKfTCLK _XT AL
Port 1 Opan Drain Stop Mode Recovery Source
1 Port 1 Push-pull Active' 000 POR Only and/or External Reset·
o PortO Low EMI 001 P30
1 Port 0 Standard' 010 P31
011 P32
o Port 1 Low EMI 100 P33
1 Port 1 Standard' 101 P27
110 P2NOR0:3
o Port2 Low EMI
111 P2NORO:7
1 Port 2 Standard'
Slop Delay
o Port 3 Low EMI o OFF
1 Port 3 Standard' 1 ON',
low EMI Oscillator Stop Recovery level
o Low EMI o low'"
1 Standard' 1 High
, Dafault Setting After Reset
Slop Flag
o POR'
1 Stop Recovery
Figure 36_ Port Configuration Register
... Default setting after RESET
WDThlR (F) OF
1:t~5ID4ID3IDL21~1
L - - WDTTAP INTRCOSC External Clock
00 5ms 256 TpC
01 «- 15 ms 512TpC
10 25 ms 1024 TpC
11 100ms 4096TpC
WDT During HALT
o OFF
1 'ON'
WDT During STOP
o OFF
1 ON'
XlALWNT RC Select for WDT
o On-Board RC •
1 XlAL
Reserved
531
ZS CONTROL REGISTER DIAGRAMS
1~1~1~1~lool~lmlool
I Reserved CounlMode
o T1 Single Pass
1 T1 Modulo N
Clock Source
1 T11ntemal
Figure 39. Reserved o T1 Extemal Timing Input
(TIN Mode)
Prescaler Modulo
R241 ThlR (Range: 1·64 Decimal
01-00 HEX)
o No Function R242T1
1 loadT1
o Disable T1 Count
1~loolool~lool~lmlool
1 Enable T1 Count
TIN Modes I T1 Initial Value
00 External Clock Input (When Written)
01 Gate Input (Range: 1·256 Decimal
10 Triggerlnput 01"()()HEX)
(Non....triggerable) T1 Current Value
11 Trigger Input (When Read)
(Retriggerable)
TOUT Modes
00 NotUsed Figure 43. CounterlTimer 0 Register
01 TO Out (F4H:ReadIWrlte)
10 T10ut
11 Internal Clock Out
R243PREO
1~lool~I~lool~lmlool
Reserved
Prescaler Modulo
I T1 Inttl.1 Value
(Range: 1·64 DecImal
01-00 HEX)
(WhenWrttten)
(Range: 1·256 DecImal
01-OOHEXj
T1 Current Value Figure 44. Prescaler 0 Register
(When Read)
(F5 H:Write Only)
532
R246 P2M R24S P01M
Iml~I~I~lool~I~lool
I P20 - P27 1/0 Definition P03 - POD Mode
o Defines Bit as Output 00 Output
1 Defines Bit as Input 01 Input
lX All -AS
Stack Selection
Figure 45. Port 2 Mode Register o External
1 Internal
(F6 H : Write Only)
P17 - Pl0 Mode
00 Byte Output
01 Byte Input
10 AD7 • ADO
R247P3M 11 Hlgh·lmpedance AD7 - ADO,
IAS,iDS,/R/lW, All - AB,
A15· A12, If Selected
533
ZS CONTROL REGISTER DIAGRAMS (Continued)
R250IRO R253 RP
looloolool~loolool~lool looloolool~loolool~lool
I IRoo _ P32 Input I
T
Expanded Register Ale
IRQ1 _ P33 Input
IR02 = P31 Input Working Register Pointer
IR03 - P30 Input
IRQ4_TO
IROS-T1
R254SPH
Figure 49. Interrupt Request Register
(FAH:ReadIWrite) looloolool~loolool~lool
I Stack Pointer Upper
Byte (SPS - SP15)
R251IMR
looloolool~loolool~lool
Figure 53. Stack Pointer High
1 Enables IRoo-IROS (FEH:ReadIWrite)
I L - - - - - . . . . : . - I-
(OO~IRoo)
R252FLAGS
Figure 54. Stack Pointer Low
(FFH:ReadIWrite)
UserFlagF1
UserFlagF2
Half Carry Flag
Oecimal Adjust Flag
OVertlow Flag
Sign Flag
Zero Flag
Carry Flag
534
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flags are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
535
CONDITION CODeS
536
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD, AND, CP,
DECW, INC, INCW, LD, OR, SBC, SUB,
ORl11101 dst/srel POP, PUSH, RL, RLC, sre OR TCM,TM,XOR
RR, RRC, SRA, SWAP dsl OR
OPC JP, CALL (Indrect)
dsl lOR 1111 0 I dsl OPC I MODE ADC, ADD, AND, CP,
dsl OR 1111 0 I dsl
LD, OR, SBC, SUB,
TCM, TM,XOR
OPC SRP VALUE
VALUE
MODE I OPC lO
ADC, ADD, AND, CP, sre OR
OR, SBC, SUB, TCM,
TM,XOR dst OR
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" ~ ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
537
INSTRUCTION SUMMARY (Continued)
R r9
DECdst R 00 - *** r=O-F
dstE-dst-1 IR 01 r X G7
DECWdst RR - X r D7
dstE-dst -1 IR
80
81
*** r Ir E3
Ir r F3
01 8F - - - - -- R R E4
IMR(7)E-O R IR E5
R 1M E6
OJNZr,dst RA rA - - - - -- IR 1M E7
rE-r-1 r=O-F IR R F5
ilr~O
PGE-PG+ dst LOC dst, src Irr G2 - - - - - -
Range: +127, dstE-sre
-128 '
LOCI dst, src Ir Irr G3 - - - - - -
EI 9F - - - - -- dstE-sre
IMR(7)E-1 rE-r + 1;rrE-rr + 1
HALT 7F - - - - - - NOP FF - - - - - -
538
INSTRUCTION SUMMARY (Continued)
POP dst R 50 - - - - - -
SUB dst, src
dst~dst~src
t 2[ J
****1*
dst~@SP: IR 51
SP~SP+1
SWAPdst R FO X * * X
IR F1
PUSH src
SP~SP-1:
@SP~src
R
IR
70
71
- - - - - - J7
25 01
RLdst R -
XOR dst,src
dst~dst
t B[ ] -
** 0
- -
90 * ** * -
IR 91 XORsrc
mJEjp
RLC dst R 10 - t These instructions have an identical set of addressing modes, which
**** - are encoded for brevity. The first opcode nibble is found in the instruction
IR 11 set table above. The second nibble is expressed symbolically by a '[ ]'
l&-I 7 of.J in this table, and its value is found in the following table to the left of the
applicable addressing mode pair.
RR dst R EO ****--
IR E1 For example, the opcode of an ADC instruction using the addressing
l.@] l.j 7 0jJ modes r (destination) and Ir (source) is 13.
RRCdst R CO ****--
IR C1 Address Mode Lower
~ dst src Opcode Nibble
539
OPCODEMAP
A
10.5
INCW
10.5
INCW
6.5 6.5 10.5 10.5 W.5 10.5 t"-i4:o
CP CP CP CP CP CP RET
RRI IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 16:0
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 6.5
C RRC RRC LDC LDCI LD RCF
Rl IRl r1.lrr2 Irl,lrr2 rl,x,R2
6.5 6.5 12.0 18.0 20.0 20.0 10.5 ~
D SRA SRA LDC LDCI CALL' CALL LD SCF
Rl IRl r2,ITTl 1r2,ITTl IRRl DA r2,x,Rl
E
6.5 6.5 6.5 10.5 10.5 10.5 10.5 t--"6:5
RR RR LD LD LD LD LD CCF
Rl IRl rl,IR2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.5 8.5 6.5 10.5 te:o
F SWAP SWAP LD LD NOP
Rl IRI Irl, r2 R2,IRl
~
.... " .... A,
.... ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1or r2= Dst address
Cycles 1 Cycles R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
540
PRODUCT SPECIFICATION
~ZiIill Z86C27-ROM
Z86C97-ROMLESS
CMOS Z8® 8-BIT
MICROCONTROLLER
FEATURES
• Low cost
• On-chip oscillator that accepts a crystal, ceramic
resonator, LC or external clock drive.
• 8 Kbytes of ROM
• One Pulse Width Modulator (14-bit resolution) for
voltage synthesis tuner control.
GENERAL DESCRIPTION
The Z86C27 and Z86C97 Digital Television Controller the DTC offers both external memory and pre-programmed
(OTC) introduce a new level of sophistication to single-chip ROM which enables the Z8 microcontroller to be used in a
architecture. The Z86C27/C97 are members of the Z8 high volume production application device embedded
single-chip microcontroller family with 8 Kbytes of ROM with a custom program (customer supplied program). The
(Z86C27), ROMless (Z86C97) and 236 bytes of RAM. Both Z86C97 ROMless offers.the use of external memory rather
devices are housed in a 64-pin DIP package, and are
CMOS compatible. Having the ROM/ROMless selectivity,
541
GENERAL DESCRIPTION (Continued)
than a preprogrammed ROM. This enables the Z8 A 14-bit PWM port provides enough voltage resolution for
microcontroller to be used in prototyping, low volume a voltage synthesizer tuning system. Seven 6-bit PWM
applications or where code flexibility is required. Zilog's ports are used for controlling audio signal level. Five 8-bit
DTC offers fast execution, efficient use of memory, sophis- PWM porls are used to vary picture levels.
ticated interrupts, input/output bit manipulation capabili-
ties, and easy hardware/software system expansion along The DTC applications demand powerful I/O capabilities.
with low cost and low power consumption. The device The Z86C27/C97 fulfills this with 35 I/O pins dedicated to
provides an ideal performance and reliability solution for input and output. These lines are grouped into five ports,
consumer and industrial television applications. and are configurable under software control to provide
timing, status signals, parallel I/O and an address/data
The Z86C27/C97 architecture is characterized by utilizing bus for interfacing to external memory.
Zilog's advanced Superintegration™ design methodol-
ogy. The devices have an 8-bitinternal data path controlled There are three basic address spaces available to support
by a ZS microconlroller, and On Screen Display (OSD) this wide range of configurations: Program Memory,
logic circuits/Pulse Width Modulators (PWM) .. On-chip Register File and Data Memory. The Register File is com-
peripherals include two register mapped I/O ports (Ports 2 posed of 236 bytes of general purpose register, two I/O
and Port 3), Interrupt control logic (1 software, 2 external Port registers and 15 control and status registers. .
and 3 internal interrupts) and a standby mode recovery
input port (Port 3, pin P30). To unburden the program from coping with the real-time
problems such as counting/timing and data communica-
The OSD control circuits support 8 rows by 20 columns for tion, the DTC's offer two on-chip counter/timers with a large
128 kinds of characters. The character color is specified number of user selectable modes (Figure 1).
by row. One of the 8 rows is assigned to show two kinds of
colors for ba(type displays such as volume control. The Note: All Signals with a preceding front slash, "I", are active
OSD is capable of displaying either low resolution (5x7 dot Low, e.g.: B/fW (WORD is active Low); IBfW (BYTE is
pattern) or high resolution (11x15 dot pattern) characters. active Low, only).
The Z86C97 currently supports high resolution char-
acters only.
542
XTAl1 P27
8K Byte
XTAL2 P26
Program ROM
IRESET P25
Port 2 P24
zecPu P23
Core P22
P21
PaO
P20
P31
P34
P35 PWM1
P36 14-bit PWM1
P40( P10)
PWM2
P41(P11 )
PWM3
P42( P12) PWM2
Port4 PWM4
P43( P13) to
(Port 1) PWM8 PWM5
P44( P14) PWM6
6-bit
P45( P15)
PWM7
P46( P16)
I - - - - l i - PWM8
P47( P17)
PWM9
P50( POOl PWM9 PWM10
P51( P01) to
PWM13 PWM11
P52( P02) Port 5 PWM12
8-bit
P53(P03) (PortO)
PWM13
P54( P04)
P55( P05)
PSG( P06)
OSCIN
P57( P07)
OSCOUT
P60(/AS) HSYNC
P61(IOS) On Screen
Display VSYNC
P62(RlIW). Port 6
(Contro~
VRED
P63(SCLK)
VGREEN
P64( P66)' VBLUE
F'65( P67)'
VBLANK
AFCIN
543
PIN CONFIGURATION
Figure 2. Z86C27 Mask-ROM Plastic DIP Figure 3. Z86C97 ROMless Plastic DIP
544
PIN IDENTIFICATION
64-pin DIP Z86C27
545
PIN IDENTIFICATION (Continued)
64-pin DIP Z86C97
546
PIN DESCRIPTION
XTAL1, XTAL2. (Time-based input, output. respectively). VSYNC. (input Schmitt triggered, CMOS level). Vertical
These pins connect to the internal parallel-resonant clock Sync is an input pin that accepts an externally generated
crystal' (4MHz max) oscillator circuit with 2 capacitors to Vertical Sync signal of either negative or positive polarity.
GND. XTAL 1 is also used as an external clock input.
OSCIN, OSCOUT. (Video Oscillator input. output, re-
lAS. Address Strobe (output, active Low) is pulsed once at spectively). Oscillator input and output pins for on-screen
the beginning of each machine cycle. Address output is display circuits. These pins connect to an inductor and two
via Port 0 and Port 1 for all external programs. Memory capacitors to generate tile character dot clock (typically
address transfers are valid at the trailing edge of lAS. around 6MHz). The dot clock frequency determines the
Under program control, lAS can be placed in the high character pixel width and phase synchronized to HSYNC.
impedance state along with Port 0 and Port 1, Data Strobe
and Read/Write. Vblank. Video Blank (output). CMOS output, program-
mable polarity. Used as a superimpose control port to
IDS. Data Strobe (output, active Low) is active once for display characters from video RAM. The signal controls
each external memory transfer. For READ operations, data Y signal output of the CRT and turns off the incoming video
must be available prior to the trailing edge of IDS. For display while the characters in video RAM are superim-
WRITE operations, the falling edge of IDS indicates the posed on the screen. The red, green, and blue outputs
output data is valid. drive the three electron guns on the CRT directly, while the
blank output tums off the Y signal.
RlIW. Read/Write (output, Write active Low) signal is low
when the DTC is writing to the external program or data Vblue. Video Blue(output). CMOS Output of the Blue video
memory. signal (B-Y) and is programmable for either polarity.
SCLK. System Clock. SCLK is the internal sysiem clock. It Vgreen. Video Green (output). CMOS Output of the Green
can be used to clock external glue logic. video signal (G-Y) and is programmable for either polarity.
HSYNC. (input Schmitt triggered, CMOS level). Horizontal Vred. Video Red (output). CMOS Output of the Red video
Sync is an input pin that accepts an externally generated signal (R-Y) and is programmable for either polarity.
Horizontal Sync signal of either negative or positive
polarity.
547
PIN DESCRIPTION (Continued)
Z86C97 I ..
b}portO
(0"",'" A15-AS)
J
VCC
OEN
PAD
OUT -----'-------j~~_-'"
548
Port 1 (P1O-P17). Port 1 is an 8-bit, CMOS compatible, (A7-AO during /AS) and data (07-00 during /DS) for an
Multiplexed Address/Data Bus (A7-AO)/(D7-DO). In the external memory cycle (Figure 5).
ROMless mode this port multiplexes the low order address
-
... ... } Port 1
Z86C97 "" 8) (A7-AO) (07-00)
-
VCC
OEN ------~------------;
PAD
20
OUT ----------~----....._{ Ohm
IN -----------~----------------'
Note: Z86C97 Only
549
PIN DESCRIPTION (Continued)
Port 2 (P20-P27). Port 2 is an 8-bit port. CMOS compatible. globally programmed as either push-pull or open-drain
bit programmable for either input or output. Input buffers (Figure 6).
are Schmitt triggered. Bits programmed as outputs may be
- ~
Z86C27/C97
. Port 2
(110 )
00-------1
OEN - - - - . - - - - - - - - 1
PAD
20
OUT---------------~__~
Ohm
550
Port 3 (P30-1. P34-5 and P36). Port 3 Pin P30 input. is read in IRQ2 to initiate an IRQ2 vectored interrupt if appropri-
directly. A negative edge event is latched in IRQ3 to initiate ately enabled. P31 high is signified as the T'N signal to
an IRQ3 vectored interrupt if appropriately enabled. An Timer1. Port 3. Pin P34 and Pin P35 are general purpose
application could place the device in STOP mode when output lines. Port 3, Pin P36 can be used as a general
P30 goes low (in the IRQ3 interrupt routine). P30 initiates a purpose output or as an output for TOUT (from Timer! or
STOP mode recovery when it subsequently goes high. Port Timer2) or SCLK (Figure 7).
3. Pin P31 is read directly. A negative edge event is latched
-
Z86C27/C97
Port 3
(I/O or
Control)
-
VCC VCC
PAD
IN
OUT ---4I-----i
Note: Input Only, Schmitt-triggered, Pad Type 2 Note: Output Only. Pad Type 3
551
PIN DESCRIPTION (Continued)
Z86C27
Port 4
Output
- J
VCC
PAD
OUT -----<t-:--t
552
Port S (PSO-PS7). Port 5 is an 8-bit, CMOS compatible.
Output Port. The output ports can directly sink 10 mA at 1.5
Volt VOL' They are typically used to drive multiplexed LED
displays (Figure 9).
Z86C27
Port S
Output
VCC
PAD
OUT - - - -........---1 N
553
PIN DESCRIPTION (Continued)
Port 6 (P60-P65). Port 6 is a 6-bit, Schmitt triggered CMOS ROM mode. In ROMless mode, pins 20 and 21 bring out
compatible, input port. The outputs of the AFC compara- the internal comparator outputs for Port 6, bit-6 and bit-7
tors internally feed into the Port 6, bit-6 and bit-7 inputs in emulation (Figure 10).
- , - ...
..
1
lAS
...
... Port 6
. IDS
Rl/W
Z86C27 .
Input
Z86C97
.. SCLK
... ...
... j ...
P66
P67
AFCIN AFCIN
- -
VCC VCC
PAD
tN
OUT - -........--1
554
AFCIN. (Comparator input port, memory mapped). Tile 6 and bit-7. AFCIN is typically used to detect AFC voltage
input signal is supplied to two comparators with VTH1 =2/ level to accommodate digital automatic fine tuning func-
5 Vee and VTH2=3/5 Vee typical threshold voltage. The tions. For Z86C97 Port 6, bit-6 and bit-7 are external
comparator outputs are internally connected to Port 6, bit- outputs through pin 20 and pin 21 (Figure 11).
VCC
P67
Internal
Databus
P66
Internal
Databus
555
PIN DESCRIPTION (Continued)
Pulse Width Modulator 1 (PWM). PWM1 is typically used In either case, the output drivers are 12-volt open-drain
as the O/A converter forVoitage Synthesis Tuning systems. circuits.
Pulse Width Modulator 2-8 (PWM). PWM2-PWM8are Pulse IRESET. System Reset. Code is executed from memory
Width Modulators with 6-bit resolution. address OOOC (HEX) after the /RESET pin is set to a high
level. The reset function is also carried out by detecting a
Pulse Width Modulator 9-13 (PWM). PWM9-PWM13 are Vcc transition state (automatic power on reset) so that the
Pulse Width Modulator circuits with 8-bit resolution or external reset pin can be permanently tied to Vcc' A low
individually programmed as general purpose outputs. level on /RESET forces a restart of the device.
SPECiAL FUNCTiONS
The Z8 OTC incorporates special functions to enhance the control, and PWM9-PWM13 (5 channels of 8-bit resolution)
Z8's application in consumer, industrial and television typically used for picture level control. The PWM control
control applications. registers are mapped into external memory and are
accessed via LOE and LOEI instructions.
Pulse Width Modulator (PWM). The OTC has thirteen PWM
channels (Figure 12). There are three types of PWM On Screen Display (050). The OSD has a capability of
circuits: PWM1 (1 channel of 14-bit resolution) typically displaying 8 rows by 20 columns of 128 kinds of characters
used for Voltage Synthesis Tuning, PWM2-PWM8 (7 chan- for either high resolution (11 x15 dots) or low resolution (5x7
nels of 6-bi\ resolution) typically used for audio level dots) pattern (Figure 13).
556
l
IRESET
r n~ n~
XTAl J
-I 14-Bk Binary
Down Counter
I I PWM
PortOulput
Reg ,II PWM Mod Reg I I
z-o
FC11h FC10h
I 7~
!
13~ 6-0
Upper7-Btt 13-7 ~I
7-Bit
Comparator
AD7~
~
¢
14-Bit
PWM1 I 13-7 RS&DFF~ ~
I-i- I--- PWM1 (Open-drain)
Reg Pulse
lower7-Btt 6~ ~I
1
Distributer
FC12-3h
I 5-0
-
RSFF
~ -PWM2 (Open-draln)
~
------
6-Bk
PWM2 h5-0 5-0 6-Bk f--
~ r--
- MPX
-
RSFF PWM3 (Open-drain)
AD7 ~ ¢ Reg Comparator
f--
I-i-
RSFF - ~ I- PWM4 (Open-drain)
FC14h
~
I---
I FC15h
I FC16h r - - RSFF -
f--
----.
~ I - PWM5 (Open-drain)
I FC17h t--- RSFF f-- ~
---. I - PWM6 (Open-drain)
f--
I FC18h
I FC19h
I FC1Ah I K f--
RSFF
RSFF
- ----.
~
~
'--
I- PWM7 (Open-drain)
I - PWM8 (Open-draln)
7-0
~ 8-Bk
PWM9 1 7-0 7-0 8-Bk
D7~¢ Reg Comparator
RSFF PWM9 (Open-drain)
~
FC1Bh
- PWM10 (Open-drain)
r--- PWM11 (Open-dmln)
I FC1Ch
I FC1Dh I---
- RSFF PWM1 2 (Open-drain)
-~ PWM1 3 (Open-drain)
I FC1Eh '1
I FC1Fh I I
,501
~
AD7-O AD7-O
OSCIN
VBLANK
Generator GREEN
BLUE
• Character Color: Seven kinds of color are specified on • Bar Line Type Display: One of the rows is selected to
a row basis. display an analog bar line every hal! column by selling
second color with proper character set.
• Character Pixel Size: Four character pixel sizes are
selected for a low resolution (2HL, 4HL, 6HL and 8HL) • Fringe Function: Fringe off/on and the color selected.
and high resolution (1 HL, 2HL, 3HL and 4HL) Horizontal
Line (HL). • Background Color: Eight kinds of color including black
background color.
• Polarity Selections: Can select active low or high for
horizontal/vertical sync input and RGB outputs. • ON/OFF Control: Character display, backgrounds are
turned on and off.
• Display Position: Can display 64 vertical positions by
4HL units and 64 horizontal positions by a 4 dot clock. • Number of Display Characters: 8 rows x 20 columns.
• Inter Row Spacing: Inter row vertical line spacing is set • Character Set: 128 (5x7 dots or 11x15 dots).
from 2HL to 25HL (17HL for high resolution).
559
Must be OOh
HEX at each pattern
00
01
02
03
LeltHal! Right Half
04
05
06
07
08
09
OA
OB
OC
OD
OE
OF
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
10
1E
1F
20
J,
3F
FCO
J, High Resolution
Character Patlern
FDF
FEO
J, High Resolution
Character Pattern
FFF
MSB LSB
(6-Bit Wide)
560
00
01
02
03
04
05
06
07
OB
09
OA
OB
OC
00
OE
OF
20
21
22
23
24
Low Resolution
J. Character Pattern
2F
40
Low Resolution
J. Character Pattern
Chained Character Pattern
4F
60
Low Resolution
J. Character Pattern
SF
FCO
Low Resolution
J. Character Pattern
FCF
FEO
Low Resolution
J. Character Pattern
FEF
MSB LSB
(6-Bit Wide)
561
SPECIAL FUNCTIONS (Continued)
Program Memory. The program ROM size is 8K bytes the specified vector address. IRQ1 vector is fixed to
(Figure 15). The IRQ vector table is located in the lower VSYNC interrupt request and occurs at the leading edge
address space. The vector address is fetched after the of the filtered VSYNC input. Program memory start at
corresponding interrupt and program control is passed to address aGOc (HEX) after reset.
Hex Hex
Address Address
(
0000 IROO (High Byte) OSD Control (OSD_CNTAL) FCOO
0001 IROO (low Byte) Vertical Position (VERT_paS) FCOl
0002 VSYNC IROl (High Byte) Horizontal Position (HOR_POS) FC02
00,03 VSYNG !RQ1 (Low Byte) Display Attribute (DISP_ATTR) FC03
0004 P3l IR02 (High Byte) Row Space (ROW_SPACE) FC04
ODDS P31 IR02 (low Byte) Fade Position (FADE_paS) FCOS
0006 P30 IR03 (High Byte) Bar Line Control (BAR_CNTAl) FC06
0007 P30 IR03 (low Byte) Bar Position (BAR_paS) FC07
0008 TO IR04 (High Byte)
0009 TO IR04 (low Byte)
PWM Mode (PWM_MODE) FC10
OOOA T1 IROS (High Byte)
PWM Output Port (PWM_OUT) FCll·
OOOB Tl IROS (low Byte)
PWMl High 6-Bit (PWM1_HI) FC12
OOOC Reset Start Address
PWMl low 8-Bit (PWM_lO) FC13
J. On-chip Program ROM
(8K Byte) PWM2 6-Bit Register (PWM2) FC14
lFFF
PWM3 6-Bit Register (PWM3) FC1S
2000
PWM4 6-Bit Register (PWM4) FC16
J. Reserved
PWMS 6-Bit Register (PWMS) FC17
FBFF
PWM6 6-Bit Register (PWM6) FC18,
FCOO
PWM7 6-Bit Register (PWM7) FC19
J. Memory Mapped I/O
PWM8 6-Bit Register (PWM8) FC1A
FC32
PWM9 8-Bit Register (PWM9) FC1B
FC33
PWM10 8-Bit Register (PWM10) FC1C
J. Reserved
PWMll 8-Bit Register (PWMll) FC1D
FCFF
PWM12 8-Bit Register (PWM12) FC1E
FDOO
PWM13 8-Bit Register (PWM13) FC1F
J. Video Refresh RAM
FDF4
FDFS Port 4 Output Port (PORT4) FC30
J. Reserved Port S lED Output Port (PORTS) FC3l
FFFF Port 6 Input Port (PORT6) FC32
562
Memory Mapped Register. All control registers and I/O Register File. A total of 253 byte registers are implemented
ports (except Port 2 and Port 3) are assigned to program in tile Z8 core. Address 00 (HEX), 01 (HEX) and FO (HEX)
memory space. Address space FCOO (HEX) contains OSO are reserved. The register file consists of 21/0 Port registers,
control registers, PWM output registers and Ports 4, 5 and 236 generat-purpose registers and 15 control and status
6 I/O registers. Two bits of the decoded AFCIN port are registers (Figure 16). The instructions can access registers
assigned to Port 6 input port. LOE and LOEI instructions directly or indirectly with an 8-bit address field. This also
are required to transfer data between the Register File and allows short 4-bit register addressing using the Register
the Memory Mapped Registers. Pointer. In the 4-bit mode, tile register file is divided into
sixteen working-register groups, each occupying 16
Data Memory (10M). The Z86C27/C97 can address up to continuous locations. Tile Register Pointer addresses
64K bytes of program memory. and 56K bytes of external the starting location of the active working-register group
data memory. External data memory may be included with (Figure 17).
or separated from the external program memory space.
tOM, an optional I/O signal that can be programmed to Note: Register Bank EO-EF is only accessed through a
appear on Port 3 Pin P34, distinguishes between data and working register and indirect addressing modes.
program memory space.
Hex
Address
00 Port 0 (Internal)
01 Port 1 (Internal)
02 Port 2 (P2)
03 Port 3 (P3)
04
General - Purpose
Registers
EF
FO Reserved
F1 Timer Mode (TMR)
F2 Timer/Counter1 (T1)
F3 T1 Prescaler (PRE1)
F4 Timer/CounterO (TO)
F5 TO Prescaler (PREO)
F6 Port 2 Mode (P2M)
F7 Port 3 Mode (P3M)
F8 Port 0-1 Mode (P01 M)
F9 Interrupt Priority Reg (IPR)
FA Interrupt Request Reg (IRQ)
FB Interrupt Mask Reg (IMR)
FC Condition Ftag (FLAGS)
FO Register Pointer (RP)
FE Stack Pointer High (SPH)
FF Stack Pointer Low (SPL)
563
SPECIAL FUNCTIONS (Continued)
--~I
R239
R15
- - - - 1/0
- Ports
- - - - - R3
564
Stack. Either the internal register file or the external data driven by internal or external clock sources; however. the
rn ern ory is used for the stack. A 16-bit Stack Pointer is used TO pmscaler is driven by the internal clock only (Figure 18).
for the external stack. which can reside anywhere in data
memory. An 8-bit Stack Pointer is used for the internal The counter. but not the prescalers. are read at any time
stack that resides within the 236 general-purpose registers. without disturbing their value or count mode. Tile clock
source for T1 is user-definable and is the internal micro-
Counterffimers. There are two 8-bit programmable counter/ processor clock (XT AL clock/4). or an external signal input
tirners (TO-T1). each driven by its own 6-bit programmable via Port 3. P31. The counter/timers are programmably
prescaler (PREO and PRE 1). The T1 prescaler can be cascaded by connecting the TO output to the inpul of T1.
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit a-Bit
Down Down
Internal Counter Counter IRQ4
Clock
Serial 110
Clock
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P3 1
565
SPECIAL FUNCTIONS (Continued)
Interrupts. The DTC has six different interrupts from six follows: two sources are claimed by Port 3 (P30, P31), one
different sources. These interrupts are maskable and by VSYNC, two by the counter/timers, and one is software
prioritized (Figure 19). The six. sources are divided as triggered only.
IRO
IRO
IMR
6
Global
Interrupt IPR
Enable
Interrupt PRIORITY
Request LOGIC
Vector Select
566
HALT Mode. The Z86C27/C97 is driven by t~o internal
clocks, TCLK and SCLK, They both oscillate at the crystal FFNOP ; clear the pipeline
frequency. TCLK provides the clock signal for the counter- 6F STOP ; enter STOP mode
timers and the interrupt block. SCLK provides the clock or
signal for all other CPU blocks. Halt mode turns off the FFNOP ; clear the pipeline
internal CPU clock (SCLK), but not the XTAL oscillation. 7F HALT ; enter HALT mode
The counter/timers and external interrupts remain active.
The device may be recovered by interrupts, either external Notes:
or internally generated. In STOP mode, XlAl2 pin has an internal pull·up on it and OSCOUT has
an internal pull·down.
STOP Mode. TIle STOP instruction stops crystal oscillation,
thereby stopping both SCLK and TCLK. The device ceases Clock. The Z86C27/C97 on-clliposcillator has a high·gain,
parallel-resonant amplifier for connection to a crystal,
to operate. The S~OP mode can be released by two
ceramic resonator, or any suitable external clock source
methods. The first method is to reset the device. A high
(XTAL 1 = Input, XTAL2 = Output). The crystal is an AT cut,
input condition on Port 3 Pin P30 is the second method.
parallel resonant. 4 MHz max with a series resistance (RS)
After releasing the STOP mode by using either one of the
two methods, program execution begins at location %OOOC less than or equal to 100 Ohms.
(HEX). To complete an instruction prior to entering the
standby modes, a NOP instruction has to be placed before The crystal source is connected across XTAL 1 AND Xl AL2
using the recommended capacitors (10 pF < CL < 300 pF,
the HALT or STOP instructions. This is required because of
where C1=C2=CL) from each pin to ground (Figure 20).
instruction pipelining. i.e.:
C2 I
External Clock
Ceramic Resonator
or Crystal
.------<.----....--... XTAL1
6.aK
+-------1. XTAL2
33pF I I 33pF MPU
LC Oscillator Circuits
567
SPECIAL FUNCTIONS (Continued)
Watch Dog Timer (WDT). The Z86C27/C97 is equipped or may not be enabled during the HALT mode. The
with a watch dog timer which should be refreshed within 12 instruction WDH 4F (HEX) enables the timer during HALT
ms. Failure to refresh the timer results in a reset of the mode. lithe HALT mode is not released and the watch dog
device. The WDT is enabled the first time that a WDT 5F timer is not retriggered (by the WDT instruction) within 12
(HEX) instruction is executed. Every subsequent WDT ms, a device reset occurs.
instruction retriggers the timer. The watch dog timer may
Vee Voltage Sensitive Reset (VSR). Reset is globally driven
if Veeis below the specified voltage (Figure 21).
::: -t-J_=--------------t
2.40 -t--------'''''''IIk-----------------t
2.20 -t---------.::!111~------------_f
1.80 -t--------------~Ir"-------_I
1.60 -t------------------""-_;;::----_I
1.40 -+---,--r--T"""-...,..--r---r--r---T"""-,---t
-60 -40 -20· +0 20 40 60 80 100 120 140
Temperature
(DC)
568
ABSOLUTE MAXIMUM RATINGS
Stress greater than those listed under Absolute Maximum tions of these specifications is not implied. Exposure to
Ratings may cause permanent damage to the device. This absolute maximum rating conditions for extended periods
is a stress rating only; operation of the device at any may affect device reliability.
condition above those indicated in the operational sec-
NOles:
[1] Port 2 open-drain t Voltage on all pins with respect to GND.
[2] PWM open drain outputs tt See Ordering Information
[3] PortS
RLH
CAPACITANCE
T..:..=25°C, Vcc=GND=OV, Freq=1.0 MHz, unmeasured pins to GND.
Input capacitance 10 pF
Output capacitance 20 pF
I/O capacitance 25 pF
AFCin input capacitance 10 pF
569
DC CHARACTERISTICS
TA=O°Cto +70°C; Vcc=+4.5V to +5.5V; Fosc=4 MHz
Notes:
[1] Port5
[2] PWM Open Drain
AC CHARACTERISTICS
Timing Diagrams
XTAL1
Tin
570
IRQn
Vee
i4----{10 )---~
Internal/RESET
External/RESET
_---II
Figure 26. Power On Reset
H8YNC
08C2
571
AC CHARACTERISTICS
TA=O° C to 70 0 C; Vcc=+4.5V to +5.5V; Fosc=4 MHz,
8B TwlL 3TpC
9 TwlH Int request input high 3TpC
10 TdPOR Power On Reset delay 25 100 ms
11 TdLVIRES Low voltage detect to In- 200 ns
Internal RESET condition
Notes:
[11 Refer to DC Characteristics fer details on switching levels.
• Units in nanoseconds
572
AC CHARACTERISTICS
Unique to Z86C97 External Memory Read/Write Timing Diagrarn
RlIW
) (
~ r-®-
Port 0, 10M
)k: )
16
~ 3
Port 1
)k: A7-AO 07- DO IN
-
:l ~
~
lAS
II 8 18
1=0= ~ 6
lOS
~ II
(Read)
f--.®
~
Port1 A7-AO 07-00 OUT
k: ~~
I-®--
7
~
~k
lOS
(Write) Ii
573
AC CHARACTERISTICS
Unique to Z86C97, TA=O°C to 70°C; Vcc=+4.5V to +5.5V; Fosc = 4 MHz
Noles:
[1] When using extended memory timing, for parameters 3, 6,7,8, and 16, add 2TpC (250 ns@4.0MHz).
[2] Min and Max limes are In nanoseconds unless otherwise noted.
574
STANDARD CHARACTER SETS SUMMARY
Input/Output Circuits
ENGLISH/KOREAN vee
I I
LSD 0 I 1 I 2 I 3 MiD4 I 5 I 6 I 7 I
20 Ohm
IN--<.
vee
20 Ohm
IN ---<
vee
PAD
OUT----l
575
SUMMARY (Continued)
Input/Output Circuits vee
OEN ------.---------~
PAD
O~--------~----~~
20
Ohm
IN -----------------~I-------------'
""\I
00
OEN -----1~---------I
IN
vee
OEN ------~--------__I
PAD
OUT
576
-r-,I--N
vee
I
-------.-I
PAD
OUT -f>o--I N
vee
RPU
20 Ohm PAD
RESET ----,x:
5T7
SUMMARY (Continued)
Input/Output Circuits
vee
STOP ------<
vee
P67 -----<C
1R
20 Ohm
P66 - -.....
XT AL 1, OSC1N
XT AL2, OSCour High gain start, low
gain run amplifier circuit
IRESET 8
POO-07 6 Z86C97 only
P10-17 4 Z86C97 only
P20-P27 5
P30-P31 2
P34-P36 3
P40-P47 3 Z86C27 only
P50-P57 3 Z86C27 only
P60-P65 2 Z86C27 only
578
DTC CONTROL REGISTER DIAGRAMS
Port Registers
t STOP Mode
Recovery Input
Figure 41. Port 4 Register
Figure 44. PWM 1 High Value Figure 45. PWM 1 Low Value
579
DTC CONTROL REGISTER DIAGRAMS
PWM Registers (Continued)
PWM3Value PWM8Value
1 PWMS,Value 1 PWM10Value
8.
PWM6 VAL %FC18
s 14131211101
1
%FC1D
PWM11 Value
580
PW12 VAL %FC1E PWM MODE %FC10
17161514131211101 17161514131211101 Mode Control
o PWM
I TTTTTTTT 1 Output Port
PWM12 Value 87654321
Figure 57. PWM 13 Value Register Figure 59. PWM pon Output Register
581
DTC CONTROL REGISTER DIAGRAMS
OSD Registers (Continued)
I Vertical Index
Figure 67. aso Bar Position Register
Figure 65. aso Fade Position Register
582
DTC CONTROL REGISTER DIAGRAMS
Z8 Micrqcomputer Control Register Diagrams
R240 FOh
1 7 1 6 1 5 1 4 131211101
o . No Function
1 - Load T1
R244 TO F4h
o - Disable T1 Count
1 - Enable T1 Count 17161514131211101
TOUT Modes
00 Not Used Figure 72. CounterlTimer 0 Register
01 TO Out (F4H; ReadlWrite)
10 T1 Out
11 Internal Clock Out
17161514131211101 Reserved
Prescaler Modulo
IL.-_____ T1 Initial Value (Range: 1-64 Decimal
(When Written) 01-00 Hex)
(Range: 1·256 Decimal
01-00 Hex)
T1 Current Value Figure 73 Prescaler 0 Register
(When Read)
(F5H; Write Only)
583
DTC CONTROL REGISTER DIAGRAMS
Z8 Microcomputer Control Register Diagrams (Continued)
R246P2M F6h
17161514131211101
I P27 - P20 I/O Definition
o Defines Bit as Output
1 Defines Bit as Input
R247P3M F7h
8 6 1 5 1 4 13\2\1101
@~
0- Port 2 Open Drain
1 - Port 2 Push-Pull
Reserved
o P32 - Input P35 - Output
1 Reserved
00 P33 - Input P34 - Output
~~ } P33 - Input P34 -/DM
11 R~served
584
P03-POO Mode
00 Reserved
01 Reserved
1x A11-AB
Stack Selection
o Reserved
1 Reserved
P17-P10 Mode
00 Byte Output
01 Byte Input
10 AD7-ADO
11 Reserved
External Memory Timing
o Normal
1 Extended
P07-P04 Mode
00 Reserved
01 Reserved
1x A15-A12
R2491PR F9h
17161514131211101
-,--
-r T Interrupt Group Priority
000 Reserved
001 C >A> B
010 A> B> C
011 A> C> B
100 B>C>A
101 C>B>A
110 B>A>C
111 Reserved
' - - - IR01, IR04 Priority (Group C)
o IR01 > IR04
1 IR04>IR01
IROO, IR02 Priority (Group B)
o IR02>IROO
1 IROO>IR02
IR03, IR05 Priority (Group A)
o IR05>IR03
1 IR03 > IR05
Reserved
585
DTC CONTROL REGISTER DIAGRAMS
Z8 Microcomputer Control Register Qiagrams (Continued)
11 TT2:::: ~:~:~
Figure 83. Stack Pointer
(FFH; Read/Write)
586
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to d~ Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only a Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
587
CONDITION CODES
588
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD. AND. CPo
ORllll0 I dstlsrc I DECW, INC, INCW,
POP, PUSH, RL, RLC, src OR
LD. OR. SBC. SUB.
TCM. TM.XOR
RR, RRC, SRA, SWAP dst OR
OPC JP, CALL (Incirecl)
dsl lOR 1
1110 I dsl OPC I MODE ADC. ADD. AND. CPo
dst OR I 1110 I dst
LD. OR. SBC. SUB.
TCM. TM.XOR
OPC SRP VALUE
VALUE
MODE I OPC lO
ADC, ADD, AND, cp, src OR
OR, SBC, SUB, TCM,
dst OR
TM,XOR
lO
OR 1111 0 I src cc I OPC JP
DAU
lO DAL
OPC CALL
DJNZ, JR DAU
DAL
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (nl" is used to refer to bit (n) of a given
" f- ". For example: operand location. For example:
indicates thai the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
589
INSTRUCTION SUMMARY (Continued)
t -
INCWdst RR AO -
***- -
ANOdst, sre
dst~dst AND sre
5[ ]
** 0
- - dst~dst + 1 IR A1
IRET BF
CALLdst DA De - - - - - - FLAGS~@SP;
******
SP~SP-2 IRR D4 SP~SP+ 1
@SP~PC, PC~@SP;
PC~dst SP~SP+ 2;
IMR(7)~1
CCF EF
*- - - - -
C~NOTC JP ee, dst DA eD - - - - - -
if ee is true e=0-F
CLR dst R BO - - - - - - PC~dst IRR 30
dst~O IR B1
JRee, dst RA eB - - - - - -
COMdst R 60 -
** 0 - - if ce is true, e = 0- F
dst~NOTdst IR 61 PC~PC+ dst
Range: +127,
CP dst, src
dst - src
t A[ 1 ****-- -12S
LO dst, sre 1m rC - - - - - -
- -
OA'dst
dst~DA dst
R
IR
40
41
*** X
dst~sre r
R
R rS
r9
r= 0- F
DEC dst R 00 - ***-- X C7
dst~dst -1 IR 01 X r D7
r Ir E3
OECWdst
dst~dst -1
RR
IR
SO
81
-
***-- Ir
R
r
R
F3
E4
R IR E5
01 SF - - - - - - R 1M E6
IMR(7)~ IR 1M E7
IR R F5
OJNZr, dst RA rA - - - - - -
r~r-1 r = 0- F LOCdst, sre Irr C2
ifr .. O
PC~PC+ dst LOCI ds!, src Ir Irr C3 - - - -
Range: +127, dst~sre
-128 r~r +1;
rr~rr +1
EI 9F - - - - - -
IMR(7)~1
HALT 7F - - - -
590
INSTRUCTION SUMMARY (Continued)
NOP FF STOP 6F
PUSH src R 70 - - - - - -
17
25 o1
SPf-SP - 1;
@SPf-src
IR 71 TCM dst, src
(NOTdst)
t 6[ ] - ** 0
- -
ANOsrc
RCF CF 0 - - - - -
Cf-O TMdst, src
dstANO src
t 7[ ] - ** 0
- -
RET AF - - - - - -
PCf-@SP;
SPf-SP + 2
XOR dst, src
dstf-dst
t 8[ ] - ** 0
- -
XOR src
RLdst R 90
****- -
~ IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ r
RLCdst R
IR
10
11
****-- in this table, and its value is found in the following lable to the left of the
R R [4]
SCF OF 1 - - - - -
Cf-1
R IR [5]
SRAdst R 00
*** 0
- - R 1M [6]
IR 01
@ IR 1M [7]
SRP src 1m 31 - - - - - -
RPf-src
591
OPCODEMAP Lower Nibble (Hex)
o 2 3 4 5 678 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R1 IR1 '1, ,2 '1,1'2 R2, R1 IR2, R1 Rl,IM IR1,IM ,1, R2 '2, Rl ,1,RA ee, RA '1, 1M ee. DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 -
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRI rl, r2 ,1,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5
-
2 INC INC SUB SUB SUB SUB SUB SUB
R1 IR1 '1, r2 ,1,lr2 R2, Rl IR2, Rl R1,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r---
3 JP SRP SBC SBC SBC SBC SBC SBC
IRR1 1M '1, ,2 rl,lr2 R2, Rl IR2. Rl Rl,IM IR1,IM
4
8.5
DA
8.5
DA
6.5
OR
6.5
OR
10.5
OR
10.5
OR
10.5
OR
10.5
OR
r--s:o
WDH
Rl IR1 '1, ,2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
5
10.5
POP
10.5
POP
6.5
AND
6.5
AND
10.5
AND
10.5
AND
10.5
AND
10.5 r---s:o
AND WDT
Rl IR1 rl, r2 rl,I,2 R2, Rl IR2, Rl Rl,IM IR1.IM
6
6.5
COM
6.5
COM
6.5
TCM
6.5
TCM
10.5
TCM
10.5
TCM
10.5
TCM
10.5
TCM
r---s:o
STOP
.,
)( Rl IRI rl, ,2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
~ 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 I"7.iJ
m 7 PUSH PUSH TM TM TM TM TM TM HALT
':0 R2 IR2 rl, r2 rl.lr2 R2,Rl IR2, Rl Rl,IM IR1,IM
.Q
Z
.,0.
~
10.5 10.5 12.0 18.0 t-"6.1
8 DECW DECW LDE LOEI DI
0. RRI IRI rl,lrr2 Ir1,lrr2
:;)
9
6.5 6.5 12.0 18.0 t--s.1
RL RL LDE LDEI EI
R1 IR1 r2,lrr1 1'2,lrrl
10.5 10.5 6.5 6.5 10.5 10:5 10.5 10.5 I'J'4.o
A INCW INCW CP CP CP CP CP CP RET
RRI IR1 r1, r2 ,1.lr2 R2, Rl IR2, R1 Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t-"-i6.o
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IR1 rl, ,2 r1,lr2 R2, Rl IR2, R1 Rl,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 ts:5
C RRC RRC LDC LDCI LD RCF
Rl IR1 r1,lrr2 Ir1,lrr2 rl,x,R2
D
6.5 6.5 12.0 18.0 20.0 20.0 10.5 t---s.5
SRA SRA LDC LOCI CALL' CALL LD SCF
R1 IR1 r2,lrr1 1'2,lrr1 IRR1 DA r2,x,Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 t---s.5
E RR RR LD LD LD LD LD CCF
R1 IR1 rl,IR2 R2, Rl IR2, R1 R1,IM IR1,IM
F
8.5 8.5
SWAP SWAP
6.5
LD
10.5
LD
r--s:o
NOP
R1 IRI Ir1, r2 R2.IRI
. T
A
.."
A
V ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble , = 4-bit address
Execution Pipeline R 1or r 2 = Ost address
Cycles J Cycles R 1or r 2 = Src address
Sequence:
Opcode, First Operand.
Mnemonic Second Operand
592
ADVANCE INFORMATION SPECIFICATION
~Zilill
Z86127
LOW-COST DIGITAL
TELEVISION CONTROLLER (LDTC)
FEATURES
• Low cost
• Watch Dog/Power-On Reset Timer
• 8 Kbytes of ROM
• One Pulse Width Modulator (14-bit resolution) for
voltage synthesis tuner control.
'i.'
• 236 bytes of RAM
GENERAL DESCRIPTION
The Z86127 Low-Cost Digital Television Controller (LDTC) package. in which only 52 are active. and are CMOS
introduce a new level of sophistication to single-chip compatible. The LDTC offers mask programmed ROM
architecture. The Z86127 is a member of the Z8l»single- which enables the Z8 microcontrolier to be used in a high
chip microcontroller family with 8 Kbytes of ROM and 236 volume production application device embedded with a
bytes of RAM. The device is housed in a 64-pin DIP custom program (customer supplied program).
593
GENERAL DESCRIPTION (Continued)
Zilog's LDTC offers fast execution, efficient use of memory, ports are used for controlling audio signal level. Five 8-bit
sophisticated interrupts, input/output bit manipulation ca- PWM ports are used to vary picture levels.
pabilities, and easy hardware/software system expansion
along with low cost and low power consumption. The The LDTC applications demand powerful I/O capabilities.
device provides an ideal performance and reliability solu- The Z86127 fulfills this with 271/0 pins dedicated to input
tion for consumer a(ld industrial television applications. and output. These lines are grouped into four ports, and
are configurable under software control to provide timing,
The Z86127 architecture is characterized by utilizing Zilog's status signals, parallel I/O and an address/data bus for
advanced SuperintegrationThl design methodology. The interfacing to external memory.
devices have an 8-bit internal data path controlled by a Z8
microcontroller, and On Screen Display (OSD) logic cir- There are three basic address spaces available to support
cuits/Pulse Width Modulators (PWM). On-chip peripherals this wide range of configurations: Program Memory, Video
include two register mapped I/O ports (Ports 2 and Port 3), RAM, and Register File .The Register File is composed of
Interrupt control logic (1 software, 2 external and 3 inlernal 236 byies of general purpose registers, two I/O Port
interrupts) and a standby mode recovery input port (Port 3, registers, 15 control and status registers and 3 reserved
pin POO). registers.
The OSD control circuits support 8 rows by 20 columns of To unburden the program from coping with the real-time
characters. The character color is speCified by row. One of problems such as counting/timing and data communica-
the 8 rows is assigned to show two kinds of colors for bar tion, the LDTC's offer's two on-chip counter/timers with a
type displays such as volume control. The OSD is capable large number of user selectable modes (Figure 1).
of displaying either low resolution (5x7 dot pattern) or high
resolution (11x15 dot pattern) characters. The Z86C97 Note: All Signals with a preceding front slash, "/", are active
currently supports high resolution characters only. Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
active Low, only)
A 14-bit PWM port provides enough voltage resolution for
a voltage synthesizer tuning system. Three 6-bit PWM
XTAl1 P27
8K Byte
XTAl2 Program ROM P26
IRESET P25
Port 2 P24
Z8CPU P23
Core P22
PaO - -I-":'::::::"'~ P21
P20
Pal
P34
P35 PWMl
P36 14 -bit PWMl
P50( POOl ~- ,----
P51(POl )
P52(P02) PWM6
to
P53(P03) Port 5
PWM8
P54(P04) (PortO) 6-bit PWM6
P55(P05) PWM7
P56( POO) I--_ _ _..t--~ PWM 8
595
PIN CONFIGURATION
N/C PWM6
N/C PWM7
N/C PWM8
N/C PWM9
PWM1 ·PWM10
P35 PWM11
P36 PWM12
P34 PWM13
P31 P27
pao P26
XTAL1 P25
XTAL2 P24
IRESET P23
P60 GND
GND Z86127 P22
P61 (LDTC) P21
P62 VCC
VCC P20
P63 Vss
P64 Vss
P65 Vss
AFCIN Vss
P50 Vss
P51 Vss
P52 Vss
P53 Vss
P54 VBLANK
P55 VBLUE
P56 VGREEN
P57 VRED
OSCIN VSYNC
OSCOUT HSYNC
596
PIN IDENTIFICATION
64-pin DIP Z86127
1 N/C No Connection
2 N/C No Connection
3 N/C No Connection
4 N/C No Connection
597
PIN DESCRIPTION
XTAU, XTAL2. (Time-based input. output, respectively). VSYNC. (input Schmitt triggered, CMOS level). Vertical
These pins connect to the internal parallel-resonant clock Sync is an input pin that accepts an externally generated
crystal (4 MHz max) oscillator circuit with 2 capacitors to Vertical Sync signal of either negative or positive polarity.
GND. XTAL1 is also used as an external clock input.
()SC1N' OSC our' (Video Oscillator input, output, respec-
lAS. Address Strobe (output. active Low) is pulsed once at tively). Oscillator input and output pins lor on-screen
the beginning of each machine cycle. Address output is display circuits. These pins connect to an inductor and two
via Port 0 and Port 1 for all external programs. Memory capacitors to generate the character dot clock (typically
address transfers are valid at the trailing edge of lAS. around 6MHz). The dot clock frequency determines the
Under program control, lAS can be placed in the nigh character pixel width and phase synchronized to HSYNC.
impedance state along with Port 0 and Port 1, Data Strobe
and Read/Write. Vblank. Video Blank (output). CMOS output, program-
mable polarity. Used as a superimpose control port to
IDS. Data Strobe (ouiput, aciive Low) is active once for display characters from video RAM. The signal controls
each external memory transfer. For READ operations, data Y signal output of the CRT and turns off the incoming video
must be available prior to the trailing edge of IDS. For display while the characters in video RAM are superim-
WRITE operations, the falling edge of IDS indicates the posed ori the screen. The red, green, and blue outputs
output data is valid. drive the three electron guns on the CRT directly, while the
blank output turns off the Y signal.
RlIW. Read/Write (output. Write active Low) Signal is low
when the DTC is writing to the external program or data Vblue. Video Blue (output). CMOS Output of the Blue video
memory. signal (8-Y) and is programmable lor either polarity.
SCLK. System Clock. SCLK is the internal system clock. It Vgreen. Video Green (output). CMOS Output of the Green
can be used to clock external glue logic. video signal (G-Y) and is programmable for either polarity.
HSYNC. (input Schmitt triggered, CMOS level). Horizontal Vred. Video Red (output). CMOS Output of the Red video
Sync is an input pin that accepts an externally generated signal (R-Y) and is programmable for either polarity.
Horizontal Sync signal of either negative or positive
polarity.
598
Port 2 (P20-P27). Port 2 is an 8-bitport, CMOS compatible,
bit programmable for either input or output. Input buffers
are Schmitt triggered. Bits programmed as outputs may be
globally programmed as either push-pull or open-drain
(Figure 3).
-
-
Z86127
Port 2
(I/O)
- --
-
00 -------1
OEN ---~~-----~
PAD
OUT - - - - - - - - - - - - U
_-
..... 20
Ohm
IN -----------~JT~-------~
599
PIN DESCRIPTION (Continued)
Port 3 (P30-1, P34-5 and P36). Port 3 Pin P30 input, is read in IRQ2 to initiate an IRQ2 vectored interrupt if appropri-
directly. A negative edge event is latched in IRQ3 to initiate ately enabled. P31 high is signified as the T'N signal to
an IRQ3 vectored interrupt if appropriately enabled. An Timer1. Port 3, Pin P34 and Pin P35 are general purpose
application could place the device in STOP mode when output lines. Port 3, Pin P36 can be used as a general
P30 goes low (in the IRQ3 interrupt routine). P30 initiates a purpose output or as an output for TOUT (from Timerl or
STOP mode recovery when it subsequently goes high. Port Timer2) or SCLK (Figure 4).
3, Pin P31 is read directly. A negative edge event is latched
1 . . . __---'.._
Z86127 Port 3
>- (VA or
Control)
-
vee vee
PAD
20 Ohm
IN
OUT ---""--1
Note: Input Only, Schmitt-triggered, Pad Type 2 Note: Output Only, Pad Type 3
600
Port 5 (P50-P57). Port 5 is an 8-bit, CMOS compatible,
Output Port. The output ports can directly sink 10 mA at1.5
Volt VOL' They are typically used to drive multiplexed LED
displays (Figure 5).
-
-"
Z86127
Port 5
Output
-
vee
PAD
OUT ----~--t N
601
PIN DESCRIPTION (Continued)
Port 6 (P60·P65). Port 6 is a 6·bit, Schmitt triggered CMOS
compatible, input port. The outputs of the AFC campara·
tors internally feed into the Port 6, bit·6 and bit·? inputs
(Figure 6).
- ..
...
.. PortG
Z85127
.... Input
...
.... AFCIN
-
VCC
IN
602
AFCIN. (Comparator input port, memory mapped). The comparator outputs are internally connected to Port 6, bit-
input signal is supplied to two comparators with VTH1= 6 and bit-7. AFC'N is typically used to detect AFC voltage
2(5 Vee and VTH2=3/5 Vee typical threshold voltage. The level to accommodate digital automatic fine tuning func-
tions (Figure 7),
VCC
P67
Internal,
Databus
P66
Internal
Databus
603
PIN DESCRIPTION (Continued)
Pulse Width Modulator 1 (PWM). PWM1 is typically used In either case, the output drivers are 12-volt open-drain
as the D{A converter for Voltage Synthesis Tuning systems. circuits.
Pulse Width Modulator 6-8 (PWM). PWM6-PWM8 are Pulse IRESET. System Reset. Code is executed from memory
Width Modulators with 6-bit resolution. address OOOC (HEX) after the /RESET pin is set to a high
level. The reset function is also carried out by detecting a
Pulse Width Modulator 9-13 (PWM). PWM9-PWM 13 are Vee transition state (automatic power on reset) so that the
Pulse Width Modulator circuits with 8-bit resolution or external reset pin can be permanently tied to Vee' A low
ihdividually programmed as general purpose outputs. level on {RESET forces a restart of the device.
SPECIAL FUNCTIONS
The Z8 LDTC incorporates special functions to enhance control, and PWM9-PWM 13 (5 channels of 8-bit resolution)
the Z8's application in consumer, industrial and television typically used for picture level control. The PWM control
control applications. registers are mapped into external memory and are
accessed via LDE and LDEI instructions.
Pulse Width Modulator (PWM). The LDTC has nine PWM
channels (Figure 12). There are three types of PWM On Screen Display (OSD). The OSD has a capability 01
circuits:PWM1 (1 channel of 14-bit. resolution) typically displaying 8 rows by 20columns of 128 kinds of characters
used for Voltage Synthesis Tuning, PWM6-PWM8 (3 chan- for either high resolution (11 x15 dots) or low resolution (5x7
nels of 6-bit resolution) typically used for audio level dots) pattern (Figures 8 and 9).
604
!RESET
I An° 1 A!r
I 14-Bit Binary -I PWMOu~m ,II ,I
XTAl
I Down Counter
I Port Reg
FC11h
PWM Mod Reg
FC10h
~ 14-Bit
PWMl
Upper7-B~
I
I
13-0 6-0
13-7
13-7
7-Bit
Comparator
!
RS&DF~
7-0
~
Jr o
I - PWM1 push-pull
AD7-0
~ Reg
Lower7-B~ 6-0
Pulse
output
I
::a Distributer
FC12-3h
~ 6-Bit
h 5-0
I 5-0
l- I- MPX I-- PWM6 (Open-drain)
I--
I-- I - PWMB (Open-drain)
I FC19h
I FC1Ah ~ RSFF I-- I--
'--
7-0
L. 8-Bit
7-0 7-0
PWM9 8-Bit
AD7-0 c::: Reg Comparator
RSFF
I--
PWM9(Open...drain)
0--- I RSFF PWM10 (Open-drain)
FC1Bh
r--- I RSFF PWMll (Open-drain)
I FC1Ch I RSFF PWM12 (Open-drain)
I FC1Dh
T FC1Eh ~ PWM13 (Open-drain)
I FC1Fh I
605
tn
~
o
"'tI
3>
-r""
A07-0 A07-O
."
C
Z
~
oZ
tn
'0
o
::::l
<::!".
"TI ::::l
cC c:
c CD
i OSCIN S
!" OSCOUT
0
:s
Video Character Sub
W "'VSH-l1 • VSYNC RAM Generator DOT
C
in
"C
VSYNC
~
trJ
~
~
c VBLANK
iii'
ce
iii
RowATTR
Reg
I ~ RED
3 GREEN
BLUE
• Character Color: Seven kinds of color are specified on • Bar Line Type Display: One of the rows is selected to
a row basis. display an analog bar line every half column by setting
second color with proper character set.
• Character Pixel Size: Four character pixel sizes are
selected for a low resolution (2HL, 4HL, 6HL and 8HL) • Fringe Function: Fringe olflon and the color selecled.
and high resolution (1 HL. 2HL, 3HLand 4HL) Horizontal
Line (HL). • Background Color: Eight kinds of color including black
background color.
• Polarity Selections: Can select active low or high for
horizontal/vertical sync input and RGB outputs. • ON/OFF Control: Cilaracter display, backgrounds are
turned on and off.
• Display Position: Can display 64 vertical positions by
4HL units and 64 horizontal positions by a 4 dot clock. • Number of Display Characters: 8 rows x 20 columns.
• Inter Row Spacing: Inter row vertical line spacing is set • Character Sel: 128 (5x7 dots or 11x15 dots).
from 2HL to 25HL (17HL for high resolution).
607
SPECIAL FUNCTIONS (Continued)
00
01
02
03
04
05
06
07
08
09
OA
OB
OC
00
OE
OF
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
10
1E
1F
20
J-
3F
FCO
High Resolution
J- Character Pattern
FOF
FEO
High Resolution
J- Character Pattern
FFF
MSB LSB
(6-Blt Wide)
608
00
01
02
03
04
05
06
07
08
09
OA
OB
OC
00
OE
OF 1st Character 2nd Character
20
21
22
23
24
Low Resolution
J. Character Pattern
2F
40
Low Resolution
J. Character Pattern
Chained Character Pattern
4F
60
Low Resolution
J. Character Pattern
SF
FCO
Low Resolution
J. Character Pattern
FCF
FEO
low Resolution
J. Character Pattern
FEF
MSB LSB
(S-Bit Wide)
609
SPECIAL, FUNCTIONS (Continued)
Program Memory. The program ROM size is 8·Kbytes the specified vector address. IRQ1 veclor is fixed 10
(Figure 11). The IRQ vector table is located in the lower VSYNG interrupt request and occurs at the leading edge
address space. The vector address is fetched after the of the filtered VSYNG input. Program memory slart at
corresponding interrupt and program control is passed to address OOOG (HEX) after reset.
Hex Hex
Address Address
610
Memory Mapped Register. All control registers and I/O registers, 236 general-purpose registers and 15 control
ports (except Port 2 and Port 3) are assigned to program and status registers (Figure 12). The instructions can
memory space. Address space FCOO (HEX) contains OSO access registers directly or indirectly with an 8-bit address
control registers, PWM output registers and Ports 5 and 6 field. This also allows short 4-bit register addressing using
I/O registers. Two bits of the decoded AFCIN port are the Register Pointer. In the 4-bit mode, the register file is
assigned to Port 6 input port. LOE and LOEI instructions divided into sixteen working-register groups, each occu-
are required to transfer data between the Register File and pying 16 continuous locations. The Register Pointer ad-
the Memory Mapped Registers. dresses the starling location of the active working-register
group (Figure 13).
Register File. A total of 253 byte registers are implemented
in the Z8 core. Address 00 (HEX), 01 (HEX) and FO (HEX) Note: Register Bank EO-EF is only accessed through a
are reserved. The register file consists of 2 I/O Port working register and indirect addressing modes.
Hex
Address
02 Port 2 (P2)
03 Port 3 (P3)
04
General - Purpose
Registers
EF
FO Reserved
F1 Timer Mode (TMR)
F2 Timer/Counter1 (T1 )
F3 T1 Prescaler (PRE1)
F4 Timer/CounterO (TO)
F5 TO Prescaler (PREO)
F6 Port 2 Mode (P2M)
F7 Port 3 Mode (P3M)
Fa Port 0-1 Mode (P01M)
F9 Interrupt Priority Reg (IPR)
FA Interrupt Request Reg (IRQ)
FB Interrupt Mask Reg (IMR)
FC Condition Flag (FLAGS)
FD Register Pointer (RP)
FE Stack Pointer High (SPH)
FF Stack Pointer Low (SPL)
611
SPECIAL FUNCTIONS (Continued)
R239
R15
I- - - - - - - - - -
R3
I/O Ports
612
Stack. Either the internal register file or the external data driven by internal or external clock sources; however, the
rnemory is used for the stack. A 16-bit Stack Pointer is used TO prescaler is driven by the internal clock only (Figure 14).
for the external stack, which can reside anywhere in data
memory. An 8-bit Stack Pointer is used for the internal The counter, but not the prescalers, are read at any time
stack that resides within the 236 general-purpose without disturbing their value or count rnode. The clock
registers. source for T1 is user-definable and is the internal micropro-
cessor clock (XTAL clock/4), or an external signal input via
CounterfTimers. There are two 8-bit programmable counter/ Port 3, P31. The counter/timers are programmably cas-
timers (TO-T1), each driven by its own 6-bit programmable caded by connecting the TO output to the input of T 1.
prescaler (PREO and PRE1). The T1 prescaler can be
PREO TO TO
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-Bit
Down Down
Internal Counter Counter IRQ4
Clock
~-... Serial 110
Clock
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
613
SPECIAL FUNCTIONS (Continued)
Interrupts. The LDTC has six different interrupts from six follows: two sources are claimed by Port 3 (P30. P31). one
different sources. These interrupts are maskable and by VSYNC. two by the counter/tiiners. and one is software
prioritized (Figure 15). The six sources are divided as. triggered only.
IRQ
IRQ
IMR
6
Global
Interrupt IPR
Enable
Interrupt PRIORITY
Request LOGIC
Vector Select
614
HALT Mode. The Z86127 is driven by two internal clocks, FFNOP ; clear the pipeline
TCLK and SCLK, They both oscillate at the crystal fre- 6F STOP ; enter STOP mode
quency. TCLK provides the clock signal lor the counter- or
timers and the interrupt block. SCLK provides the clock FFNOP ; clear the pipeline
signal for all other CPU blocks. Halt mode turns off the 7F HALT ; enter HALT mode
internal CPU clock (SCLK), but not the XTAL oscillation.
The counter/timers and external interrupts remain active. Nole:
The device may be recovered by interrupts, either external In STOP mode. XTAL2 pin has an internal pull-up on it and OSCOUT has
or internally generated. an internal pull-down.
STOP Mode. The STOP instruction stops crystal oscilla- Clock. The Z86127 on-chip oscillator has a high-gain,
tion, thereby stopping both SCLK and TCLK. The device parallel-resonant amplifier for connection to a crystal,
ceases to operate. The STOP mode can be released by ceramic resonator, or any suitable external clock source
(XTAL 1 = Input, XTAL2= Output). The crystal is an AT Cllt,
two methods. The first method is to reset the device. A high
parallel resonant, 4 MHz max with a series resistance (RS)
input condition on Port 3 Pin P30 is the second method.
After releasing the STOP mode by using either one of the less than or equal to 100 Ohms.
two methods, program execution begins at location OOOC
The crystal source is connected across XT AL 1 AND Xl AL2
(HEX). To complete an instruction prior to entering the
using the recommended capaCitors (10 pF < CL < 300 pF,
standby modes, a NOP'instruction has to be placed before'
where C1=C2=CL) from each pin to ground (Figure 16).
the HALT or STOP instructions. This is required because of
instruction pipelining. Le.:
XTAL2
.---------~ XTAL2
C2 I
External Clock
Ceramic Resonator
or Crystal
XTAL1
LC Oscillator Circuits
615
SPECIAL FUNCTIONS (Continued)
Watch Dog Timer (WDT). The Z86127 is equipped with a vcc Voltage Sensitive Reset (VSR). Reset is globally driven
watch dog timer which should be 'refreshed within 12 ms. if Vccis below the specified voltage (Figure 17).
Failure to refresh the timer results in a reset of the device.
The WDT is permanently enabled.
V BO 3.60
3.40-+--:----------------------~
3.20~--~---~~----------------~
3.00-+---------~r--------------~
2.80 -1------------,:-----------_1
2.60 -t---------------~r_-------_t
2.40 -+-------------------=~...- = : - - - - - I
2.20 -i---'---"'T""-...,.---r---r----r--,---r--..r---t
616
ABSOLUTE MAXIMUM RATINGS
Stress greater than those listed under Absolute Maximum sections of these specifications is not implied. Exposure to
Ratings may cause permanent damage to the device. This absolute maximum rating conditions for extended periods
is a stress rating only; operation of the device at any may affect device reliability.
condition above those indicated in the operational
Notes:
[1] Port 2 open-drain
[2] PWM open drain outputs
[3] PortS
t Voltage on all pins with respect to GND.
tt See Ordering Information
From Output
Under Test D----"T--I
RLH
617
CAPACITANCE
TA=25°C; Vcc=GND=OV; Freq=1.0 MHz; unmeasured pins to GND.
Input capacitance 10 pF
Output capacitance 20 pF
I/O capacitance 25 pF
AFCin input capacitance 10 pF
DC CHARACTERISTICS
TA=O°C to +70°C; Vee=+4.5V to +5.5V; Fosc=4 MHz
VIHC Input XTAL/Osc in High 0.8 Vee Vee 3.0 V External Clock Generator Driven
VIf( Schmitt Hysteresis 0.1 Vee 0.8 V
VPIJ Maximum Pull-up Voltage 12 V [2]
Noles:
[1) Port 5
[2) PWM Open Drain
618
AC CHARACTERISTICS
Timing Diagrams (Figures 19-23)
XTALl TIn
IROn
619
AC CHARACTERISTICS
Timing Diagrams (Continued)
Vee
i4---{10}-----"""i
Internal/RESET
External/RESET
_---II
Figure 22. Power On Reset
H8YNC
08C2
620
AC CHARACTERISTICS
TA=O° C to 70 0 C; Vcc=+4.5V to +5.5V; Fosc=4 MHz,
88 TwlL 3TpC
9 TwlH Int request input high 3TpC
10 TdPOR Power On Reset delay 25 100 ms
11 TdLVIRES Low voltage detect to In- 200 ns
Internal RESET condition
Noles:
[1) Refer to DC Characteristics for details on switching levels.
• Units in nanoseconds
621
STANDARD CHARACTER SETS SUMMARY
Input/Output Circuits (Figures 24-32)
ENGLISH/KOREAN
vee
ILSD I 0 I 1 I 2 I 3MiD4 I 5 I 6 I 7 I
IN ----<
vee
20 Ohm
IN--<
vee
PAD
OUT -----*--1
622
vee
OEN ----~----------~
PAD
OUT -------.--01 20
Ohm
IN ----------------~~I---------~
00
OEN ------~--------~
IN ----~-------'
vee
OEN ----+-----~
PAD
OUT ----------~~L-~
623
SUMMARY (Continued)
Input/Output Circuits
vee
T I PAD
jl---N-.---.
vee
20 Ohm
PAD
RESET ----{)~
624
vee
STOP
vee
P67 ---....c:
lR
20 Ohm
P66
2R
XTAL 1, OSCIN
XT AL2, OSC our High gain start, low
gain run amplifier circuit
IRESET 8
P20-P27 5
P30-P31 2
P34-P36 3
P50-P57 3
P60-P65 2
AFCIN 9
HSYNC, VSYNC 2
VRED,VBLUE,VGREEN, 3
VBLANK 3
PWM1 3
PWM [2, 6 -13] 7
625
DTC CONTROL REGISTER DIAGRAMS
Port Registers (Figures 33-49)
1 STOP Mode
Recovery Input
Figure 36. Port 5 Register
I
, L . I_ _ _
Figure 38. PWM 1 High Value Figure 39. PWM 1 Low Value
626
PWMS VAL %FC18 PWM10 VAL %FC1Ch
• • 514131211101 17161514131211101
627
DTC CONTROL REGISTER DIAGRAMS
PWM Registers (Continued)
Figure 48. PWM Mode Register Figure 49. PWM pon Output Register
628
Inter Row Space Row Address
Fade Direction Blue Bar Color
0- Fade After Green Bar Color
1 - Fade Before
Red Bar Color
Fade On-Off Bar Color Enable
0- Off
1 - On
Figure 56. OSD Bar Control Register
Figure 54. OSD Row Space Register
• • 514131211101
I Bar Column Position
Vertical Index
Figure 55. OSD Fade Position Register Figure 57. OSD Bar Position Register
629
DTC CONTROL REGISTER DIAGRAMS
Z8 Microcomputer Control Register Diagrams (Figures 58-72)
R240 FOh
171 6 1514131211101
o - No Function
1 - Load T1 R244 TO F4h
o - Disable T1Count 17161514131211101
1 - Enable T1 Count
I TO Initial Value
liN Modes
00 External Clock Input (When Written)
01 Gate Input (Range: 1-256 Decimal
10 Trigger Input 01-00 Hex)
(Non-retriggerable) TO Current Value
11 Trigger Input (When Read)
(Retriggerable)
L -_ _ _ _ _ _ _ _ TOUT Modes
Figure 62. CounterlTimer 0 Register
00 Not Used (F4H; ReadlWrite)
01 TOOut
10 T1 Out
11 Internal Clock Out
630
R246 P2M F6h
1 7 \6\s\4\3\21 1 \01
R247P3M F7h
8 6 \sI 4 1 3 \2\1\01
~~OO
0 - Port 2 Open Drain
1 - Port 2 Push-Pull
Reserved
o P32 - Input P3S - Output
1 Reserved
P33 - Input P34 - Output
631
DTC CONTROL REGISTER DIAGRAMS
Z8 Microcomputer Control Register Diagrams (Continued)
R2491PR F9h
17161514131211101
-,--
L I Interrupt Group Priority
000 Reserved
001 C>A> B
010 A>B>C
011 A> C> B
100 B>C>A
101 C>B>A
110 B>A>C
111 Rese~ed
' - - - IR01, IR04 Priority (Group C)
o IR01 > IR04
1 IR04> IR01
IROO, IR02 Priority (Group B)
o IRQ2> IROO
1 IRoo> IR02
IR03, IR05 Priority (Group A)
o IR05> IR03
1 IR03> IR05
Reserved
632
R254SPH FEh
17161s141312111 0 1
User Flag Fl 1'--____ Stack Pointer Upper
User Flag F2 Byte (SP1S·SP8)
Half Carry Flag
Decimal Adjust Flag
Overflow Flag Figure 71. Stack Pointer
Sign Flag (FEH; ReadlWrite)
Zero Flag
Carry Flag
R2S3 RP FDh
17161s141312111 0 1 Figure 72. Stack POinter
I I~ Irrelevent
Register Pointer
(FFH; Read/Write)
633
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
634
CONDITION CODES
635
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
CLR. CPL. DA, DEC. OPC I MODE ADC. ADD. AND. CPo
DECW. INC. INCW. lD. OR. SBC. SUB.
ORI tttOI dstlsrcl POP. PUSH. Rl. RlC. sre OR TCM.TM.XOR
RR. RRC. SRA. SWAP dst OR
ope JP. CAll (Incirect)
dst lOR 1111 0 I dst OPC I MODE ADC. ADD. AND. CPo
lD. OR. SBC. SUB.
dst OR 11110 I dst TCM.TM.XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC. ADD. AND. CPo Src OR
OR. SBC. SUB. TCM•.
TM.XOR dst OR
OPC CAll
DJNZ.JR DAU
DAl
FFH STOPlHAlT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment .of a value is indicated by the symbal natatian "addr (n)" is used ta refer ta bit (n) .of a given
" f- ", For example: .operand lacation, For example:
indicates that the saurce data is added to the destination refers ta bit 7 .of the destination .operand,
data and the result is stared in the destinatian lacatian, The
636
INSTRUCTION SUMMARY (Continued)
ADCdst, src t 1( 1
****0 * INC dst rE -
***
dst+-dst + src +C dst+-dst + 1 =
r 0-F
R 20
ADDdst, src t O[ 1
****0 * IR 21
dst+-dst + src
- -
INCWdst RR AO -
***- -
ANDdst, src
dst+-dst AND src
t 5( 1 **0 - dst+-dst + 1 IR A1
IRET BF
CALLdst DA D6 - - - - - - FLAGS+-@Sp.; ******
SP+-SP - 2 IRR D4 SP+-SP + 1
@SP+-PC, PC+-@SP;
PC+-dst SP+-SP + 2;
IMR(7)+-1
CCF
C+-NOTC
EF *- - - - -
JPcc, dst DA cD - - - - - -
if cc is true =
c 0- F
CLRdst R BO - - - - - - PC+-dst IRR 30
dst+-O IR B1
JRcc, dst RA cB - - - - - -
COMdst R 60 -
**0 - - if cc is true, =
c 0- F
dst+-NOT dst IR 61 PC+-PC + dst
Range: +127,
CPdst, src t A[ 1
****- - -128
dst - src
LD dst, src 1m rC - - - - -
DAdst R 40
***X - - dst+-src r R r8
dst+-DA dst IR 41 R r9
=
r 0-F
DECdst
dst+-dst - 1
R
IR
00
01
-
***- -
X
X
r
C7
D7
r Ir E3
DECWdst
dst+-dst - 1
RR
IR
80
81
-
***- - Ir
R R
F3
E4
R IR E5
DI 8F - - - - - - R 1M E6
IMR(7)+-0 IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
r+-r - 1 =
r 0- F LDCdst, src Irr C2
if r;< 0
PC+-PC + dst LDCI dst, src Ir Irr C3
Range: +127, dst+-src
-128 r+-r +1;
rr+-rr + 1
EI gF - - - - - -
IMR(7)+-1
HALT 7F - - - - - -
637
INSTRUCTION SUMMARY (Continued)
NOP FF STOP 6F
- - - - -----------
OR dst, src
dstrdst OR src
t 4[ ] -
**0 - - SUB dst, src
dstrdstrsrc
t 2[ ]
****1 *
POP dst R 50 - - - - - - SWAP dst R FO X
** X - -
dstr@SP; IR 51 IR F1
SPrSP + 1
PUSH src R 70 - - - - - -
17
6 o1
SPrSP-1;
@SPrsrc
IR 71 TCM dst, src
(NOT dst)
t 6[ ] -
** 0 - -
ANOsrc
RCF GF 0 - - - - - ------ .-~ --_.-
t - - -
GrO TM dst, src
dstANOsrc
7[ ]
**0
RET AF - - - - - -
PGr@SP; t 1 -
SPrSP+ 2
XOR dst, src
dstrdst
B[
**0
XOR src
RLdst R 90
****- -
~
IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
set tabl.e above. The second nibble is expressed symbolically by a '[ ]'
RLC dst
L0=ttS}J
R
IR
10
11 ****- - in this table, and its value is found in the following table to the left of the
applicable addressing mode pair.
~7 o~
R
IR
GO
G1 ****
[2]
t 1 ~
SBC dst, src
dstrdstrsrcrG
3[
***1 * Ir [3]
R R [4]
SCF OF 1 - - - - -
Cr1
R IR [5]
- -
SRA dst R
IR
00
01 ***0 R 1M [6]
@ IR 1M [7]
SRP src 1m 31 - - - - - -
RPrsrc
638
OPCODE MAP
5
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
POP POP AND AND AND AND AND AND WDT
RI IRI rl, r2 rl,lr2 R2,Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
COM COM TCM TCM TCM TCM TCM TCM STOP
)( Rl IRI rl, r2 rl,lr2 R2,Rl IR2, RI RI,IM IR1,IM
'"
OS 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 r--uJ
7 PUSH PUSH TM TM TM TM TM TM
'"
jj
.c R2 IR2 rl, r2 rl,lr2 R2,Rl IR2, Rl Rl,IM IR1,IM
HALT
Z
~
10.5 10.5 12.0 18.0 r--;;:;-
8 DECW DECW LDE LDEI
'"
Q.
Q. RRI IRI rl,lrr2 Irl,lrr2
DI
::J
6.5 6.5 12.0 18.0 r--;;:;-
9 RL RL LDE LOEI EI
RI IRI r2,lrr1 Ir2,lrrl
A
10.5
INCW
10.5
INCW
6.5
CP
6.5
CP
10.5
CP
10.5
CP
10.5
CP
10.5
CP
t--u.o
RET
RRI IRI r1, r2 rl,lr2 R2, Rl IR2, RI Rl,IM IRI,IM
B
6.5
CLR
6.5
CLR
6.5
XOR
6.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
r-w.o
IRET
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl RI,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 ~
C RRC RRC LDC LDCI LD RCF
Rl IRI rl,lrr2 Irl,lrr2 rl,x,R2
6.5 6.5 12.0 18.0 20.0 20.0 10.5 ~
D SRA SRA LOC LDCI CALL' CALL LD SCF
Rl IRI r2,lrrl Ir2,lrrl IRRI DA r2,x,Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
E RR RR LD LD LD LD LD CCF
Rl IRI rl,IR2 R2, Rl IR2, Rl Rl,IM IRI,IM
8.5 8.5 6.5 10.5 ~
F SWAP SWAP LD LD NOP
Rl IRI Irl, r2 R2,IRI
'- A- A-
T T T ~
3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4·bit address
Execution Pipeline R 1 or r 2 = Ost address
Cycles 1 Cycles R 1 or r 2 = Src "ddress
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
639
ADVANCE INFORMATION SPECIFICATION
Z86C50
CMOS Z8® CCpTM ICE
IN-CIRCUIT EMULATOR
FEATURES
_ 8-bit CMOS Z8 CCP base In-Circuit Emulation chip _ All internal control Signals interface (Le., fSYNC,
flACK, fMAS, /MDS, etc.)
_ 124-pin PGA package
_ Disable Timers control signal
• Full Z8 CCP family instruction set
_ Hold internal clock control signal
_ 3.0 to 5.5 volt operation range
_ Wait control signal
_ Clock speed 20 MHz
_ STOP and HALT modes signal status outputs
• 236-byte general-purpose register
_ Two on-board analog comparators
• Low EMI mode programmable
_ Two programmable 8-bit Counter/Timers, each with
• Internal register read bus and write bus interface a 6-bit programmable prescaler
_ Register file bank pointer and register file address bus _ Six vectored, priority interrupts from six dirferentsources
interface for accessing the Expanded Register File
(ERF) externally. _ Internal r:?rogram memory size select interface
GENERAL DESCRIPTION
The Z86C50 CCP In-Circuit Emulation (ICE) chip intro- Figure 1 is the functional block diagram of Z86C50. This
duces a new level of sophistication to ICE architecture. The device is housed in a 124-pin PGA package (Figure 2).
Z86C50 not only provides all the control Signal interfaces, Table 1 is the pin identification of the Z86C50.
but also the internal register bus interface. The Expanded
Register File (ERF) can be external and interface with the Note: All Signals with a preceding front slash, "/", are active
internal register bus and ERF control signals. Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
active Low, only).
The Z86C50 allows users to prototype a system with an
actual hardware device and to develop the code. Also, this
device is very useful in emulator applications.
641
GENERAL DESCRIPTION (Continued)
SCLK
ISCLK
TCLK
ITCLK
ISYNC
Machine Timing nACK
and IDM
Instrument Control !STOP
ICE
!HALT
Control
Block CTO
SIZED
SIZE1
SIZE2
IIRQ3
/cE_ERF
RESET IIRQ4
IREGRD
WDT,POR !SMREC
IREGWR
IDTIMERS
ERFBank
!HOLD
Pointer
/WAIT
Register
Acktess IADMUX
642
0000000000000 N
0000000000000 M
0000000000000 L
0000 0000 K
000 000 J
000 000 H
000 Z86C50 000 G
000 000 F
000 000 E
0000 0000 D
0000000000000 C
0000000000000 B
0000000000000 A
13 12 11 10 9 8 7 6 5 4 3 2 1
643
PIN DESCRIPTION
644
Pin # Symbol Function Direction
645
PIN DESCRIPTION
646
PIN FUNCTIONS
POO-P07. Port O. nibble programmable. Port 0 can be RBPO-RBP3. Register Bank Pointer (Output). The RBP
configured as input. output or address lines. pOints to the current register bank. The ERF is located in
bank % 1 to bank %F.
Pl0-P17. Port 1, byte programmable. Port 1 can be con-
figured as input, outputormultiplexed address/data lines. RA7-RAO. Register Address Bus(Output). This bus is used
to access each of 256 byte registers of the current register
P20-P27. Port 2, bit programmable. Port 2 can be con- bank.
figured as input or output lines.
IW07-IWOO. Register Write Bus (Output). This bus is used
P30-P33. Port 3 input lines, P31-P33 can be configured as to write the data to the register.
analog input.
IREGWR. Register Write signa/(Output). This pin goes low
P34-P37. Port 3 output lines. during each register write cycle.
AD-A15. Internal Memory Address Bus (Output). The in- IR07-IROO. Register Read Bus(lnput). This bus is used to
ternal memory can address up to 32 Kbyte. read the data from the register.
IAOMUX. Address/Oata Bus Mu/tiplexed(lnput). When this IREGRO. Register Read signa/(Output). This pin goes low
pin is low, A7-AO is address and data bus multiplexing during each register read cycle.
(AD7-ADO). When this pin is high, A 15-AO outputs the
address only. This pin has an internal pull-up resistor. ICE_ERF. ERF Chip Enable (Output). This pin goes active
when the ERF is accessed and inactive when the on-board
07-00 (In/Output). Internal Memory Data Bus. register file is accessed.
RIm. Read/Write Signal output line. 10M. Data Memory Strobe (Output). This pin goes low
during data memory access.
SIZED-SIZE2. Internal Memory Size (Input). These three
pins select the internal memory size (Table 2). IMOS.lnternal Memory Data Strobe(Output). This pin goes
low during each internal memory fetch cycle.
Table 2. Memory Size Table
IMAS. Internal Memory Address Strobe (Output). This pin
SIZE2 SIZE1 SIZEO Memory Size goes low during each T1 cycle.
0 0 0 o Kbyte lOS. Data Strobe (Output). This pin goes low during each
0 0 1 2 Kbytes
0 1 0 4 Kbytes external memory fetch cycle.
0 1 1 8 Kbytes
16 Kbytes lAS. Address Strobe (Output). This pin goes low during
1 0 0
32 Kbytes each T1 cycle.
1 0 1
647
PIN FUNCTIONS (Continued)
SCLK. System Clock output pin. !WAIT. Wait (Input). The code execution is stopped after
completion of the currently executing instruction by Ihe low
ISCLK. Inverse System Clock output pin. level at this pin. The address of the fetching byte is latched.
{AS goes high and IDS goes low. The high level at Ihis pin
ISYNC. Instruction Sync Signal (Output). This signal indi- releases from WAIT. This pin has an internal pull-up resistor.
cates the last clock of the current executing instruction.
IHALT. HAL T Mode Indication (Output). The low level of
/lACK. Interrupt Acknowledge (Output). This pin goes low this .pin indicates the ICE chip in HALT mode.
during an interrupt cycle.
ISTOP. STOP Mode Indication (Oulput). Tile low level of
/lRQ3. Interrupt Request 3 input line. this pin indicates tile ICE chip in STOP mode.
/lRQ4. Interrupt Request 4 input line. ISMA. STOP Mode Recovery (Input). Low level at this pin
wakes up the ICE chip from STOP mode.
IDTIMERS. Disable Timers (Input). All timers (including
the WDT) are stopped by the low level at this pin. This pin TCLK. Timer Clock Output lines. Tile frequency of TCLK is
has an intemal pull-up resistor. the same as SCLK. TCLK drives the timer and interrupt
logic.
IHOLD. Hold (Input). The internal clock is stopped by the
low level at this pin. The on-board oscillator keeps on CTO. Counter/Timer 0 output line.
oscillating. This pin has an internal pull-up resistor.
648
TIMING DIAGRAMS
Figure 3 shows the configuration of ICE Control Register Figures 4 through 9 are the preliminary access timing
(ICECON) which selects the access timing of the Ex- diagrams of the register file.
panded Register File.
ICECON (F) OA
1071061051041031021011 Dol
~ Expanded Register File Timing .
o 0 Normal Timing (SCLK xl)
(Default after Reset)
01 SCLKx2
1 0 SCLKx4
1 1 SCLKx8
SCLK
RAM
Address
IREGRDO
DB
I--
!ACCESS
649
TIMING DIAGRAMS (Continued)
SCLKx 2, 4, orB
SCLK
I
I
RAM
Address \ LI
I
I
IREGRDO
\ LI
I
DB ---------+---- ~D>------
!ACCESS
Figure 5. Internal Register File Read Cycle For Indirect Addressing (Extended Timing)
SCLK
RAM
Address ___________x X~ ________
IREGRDO
'--I
DB
------------~<=>~.--------
Figure 6. Internal Register File Write Cycle
650
SCLK x 2, 4, or 8
SCLK
I
RAM
Address
L!
I
IREGRDO
L!
I
DB
------4d b~---
Figure 7. Internal Register File Write Cycle (Extended Timing)
651
TIMING DIAGRAMS (Continued)
SCLK
DB f '\.
'\. f
~
IREGWR
fWD
f
"-
IREGRDO
DB ,
'\.
--
tACCESS
IREGRD
IRD
--------------~(----------------
Figure 8. External Read And Write Timing (Normal Timing)
652
SCLK x 2, 4, or 8
SCLK
I
RAMA
P
I
RA3-0
!I X
IREGWRO
LI
I
I
DB
K )
I
I
I
IREGWR
I
I
/
I
tWO
k
I
I
~
IREGRDO
I
DB
[( )
IREGRD
!ACCESS
, I
I
I I /
I I
I I
I
IRD I
I K
Figure 9. External Read And Write Timing (Extended Timing)
653
Internal
ClK
SClK
IAS~
IDS
ISYNC
IHOlD
Pin
IHOlD
Internal
Notes:
1. SClK, TClK go HIGH
2. lAS, IMAS go lOW
654
Internal
CLK
SCLK
!MAS.
lAS
u ff
u
!MDS.
IDS
L---------~J1.C~~------------~
/WAIT
Pin
\'------::IJ
Notes:
1. WAIT Pin sampled during IMDS./DS Low
2. WAIT Released
3. Remainder of IDS
TCLK not affected by /WAIT function
Internal
CLK
SCLK
/WAIT
Pin
Notes:
1. IDTIMERS Pin Samples
2. IDTIMERS Released
655
MICROCON~~3cL~~ Z86C61
GENERAL DESCRIPTION FEATURES
~ ~ -
vo Address or VO Address/Data or VO
(Bit Programmable) (Nibble Programmable) (Byte Programmable)
657
MICROCON~~3tL~~ Z86C62
GENERAL DESCRIPTION FEATURES
Address or VO Address/Data or VO
(Nibble Programmable) (Byte Programmable)
VO
(B~ Programmable)
659
PRODUCT SPECIFICATION
~ZiIm
Z86C90/C89
ROMLESS CMOS
Z8® 8-BIT MICROCONTROLLER
FEATURES
Ii Low cost
• 6-bit programmable prescaler
• ROMless
• On-chip oscillator that accepts a crystal, ceramic
resonator, LC, or external clock drive (ZS6C90).
GENERAL DESCRIPTION
The ZS6C90/CS9 CCpTM (Consumer Controller Processor) The ZS6C90/CS9 architecture is based on Zilog's 8-bit
introduces a new level of sophistication to single-chip microcontroller core with an Expanded Register File to
architecture. The ZS6C90/CS9 are ROMless members of allow access to register mapped peripheral and I/O circuits.
the ZS single-chip microcontroller family with 236 bytes of The CCP offers a flexible I/O scheme, an efficient register
general purpose RAM. The only difference that exists and address space structure, and a number of ancillary
between the ZS6CS9 and the ZS6C90 is that the on-chip features that are useful in many industrial, automotive,
oscillator olthe ZS6CS9 can accept an external RC network computer peripherals, and advanced scientific applica-
or other external clock source, while the ZS6C90's on-chip tions.
oscillator accepts a crystal, ceramic resonator, LC, or
external Clock source drive. The CCP controllers are housed The CCP applications demand powerful I/O capabilities.
in a 40-pin DIP, 44-pin Leaded Chip Carrier, or a 44-pin The ZS6C90/CS9 fulfills this with 32 pins dedicated to input
Quad Flat Pack, and are CMOS compatible. The CCP and output. These lines are grouped into four ports. Each
offers the use of external memory which enables this ZS port consists of eight lines, and is configurable under
microcomputer to be used where code flexibility is required. software control to provide timing, status signals, parallel
Zilog's CMOS microcomputer offers fast execution, effi- I/O with or without handshake, and an address/data bus
cient use of memory, sophisticated interrupts, input/output for interfacing external memory.
bit manipulation capabilities, and easy hardware/software
system expansion along with low cost and low power
consumption.
661
GENERAL DESCRIPTION (Continued)
There are four basic address spaces available to support Included are a large number of user selectable modes,
this wide range of configurations: Program Memory, and two on-board comparators to process analog signals
Register File, Data Memory, and Expanded Register File. with a common reference voltage (Figure 1).
The Register File is composed of 236 bytes of general
purpose registers, four I/O port registers, and fifteen control Note: All Signals with a preceding front slash, "/", are active
and status registers. The Expanded Register File consists Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
of two control registers. active Low, only); INIIS (NORMAL and SYSTEM are both
active Low).
To unburden the program from coping with the real-time
problems, such as counting/timing and data communi-
cation, the Z86C90/C89 offers two on-chip counter/timers.
Machine Timing
&
Instruction Control
RESET
ALU WDT,POR
FLAGS
Register
Pointer
Two Analog
Comparators
662
PIN DESCRIPTION
RlfW IDS
P25 P24
P26 P23
P27 P22
P04 P21
P05 P20
P06 P03
P14 P13
P15 P12
Z86C90fC89
P07 10 DIP GND
vec P02
P16 P11
PH P10
XTAL2 P01
XTAL1 POO
P31 P30
P32 P36
P33 P37
P34 P35
lAS IRESET
663
PIN DESCRIPTION (Continued)
(; 8
Il.. Il..
65432 44 43 42 41 40
P21 7 39 P30
P22 8 38 P36
P23 9 37 P37
P24 10 36 P35
IDS 11 35 IRESET
Z86C90/C89
N/C 12 PLCC 34 GND
RI/W 13 33 lAS
P25 14 32 P34
P26 15 31 P33
P27 16 30 P32
P04 17 29 P31
18 19 20 21 22 23 24 25 26 27 28
I"-
CD I"- CD
~:::::i
It) It)
0 0 """ Ii: 0 0 0
Ii: Ii: Ii:
> ~
0
x~e
Il.. Il.. Il..
Pin Assignments
664
~
33 32 31 30 29 28 27 26 25 24 23
P21 34 22 P30
P22 35 21 P36
P23 36 20 P37
P24 37 19 P35
IDS 38
Z86C90/C89 18 IRESET
N/C 39 QFP 17 GND
RlIW 40 16 lAS
P25 41 15 P34
P26 42
, 14 P33
P27
P04 :0 1 2 3 4 5 6 7 8 9 10 11
13
12
P32
P3l
"- ~
665
PIN DESCRIPTION (Continued)
666
Table 2. 44-Pin Leaded Chip Carrier Pin Identification
667
PIN DESCRIPTION (Continued)
I
PIN FUNCTIONS
/DS. (output, active Low). Data Strobe is activated once for XTAL1. Crystal 1 (time-based input). This pin connects a
each external rnemory transfer. For a READ operation, parallel-resonant crystal, ceramic resonator, LC, or RC
data must be available prior to the trailing edge of /DS. For network or an external single-phase clock to the on-chip
WRITE operations, the falling edge of /DS indicates that oscillator input.
qutput data is valid.
XTAL2. CrystaI2(tirne-based output). This pin connects a
lAS. (output, active Low). Address Strobe is pulsed once parallel-resonant, crystal, ceramic resonant, LC, or RC
at the beginning of each machine cycle. Address output is network to the on-chip oscillator output.
via Port O/Port 1 for all external programs. Memory address
transfers are valid at the trailing edge of /AS. Under RlIW. (output, write Low). Read/Write, the R//W signal is
program control, /AS is placed in the high-impedance low when the CCP is writing to the external program or data
state along with Ports 0 and 1, Data Strobe, and Read/ memory.
Write.
668
Port 0 (POO-P07). Port 0 is an 8-bit. bidirectional, CMOS address range requires 12 bits or less, the upper nibble of
compatible port. These eight I/O lines are configured Port 0 can be programmed independently as I/O while tile
under software control as a nibble I/O port, or as an lower nibble is used for addressing. If one or both nibbles
address port for interfacing external memory. The input are needed for I/O operation, they must be configured by
buffers are Schmitt triggered and the output drivers are writing to the Port 0 mode register. After a hardware reset,
push-pull. PortO is placed under handshake control. In this Port 0 is configured as address lines A 15-A8, and ex-
configuration, Port 3, lines P32 and P35 are used as the tended timing is set to accommodate slow memory access.
handshake control/DAVO and RDYO. Handshake signal The initialization routine can include reconliguration to
direction is dictated by the I/O direction to Port 0 of the eliminate this extended timing mode.
upper nibble P04-P07. The lower nibble must have the
same direction as the upper nibble. Port 0 is set in the high~impedance mode if selected as an
address output state along with Port 1 and tile control
For external memory references, PortO can provide address signals /AS, /DS and RI/W (Figure 5).
bits A11-A8 (lower nibble) or A15-A8 (lower and upper
nibble) depending on the required address space. If the
ZS6C90/C89
MCU
Handshake Controls
/DAVO and RDVO
(P32 and P35)
OEN
Out
r
I Auto Latch
I I
I_____________
R=500KQ 1
669
PIN FUNCTIONS (Continued)
Port 1 (P10-P17). Port 1 is a multiplexed Address (A7-AO) Port 1 can be placed in the high-impedance state along
and Data (07-00), CMOS compatible port. Port 1 is dedi- with Port 0, /AS, IDS and RI/W, allowing the Z86C90/C89 to
cated to the Zilog ZBUS"-compatible memory interface. share common resources in multiprocessor and OMA
The operations of Port 1 are supported by the Address applications.
Strobe (lAS) and Data Strobe (IDS) lines, and by the Read/
Write (RI/W) and Data Memory (10M) control lines. Data The CCP wakes up with the 8 bits of Port 1 configured as
memory read/write operations are done through this port address outputs for external memory.
(Figure 6). If more than 256 external locations are required,
Port 0 outputs the additional lines.
Port 1
(110 or AD7 - ADO)
Z86C90lCB9
MCU
.. }
Handshake Controls
IDAV1 and RDY1
(P34 and P33)
OEN
Out
r ----------
I Auto Latch
I_____________
. JI
I R=500Kil
670
Port 2 (P20-P27). Port 2 is an 8-bit, bidirectional, CMOS open-drain. Port 2 may be placed under handsllake con-
compatible I/O port. These eight I/O lines can be config- trol.ln this configuration, Port 3lines, P31 and P36 are used
ured under software control as an input or output, inde- as the handshake controls lines /DAV2 and RDY2. TI18
pendently. Port 2 is always available for I/O operation. The handshake signal assignment for Port 3, lines P31 and P36
input buffers are Schmitt triggered. Bits programmed as is dictated by the direction (input or output) assigned to
outputs are globally programmed as either push-pull or bit-7 Port 2 (Figure 7).
- .. ..
-.. .. Port 2 (110)
Z86C901C89
MCU
.. .
Handshake Controls
} IDAV2 and RDY2
(P31 and P36)
-
Open Drain
OEN
Out
r ----------- ...
Auto Latch
I I
I
I R= 500 K.Q I
L- _ _ _ _ _ _ _ _ _ _ _ _ _ ...J
Port 3 (P30-P37). Port 3 is an 8-bit, CMOS compatible four- Counter/Timers, interrupt, Port handshake and Data
fixed input and four-fixed output. Port 3 consists of four- Memory functions. Port 3, Pin-O input is Scllmitt triggered,
fixed input (P30-P33) and four-fixed output (P34-P37), and and pins P31, P32, and P33 are standard CMOS inputs;
can be configured under software control for InpuVOutput, outputs are push-pull.
671
PIN FUNCTIONS (Continued)
Two on-board comparators process analog signals on Port 3 also provides the following control functions: hand-
P31 and P32 with reference to the voltage on P33. The shake for Ports 0, 1 and 2 (lOAV and ROY); four external
analog function is enabled by programming the Port 3 interrupt request signals (IRQO-IRQ3); timer input and
Mode Register (bit-1). Port 3, pins 0 and 3 are falling edge output signals (TIN and Tour) and Data Memory Select
interrupt inputs. P31 and P32 are programmable as rising, [(10M) (Figure 8)].
falling, or both edge triggered interrupts (IRQ register bits
6 and 7). P33 is the comparator reference voltage input. Auto-Latch. The Auto-Latch puts valid CMOS levels on all
Access to Counter/Timer 1 is made through P31 (TIN) and CMOS inputs (except P31-P33) that are not externally
P36 (Tour)' Handshake lines Ports 0, 1 and 2 are available driven. Whether this level is zero or one, cannot be de-
ori P31 through P36. termined. A valid CMOS level, rather than a floating node,
reduces excessive supply current flow in tile input buffer.
-
Z86C901089 Port 3
MCU (1/0 or
Handshake)
-
..
-------------------,
~
: ~ ~ . : Auto latch
I I
P30 ~ P30Data
)~--------~---------------~------------------------~~~.-- la~IR03
R247=P3M
1 = Analog
0= Digital
P31 (AN1)
, - - - - - , DIG. ~
~ _________ IR02, TIN, P31 Data latch
P32(AN2)
,
I
I
,
I
P33(REF) I
I
672
Table 4. Pin Assignments
P30 IN IR03
P31 IN TIN AN1 IR02 D/R
P32 IN AN2 IROO D/R
P33 IN REF IR01 D/R
P34 OUT RID DM
P35 OUT RID
P36 OUT ToUT RID
P37 OUT
Noles:
HS = Handshake Signals
D=DAV
R=RDY
Comparator Inputs. Port 3, Pins P31 and P32 each have a After the paR time, /RESET is a Schmitt triggered input. To
comparator front end. The comparator reference voltage avoid asynchronous and noisy reset problems, the Z86C901
(Pin P33) is common to both comparators. In analog mode, C89 is equipped with a reset filter of four external clocks
P31 and P32 are the positive inputs to the comparators and (4TpC). If the external reset signal is less than 4TpC in
P33 is the reference voltage supplied to both comparators. duration, no reset occurs. On the fifth clock after the reset
In digital mode, Pin P33 can be used as a P33 register input is detected, an intemal RST signal is latched and held for
or IR01 source. an internal register count of 18 external clocks, or for the
duration of the external reset, whichever is longer.
IRESET. (input, active-Low). Initializes the MCU. Reset is
accomplished either through Power-On, Watch Dog Timer During the reset cycle, IDS is held active low while lAS
reset, STOP Mode Recovery, or external reset. During cycles at a rate of TpC/2. Program execution begins at
Power-On Reset and Watch Dog Reset, the internally location OOOC (HEX), 5-10 TpC cycles after the RST is
generated reset drives the reset pin low for the paR time. released. For Power-On Reset, the typical reset output
Any devices driving the reset line should be open-drain in time is 5 ms. The Z86C90/C89 does not reset WDTMR,
order to avoid damage from a possible conflict during SMA, P2M, or P3M registers on a STOP Mode Recovery
reset conditions. Pull-up is provided internally. operation.
FUNCTIONAL DESCRIPTION
The Z8 CCP incorporates special functions to enhance the Program Memory. The Z86C90/C89 addresses up to 64K
Z8's functionality in industrial, scientific research and external program memory (Figure 9). The first 12 bytes of
advanced technologies applications. program memory are reserved for the interrupt vectors.
These locations contain six 16-bit vectors that correspond
Reset. The device is reset in one of the following condi-· to the six available interrupts. Program execution begins at
tions: location OOOC (HEX) after a reset.
• Power-On Reset
• Watch-Dog Timer
• STOP Mode Recovery Source
• Brown-out Recovery
• External Reset
673
FUNCTIONAL DESCRIPTION
65 535 65535
External
ROM and RAM
I- - - - - ----- -
Location of 12
First Byte of ~
Instruction 11 IR05 External
Executed
After RESET 10 Data
IR05
tv1emory
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 r--... IR02
~~
IR02
Interrupt 8192
Vector 3 IR01
(Upper Byte) 8191
2 IR01
Not Addressable
1 IROO
0 IROO o
Figure 10. Program Memory Configuration Figure 11. Data Memory Configuration
674
Z8 STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
%FF SPL u u u u u u u u
REGISTER POINTER
%FE SPH u u u u u u u u
1716151413121'101 %FD RP 0 0 0 0 0 0 0 0
Working Register
Group Pointer I I Expanded Register
Group Pointer
%Fe
%FB
FLAGS
IMR
U
0
U
U
U
U
U
U
U
U
U
U
U
U
U
U
%FA IRQ 0 0 0 0 0 0 0 0
%F9 IPR U U U U U U U U
%F8 P01M 1 0 1 1 0 1 1 0
·· %F? P3M 0 0 0 0 0 0 0 0
/ %F6
CI/O F5
P2M
PREO
1
U
1
U
1
U
1
U
1
U
1
U
1
U
1
-----------
Z8 Reg. File %F4 TO U U U U U U U U
"!oFF %F3 PRE1 U U U U U U 0 0
"/"FO
%F2 T1 U U U U U U U U
%F1 TMR 0 0 0 0 0 0 0 0
%FO Reserved
%7F · % (F) OF
%{FlOE
WDTMR
Reserved
u u u 0 1 1 0 1
%{F)OD Reserved
%{F)Oe Reserved
· %(FlOB
% {Fl OA
SMR
Reserved
0 0 1 0 0 0 U 0
%{F)09 Reserved
Reserved
%(F) 08 Reserved
%{F)07 Reserved
%OF
"/000 %(F) 06 ResQtved
%(F) 05 Reserved
% (F) 04 Reserved
% (F) 03 Raserved
% (F) 02 Reserved
%{F)Ol Reserved
%(F) 00 Reserved
% (O)03 P3 1 1 1 1 U U U U
%(O) 02 P2 U U U U U U U U
% (O) 01 Reserved U U U U U U U U
% (O) 00 PO U U U U U U U U
U = Unknown
• Will not be reset with a STOP Mode Recovery
675
FUNCTIONAL DESCRIPTION (Continued)
R253 RP The counters can be programmed to start. stop. restart to
continue. or restart from the initial value. The counters can
also be programmed to stop upon reaching zero (single
pass mode) or to automatically reload ttle initial value and
continue counting (modulo-n continuous mode).
Expanded Register Group The counters. but not the prescalers. are read at any time
Working Register Group without disturbing their value or count mode. The clock
Delau~ setting attar RESET = OOOOOOOO
source for T1 is user-definable and can be either the
internal microprocessor clock divided by lour. or an exter-
nal signal input via Port 3. The Timer Mode register con-
Figure 12. Register Pointer Register figures the external timer input (P31) as an exlemal clock.
a trigger inpullhat can be retriggerable or nOIl-retriggerable.
or as a gate input for the internal clock. The counler/timers
Register File. The register file consists of four I/O port can be cascaded by connecting Ihe TO oulput 10 the
registers. 236 general purpose registers and 15 control inputofT1.
and status registers (RO-R3. R4-239 and R240-R255. re-
spectively). plus two system configuration registers in the
expanded register group. The instructions can access
registers directly or indirectly via an 8-bit address field.
This allows a short. 4-bit register address using the Regis- _~I
~======~
r7 r6 r5 r41
______
r3 r2 r1
--,R2~
ril1R253
ter Pointer (Figure 13). In the 4-bit mode. the register file is R240
divided into 16 working register groups. each occupying The upper nibble 01 the register file address
16 continuous locations. The Register Pointer addresses provided by the register pointer specifies
the starting location of the active working register group. the active working-register group
..
~
working registers and indirect addressing modes.
}
. Stack. The Z86C90/C89 external data memory or the
internal register file is used for the stack. The 16-bit Stack
Pointer (R254-R255) is used for the external stack residing
anywhere in the data memory for ROM less mode. An 8-bit
Stack Pointer (R255) is used for the internal stack that
..
resides within the 236 general purpose registers (R4- ~ The lower nibble
01 the register
R239). SPH is used as a general purpose register only file address
. Specified Working ~
when using internal stacks. ~ Register Group
provided by the
instruction points
to the Specified
CounterfTimers. There are two 8-bit programmable counter/ register
timers (TO-T1). each driven by its own 6-bit programmable ~
prescaler. The T1 prescaler is driven by internal or external
clock sources; however. the TO prescaler is driven by the ~
internal clock only (Figure 14). R15
676
losc I Internal Data Bus
PREO TO TO
Initial Value Initial Value Current Value
Register Register
6-Bit a-bit
Down Down
Counter Counter IR04
Internal
Clock
TOUT
External Clock P36
Clock
Logic
6-Bit 8-Bit IROS
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P31
677
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86C90/C89 has six different interrupts and two in counter/timers (Table 5). The Interrupt Mask
from six different sources. The interrupts are maskable and Register globally or individually enables or disables the six
prioritized (Figure 15). The six sources are divided as interrupt requests.
follows; four sources are claimed by Port 3 lines P30-P33,
IROO IR02
IR01, 3, 4, 5
Interrupt
Edge 1 4 - - IRO (D6,'D7)
Select
Global
Interrupt
Enable
Interrupt
Request
Vector Select
678
Table 5. Interrupt Types, Sources, and Vectors
IROO /OAV 0, IROO 0,1 External (P32), Rising Falling Edge Triggered
IRO 1, IRO 1 2, 3 External (P33), Falling Edge Triggered
IR02 /OAV 2, IRO 2, TIN 4,5 External (P31), Rising Falling Edge Triggered
When more than one interrupt is pending, priorities are (XT AL 1 = Input, XT AL2 = Output). The crystal should be AT
resolved by a programmable priority encoder that is con- cut, 1 MHz to 12 MHz max., Witll a series resistance (liS)
trolled by the Interrupt Priority register. An interrupt ma- less than or equal to 100 Ohms. The Z86C89 on-cllip
chine cycle is activated when an interrupt request is osciffator may be driven with a low cost RC network or other
granted. Thus, this disables all subsequent interrupts, suitable external clock source. (Note: The RC option is not
saves the Program Counter and Status Flags, and then available in the 12 MHz part).
branches to the program memory vector location reserved
for that interrupt. All Z86C90/C89 interrupts are vectored The crystal should be connected across XTAL 1 and XTAL2
through locations in the program memory. This memory Llsing the recommended capacitors (capacitance is more
location and the next byte contain the 16-bit address of the than or equal to 22 pF) from each pin to ground. TI1e nc
interrupt service routine for that particular interrupt re- oscillator configuration is an external resistor connected
quest. To accommodate polled interrupt systems, interrupt from XTAL 1 to XTAL2, with a frequency-setting capacitor
inputs are masked and the Interrupt Request register is from XTAL 1 to ground (Figure 16). See Figures 52-54 for
polled to determine which of the interrupt requests need typical characteristics.
service.
Power-On-Reset (POR). A timer circuit clocked by a dedi-
An interrupt resulting from AN1 is mapped into IR02, and cated on-board RC oscillator is used for tile Power-On
an interrupt from AN2 is mapped into IROO. Interrupts Reset (POR) timer function. The POR time allows Vee and
IR02 and IROOmay be rising, falling or both edge triggered, the oscillator circuit to stabilize before instruction execu-
and are programmable by the user. The software can poll tion begins. .
to identify the state of the pin.
The POR timer circuit is a one-shot timer triggered by one
Programming bits for the Interrupt Edge Select are located of three conditions:
in the IRO Register(R250), bits 07 and 06. The configuration
is shown in Table 6. 1. Power fail to Power OK status.
2. STOP mode recovery (if 05 of SMR=1).
Table 6. IRQ Register 3. WOT timeout. .
IRQ Interrupt Edge The POR time is a nominal 5 ms. Bit-5 of tile Stop Mode
D7 D6 P31 P32 Register determines whether the POR timer is bypassed
after STOP mode recovery (typical for external clock, RC/
0 0 F F LC oscillators).
0 1 F R
1 0 R F HALT. HALT turns off the internal CPU clock, but nol the
1 1 R/F R/F XTAL oscillation. The counter/timers and external inter-
rupts IROO, IR01, IR02, and IR03, remain active. Tl18
Noles: devices are recovered by interrupts, either externally or
F=Falling Edge internally generated.
R=Rising Edge
679
FUNCTIONAL DESCRIPTION (Continued)
~XTAL1
~
XTAL1
~
XTALl -+-jXTALl
cl cl ,
I I C1
I
.... 1Sl ..,. L ..,. R
STOP. This instruction turns off the internal clock and signal. Bits 0 and 1 determine the timeout period 01 tile
external crystal oscillation and reduces the standby cur- WDT. The SMR is located in Bank F of tile Expanded
rent to 10 microamperes or less. The STOP Mode is Register Group at address OBH.
terminated by a reset only, either by WDT timeout, POR,
SMR recovery or external reset. This causes the processor SMR (FlOB
to restart the appiicaiioll program at address aGOc (HEX).
Iwloolool~loolwlrnlool
I I L~~.~"
In order to enter STOP (or HALT) mode, it is necessary to
first flush the instruction pipeline to avoid suspending
execution in mid-instruction. To do this, the user 'must . 0 OFF'
execute a NOP (opcode=FFH) immediately before the 1 ON
680
SCLKfTCLK divide-by-16 Select (00). DO of the SMR con- STOP Mode Recovery Source (02, 03, and 04). These three
trol a divide-by-16 prescaler of SCLK/TCLK. The purpose bits of the SMR specify the wake up source of the STOP
of this control is to selectively reduce device power con- recovery (Figure 18 and Table 7).
sumption during normal processor execution (SCLK control)
and/or HALT mode (where TCLK sources counter/timers
and interrupt logic).
SMR D4 03 D2
~
vo: 0 SMR SMR 0403 D2 SMR 04 03 D2 SMR 04 03 02
I 0 I I I 0 I I I
P30
P31
P32
ToPOR
----------------+-----------------------------------~~------~~~
Stop Mode Recovery Edge
Select (SMR)
To P33 Data
Latch and IRQ1
~P~~F~ro-m~p~a~d~s-------+---------------------------------------iMux~~-------.~
DlgltaVAnalog Mode
Select (P3M)
Table 7. STOP Mode Recovery Source STOP Mode Recovery Delay Select (05). This bit, if tligh,
disables tile 5 ms /RESET delay after STOP Mode Recov-
SMR:432 Operation ery. The default configuration of this bit is one. II the "last"
04 02 Description of Action wake up is selected, the STOP Mode Recovery source
03
needs to be kept active for at least 5 TpC.
0 0 0 paR and/or external reset recovery
0 0 1 P30 transition
STOP Mode Recovery Edge Select (06). A 1 in til is bit
0 1 0 P31 transition
position indicates that a high level on anyone of the
0 1 1 P32 transition
recovery sources wakes the Z86C90/C89 I rom STOP Mode.
0 0 P33 transition A 0 indicates low level recovery. The default is 0 on paR
0 1 P27 transition (Figure 18).
1 0 Logical NOR of P20 through P23
1 1 Logical NOR of P20 through P27
681
FUNCTIONAL DESCRIPTION (Continued)
Cold or Warm Start (D7). This bit is set by the device upon its terminal count. The WDT is initially enabled by execut-
entering STOP Mode. A 0 in this bit (cold) indicates that the ing the WDT instruction and refreshed on subsequent
device will be reset by POR/WDT RESET. A 1 in this bit executions of the WDT instruction. The WDT circuit is
(warm) indicates that the device awakens by a SMR driven by an on-board RC oscillator or external oscillator
source. from the XTAL 1 pin. The POR clock source is selected wi ttl
bit 4 of the WDT register (Figures 19 and 20).
Watch-Dog-Timer Mode Register (WDTMR). The WDT is a
retriggerable one-shot timer that resets the Z8 if it reaches
WDTMR (F)OF
Iwlwl~I~lool~I~lool
11 ~TT~ ,~~=
00 5ms
External Clock
256TpC
01* 15ms 512TpC
10 25 ms 1024TpC
11 100ms 4096TpC
WDT During HALT
o OFF
1 ON *
' - - - - - - - WDT During STOP
o OFF
1 ON'
L...._ _ _ _ _ _ XTAL 111NT RC Select for WDT
o On-Board RC •
1 XTAL
L -_ _ _ _ _ _ _ _ _ Reserved
WDT Time Select (DO,D1). Selects the WDT time period. It WDTMR During HALT (D2). This bit determines whether or
is configured as shown in Table 8. not the WDT is active during HALT Mode. A 1 indicates
active during HALT. The default is 1.
Table 8. WDT Time Select
WDTMR During STOP (D3). This bit determines whether or
Timeout of Timeout of not the WDT is active during STOP Mode. Since XfAL
D1 DO internal RC OSC XTALclock ctock is stopped during STOP Mode, the on-board RC has
to be selected as the clock source to the POR counter. A
0 0 5 ms min 256TpC
1 indicates active during STOP. The default is 1.
0 1 15 ms min 512TpC
1 0 25 ms min 1024TpC
Clock source for WDT (D4). This bit determines Wllich
1 1 100 msmin 4096TpC
oscillator source is used to clock the internal POR and WDT
counter chain. If the bit is a 1, tile internal RC oscillator is
Noles:
bypassed and the POR and WDT clock source is driven
TpC = XlAL clock cycle
The default on reset is 15 ms. from the external pin, XTAL 1. The default configuration of
See Rgures 55 to 58 for details. this bit is 0, which selects the RC oscillator.
682
Clear 18 Clock RESET
L...,;.;;;;;;..... ...----ICLK Generator RESET
Internal
RESET
WDTSelect
(WDTMR) ------lr-----t---1~;::~~~~~~~
CKSource
Select
(WDTMR)
-----+--.,
XTAL -----.1--1
WDT/POR Counter Chain
CLR
VDD
2VREF.
From Stop
Mode
Recovery
Source 12 ns Glitch Filter
W D T - - - - - -....
683
FUNCTIONAL DESCRIPTION (Continued)
The device functions normally at or above 3.0 V under all trip point for the temperatures and operating frequencies
conditions. Below 3.0 V, the device functions normally until in cases 1 and 2. The actual brown out trip point is
the Brown-Out Protection trip point is reached, below a function of temperature and process parameters
which reset is globally driven. The device is guaranteed to (Figure 21).
function normally at supply voltages above the brown out
Vee 2.80
(Volts)
2.60
2.40 ~
2.20
f' ~
'"
2.00
1.80
1.60
"" ~
~~
V80 (Typical)
684
STANDARD TEST CONDITIONS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. Tl1is
Vee Supply Voltage (*) -0.3 +7.0 V is a stress rating only; operation of the device at any
TSTG Storage Temp -65° +150° C condition above those indicated in the operational sec-
TA Oper Ambient Temp t C tions of these specifications is not implied. Exposure to
Power Dissipation 2.2 W absolute maximum rating conditions for an extended
period may affect device reliability.
Noles:
* Voltage on all pins with respect to GND.
t See Ordering Information.
CAPACITANCE
TA = 25°C. Vee = GND = OV. f = 1.0 MHz. unmeasured pins to GND
Parameter Max
Input capacitance 12 pF
Output capacitance 12 pF
I/O capacitance 12 pF
685
DC CHARACTERISTICS
Va. Clock Input 3.3V GND -0.3 0.2 Vee GND-0.3 0.2 Vee 0.7 V Driven by External
Low Voltage Clock Generator
5.0V GND-0.3 0.2 Vee GND-D.3 0.2 Vee 1.5 V Driven by External
Clock Generator
VIH Input High Voltage 3.3V 0.7 Vee VeetO.3 0.7 Vee Vec+0.3 1.3 V
5.0V 0.7 Vee VeetO.3 0.7 Vee Vee+0.3 2.5 V
Va. Input Low Voltage 3.3V GND-D.3 0.2 Vee GND-0.3 0.2 Vee 0.7 V
5.0V GND-0.3 0.2 Vee GND-0.3 0.2 Vee 1.5 V
VOH Output High Voltge 3.3V Vec-0.4 Vec-0.4 3.1 V IOH =-2.0mA
5.0V Vec-O.4 Vec-D·4 4.8 V 10I1 =-2.0mA
V!l.l Output Low Voltage 3.3V 0.6 0.6 0.2 V 1011 =+4.0 mA
5.0V 0.4 0.4 0.1 V lill =+4.0 mA
VOI2. Output Low Voltage 3.3V 1.2 1.2 0.3 V lill =+6mA,
S.OV .
1.<-" < n
1.£ 0.3 V
3 Pin Max
'Ill = +i2mA,
3 Pin Max
686
Sym Parameter vee TA = O°C TA =-40° C Typ@ Units Conditions Notes
Note [3] to 70°C to 105° C 25°C
Min Max Min Max
Notes:
[1] Icc. Typ Max Un~ Frequency
Crystal/Resonator 3.0mA 5 rnA 8 MHz
External Clock Drive O.3mA 5 mA 8MHz
[2] GND=OV
[3] 5.0V ±O.5V,3.3V ±O.3V.
[4] All outputs unloaded, I{O pins floating, inputs at rail.
[5] CL l=Cl2=l00 pF
[6] Same as note [4] except inputs at Vcc'
[7] The Veo increases as the temperature decreases.
687
AC CHARACTERISTICS
External I/O or Memory Read and Write Timing Diagram
RlIW
PortO,lOM
Port 1 07·00 IN
lAS
!-----{)---'*--{18i}---!1-<1
IDS
(Read)
PorU
____-J)(~___~_-_A_O___ OUT
--""'0>---
IDS
(Write)
688
AC CHARACTERISTICS
External I/O or Mernory Read and Write Timing Table
Noles:
[1) When using extended memory timing add 2 TpC.
[2) Timing numbers given are for minimum TpC.
[3) S.OV ±0.5V, 3.3V ±0.3V.
t Standard Test Load
tt All timing references use 0.9 Vee for a logic 1 and 0.1 Vee for a logic O.
689
AC CHARACTERISTICS
Additional Timing Diagram
Clock
Clock
Setup
1\ ;---\ ;---\ ;---\ ';---\ ~~
Slop
---------~:~~:~-----~--~®~~--------~J<-------
Mode
Recovety
Source
690
AC CHARACTERISTICS
Additional Timing Table
691
AC CHARACTERISTICS
Additional Timing Table (Continued)
Notes:
[1) TIming Reference uses 0.9 Vcc for a logic 1 and 0.1 Vcc for a logic O.
[2) Interrupt request via Port 3 (P31-P33).
[3) Interrupt request via Port 3 (P30).
[4) SMR-D5 = 0
[5) Reg. WDTMR
[6) 5.0V ±0.5V, 3.3V ±0.3V
[7) Reg. SMR - 05=0
[8) Reg. SMR - D5=1
692
AC CHARACTERISTICS
Handshake Timing Diagrams
r----'lr···················································....
Data In Data In Valid Next Data In Valid
'-----'lr··················'································.....
RDY
(Output)
DaiaOut
rr--------------\r- - - -- - - - - - - - - _.
Data Out Valid Next Data Out Valid
I ' - - - - - - - - - - - - - - \ r - - - - - - - - - - - - - _.
RDY
(Input)
693
AC CHARACTERISTICS
Handshake Timing Table
Note:
[1] S.OV±O.SV, 3.3V±O.3V
694
EXPANDED REGISTER FILE CONTROL REGISTERS
L
SMR (F)OB WDllJIR (F)OF
Imloolool~lool~I~lool
SCLKfTClJ( Divide by 16
o OFF"
1 ON
-~ L - WDTTAP INTRCOSC External Clock
00
01·
5 ms
15ms
256TpC
512TpC
10 25 ms 1024 TpC
RESERVED
11 lOOms 4096TpC
Stop Mode Recovery Source
000 POROnly" WDTDuring HALT
001 P30 o OFF
1 ON"
010 P31
011 P32 L-_ _ _ _ _ WDTDuring STOP
100 P33 o OFF
101 P27 1 ON'
110 P2NOR0-3 L-_ _ _ _ _ _ XTAL111NTRCSelectforWDT
111 P2NORO·7
Stop Delay
o OFF
1 ON"
L-__________ o On-Board RC"
1 XTAL
Ra~oo
695
ZS CONTROL REGISTER DIAGRAMS
R240 R243 PREI
1~1~1~1~lool~I~lool
I Reserved Count Mode
oTl Single Pass
1 Tl ModuioN
R245PREO
Figure 30. Timer Mode Register
(F1 H:ReadIWrite)
Count Mode
oTO Single Pass
1 TO Modulo N
R242Tl Reserved
(WhenWr~n)
(Range: 1-256 Decimal
01-00 HEX) Figure 34. Prescaler 0 Register
T1 Current Value (F5H:Write Only)
(When Read)
R24BP2M
Figure 31. CounterfTimer 1 Register
(F2H:ReadIWrite) 1~1~lool~lool~I~lool
I P20 - P27 110 Dellnltion
o Defines Bit as Output
1 Defines Bit as Input
696
R247P3M R2491PR
-r-
o Port 2 Pull-Ups Open Drain
1 Port 2 Pull-Ups Active
T 1 Interrupt Group Prlorlty
000 Reserved
o P31, P32 Digital Mode 001 C>A>B
1 P31, P32 Analog Mode 010 A>B>C
011 A>C>B
o P32=lnpu' 100 B>C>A
P35=Outpu' 101 C>B>A
1 P32 = IDAVOIRDVO 110 B>A>C
P35 = RDVo/IDAVO 111 Reserved
IR01, IR04 Priority (Group C)
00 P33 = Inpu' o IROl >IR04
P34 =OUtpu' 1 IR04>IROl
o P31 = Inpul (TlN) IRoo, 1R02 Prlorlty (Group B)
P3S = Output (TOUT) o IR02>IRoo
P31 = IDAV2IRDV2 1 IRoo>IR02
P3S = RDV2IIDAV2 IR03, IROS Priority (Group A)
o P30=lnpu' o IROS> IR03
P37=OUtput 1 IR03>IROS
Reserved
Reserved
Figure 36_ pon 3 Mode Register Figure 38. Interrupt Priority Register
(F7H:Write Only) (F9H:Write Only)
R248P01M R250lRQ
1~loolool~lool~I~lool
I
1
P03 - POO Mode
00 Output IROO = P32 Input
01 Input IROl = P33 Input
lX All-A8 IR02 = P31 Input
IR03 = P30 Input
Stack Seleclion IR04=TO
o Extemal IR05=Tl
1 Intemal
Inter Edge
P17 - Pl0 Mode P31! P32! =00
Must be: 10 AD7 - ADO P3l! P32t =01
P3ll P32! = 10
External Memory T1ming P31t!P32t!=11
o Nonnal
1 Extended
697
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R2S1IMR
R253RP
Iwlool~I~lool~lrnlool
1 Enables IRoo-IROS
o
(DO-IRoo)
Rsserved
I L . . - I-
Expanded Register File
Working Register Pointer
1 Enables Intenupts
R254 SPH
R252FLAGS
Iwlool~I~loolmlrnlool
I Stack Polnler Upper
~
Byle (SP1S - SP8)
User Flag Fl
User Rag F2
Figure 43. Stack Pointer High
Hall Carry Flag
(FEH:Read/Write)
Decimal Adjust Flag
OVerflow Rag
Sign Flag
R255SPl
, Zero Flag
Carry Flag
Iwlool~I~loolmlrnlool
I Stack Poinler Lower
Byte (SP7 - SPO)
Figure 41. Flag Register
(FCH:ReadIWrite)
Figure 44. Stack Pointer Low
(FF H:ReadlWrite)
698
DEVICE CHARACTERISTICS
13
ICC (mA)
A
12
11 /
10 /
9
,
V
8 /
7
/
/ B
6
/ /
5
/ /'
4 V v.
/
3
/ /"
Legend:
A-Icc= 5.0V
B-lcc=3.5V
699
DEVICE CHARACTERISTICS (Continued)
Iccl (rnA) 4
/
3 / a
/ /' ./
//
2 / ',/ c
...,.,.,V / /'
---- .....--
~
./
- - ~
Frequency (KHz)
Legend:
700
I CC2(1lA) 4
~'"
3
" "'~""
,~ '\ ~
,~~
~~~
2
'"
,,~ ,,~'\ ~
,,~ ~~
'"~"" "'~~
~~~
__ F
'""'~'"
E
0_
C
B
A
-40 -20 o 25 55 80 105
Temperature (OC)
legend:
701
DEVICE CHARACTERISTICS (Continued)
10H -40
(rnA) - A,
r-... , i'..
-30 - -8, , i'...
"- ......
e .... "-,
"......i"--.... :'.....
.............. .....
~ i'...
, i'..
........... to....,.......... 1"-...'
-10
. . . r--.::: "-
t'............
"-
-.........;: ~...... i'..
~
~~
o ~
2.0 3.0 4.0 5.0
VOH (Volts)
a. Vee~5.0V
10H -12
A\
(rnA)
-10
\
-8
I--- r-e
B ..
\ \. ~
\ ,
-6
1\\ \
-4 '\ ~\
I\\.'
-2
o
2.0
~~
1\\
3.0
, 4.0 5.0
VOH (Volts)
b. Vee =3.3V
Legend:
A=-55°C
B= 25°C
C = 125°C
702
IOL 16
(rnA)
~A
14
/
12 /
V B-
./ /
10
V v
8 ./ V C-
~ ./ /
6 ./ / ./
~ v ./
4 ./ V ./
./ ./
./
2 //:/
A~
0
a. VCC =5.0V
0.3 0.4
VOL (Volls)
IOL 12
(rnA)
10 A_
./
/
..,V B_
6 V V
./ '/ C
./ ..,.."., .--'"
~
4
./ ..,." 10"" .........-
2 ~ './ --.... .....
~ ::;...-
o
~-
0.1 0.2 0.3 0.4
VOL (Volls)
b. VCC=3.3V
Legend:
A ~-55°C
B ~ 25°C
C ~ 125°C
703
DEVICE CHARACTERISTICS (Continued)
Time 22.0
(Msec)
20.0
,
18.0
V
I'" -- I,..-A
16.0 ~
V
~
V-- I,..-B
14.0
~
~
...... --
~
--
-----
I,..-c
12.0 ......
10.0
~
~
~
~
- ~ I,..-D
--- V--
-""""
~~ V-- ~E
8.0
---:::::- ------------- --
~
~
--- ---
-""
~
~
I- F
6.0
~
4.0
\
2.0
o
-60 -40 -20 o 20 40. 60 80 100 120
Temperature (DC)
Legend:
A- Vcc=3.0V D -Vccc4.5V
B-Vcc=3.5V E-Vcc=5.0V
C-Vcc=4.0V F - Vcc= 5.5V
704
I ALL ... _ F .
(rnA) 15
10
o
-55 -25 +125
Temperature (0C)
a. Typical Auto Latch Low Current vs Temperature
-5
o
-55 -25 +125
Temperature (0C)
b. Typical Auto Latch High Current vs Temperature
Legend:
705
DEVICE CHARACTERISTICS (Continued)
Frequency· 10000
(KHz)
5000
,
-- --- ------ ---- -- - - - ._----- - -_ . -- --
"" ......
-
........
......
i"'-- ..... ................
1000
............
i '~
500 ....... .....
""-,I
!'
I 111 I I I~ I I
100 ~
------ -- -- ._---- -- ~ I"i'
50
-- -
-- -
- - - ----- - - D~~- - -
"-I'
10
~ r\.
- - - --
r\i\
=--=[=-- -=I=-Tf=-=- -: ~-I=-I-- I --~ r"I A
5 r_~
i' "
---- --
-I III I I II
5 10 50 100 500 1000 5000 10000
Resistance (K Ohms)
Legend:
A-Vcc=5.0V C=33pF
B -Vcc=3.3V C = 33pF
Note: • The internal clock frequency is one haK the external clock frequency.
This chart for reference only. Each process will have a different characteristic curve.
706
Internal 10000
Frequency'
(KHz) 5000
--- .. --. --- . -- - --
I I II I-
1000 "-
~~
l-lll-
500 I-
-1-1- -- ---_..
-~-:I- -1-1-1
~
- ---
----_. - ..
\: i'
-l II
""~ ~ r---....
100
o I-III
1 100 1000
Resistance (kohms)
Legend:
A - C = 100pF
B - C = 181 pF
Note:' The Internal clock frequency is one half the external clock frequency.
This chart for reference only. Each process will have a different charaderistc curve.
707
DEVICE CHARACTERISTICS (Continued)
Internal 10000
Frequency'
(KHz)
5000
""1\
1\ ~ --
r-... ............
1000
...... r-.,
I'--.
..............
"
I'- - r- ~
'"1'"
i'i'o
I I I I I II" I I I I I I I I
l"-
.......
..... , .......
A-
500 --..
--t-
-
1- ___
--
---- I Til - II I ~I I II I 1- -=
B
100 -
o
5 10 20 60 100 150 200 300
Capacitance (pF)
Legend:
A -C = l00pF
B-C=181 pF
Note: • The intemal clock frequency is one half the external clock frequency.
This chart for reference only. Each process will have a different characleristc curve.
R=l kohm
708
Time 40
(Msec)
A
35
30
B
25
D
20
E
F
15
10
o ~--~----~--~----~--~~--~----~--~--~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
Legend:
709
DEVICE CHARACTERISTICS (Continued)
Time 80r---~----~--~----~----~---r----~--~----'
(Msec)
20~---T~--+----1----~--~~---r----+----+--~
10L----L----~--~--~~--~--~----~--~----~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (OC)
Legend:
710
Time 150 .----r--..,...--,...---r--..,...--,...---r--..,...~__,
(Msec) A
125 ~--~-----+-----r----~----~~~r----+-----r----~
B
100~---+-----r----+---~~--~=---+---~-----c~--i
o
75 ~--~~---+----~--~~----~~~~~-+-----r----~
E
50~---i§§~~~==+s==~:;;;~::::t==--i----~_F~~
25~---+----~----+---~----~----+----1-----r----1
o ~--~----~--~----~--~~--~---~-~-~
-60 -40 -20 o 20 40 60 80 100 120
Temperature (0C)
Legend:
711
DEVICE CHARACTERISTICS (Continued)
Time 500
(Msec) A
450
/ B
V ~
~
400
/ .,..- -~ C
350 ./
/ . ..,..".
~
V ~
300
/' ,. ./~ ..,..".
~ .D
~ ~ E
V
250
200
~
~
~
~
.....-- ----- l.--
- ,,-------
.....--
~
~ ---
---
~
~, --
------ F
150
~
100
·60 -40 ·20 o 20 40 60 80 100 120
Temperature (OC)
Legend:
712
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- . Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
713
CONDITION CODES
714
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD, AND, CP,
L-_~;';';"'_-'
OR \1 1 1 0 I dstlsre \
_ . .
DECW, INC, INCW,
POP, PUSH, RL, RLC, sre OR
LD, OR, SBC, SUB,
1---+-----1 TCM, TM, XOR
RR, RRC, SRA, SWAP dsl OR
OPC
I---d-S-I- - l O R
I \1 1 1 0 I dsl
JP, CALL (Indirect)
I MODE
OPC r----.---. ADC, ADD, AND, CP,
dsl OR 1111 I
0 dst
L...;..;....;.~~.;.;.....J
LD, OR, SBC, SUB,
TCM, TM, XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC, ADD, AND, CP, sre OR
OR, SBC, SUB, TCM,
TM,XOR dst OR
OPC CALL
DJNZ,JR DAU
DAL
FFH STOPIHALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" f-- ". For example: . operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
715
INSTRUCTION SUMMARY (Continued)
716
INSTRUCTION SUMMARY (Continued)
POP dst R 50 - - - - - -
SUB dst, src
dst~dst~src
t 2[ 1
****1*
dst~@SP; IR 51
SP~SP+1
SWAPdst R
IR
FO
F1
X
** X
PUSHsrc
SP~SP-1;
@SP~src
R
IR
70
71
- - - - - -. 17
2G 01
----~---
717
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 I, 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM rl, R2 r2. Rl rl,RA cc. RA rl.IM ce,DA rl
6.5 6.5 6.5 6.5 10.5 1,10.5 10.5 10.5 t-
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 6.5 6.5 10.5 1,10.5 10.5 10.5 t-
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
8.0 6.1 6.5 6.5 10.5 1,10.5 10.5 10.5 t-
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRI 1M rl. r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1.IM
8.5 8.5 6.5 6.5 10.5 I, 10.5 10.5 10.5 r-;u;-
4 DA DA OR OR OR OR OR OR WDH
Rl IRI rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
10.5 10.5 6.5 6.5 10.5 I, 10.5 10.5 10.5 ~
5 POP POP AND AND AND AND AND AND WDT
Rl IRI rl, r2 rl,lr2 R2. Rl IR2, Rl Rl,IM IR1,.IM
6
6.5 6.5 6.5 6.5 10.5 1,10.5 10.5 10.5 t"6D
COM COM TCM TCM TCM TCM TCM TCM STOP
>< Rl IRI rl. r2 rl,lr2 R2, Rl IR2, Rl Rl.IM IR1,IM
;;. " 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 '7n
7 PUSH PUSH TM
":a.<> R2 IR2 rl, r2
TM
rl,lr2
TM TM
R2, Rl IR2,Rl
TM
Rl,IM
TM
IR1.IM
HALT
B
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRI r1, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM
6.5 6.5 12.0 18.0 10.5 '6:5
C RRC RRC LDC LDCI LD RCF
Rl IRI rl,lrr2 Irl,lrr2 rl,x.R2
D
6.5
SRA
6.5
SRA
12.0
LDC
18.0 20.0
LDCI CALL"
20.0
CALL
10.5
LD
r-s-s
SCF'
Rl IRI rl,lrr2 Irl,lrr2 IRRI DA r2.x.Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 '6:5
E RR RR LD LD LD LD LD CCF
Rl IRI rl,IR2 R2. Rl IR2, Rl Rl,IM IR1,IM
8.5 8.5 6.5 10.5 t"6D
F SWAP SWAP LD LD NOP
Rl IRI Irl, r2 R2,IRI
... ... A,
... A,
.. ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution
Cycle 1 Pipeline
Cycles
R 1 or r 2 = Dst address
R 1 or r 2 = Src address
Sequence:
Opcode, First Operand.
Mnemonic Second Operand
718
PRODUCT SPECIFICATION
~ZiIro
Z86C91
CMOS Z8® ROM LESS
MICROCONTROLLER
FEATURES
• Full-Duplex UART
• Clock speeds 12, 16 and 20 MHz
GENERAL DESCRIPTION
The ZB6C91 microcontrolier (MCU) introduces a new level The device applications demand powerful I/O capabilities.
of sophistication to single-chip architecture. The Z86C91 The ZB6C91 fulfills this with 24-pin dedicated to input and
is a member ofthl? ROM less Z8 single-chip microcontrolier output. These lines are grouped into four ports. Eacll port
family with 236 bytes of RAM. consists of eightlines, and is configurable under sottware
control to provided timing, status signals, serial or parallel
The MCU is housed in a 40-pin DIP, 44-pin Leaded Chip- I/O with or without handshake, and an address/data bus
Carrier, or a 44-pin Quad Flat Pack, and is manufactured for interfacing external memory ..
in CMOS technology. The Z86C91 is a ROM less part and
offers the use of external memory which enables this Z8 There are three basic address spaces available to support
microcontroller to be used where code flexibility is required. this wide range of configuration: Program Memory, Data
Memory and 236 General-Purpose Registers.
Zilog's CMOS microcontrolleroffers fast execution, efficient
use of memory, sophisticated interrupts, input/output bit To unburden the program from coping with the real-time
manipulation capabilities, and easy hardware/software problems such as counting/timing and serial data com-
system expansion along with low cost and low power munication, the ZB6C91 offers two on-chip counter/timers
consumption. with a large number of user selectable modes, and an
asynchronous receiver/transmitter (UART-Figure 1).
The Z86C91 architecture is characterized by Zilog's 8-bit
microcontroller core. The device offers a flexible I/O Note: All Signals with a preceding front slash, "I", are active
scheme, an efficient register and address space structure, Low, e.g.: BIIW (WORD is active Low); IBIW (BYfE is
multiplexed capabilities between address/data, I/O, and a active Low, only)
number of ancillary features that are useful in many industrial
and advanced scientific applications.
719
GENERAL DESCRIPTION (Continued)
UART AlU
Counterl FLAGS
Timers
(2)
Register
Pointer
Interrupt
Control Program
Counter
Port 2
720
PIN DESCRIPTION
vee P36
XTAl2 P3l
XTAL1 P27
P37 P26
P30 P25
IRESET P24
RIIW P23
IDS P22
lAS P2l
Z86C91
P35 P20
DIP
GND P33
P32 P34
POO P17
POl P16
P02 P15
P03 P14
P04 P13
P05 P12
P06 Pll
P07 Pl0
721
PIN DESCRIPTION (Continued)
~
...J '"
...J
<~
~x
6 5 4 3 2 1 44 43 42 41 40
IRESET 7 N/C
RlIW 8 P24
IDS 9 P23
lAS 10 P22
P35 11 P21
GND 12 Z86C91 P20
PLCC
P32 13 P33
POO 14 P34
POl 15 P17
P02 16 P16
GND 17 P15
18 19 20 21 22 ,23 24 25 26 27 28
1 Vee Power Supply Input 14-16 POO-P02 Port 0 pin 0,1,2 In/Output
2 XTAL2 Crystal, Oscillator Clock Output 17 GND, Ground Input
3 XTAL1 Crystal, Oscillator Clock Input 18-22 P03-P07 Port 0 pin 3,4,5,6,7 In/Output
4 P37 Port 3 pin 7 Output 23-27 P10-P14 Port 1 pin 0,1,2,3,4 In/Oulput
9 IDS Data Strobe Output 34-38 P20-P24 Port 2 pin 0,1,2,3,4 In/Outp!)t
10 lAS Address Strobe Output 39 N/C Not Connected Input
11 P35 Port 3 pin 5 Output 40-42 P25-P27 Port 2 pin 5,6,7 In/Output
12 GND Ground Input 43 P31 Port 3 pin 1 Input
13 P32 Port 3 pin 2 Input 44 P36 Port 3 pin 6 Output
722
33 32 31 30 29 28 27 26 25 24 23
IRESET 34 22 GND
RlIW 35 21 P24
IDS 36 20 P23
lAS 37 19 P22
P35 38 18 P21
GND 39
Z86C91
QFP 17 P20
P32 40 16 P33
POO 41 15 P34
POI 42 14 PH
0
P02 43 13 P16
GND 44 12 P15
1 2 3 4 5 6 7 8 9 10 11
1-5 P03-P07 Port 0 pin 3,4,5,6,7 In/Output 31 XTAL1 Crystal, Oscillator Clock Input
6 GND Ground tnput 32 P37 Port 3 pin 7 Output
7-14 P10-P17 Port 1 pin 0,1,2,3,4,5,6,7 In/Output 33 P30 Port 3 pin 0 Input
15 P34 Port 3 pin 4 Output 34 /RESET Reset Input
723
PIN FUNCTIONS
IDS. (output, active Low). Data Strobe is activated once for held active low while /AS cycles at a rate of TpC/2. When
each external memory transfer. For a READ operation. /RESET is deactivated program execution begins at loca-
data must be available prior to the trailing edge of /DS. For tion OOOC. Power-up reset tirne is held low for 50 mS, or until
WRITE operations, the falling edge of /DS indicates that VCC is stable, whichever is longer.
output data is valid.
Port O. POO-PO? Port 0 is an 8-bit. nibble programmable,
lAS. (output, active Low). Address Strobe is pulsed once bidirectional, TTL compatible port. These eight I/O lines
at the beginning of each rnachine cycle. Address output is are configured under software control as a nibble I/O port.
via Port 1 for all external program. Memory address trans- or as an address port for interfacing external memory.
fers are valid at the trailing edge of /AS. Under program When used as an I/O port, Port 0 may be placed under
control, /AS can be placed in the high-impedance state Ilandshake control. In this configuration, Port 3, lines F'32
along with Ports 0 and 1, Data Strobe, and Read/Write. and P35 are used as the handshake control /DAVO and
RDYO (Data available and Ready). Handshake signal
XTAL1, XTAL2. Crystal 1, CrystaI2(time-based input and assignment is dictated by the I/O direction of tile upper
a
output, respectively). These pins connect parallel-reso- nibble P04-PO? The lower nibble must have the same
nant crystal, ceramic resonator, LC, or any external single- direction as the upper nibble to be under handshake
phase clock to the on-chip oscillator and buffer. control.
R/tw. (output, write LoW). The Read/lWrite signal is low For external memory references, Port 0 provides Address
when the MCU is writing to the external program or data bits A11-A8 (lower nibble) or A15-A8 (lower and upper
memory. nibble) depending on the required address space. II tile
address range requires 12 bits or less, the upper nibble of
IRESET. (input, active-Low). To avoid asynchronous and Port 0 can be programmed independently as I/O wllile tile
noisy reset problems, the Z86C91 is equipped with a reset lower nibble is used for addressing. If one or both nibbles
filter of four external clocks (4TpC). If the external/RESET are needed for I/O operation, they must be configured by
signal is less than 4TpC in duration, no reset occurs. writing to the Port 0 Mode register. After a hardware reset,
Port 0 lines are defined as address lines A 15-A8, and
On the 5th clock after the /RESET is detected, an internal extended timing is set to accommodate slow memory
RST signal is latched and held for an internal register count access. The initialization routine includes reco(lfiguration
of 18 external clocks, or for the duration of the external to eliminate this extended timing mode (Figure 5).
/RESET, whichever is longer. During the reset cycle, /DS is
724
} Port 0 1"'1
Z86C21
MCU
Handshake Controls
} IDAVO and RDYO
I-----t~ (P32 and P35)
OEN
Out
In
-----------,
1 Auto Latch
1
: RAJ 500k n 1
- - - - - - ______ 1
725
PIN FUNCTIONS (Continued)
Port 1. (PlO-P17). Port 1 is an 8-bit, TTL compatible port. Port 1 can be placed in a high-impedance state along with
I! has multiplexed Address (A7-AO) and Data (07-00) Port 0, lAS, IDS and R/{w, allowing the MCU to shiue
ports for in.terfacing external memory. common resources in multiprocessor and DMA applica-
tions. Data transfers are controlled by assigning P33 as a
If more than 256 external locations are required, Port 0 Bus Acknowledge input, and P34 as a Bus request output
must output the additional lines. (Figure 6).
Port 1
(110 or AD7 - ADO)
. Z86C21
MCU
OEN
Out
In
r-----------,
I I Auto Latch
.I I
IL.. R~
_ _ _500kn
_______ ...JI
726
Port 2. (P20-P27). Port 2 is an 8-bit, bit programmable, 2 is placed under handshake control. In this configuration,
bidirectional, TTL compatible port. Each of Ihese eight I/O Port 3 lines P31 and P36 are used as the handshake conlrol
lines are independently programmed as an input or output lines /DAV2 and RDY2. The handshake signal assignment
or globally as an open-drain output. Port 2 is always for Port 3 lines P31 and P36 is dictated by the direction
available for I/O operation. When used as an I/O port, Port (input or output) assigned to P27 (Figure 7).
Z86C21
- - Port 2 (1/0)
MCU
Handshake Controls
} IDAV2 and RDY2
(P3l and P36)
-
Open Drain
OEN
Out
72:7
PIN FUNCTION (Continued)
Port 3. (P3D-P37). Port 3 is an 8-bit, TTL compatible four output ports. Port 3, when used as serial I/O. are
fixed input and four fixed output port. These eight I/O lines programmed as serial in and serial out, respectively
have four-fixed (P33-P30) input and four fixed (P37-P34) (Figure 8).
-
-
Z86C9 1 Port 3 (1/0)
MCU (1/0 or Control)
Port 3 is configured under software control to provide the (IROO-IR03); timer input and output signals (TIN and Tou,)'
following control functions: handshake for Ports 0 and 2 and Data Memory Select (lDM).
(lDAV and RDY); four external "interrupt request signals
Noles:
HS = HANDSHAKE SIGNALS
D = Data Available
R=Ready
728
Port 3 lines P30 and P37. are programmed as serial I/O Received data must have a start bit. 8 data bits and at least
lines for full-duplex serial asynchronous receiver/trans- one stop bit. If parity is on. bit 7 of the received data is
mitter operation. The bit rate is controlled by the Counter/ replaced by a parity error flag. Received characters gen-
TimerO. erate the IRQ3 interrupt request.
The Z86C91 automatically adds a start bit and two stop Auto-Latch. The Auto-Latch puts valid CMOS levels on all
bits to transmitted data (Figure 9). Odd parity is also CMOS inputs that are not externally driven. lilis reeJuces
available as an option. Eight data bits are always trans- excessive supply current flow in the input buffer when it is
mitted. regardless of parity selection. If parity is enabled. not driven by any source.
the eighth bit is the odd parity bit. An interrupt request
(IRQ4) is generated on alltransmilled characters.
729
FUNCTIONAL DESCRIPTION
65535 65535
External
ROM and RAM
r - --- -- ----
Location of
First Byte of
12 " ~-
Instruction 11 IR05 External
Executed
After RESET 10 Data
IROS
Memory
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 ....... IR02
~~
IR02
Interrupt 8192
Vector 3 IR01
(Upper Byte) 8191
2 IR01
Not Addressable
1 IROO
0 IROO o
Figure 10. Program Memory Configuration Figure 11. Data Memory Configuration
730
Register File. The Register File consists of three I/O port mode, the Register File is divided into 16 working register
registers, 236 general-purpose registers and 16 control groups, each occupying 16 continuous locations. The
and status registers (Figure 12). The instructions can Register Pointer addresses the starting location of tile
access registers direclly or indireclly via an 8-bit address active working-register group.
field. The Z86C91 also allows short 4-bit register address-
ing using the Register Pointer (Figure 13). In the 4-bit Note: Register Bank EO-EF is only accessed 1I1rough
working register and indirect addressing modes.
LOCATION IDENTIFIERS
244 Timer/Counter 0 TO
242 Timer/Counter 1 T1
239
General-Purpose
Registers
4
3 Port 3 P3
2 Port 2 P2
Reserved
o PortO PO
731
FUNCTIONAL DESCRIPTION (Continued)
R239
R15
- - -
I/OPOrtS '- - - R3
Stack. The Z86C91 has a 16-bit Stack Pointer (R254-R255) registers (R4-R239). The high byte of the Stack Poinler
used for external stack that resides anywhere in the data (SPH-Bit 8-15) is used as a general purpose register when
memory. An 8-bit Stack Pointer (R255) is used for the using internal stack only.
internal stack that resides within the 236 general-purpose
732
Countermmers. There are tw08-bit programmable counter! also be programmed to stop upon reaching zero (single
timers (TO-T1), each driven by its own 6-bit programmable pass mode) or to automatically reload the initial value and
prescaler. The T1 prescaler is driven by internal or external continue counting (modulo-n continuous mode).
clock sources; however, the TO prescaler is driven by the
internal clock only (Figure 14). The counter, but not the prescalers, are read at any time
without disturbing their value or count mode. lha clock
The 6-bit prescalers divide the input frequency of the clock source for T1 is user-definable and can be either tile
source by any integer number from 1 to 64. Eactl prescaler internal microprocessor clock divided by four, or all exter-
drives its counter, which decrements the value (1 to 256) nal signal input via Port 3. The Timer Mode register coillig-
that has been loaded into the counter. When both the ures the external timer input (P31) as an external clock, a
counter and prescaler reach the end of the count, a timer trigger input that can be retriggerable or non-retriggerable,
interrupt request, IR04 (TO) or IR05 (T1), is generated. or as a gate input for the internal clock. Port 31ine P36 also
serves as a timer output (Tour) througll which TO, Tl or sub
The counter can be programmed to start, stop, restart to the internal clock is output. The counter/timers are cas-
continue, or restart from the initial value. The counters can caded by connecting the TO output to the input of T 1
TO
Current Value
Register
IRQ4
Serial 110
Clock
TOUT
P3S
Tl
Current Value
Register
733
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The Z86C91 has six different interrupts from To accommodate polled interrupt systems, interrupt in-
eight different sources. The interrupts are maskable and puts are masked and the Interrupt liequest register is
prioritized. The eight sources are divided as follow: four . polled to determine which of the interrupt requests need
sources are claimed by Port 3 lines P30-P33, one in Serial service. Software initialed interrupts are supported by
Out. one in Serial In, and two in the counter/timers (Figure setting the appropriate bit in the Interrupt Request register
15). The Interrupt Mask Register globally or individually (IRQ).
enables or disables the six interrupt requests. Wilen more
than one interrupt is pending, priorities are resolved by a Internal interrupt requests are sampled on the falling edge
programmable priority encoder that is controlled by the of the last cycle of every instruction, and the interrupt
Interrupt Priority register. request must be valid 5TpC before the falling edge of the
last clock cycle of the currently executing instruction.
All Z86C91 interrupts are vectored through locations in the
program memory. When an interrupt machine cycle is When the device samples a valid interrupt request, lIle
activated, an interrupfrequest is granted. Thus, this dis- next 48 (external) clock cycles are used to prioritize the
ables all of the subsequent interrupts, save the Program interrupt. and push the two PC bytes and the FLAG register
Counter and Status Flags, and then branches to the on the stack. The following nine cycles are used to fetcll the
program memory vector location reserved for that interrupt. interrupt vector from external memory. The first byte of the
This memory location and the next byte contain the 16-bit interrupt service routine is fetched beginning on the 58th
address of the interrupt service routine for that particular TpC cycle following the internal sample point, which cor-
interrupt request. responds to the 63rd TpC cycle following the external
interrupt sample point.
tRQO-IRQ5
6
. Global
Interrupt
Enabte
tnterrupt
Request
Vector Setect
734
Clock. The Z86C91 on-chip oscillator has a high-gain, than or equal to 100 Ohms. The crystal should be con-
parallel-resonant amplifier for connection to a crystal, LC, nected across XTAL 1 and XT AL2 using the recommended
ceramic resonator, or any suitable external clock source capacitors (10 pF < CL < 300 pF) from each pin to ground
(XTAL 1=Input, XTAL2=Output). The crystal should be AT (Figure 16).
cut, 1 MHz to 20 MHz max, and series resistance (RS) less
C2:J;:
HALT. Turns off the internal CPU clock but not the XTAL In order to enter STOP (or HALT) mode, it is necessary to
oscillation. The counter/timers and the external interrupts first fluStl the instruction pipeline to avoid. suspending
IROO, IR01, IR02 and IR03 remain active. The devices execution in mid-instruction. To do this, the user must
are recovered by interrupts, either externally or internally execute a NOP (opcode=OFFH) immediately before the
generated. appropriate steep instruction,. i.e.:
STOP. This instruction turns off the internal clock and FF NOP ; clear tile pipeline
external crystal oscillation and reduces the standby cur- 6F STOP ; enter STOP mode
rent to 10 microamperes or less. The Stop mode is termi- or
nated by a reset, which cause the processor to restart the FF NOP ; clear the pipeline
application program at address OOOCH. 7F HALT ; enter HALT mode
735
ABSOLUTE MAXIMUM RATINGS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to tile device. This
Vee Supply Voltage' -0.3 +7.0 V is a stress rating only; operation of the device at any
TSTG Storage Temp -65 +150 C condition above those indicated in tile operational sec-
TA Oper Ambient Temp t C tions of these specifications is not implied. Exposure to
absolute maximum rating conditions for an extended pe-
Noles: riod may affect device reliability.
, Voltages on all pins with respecllo GND.
t See Ordering Information
9.1 kn
736
DC CHARACTERISTICS
lee1 Standby Current 6.5 6.5 4 rnA HALT Mode VIN = OV, Vee @12MHz[1]
7 7 4.5 rnA HALT Mode VIN = OV, Vee @16MHz[1]
8.5 8.5 rnA HALT Mode VIN = OV, Vee @20MHz[1]
1CC2 Standby Current 10 10 1 IlA STOP Mode VIN = OV, Vee [1]
IAll Auto Latch Low Current -10 10 -14 14 5 J.II\
Note:
[1) All inputs driven to OV. Vcr; and outputs floating.
737
AC CHARACTERISTICS
External I/O or Memory Read/Write Timing Diagram
RlIW
) K
--®-
~
Port 0, 10M )~
'J/
16
~ 3
~
Port 1
)1 A7·AO 07· DO IN
--<I)-oo ~ - f-®
~
lAS
~ 8 18
1=0= ~ 6
IDS
~ I
~
(Read)
~
It
Port1 A7·AO
)] 07· DO OUT
_J
--®-- --@-
IDS , 7
(Wr~e)
17 "
Figure 18. External 110 or Memory Read/Write Timing
738
AC CHARACTERISTICS
External 110 or Memory Read or Write Timing Table
Noles:
[1) When using extended memory timing add 2 TpC. Clock Dependent Formulas
[2) Timing numbers given are for minimum TpC.
[3) See cloak cycle dependent charact~ristics table. Number Symbol Equation
,739
AC CHARACTERISTICS
Additional Timing Diagram
Clock
\ }@i:fu \'---
TIN
V \'---
IRalN
'hi \-
Figure 19. Additional Timing
AC ·CHARACTERISTICS
Additional Timing Table
9 TwlH Interrupt Request Input High Times 3TpC 3TpC 3TpC 3TpC 3TpC 3TpC [2,3]
Noles:
[1] Clock timing references use 3.fN for a logic 1 and O.BV for a logic O.
(2) Timing references use 2.0V for a logic 1 and O.BV for a logic O.
(3) Interrupt references request via Port 3.
(4) Interrupt request via Port 3 (P31-P33).
(5) Interrupt request via Port 30.
740
AC CHARACTERISTICS
Handshake Timing Diagrams
RDY
(OUtput)
rr------------~}- - - - - - - - - - - - - _.
Data Out ~ata Out Valid Next Data Out Valid
I'------------~}- - - - - - - - - - - - - --
ROY
(Input)
AC CHARACTERISTICS
Handshake Timing Table
No Symbol Parameter TA =ooe TO 700 e TA =·40oe TO 105°e Notes
12,16, and 20 MHz 12,16, and 20 MHz (Data Direction)
Min Max Min Max
1 TsDI(DAV) Dala In Selup Time 0 0 IN
2 ThDI(DAV) Dala In Hold Time 145 145 IN
3 TwDAV Dala Available Widlh 110 110 IN
4 TdDAVI(RDY) DAV fall 10 RDY fall Delay 115 115 IN
5 TdDAVld(RDY) DAV rise 10 RDY rise Delay 115 115 IN
6 TdDO(DAV) RDY rise to DAV fall Delay 0 0 IN
7 TclDAVO(RDY) Data Out 10 DAV fall Delay TpC TpC OUT
8 TclDAVO(RDY) DAV fall 10 RDY fall Delay 0 0 OUT
9 TdRDYO(DAV) RDY fall 10 DAV rise Delay . 115 115 OUT
10 TwRDY RDYWidlh 110 110 OUT
11 TdRDYOd(DAV) RDY rise 10 DAV fall Delay 115 115 OUT
741
Z8 CONTROL REGISTER DIAGRAMS
R240SIO R243 PRE1
Iwloolool~lool~lrnlool
I Serial Data (DO =lSB) Count Mode
o T1 Single Pass
1 T1 ModuloN
R245 PREO
Figure 23. Timer Mode Register (F1H: ReadIWrite)
Reserved (Must be 0)
I Tl Initial Value Prescaler Modulo
(When Written) (Range: 1-64 Decimal
(Range: 1-256 Decimal 01-00 HEX)
01-00 HEX)
T1 Current Value
(When Read)
Figure 27. Prescaler 0 Register (F5H: Write Only)
742
R246P2M R248 P01M
Imloolool~lool~I~lool
I pa, - P271/o Definition P03 - POO Mode
o Dellnes Bil as OUlput 00 Output
1 Dellnes Bit as Input 01 Input
IX All-AS
Stack Selection
Figure 28_ Port 2 Mode Register (F6H: Write Only) o External
1 Internal
743
Z8 CONTROL REGISTER DIAGRAMS (Continued)
R250IRQ R253 RP
II
IRQ1 = P33 Input
IRQ2 = P31 Input
IRQ3 = P30 Input. Sariallnput r4 }
IRQ4 = TO Sarial Output L - - - I-
:: Register Pointer
IRQ5=TI
Reserved r7
Figure 32. Interrupt Request Register Figure 35. Register POinter Register
(FAH: ReadlWrite) (FDH: ReadlWrite)
R2511MR R254SPH
IIDloolool~lool~lrnlool
1 Enables IRQ5-IRoo
I Stack Pointer Upper
(Dl= IRQO) Byte (SP,.- SF's)
1 Enables RAM Protect
1 Enables Interrupts
Figure 36. Stack Pointer Register (FEH: ReadlWrite)
R252FLAGS 1~loolool~lool~lrnlool
I Stack Pointer Lower
Byte (SP7 - SPo)
User Flag F1
User Flag F2
HaW Carry Flag Figure 37. Stack Pointer Register (FFH: Read/Write)
Decimal Adjust Flag
Overflow Flag
Sign Flag
L -_ _ _ _ _ _ _ _ " Zero Flag
Carry Flag
744
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flages are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address, Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
745
CONDITION CODES
746
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
MODE I OPC LD
src OR
dsl OR I---/---i
MODE I OPC LD
dstlsrc I x
ADDRESS
cc I OPC JP
DAU
DAL
OPC CALL
DJNZ, JR DAU
DAL
FFH -, STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" f- ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
747
748
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - - STOP 6F
-----------
OR dst, src t 4[ ] - 0 - - t
dst(-dst OR src ** SUB dst, src
dst(-dst(-src
2[ ]
**** 1
*
POP dst R 50 - - - - - - SWAP dst R FO X
** X - -
dst(-@SP;
~
IR 51 IR F1
SP(-SP + 1 17 o1
PUSH src R 70 - - - - - -
SP(-SP - 1; IR 71 TCM dst, src t 6[ ] - 0 - -
@SP(-src (NOT dst) **
AND src
RCF CF 0 - - - - -
C(-O TM dst, src t 7[ ] - 0 -
dstAND src **
RET AF - - - - - -
PC(-@SP; XOR dst, src t B[ ] - 0 - -
SP(-SP+ 2 dst(-dst **
XOR src
RLdst R 90
****- -
~
IR 91
t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ ]'
RLC dst R 10
****- - in this table, and its value is found in the following table to the left of the
~
IR 11 applicable addressing mode pair.
DF 1 - - - - - R R [4]
SCF
C(-1
R IR [5]
SRA dst R DO
*** 0 - -
R 1M [6]
~
IR D1
IR 1M [7]
SRP src 1m 31 - - - - - -
RP(-src
749
OPCODEMAP
Lower Nibble (Hex)
o 2 3 4 5 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM rl, R2 r2, Rl rl, RA ee, RA rl,lM ee, DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r-----
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5 r--
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRl 1M rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 t--
5 POP POP AND AND AND AND AND AND
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
6 COM COM TCM TCM TCM TCM TCM TCM STOP
..
)(
e...
Rl IRl
10/12.1 12/14.1
rl, r2
6.5
rl,Ir2
6.5
R2, Rl IR2, Rl
10.5 10.5
Rl,lM
10.5
IR1,IM
10.5 ty:Q
7 PUSH PUSH 1M 1M 1M 1M 1M 1M HALT
:c
.D R2 IR2 rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
Z
....
a.
a.
8
10.5 10.5 12.0
DECW DECW LDE
RRl IRl
18.0
LDB
rl,Irr2 Irl,Irr2
""6T
DI
::J
6.5 6.5 12.0 18.0 ""6T
9 RL RL LDE LDB B
. Rl IRl r2,Irrl Ir2,Irrl
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 '14:0
A INCW INCW CP CP CP CP CP CP RET
RRl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
B
6.5
CLR
6.5
CLR
6.5
XOR
6.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
rw:o
IRET
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
C
6.5
RRC
6.5
RRC
12.0
LDC
18.0
LDCI
10.5
LD
r--s:s
RCF
Rl IRl rl,Irr2 Irl,Irr2 rl,x,R2
6.5 6.5 12.0 18.0 20.0 20.0 10.5 ~
D SRA SRA LDC LDCI CALL' CALL LD SCF
Rl IRl r2,Irrl Ir2,Irrl IRRl DA r2,x,Rl
E
6.5
RR
6.5
RR
6.5
LD
10.5
LD
10.5
LD
10.5
LD
10.5
LD
r--s:s
CCF
Rl IRl rl,IR2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 10.5 ~
F SWAP SWAP LD LD NOP
Rl IRl Irl, r2 R2,IRl
\,
".
2
A,
".
3
" 'Y'
2
~
3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline R 1 or r 2 = Ost address
Cycles J Cycles R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
750
PRELIMINARY PRODUCT SPECIFICATION
~ZiIill
Z86C93
CMOS Z8® MULT/DIV
MIGROGONTROLLER
FEATURES
• Complete microcontroller, 24 I/O lines, and up to 64 • Full-duplex UART and two 16-bit counter timers with
Kbytes of addressable extemal space each for program 6-bit prescalers.
and data memory.
• Third 16-bit counter/timer with 4-bit prescaler, one
• 16-bit x 16-bit hardwired multiplier with 32-bit product capture register and a fast decrement mode.
in 17 clock cycles.
• Register Pointer so that short, fast instructions can
• 32-bit by 16-bit hardwired divider with 16-bit quotient access anyone of th,e sixteen working register groups.
and 16-bit remainder in 20 clock cycles.
• Additional emulation signals SCLK, lACK, and /SYNC
• 256-byte register file, including 236 general registers, are made available.
four I/O port registers and 16 status and control
registers. • Single +5V power supply, all I/O pins TTL compatible
• 17-byte Expanded Register File, including two general- • 1.2 micron CMOS technology
purpose registers and 15 status and control registers.
• Clock speed - 20 MHz
• Vectored, priority interrupts for I/O, counter/timers
and UART. • Two low power standby modes, STOP and HALT
GENERAL DESCRIPTION
The Z86C93 is a CMOS ROMless Z8 microcontroller en- There are 256 registers located on-chip organized as 236
hanced with a hardwired 16-bit x 16-bit multiplier and general purpose registers, 16 control and status registers,
32-bit/16-bit divider and three 16-bit counter timers (Fig- and four I/O port registers. The register file can be divided
ure 1). A capture register and a fast decrement mode is into sixteen groups of 16 working registers each. Con-
also provided. It is fabricated using 1.2 micron CMOS figuration of the registers in this manner allows the use of
technology ..It is offered in 40-pin Plastic Dual-In-Line, 44- short format instructions; in addition, any of the individual
pin Leaded Chip Carrier and 44-pin Plastic Quad Flat Pack registers can be accessed directly. There are an additional
(Figures 2,3, 4, and 5). Besides the three additional emu- 17 registers implemented in the Expanded Register File in
lation signals (SCLK, lACK, and /SYNC), the Z86C93 is Banks 0 and E. Two of the registers may be used as
fully pin compatible with Z86C91, yet it offers a much more general purpose registers, while 15 registers supply Ihe
powerful mathematical capability. data and control functions for the Multiply/Divide Unit and
Counter/Timer blocks.
The Z86C93 provides up to 16 output address lines thus
permitting an address space of up to 64 K bytes of data r,
Note: All Signafs with a preceding front slash, • are active
and program memory each. Eight address outputs (AD7- Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
ADO) are provided by a multiplexed, 8-bit. Address/Data active Low, only); INIIS (NORMAL and SYSTEM are both
bus. The remaining 8-bits can be provided by the software active Low).
a
configuration of Port to output address bits A 15-A8.
751
GENERAL DESCRIPTION (Continued)
Output Input VCC GND XTAL lAS IDS RlIW IRESET SCLK lACK ISYNC
~ J
Machine Timing, Emulation
and Instruction Control
ALU
FLAGS
Register
Pointer
Register File
256 x 8-Bit
752
PIN DESCRIPTION
-- +5V
GND
IRESET
RlIW
SCLK
lACK
ISYNC
} Emo"tio",
Pins
IDS XTAL1
lAS XTAL2
POO P20
POl P2l
P02 P22
Port 0 (Nibble P03 P23 Port 2 (Bit
Programmable Programmable)
1I0orA15-AS P04 Z86C93 P24 110
P05 MCU P25
P06 P26
P07 P27
Pl0 P30
Pll P3l
P12 P32
Port 1 (Byte P13 P33 Port 3 Serial and
Programmable) Parallel 110 and
AD7-ADO P14 P34 Control
P15 P35
P1G P3G
P17 P37
753
PIN DESCRIPTION (Continued)
~ ::.::i~
"" ~~
...10 >U)~""U)on
Ot') t') on t') t') C\I C\I C\I
WOo 0. '+0.0.0.0.0.
654 3 2 1 44 43 42 41 40
IRESET 7 39 NC
RlIW 8 38 P24
IDS 9 37 P23
lAS 10 36 P22
P35 11 35 P21
Z86C93
GND 12 MCU 34 P20
P32 13 33 P33
POO 14 32 P34
P01 15 31 P17
P02 16 30 P16
lACK 17 29 P15
18 19 20 21 22 23 24 25 26 27 28
ac!;8~~~;:~~VO
o.o.o.o.o.o.o.o.o.a:~
!,Q
1 Vee Power Supply Input 14-16 POO-P02 Port 0 pin 0,1,2 In/Output
2 XTAL2 Crystal. Osc. Clock Output 17 lACK In!. Acknowledge Output
3 XTAL1 Crystal, Osc. Clock Input 18-22 P03-P07 Port 0 pin 3,4,5,6,7 In/Output
4 P37 Port 3 pin 7 Output 23-27 P10-P14 Port 1 pin 0,1,2,3,4 In/Output
9 /DS Data Strobe Output 34-38 P20-P24 Port 2 pin 0,1,2,3,4 In/Output
10 /AS Address Strobe Output 39 N/C Not Connected Input
11 P35 Port 3 pin 5 Output 40-42 P25-P27 Port 2 pin 5,6,7 In/Output
12 GND Ground GND Input 43 P31 Port 3 pin 1 Input
13 P32 Port 3 pin 2 Input 44 P36 Port 3 pin 6 Output
754
33 32 31 30 29 28 27 26 25 24 23
P25 34 22 ISYNC
P26 35 21 P14
P27 36 20 P13
P31 37 19 P12
P36 38 18 P11
Z86C93
+5V 39 MCU 17 P10
XTAL2 40 16 P07
XTAL1 41 15 P06
P37 42 14 P05
P30
SCLK
43
44 0
1 2 3 4 5 6 7 8 9 10 11
13
12
P04
P03
/jj~cncn~o C\I
C')
O,....N~
000 u
cn~e~a..i3 a.. a..a..a..~
w
~
5 P35 Port 3 pin 5 Input 34-36 P25-P27 Port 2 pin 5,6,7 In/Output
6 GND Ground GND Input 37 P31 Port 3 pin 1 Input
7 P32 Port 3 pin 2 Input 38 P36 Port 3 pin 6 Output
8-10 POO-P02 a
Port pin 0,1,2 In/Output 39 Vee Power Supply Input
40 XTAL2 Crystal, Osc. Clock Output
11 lACK Int. Acknowledge Output
12-16 P03-P07 a
Port pin 3,4,5,6,7 In/Output 41 XTAL1 Crystal, Osc. Clock Input
17-21 P10-P14 Port 1 pin 0,1,2,3,4 tn/Output 42 P37 Port 3 pin 7 Output
22 /SYNC Synchronize Pin Output 43 P30 Port 3 pin a Input
23-25 P15-P17 Port 1 pin 5,6,7 In/Output 44 SCLK System Clock Output
755
PIN FUNCTIONS
IDS. (output, active Low). Data Strobe is activated once for Port 0 POO-P07. Port 0 is an 8-bit, nibble programmable,
each external mernory transfer. For a READ operation, bidirectional, TTL compatible port. These eight 1/0 lines
data must be available prior to the trailing edge of IDS. For can be configured under software control as a nibble 1/0
WRITE operations, the falling edge of IDS indicates that port, or as an address portfor interfacing external memory.
output data is valid. When used as an 1/0 port, Port 0 may be placed under
handshake control. In this configuration, Port 3, lines P32
lAS. (output, active Low). Address Strobe is pulsed once and P35 are used as the handshake control IDAVO and
at the beginning of each machine cycle. Address output is RDYO (Data Available and Ready). Handshake signal
via Port 1 for all external programs. When IRESET is assignment is dictated by the 1/0 direction of the upper
asserted, lAS toggles. Memory address transfers are valid nibble P04-P07. The lower nibble must have the same
at the trailing edge of lAS. Under program control, lAS can direction as the upper nibble to be under handshake
be placed in the high-impedance state along with Ports 0 control. Port 0 cornes up as A 15-A8 Address lines
and 1, Data Strobe, and Read//Write. after IRESET.
XTAL1, XTAL2. Crystal 1, CrystaI2(time-based input and For external memory references, Port 0 can provide ad-
output, respectively). These pins connect a parallel-reso- dress bits A 11-A8 (lower nibble) or A 15-A8 (lower and
nant crystal, ceramic resonator, LC, or any external single- upper nibble) depending on the required address space.
phase clock to the on-chip oscillator and buffer. If the address range requires 12 bits or less, the upper
nibble of Port 0 can be programmed independently as 1/0
RlIW. (output, read Highlwrite Low). The Read/Write signal while the lower nibble is used for addressing. If one or bolh
is low when the MCU is writing to the external program or nibbles are needed for 1/0 operation, they must be config-
data memory. It is high when the MCU is reading from the ured by writing to the Port 0 Mode register. After a hard-
external program or data memory. ware reset, Port 0 lines are defined as address lines A 15-
A8, and extended timing is set to accommodate slow
IRESET. (input, active-Low). To avoid asynchronous and memory access. The initialization routine can include
noisy reset problems, the Z86C93 is equipped with a reset reconfiguration to eliminate this extended timing mode
filter of four external clocks (4TpC). If the extemallRESET (Figure 6). The 10EN (Output Enable) signal in Figure 6 is
signal is less than 4TpC in duration, no reset occurs. an internal signal.
On the 5th clock after the IRESET is detected, an internal Port 1 P10-P17. Port 1 is an 8-bit, byte programmable,
RST signal is latched and held for an internal register count bidirectional, TTL compatible port. It has multiplexed
of 18 external clocks, or for the duration of the external Address (A7-AO) and Data (07-00) ports.
IRESET, whichever is longer. During the reset cycle, IDS is
held active low while lAS cycles at a rate of TpC/2. When To interface external memory, Port 1 is prog rammed for the
IRESET is deactivated, program execution begins at loca- multiplexed AddresslData mode. If more than 256 external
tion OOOC (HEX). Reset time must be held low for 50 ms or locations are required, Port 0 must output the additional
until VCC is stable, whichever is longer. lines (Figure 7).
SCLK. System Clock(output). The inte~nal system clock is Port 2 P20-P27. Port 2 is an 8-bit, bit programmable,
available at this pin. bidirectional, CMOS compatible port. Each of these eight
I/O lines are independently programmed as an input or
lACK. Interrupt Acknowledge (output, active-High). This output, or globally as an open-drain output. Port 2 is always
output, when high, indicates that the Z86C93 is in an available for 1/0 operation. When used as an I/O porI, Port
interrupt cycle. 2 is placed under handshal(e control. In this configuration,
Port 3 lines P31 and P36 are used as Ihe handsllake
ISYNC. (output, active-Low). This signal indicates the last controls lines IDAV2 and RDY2. The handshake signal
clock cycle of the currently executing instruction. assignment for Port 3 lines P31 and P36 is dictated by the
direction (input or output) assigned 10 P27 (Figure 8).
756
Z86C93
MCU
Handshake Controls
} tDAVO and RDYO
t----t~ (P32 and P3S)
+SV
tOEN
Out
In
I .,
Auto Latch
I I
I I
L _________ l
~
M~
Port 1
(VO or AD? • ADO)
To External
Memory
+5V
tOEN
Out
701
PIN FUNCTIONS (Continued)
Port2 (VO)
Z86C93
MCU
Handshake Controls
IDAV2 and RDY2
(P31 and P36)
+5V
IOpen Drain
IOEN -
Out
In
758
Port 3 P30-P37. Port 3 is anB-bit, CMOS compatible four output ports. Port 3 pins P30 and P37, when used as serial
fixed input and four fixed output port. These B I/O lines I/O, are programmed as serial in and serial out. respec-
have four-fixed (P30-P33) input and four fixed (P34-P37) tively (Figure 9 and Table 4).
-
Z86C9 3 Port 3
MCU (1/0 or Control)
-------------,
Auto laIch
D
pAD
~ In
~
Port 3 is configured under software control to provide the regardless of parity selection. If parity is enabled, the
following control functions: handshake for Ports 0 and 2 eighth bit is the odd parity bit. An interrupt request (IRQ4)
(IDAV and ROY); four external interrupt request Signals is generated on all transmitted characters.
(IRQO-IRQ3); timer input and output signals (Tin and Tout),
and Data Memory Select (10M). Received data must have a start bit, B data bits and at least
one stop bit. If parity is on, bit 7 of the received data is
Port 3 lines P30 and P37, can be programmed as serial replaced by a parity error flag. Received characters gen-
I/O lines for full-duplex serial asynchronous receiver/ erate the IRQ3 interrupt request.
transmitter operation. The bit rate is controlled by the
Counter/Timer O. Auto-Latch. The auto-latch puts a valid CMOS level on all
CMOS inputs that are not externally driven. Whether til is
The ZB6C93 automatically adds a start bit and two stop bits level is zero or one, cannot be determined. A valid CMOS
to transmitted data (Figure 10). Odd parity is also available level rather than a floating node reduces excessive supply
as an option. Eight data bits are always transmitted, current flow in tile input buffer.
759
PIN FUNCTIONS (Continued)
ADDRESS SPACE
Program Memory. The Z86C93 can address up to space. 10M, an optional 1/0 function tllat can be pro-
64 Kbytes of external program memory. Program execu- grammed to appear on pin P34, is used to distinguish
tion begins at external location OOOC (HEX) after a reset. between data and program memory space (Figure 11).
The state of the 10M signal is controlled by tile type
Data Memory. The Z96C93 can address up to 64 Kbytes instruction being executed. An "LOC" opcode references
of external data memory. External data memory is included PROGRAM (10M inactive) memory, and an "LDE" instruc-
with, or separated from, the extemal program memory tion references OATA (10M active low) memory.
760
65535
Program Data
Memory Memory
Location 01
Frrst Byte 01
Instruction
Executed
Alter RESET
-....... :-..- - - -
12
- -
11
10 I- IR05 -
9
Interrupt
Vector 8 I- IR04 -
(Lower Byte)
~ I- IR03 -
Interrupt
5 ~
IF IR02 -
Vector - 3
(Upper Byte) 2
I- IR01 -
1
0
I- IROO -
Figure 11. Program and Data Memory Configuration
Expanded Register File. The register Iile has been and status registers. The instructions can access registers
expanded to allow for additional system control registers, directly or indirectly via an 8-bit address field. The Z86C93
and for mapping of additional peripheral devices along also allows short 4-bit register addressing using the Reg-
with I/O ports into the register address area (Figure 12). isterPointer (Figure 14).ln the 4-bitmode, the Register File
The Z8 register address space RO through R15 has now is divided into 16 working register groups, each occupying
been implemented as 16 groups of 16 registers per group. 16 continuous locations. The Register Pointer addresses
These register groups are known. as the ERF (Expanded the starting location of the active working-register group.
Register File). Bits 7-4 of register RP select the wprking
register group. Bits 3-0 of register RP select the expanded Note: Register Bank EO-EF can only be accessed through
register group (Figure 13). The registers that are used in working register and indirect addressing modes.
the multiply/divide unit reside in the Expanded Register
File at Bank E and those for the additional timer control Stack: The Z86C93 has a 16-bit Stack Pointer (R254-
words reside in Bank D. The rest of the Expanded Register R255), used for external stack, that resides anywhere in
is not physically implemented and is open for future the data memory. An 8-bit Stack Pointer (R255) is used for
expansion. the internal stack that resides within the 236 general-
purpose registers (R4-R239). The high byte of the Stack
Register File. The Register File consists of four I/O port Pointer (SPH, Bits 8-15) can be used as a general purpose
registers, 236 general-purpose registers and 16 control register when using internal stack only.
761
ADDRESS SPACE (Continued)
Z8 STANDARD CONTROL REGISTERS
RESET CONDITION
REGISTER
%FF SPL u u u u u u u u
%FE SPH u u u u u u u u
REGISTER POINTER
"("FO RP 0 0 0 0 0 0 0 0
1716151413121 1 !o1 %FC FLAGS u u u u u u u u
Working RegiS.;~ 0 u u u u u u u
Group Pointer I Expanded Register
Group Pointer
"/"FB
"/.. FA
IMR
IRQ 0 0 0 0 0 0 0 0
"IaF9 IPR u u u u u u u u
.. "I.. FB
"!oF?
P01M
P3M
0
0
1
0
0
0
0
0
1
0
1
0
0
0
1
"IaFS P2M 1 1 1 1 1 1 1 1
/ %F5
%F4
PREO
To
U
U
U
U
U
U
U
U
U
U
U
U
U
U
0
- ----
Z8Reg. File %F3 PREI U U U U U U 0 0
%FF Of.. F2 T1 u u u u u u u u
"IoFO
%Fl TMR 0 0 0 0 0 0 0 0
%FO SIO u u u u u u u u
%(E)6 MOCON 1 0 0 u u u 0 0
%(E)5 MREG5 u u u u u u u u
%(E)4 MREG4 u u u u u u u u
%(E)3 MREG3 u u u u u u u u
%(E)2 MREG2 u u u u u u u u
%(E)1 MREGt u u u u u u u u
%(E)O MREGO u u u u u u u u
"/oOF
%00
%(D)4 TOH u u u u u u u u
%(D)3 T2PRE u u u u 0 u 0 0
%(D)2 T1H u u u u u u u u
%(D)1 T2TMR u 0 u 0 0 0 0 0
%(D)O Reserved
762
R253 RP
R230
R15
- - - R3
I/O Ports
763
FUNCTIONAL DESCRIPTION
This section breaks down the Z86C93 into its main func- The multiply/divide unit is interfaced like a peripheral. The
tional parts. only addressing mode available with the peripheral inter-
face is register addressing. In other words, all of tile
Multiply/Divide Unit operands are in the respective registers before a multipli-
cation/division can start.
This section describes the basic features, implementation
details of the interface between the Z8 and the multiply/ Register mapping. The registers used in the multiply/divide
divide unit. unit are mapped onto the expanded register life in Bank E.
The exact register locations used are shown below.
Basic features:
REGISTER ADDRESS
• 16-bit by 16-bit multiply with 32-bit product
MREGO % (E) 00
• 32-bit by 16-bit divide with 16-bit quotient and 16-bit MREGl % (E)Ol
remainder MREG2 %(E)02
MREG3 %(E)03
• Unsigned integer data format MREG4 % (E) 04
MREG5 % (E) 05
• Simple interface to Z8 MDCON % (E) 06
GPR % (E) 14
Interface to ZS. The following is a brief description of the GPR % (E) 15
register mapping in the multiply/divide unit and its
interface to Z8 (Figure 15).
Z8
764
Register allocation. The following is the register allocation Tile following is the register allocation during division.
during multiplication.
Higll byte of high word of dividend MREGO
Multiplier high byte MREG2 Low byte of high word of dividend MREG1
Multiplier low byte MREG3 High byte of low word of dividend Mf1EG2
Multiplicand high byte MREG4 Low byte of low word of dividend MREG3
Multiplicand low byte MREG5 Higll byte of divisor MREG4
Result high byte of high word MREGO Low byte of divisor MI~EG5
Result low byte of high word MREG1 High byte of remainder MREGO
Result high byte of low word MREG2 Low byte of remainder MREG1
Result low byte of low word MREG3 High byte of quotient MREG2
Multiply/Divide Control register MDCON Low byte of quotient MREG3
Multiply/Divide Control register MDCON
Division Overflow
Handshake Bit (0= No Overflow
1= Overflow)
MUL = 1 0
NOP = 1
DONE bit (07). This bit is a handshake bit between the tilis bit is also write-protected during maUl unit operation
math unit and the external world. On power up, this bit is set and is reset to zero by the math unit upon starling of the
to one to indicate that the math unit has completed multiply/divide operation.
the previous operation and is ready to perfor.m the next
operation. DIVSL. Division Select (05). Similar to 06, 05 starts a
division operation.
Before starting a new multiply/divide operation, this bit
should be reset to zero by the processor/programmer. This 04-02. Reserved.
indicates that all the data registers have been loaded and
the math unit can now begin a multiply/divide operation. OIVOVF. Division Overflow (01). This bit indicated an
During the process of multiplication or division, tilis bit is overflow during the division process. Division overflow
write-protected. Once the math unit completes its opera- occurs when the high word of the dividend is greater tilan
tion it sets this bit to indicate the completion of operation. or equal to the divisor. This bitis read only. When setto one,
The processor/programmer can then read the result. it indicates overflow error.
765
FUNCTIONAL DESCRIPTION (Continued)
DIVZR. Division by Zero (DO). When set to one, this indi- The two General Purpose Registers (GPR) can be used as
cates an error of division by zero. This bit is read only. scratch pad registers or as external data memory address
pointers during an LDE instruction. MREGO thru MREG5, if
Example: not used for multiplication or division, can be used as
general purpose registers.
Upon reset, the status of the MDCON register is 100uuuOOb
(07 to DO). Performance of multiplication. The actual multiplication
takes 17 internal clock cycles. It is expected that the Cllip
u = Undefined would run at a 10 MHz internal clock frequency (external
x = Irrelevant clock divided by two). This results in an actual multiplication
b = Binary time (16-bit x 16-bit) of 1.7 us. If the time to load operands
and read results is included:
If multiplication operation is desired, the MDCON register
is set to 01 Oxxxxxb. No. of internal clock cycles to load 5 registers: 30
No. of internal clock cycles to read 4 registers: 24
If the MDCON register is READ during multiplication, it
would have a value of OOOuuuOOb. The total internal clock cycles to perform a multiplication is
71. This results in a net multiplication time of 7.1 us. Note
On completion of multiplication, the result of the MDCON that this would be the worst case. This assumes 1I1at all of
register is l00uuuOOb. the operands are loaded from the external world as opposed
to some of the operands being already in place as a result
If division operation is desired, the MDCON register is set of a previous operation wllose destination register is one of
to 001 xxxxxb. the math unit registers.
During division operation, the register would contain Performance of division. The actual division needs 20 in-
OOOuu??b (? - value depends on the DIVIDEND, DIVISOR). ternal clock cycles. This translates to 2.0 us for the actual
division at 10 Mhz (internal clock speed). If the time to load
Upon completion 01 division operation,.the MDCON regis- operands and read results is included:
ter contains 100uuu??b.
Number of internal clock cycles to load operands: 42
Note that once the multiplication/division operation starts, Number of internal clock cycles to read results: 24
all data registers (MREG5 thru MREGO) are write-protected
and so are the writable bits of the MDCON register. The The total internal clock cycles to perform a division is 86.
write protection is released once the math unit operation is This translates to 8.6 us at 10 Mhz.
complete. However, tile registers may be read at any time.
Countermmers
A multiplicatiofl sequence would look like:
This section describes the enhanced features of the counterl
1. Load multiplier and multiplicand. timers (CTC) on the Z86C93. It contains the register
2. Load MDCON register to start multiply operation. mapping of CTC registers and the bit functions of the newly
3. Wait for the DONE bit of the MDCON register to be added TillJer2 control register.
set to ONE and then read results.
In a standard Z8, there are two 8-bitprogrammable counterl
Note that while the multiply/divide operation is in progress, timers (TO and Tl), each driven by its own 6-bit program-
the programmer can use the Z8 to do other things. Also, mable prescaler. The Tl prescaler is driven by internal or
since the multiplication/division takes a fixed number of external clock sources; however, the TO prescaler is driven
cycles, he can start reading the results before the DONE by the internal clock only.
bit is set.
The 6-bit prescalers divide the input frequency of the clock
During a division operation, the error flag bits are set at the source by any integer number from 1 to 64. Each prescaler
beginning of the division operation which means the flag drives its counter, which decrements tile value (1 fa 256)
bits can be checked by the Z8 while the division operation that has been loaded into the counter. When the counter
is being done. reaches the end of the count, a timer interrupt request
IR04 (TO) or IR05 (T1), is generated.
766
The counters are programmed to start, stop, restart to These three counters are cascadable as shown in Table 5.
continue, or restart from the initial value. The counters can The result is that T2 may be extendable to 32 bits and Tl
also be programmed to stop upon reaching zero (single extendable to 24 bits. Bits 1 andO(CASl AND CASO) of Ule
pass mode) or to automatically reload the initial value and T2 Prescaler Register (PRE2) determine the counter length.
continue counting (modulo-n continuous mode).
Table 5. Counter Length Configurations
The counters, but not the prescalers, are read at any time
without disturbing their value or count mode. The clock CAS 1 CASO TO T1 T2
source for Tl is user-definable and is either the internal
microprocessor clock divided by four, or an external signal
o o 8 8 32
IR04
XTAUS
P36
TOUT
XTAUS
or
External
IR05
XTAUS
or
XTAU2
T2IRQ
P32 _ _- I IROO
767
FUNCTIONAL DESCRIPTION (Continued)
Observations
Except for the programmable down counter length and The T2 prescaler register is shown in Figure 19. Bits 1 and
clock input, T2 is identical to TO. oof this register control the various cascade modes of tile
counters.
TO and T1 retain all their features except that now they are
extendable interims of the down counter length. T2TMR (D) 01
T2 End Of Count
The counters are configured in the following maimer: o NotEOC
1 EOC
16
T1
16
T2
16
10 8 24 16
T2 32-bit high byte (TO) + high byte (T1) + 11 8 16 24
high byte (T2) + low byte (T2)
Reserved
Prescaler Modulo
Note that the T2 interrupt is logically ORed with P32 to (Range: 1 - 16 Decimal
01 - 00 Hex)
generate IROO.
The T2 Timer Mode register is shown in Figure 18. Upon Figure 19. T2 Prescaler Register (PRE2)
reaching end of count, bit 7 of this register is settoone.' This
bit is NOT reset in hardware and it has to be cleared by the
interrupt service routine. Interrupts
The register map of the new CTC registers is shown in The Z86C93 has six different interrupts from eight different
Figure 12. TO high byte and T1 high byte are at the same sources. The interrupts are maskable and prioritized. Tile
relative locations as their respective low bytes, but in a eight sources are divided as follow: four sources are
different register bank. claimed by Port 3 lines P30-P33, one in Serial Out, one in
768
Serial In, and two in the counter/timers. The Interrupt Mask request must be valid 5TpC before the falling edge of the
Register globally or individually enables or disables the six last clock cycle of the currently executing instruction.
interrupt requests. When more than one interrupt is pend-
ing, priorities are resolved by a programmable priority When the device samples a valid interrupt request, the
encoder that is controlled by the Interrupt Priority register. next 48 (extemal) clock cycles are used to prioritize tile
All ZB6C93 interrupts are vectored througillocations in the interrupt. and PUSll the two PC bytes and the FLAG register
program memory. When an interrupt machine cycle is on the stack. The following nine cycles are used to letch tile
activated an interrupt request is granted. Thus, this dis- interrupt vector from external memory. Tile first byte of tile
ables all of the subsequent interrupts, save the Program interrupt service routine is fetched beginning on tile 58t11
Counter and Status Flags, and then branches to the TpC cycle following the internal sample point, Wllich cor-
program memory vector location reserved for that inter- responds to tile 63rd TpC cycle following the external
rupt. This memory location and the next byte contain the interrupt sample pOint.
16-bit address of the interrupt service routine for that
particular interrupt request. Clock
To accommodate polled interrupt systems, interrupt in- The Z86C93 on-chip oscillator has a high-gain, parallel-
puts are masked and the Interrupt Request register is resonant amplifier for connection to a crystal, LC, ceramic
polled to determine which of the interrupt requests need resonator, or any suitable external clock source
service. Software initiated interrupts are supported (XTAL 1=1 nput, XTAL2=Output). The external clock levels
by setting the appropriate bit in the Interrupt Request are not TTL. The crystal should be AT cut, 1 MHz to 20 MHz
Register (IRO). max, and series resistance (RS) is less than or equal to 100
Ohms. The crystal should be connected across XT AL 1
Internal interrupt requests are sampled on the falling edge and XTAL2 using the recommended capacitors (10
of the last cycle of every instruction, and the interrupt pF<CL<100 pF) from each pin to ground (Figure :>'0).
C2~ C2~
Halt. Turns off the internal CPU clock but not the XTAL In order to enter STOP (or HALT) mode, it is necessary to
oscillation. The counter/tirners and the external interrupts first flush the instruction pipeline to avoid suspending
IROO, IR01, IR02 and IR03 remain active. The devices execution in mid-instruction. To do this, the user executes
are recovered by interrupts, either externally or internally a NOP (opcode=OFFH) immediately before the appropri-
generated. ate sleep instruction, Le.:
STOP. This instruction turns off the internal clock and FF NOP ; clear the pipeline
external crystal oscillation and reduces the standby cur- 6F STOP ; enter STOP mode
rent to 10 microamperes or less. The Stop mode is termi- or
nated by a /RESET, which causes the processor to restart FF NOP ; clear the pipeline
the application program at address OOOC (HEX). 7F HALT ; enter HALT mode
769
ABSOLUTE MAXIMUM RATINGS
Symbol Description Min Max Units Stress greater than those listed under Absolute Maximum
Ratings may cause permanent damage to the device. This
Supply Voltage* -0.3 +7.0 v is a stress rating only; operation 01 the device at any
Storage Temp -65 + 150 c condition above those indicated in the operational sec-
Oper Ambient Temp t c tions of tllese specifications is not implied. Exposure to
absolute maximum rating conditions for an extended pe-
* Voltages on all pins with respect to GND. riod may affect device reliability.
t See Ordering Information
770
DC ELECTRICAL CHARACTERISTICS
leet Standby Current 10 10 S rnA HALT Mode VIN = OV, Vee @16MHz[1]
12 12 9 rnA HALT Mode VIN = OV, Vee @20 MHz [1]
lecz Standby Current 10' 20 1 J.tA STOP Mode VIN = OV, Vee [1]
IAll Auto Latch Low Current -10 10 -14 14 5 J.tA
Nole:
[1] All inputs driven to av, Vee and outputs floating.
711
AC CHARACTERISTICS
External I/O or Memory Read/Write Timing Diagram
RlIW
) K
~
~
Port 0, IDM
) )~
16
~ 3
Port 1
)~ A7-AO D7 - DO IN
f-0-- -®- - kB
.1
~
lAS
I 8 18
~ --®- 6
IDS
I
(Read)
-----® "
---®----
Port1 A7-AO
): D7- DO OUT
~
~ H5>-
7
~~
IDS
(Write) It
772
AC CHARACTERISTICS
External I/O or Memory Read and Write Timing Table
No Symbol Parameter TA =O°C to 70°C TA =-40°C to 105°C Units Notes
16 MHz 20 MHz 16 MHz 20 MHz
Min Max Min Max Min Max Min Max
1 TdA(AS) Address Valid to lAS Rise Delay 25 20 25 20 ns [2,3]
2 TdAS(A) lAS Rise to Address Float Delay 35 25 35 25 ns [2,3]
3 TdAS(DR) lAS Rise to Read Data Req'd Valid 180 150 180 150 ns [1,2,3]
4 TwAS lAS Low Width 40 30 40 30 ns [2,3]
5 TdAZ(DS) Address Float to IDS Fall 0 0 0 0 ns
6 TwDSR IDS (Read) Low Width 135 105 135 105 ns [1,2,3]
7 TwDSW IDS (Write) Low Width 80 65 80 65 ns [1,2,3]
8 TdDSR(DR) IDS Fall to Read Data Req'd Valid 75 55 75 55 ns [1,2,3]
9 ThDR(DS) Read Data to IDS Rise Hold Time 0 0 0 0 ns [2,3]
10 TdDS(A) IDS Rise to Address Active Delay 50 40 50 40 ns [2,3]
11 TdDS(AS) IDS Rise to lAS Fall Delay 35 25 35 25 ns [2,3]
12 TdRfW(AS) R/fW Valid to lAS Rise Delay 25 20 25 20 ns [2,3]
13 TdDS(R/W) IDS Rise to RlfW Not Valid 35 25 35 25 ns [2,3]
14 TdDW(DSW) Write Data Valid to IDS Fall (Write) Delay 25 20 25 20 ns [2,3]
15 TdDS(DW) IDS Rise to Write Data Not Valid Delay 35 25 35 25 ns [2,3]
16 TdA(DR) Address Valid to Read Data Req'd Valid 230 180 230 180 ns [1,2,3]
17 TdAS(DS) lAS Rise to IDS Fall Delay 45 35 45 35 ns [2,3]
18 TdDl(DS) Data Input Setup to IDS Rise 60 50 60 50 ns [1,2,3]
19 TdDM(AS) 10M Valid to lAS Rise Delay 30 20 30 20 ns [2,3]
Notes:
[1] When using extended memory timing add 2 TpC.
[2] Timing numbers given are for minimum TpC.
[3] See clock cycle dependent characteristics table 5.
Note:
Equation units are in nanoseconds
773
AC CHARACTERISTICS
Additional Timing Diagram
Clock
TIN
IRON
Clock
Sewp ,
"~
Slop
-------->-t~~.--------~-@~==~~~~------
Mode
Recovery
Source
774
AC CHARACTERISTICS
Additional Timing Table
No Symbol Parameter TA =ooe to 70°C TA=-40oe to 105°C Units Notes
16 MHz 20 MHz 16 MHz 20 MHz
Min Max Min Max Min Max Min Max
1 TpC Input Clock Period 62.5 1000 50 1000 62.5 1000 50 1000 ns [1]
2 TrC,TIC Clock Imput Rise & Fall Times 10 10 10 10 ns [1]
3 TwC Input Clock Width 25 15 25 15 ns [1]
4 TwTinL Timer Input Low Width 75 75 75 75 ns [2]
5 TwTinH Timer Input High Width 3TpC 3TpC 3TpC 3TpC [2]
6 TpTin Timer Input Period BTpC BTpC BTpC BTpC [2]
7 TrTin,TfTin Timer Input Rise & Fall Times 100 100 100 100 ns [2]
BA TwlL Interrupt Request Input Low Times 70 70 70 70 ns [2,4]
BB TwlL Interrupt Request Input Low Times 5TpC 5TpC 5TpC 5TpC [2,5]
9 TwlH Interrupt Request Input High Times 3TpC 3TpC 3TpC 3TpC [2,3]
Noles:
[1] Clock timing references use 3.8V for a logic 1 and 0.8V for a logic O.
[2] Timing references use 2.0V for a logic 1 and 0.8V for a logic O.
[3] Interrupt references request via Port 3.
[4] Interrupt request via Port 3 (p31-P33f.
[5] Interrupt request via Port 30.
775
AC CHARACTERISTICS
Handshake Timing Diagrams
r___--'l} ...............:...........................................
Data In Data In Valid Next Data In Valid
'------'I} ...........................,...............................
ROY
(Output)
Ir---------------'l~ - - - - - - - - - - - - - --
Data Out Data Oul Valid Next Data Oul Valid
I'---------------'l~ - - - - - - - - - - - - - --
IDAV
(Output)
ROY
(Input)
n6
AC CHARACTERISTICS
Handshake Timing Table
No Symbol Parameter T. =ooe to 70°C T. =-40oe to 105°C Units Notes
16 MHz 20 MHz 16 MHz 20 MHz
Min Max Min Max Min Max Min Max
1 TsDI(DAV) Data In Setup Time 0 0 0 0 ns IN
2 ThDI(DAV) Data In Hold Time 145 145 145 145 ns IN
3 TwDAV Data Available Width 110 110 110 110 ns IN
4 TdDAVI(RDY) DAV Fall to RDY Fall Delay 115 115 115 115 ns IN
5 TdDAVld(RDY) DAV Rise to ROY Rise Delay 115 115 115 115 ns IN
6 TdDO(DAV) ROY Rise to DAV Fall Delay 0 0 0 0 ns IN
7 TcLDAVO(RDY) Data Out to DAV Fall Delay TpC TpC TpC TpC OUT
8 TcLDAVO(RDY) DAV Fall to ROY Fall Delay 0 0 0 0 ns OUT
9 TdRDYO(OAV) ROY Fall to DAV Rise Delay 115 115 115 115 ns OUT
10 TwRDY ROY Width 110 110 110 110 ns OUT
11 TdROYOd(OAV) ROY Rise to DAV Fall Delay 115 115 115 115 ns OUT
m
EXPANDED REGISTER FILE CONTROL REGISTERS
T2TMR (D) 01 TOH (D) 04
1~1~lool~lool~lrnlool
o No Function
I TO High Byte Inttlal Value
1 LoadT2 (When Written)
T20ut(P35)
o Disable
1 Enable
T2H(0)06
Reserved
Figure 26. Timer 2 Mode Register Figure 30. Counter Timer 2 Register High Byte
[%(0) 01: ReadlWrite] [%(0) 06: ReadlWrite]
T1H(0)02
1~1~lool~lool~lrnlool
T2L(0) 07
I Tl High Byte Initial Value
1071061 osl 1 Dol
04 1 03 1 0 2 011
(WheriWrillBn)
1~1~lool~lool~lrnlool
I I =~,,-~
00
01
TO
8
16
Tl
8
16
T2
32
16
10 8 24 16
11 8 16 24
Reserved
Presca.ler Modulo
(Range: 1 - 16 Decimal
01 -00 Hex)
n8
Z8 CONTROL REGISTERS
R240SI0 R243 PRE1
IIDloolool~loolool~lool
I Serial Data (DO = LSB) Count Mode
o n Single Pass
1 T1 Modulo N
Clock Source
Figure 32. Serial 110 Register 1 T1 Internal
(FOH: ReadIWrite) o T1 External Timing Input
(TIN) Mode
Prescaler Modulo
(Range: 1·64 Decimal
01·00 HEX)
R241 TMR ,
0 No Function
1 loadn
IIDloolool~lool~I~lool
o Disable n Count
1 Enable T1 Count
I TO low Byte Initial Value
(When Written)
TIN Modes
00 Exlernal Clock Input TO low Byte CUrrent Value
01 Gale Input (When Read)
10 Trigger Inpul
(Non·retriggerable)
11 Trigger Input
(Retriggerable) Figure 36. CounterlTimer 0 Register
(F4H:Read/Write)
TOUT Modes
00 Not Used
01 TOOul
10 n Oul
11 Intemal Clock Out R245 PREO
IIDloolool~lool~I~lool
(Range: 1-64 Decimal
01·00HEXj
R246 P2M
Figure 34. CounterlTimer 1 Register
(F2H:Read/Write) IIDloolool~lool~I~lool
I P20 • P27 110 DeIinition
o Defines Bit as Output
1 Defines Bit as Input
n9
Z8 CONTROL REGISTERS (Continued)
R247P3M
Iwl~I~I~loolool~lool
-;-
o Port 2 Pull-Ups Open Omin
1 Port 2 Pull-Ups Active
o P31, P321nputs
1 Reserved
0 P32= Input P35 = Output
1 P32 = IDAVOIROYO P3S = ROYO/IDAVO
00 P33 = Input P34 = Output
~~ } P33 = Input P34 = IDM
11 Reserved
0 P31 = Input (TIN) P36 = Output (TOUl)
1 P31 = IDAV2IROY2 P36 = ROY2IIDAV2
0 P30 = Input P37=Output
1 P30 = Serial IN P37 = Serial OUT
0 Parity OFF
1 Parity ON
R248 POIM
780
R250IRO R253 RP
IIDlool~I~lool~I~lool
I
T
IROO P32 Input Expanded Register File
IR01 P33 Input
IR02 P31 Input Working Register Pointer
IR03 P30 Input
IR04 TO
IROS T1
Figure 45. Register Pointer
Inter Edge
P31l P32l =00 (FDH:Read/Write)
P31l P32t =01
P31 t P32l = 10
P31 tlP32tl= 11
IIDlool~I~lool~I~lool
Figure 46. Stack Pointer High
1 Enables IROo-lROS (FEH:Read/Write)
{DO = IROO)
IIL . - -- Reserved
1 Enables Interrupts
R25SSPl
Figure 43. Interrupt Mask Register IIDlool~I~lool~I~lool
(FBH :Read/Write)
I Stack Pointer Lower
Byte (SPO • SPl)
R252FlAGS
781
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected lIages are indicated by:
R Register or working-register adqress
r Working-register address only a Clear to zero
IR Indirect-register or indirect 1 Set to one
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
782
CONDITION CODES
783
INSTRUCTION FORMATS
dsl OPC
One·Byte Instructions
CLR, CPL, DA, DEC, OPC I MODE ADC, ADD, AND, CP,
OR 11110 I dstlsrc I DECW,INC,INCW,
POP, PUSH, RL, RLC, sre OR
LD, OR, SBC, SUB,
TCM, TM,XOR
RR, RRC, SRA, SWAP dsl OR
OPC JP, CALL (In<ireel)
dsl lOR 1111 0 I dsl OPC I MODE ADC, ADD, AND, CP,
LD, OR, SBC, SUB,
dsl OR 1 1110 1
dsl TCM,TM,XOR
OPC SRP VALUE
VALUE
MODE I OPC LO
ADC, ADD, AND, cp, sre OR
OR, SBC, SUB, TCM,
dsl OR
TM, XOR
OPC CALL
DJNZ, JR DAU
DAL
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment 01 a value is indicated by the symbol notation "addr (n)" is used to reler to bit (n) 01 a given
" ~ ". For example: operand location. For example:
indicates that tt1e source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
784
INSTRUCTION SUMMARY (Continued)
AOCdst, sre t 1[ 1
****0 * INC dst rE -
***
dstf-dst + sre +C dstf-dst + 1 r = 0- F
R 20
AOOdst, sre
dstf-dst + sre
t O[ 1
****0 * IR 21
INCWdst RR AO - - -
ANOdst, sre t 5[ 1 - 0 - - dstf-dst + 1 IR A1 ***
dstf-dst ANO sre **
IRET BF
CALL dst OA 06 - - - - - - FLAGSf-@SP; ******
SPf-SP-2 IRR 04 SPf-SP + 1
@SPf-PC, PCf-@SP;
PCf-dst SPf-SP + 2;
IMR(7)f-1
CCF EF - - - - -
Cf-NOTC * JP ee, dst OA cO - - - - - -
if ee is true e = 0- F
CLR dst R BO - - - - - - PCf-dst IRR 30
dstf-O IR B1
JR ee, dst RA eB - - - - - -
COMdst
dstf-NOT dst
R
IR
60
61
-
**0 - - if ee is true,
PCf-PC + dst
e =0- F
Range: +127,
CP dst, sre t A[ 1 - - -128
dst - sre ****
LOdst, sre 1m rC - - - - - -
OAdst R 40 X - - dstf-sre R r8
dstf---OAdst IR 41 *** R 19
r=0-F
DEC dst R 00 - ***- - X C7
dstf-dst - 1 IR 01 X r 07
r Ir E3
OECWdst RR 80 - ***- - Ir F3
dstf-dst - 1 IR 81 R R E4
R IR E5
01 8F - - - - - - R 1M E6
IMR(7)f---O IR 1M E7
IR R F5
OJNZr, dst RA rA - - - - - -
rf-r - 1 =
r 0-F LOC dst, sre Irr C2
if r;t 0
PCf-PC + dst LOCI dst, sre Ir Irr C3
Range: +127, dstf-sre
-128 rf-r + 1;
rrf-rr + 1
EI 9F - - - - - -
IMR(7)f-1
HALT 7F - - - - - -
785
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - STOP 6F
OR dst. src
dstf--dst OR src
t 4[ J - **0 - - SUB dst. src
dstf--dstf--src
t 2[ J
****1*
POPdst R 50 - - - - - - SWAPdst R FO X
** X
- -
dstf--@SP; IR 51 IR F1
SPf--SP + 1
PUSH src R 70 - - - - - -
17
6 o 1
SPf--SP - 1;
@SPf--src
IR 71 TCM dst. src
(NOTdst)
t 6[ ] -
** 0
- -
AND src
RCF CF 0 - - - - -
Cf--O TM dst. src t 7[ J - ** 0
- -
dstAND src
RET AF - - - - - -
PCf--@SP;
SPf--SP + 2
XOR dst. src
dstf--dst
t B[ J - ** 0
- -
XOR src
RLdst R 90
****--
~
IR 91
t These instructions have an identical set of addressing modes. which
are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a'[ ]'
-
RLC dst R
IR
10
11
****- in this table. and its value is found in the following table to the left of the
l€I=£Ejj:J applicable addressing mode pair.
R R [4]
SCF OF 1 - - - - -
Cf--1
R IR [5]
SRAdst R DO
*** 0
- - R 1M [6J
~
IR 01
IR 1M [7]
SRPsrc 1m 31 - - - - - -
RPf--src
786
opeODE MAP
Lower Nibble (Hex)
o 2 3 4 5 678 9 A B C o E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl rl, r2 ,1.1,2 R2. Rl IR2. Rl RI.IM IR1.IM ,1. R2 '2. Rl ,1. RA cc. RA ,l.IM cc. DA ,1
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 -
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl '1. ,2 ,1.1,2 R2. Rl IR2. Rl Rl.IM IR1.IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 t-
INC INC SUB SUB SUB SUB SUB SUB
Rl IRl r1, r2 ,1.1,2 R2. Rl IR2. Rl Rl.IM IR1.IM
B.O 6.1 6.5 6.5 10.5 10.5 10.5 10.5 t-
3 JP SRP SBC SBC sec sec sec sec
IRRl 1M '1. ,2 '1.1'2 R2. Rl IR2. Rl Rl.IM IR1.IM
B.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 t-
4 DA DA OR OR OR OR OR OR
Rl IRl r1, r2 ,1.1,2 R2. Rl IR2. Rl Rl.IM IR1.IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r-----
5 POP POP AND AND AND AND AND AND
Rl IRl rl, r2 ,1.1,2 R2. Rl IR2. Rl R1.IM IR1.IM
6
6.5
COM
6.5
COM
6.5
TCM
6.5
TCM
10.5
TCM
10.5
TCM
10.5
TCM
10.5
TCM
r--s:o-
STOP
)( Rl IRl '1. ,2 '1.1'2 R2. Rl IR2. Rl Rl.IM IR1.IM
(J)
;;. 10/12.1 12/14.1 6.5 6.5 10.5 10.5 10.5 10.5 ~
(J) 7 PUSH PUSH 1M 11'.1 TM 1M TM TM HALT
:a
.0 R2 IR2 rl, r2 ,1.1,2 R2. RI IR2. Rl Rl.IM IR1.IM
z 10.5 10.5 12.0 18.0 6:"1
Q; 8 DECW DECW LDE LDEI 01
c. RRl IRl r1,lrr2 l,l.lrr2
c.
::J
6.5 6.5 12.0 18.0 6:"1
9 RL RL LDE lOEI EI
Rl IRl r2,lrrl 1'2.lrrl
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 140
A INCW INCW CP CP CP CP CP CP RET
RRl IRl fl, r2 ,1.1'2 R2. Rl IR2. Rl Rl.IM IR1.IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 '16:0
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRl rl, r2 ,1. 1,2 R2. Rl IR2. Rl Rl.IM IR1.IM
6.5 6.5 12.0 18.0 10.5 ~
C RRC RRC lDC lOCI lD RCF
Rl IRl 'l.lrr2 l'l.lrr2 'l.x.R2
0
6.5 6.5 12.0 18.0 20.0 20.0 10.5. I-s:5
SRA SRA lDC lDCI CALL' CALL lD SCF
Rl IRl r2,lrr1 1'2.lrrl IRRl DA '2.x.Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 '65
E RR RR LD lD LD lD LD CCF
Rl IRI 'l.IR2 R2. Rl IR2. Rl Rl.IM IR1.IM
F
8.5 8.5 6.5 10.5 '6.0
SWAP SWAP LD LD NOP
Rl IRl 1'1. ,2 R2.IRl
... A
~
A
V V 'T
2 3 3
Byles per Inslruction
Lower Legend:
Opcode R = 8-bit add,ess
Nibble r = 4-bit add,ess
Execution Pipeline R1 0' r 2 = Ost add,ess
Cycles 1 Cycles R 1 0' r 2 = Src address
Sequence:
Opcode. Fi,st Operand.
Mnemonic Second Operand
787
CMOS Z8 ROMLESS
MICROCONTROLLER Z86C94
GENERAL DESCRIPTION FEATURES
789
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
CMOS ROMLESS
Z8 MICROCONTROLLER
Z86C96
GENERAL DESCRIPTION FEATURES
an on-chip program ROM. Use of external • Register Pointer so that short, fast
memory rather than a preprogrammed ROM • 256-byte register file, including 236 instructions can access anyone of
enables this Z8 microcomputer to be used geneml purpose registers, six 110 the sixteen working-register groups.
in applications where code flexibility is port registers, and 16 status and
required. control registers. • 3.0 to 5.5 volts operating range
The Z86C96 can provide up to 16 output
address lines, thus permitting an address • Three Expanded Register File 110 port .. Clock speed 20 MHz
space of up to 64K bytes of data or pro- registers and five control registers
gram memory. Eight address outputs (AD7- II 1.2 micron CMOS technology
ADO) are provided by a multiplexed, 8-bit, • Vectored, priority interrupts for I/O,
Address/Data bus. The remaining 8 bits can counter/timers, and UART. .. Two low-power standby modes,
be provided by the software configuration of STOP and HAL T
Port 0 to output address bits A 15-A8. .. On-chip oscillator that accepts
There are 256 registers located on-chip clYstal, cemmic resonator. LC or
organized as 236 general purpose regis- extemal clock drive.
ters, 16 control and status registers, and
six I/O port registers. Register file can be
Output Input Vee GND XTAL lAS IDS RlIW IRESET
divided into sixteen groups of 16 working
registers each. Configuring the register file
in this manner allows the use of short format ~ !
instructions; in addition, any of the indi-
vidual registers can be accessed directly.
The Z86C96 is the ROMless version of
the Z86C62.
Flags
1/0
(B~ Programmable)
791
ADVANCE INFORMATION SPECIFICATION
'.ZiIm
Z88COO
CMOS SUPER8 Th1
ROMLESS MCU
FEATURES
.. Full Super8 Instruction Set II Interrupt structure supports:
- 27 interrupt sources
.. CMOS Technology - 16 interrupt vectors
- 8 interrupt levels
II!! Available in 48- and 68-pin packages - Servicing capabilities in 600 nsec
!!!I Multiply and Divide instructions, Boolean and II Full-Duplex UART with special features
BCD operations
II On-Chip oscillator
Iil 325 byte registers, including 272 general-purpose
registers, and 53 mode and control registers II DC to 25 MHz operating frequency
GENERAL DESCRIPTION
The CMOS Super8 offers new flexibility and sophistication Incorporated in the new CMOS Super8 is also a bonding
in 8-bit microcontrollers. The Super8 offers all the features option for a de-multiplexed extemal memory interface bus.
necessary for industrial, consumer, and automotive ap- In de-muxed mode, PORTs 0 and 4 function as address
plications with an enhanced feature set in CMOS technol- ports, with PORT 1 as data bus. PORT 4 drives the lower
ogy. At the same time, the CMOS Super8 retains full pin- address bits and PORT 0 drives the upper address bits,
for-pin compatibility with the NMOS Super8. Available in when both ports are configured as external memory inter-
48-pin Dual In-line Plastic (DIP) and 64-pin Plastic Leaded face. This gives the user more addressing flexibility.
Chip Carrier (PLCC), the CMOS Super8 is the last word in
general purpose controllers. Finally, by adding the enhanced features of WDT, STOP
and HALT modes, and more versatile counter/timers, the
The Super8 features a full-duplex, Universal Asynchro- CMOS Super8 can fit easily into more complex function
nous Receiver/Transmitter (UART) with on-chip baud rate applications where a general-purpose microcontroller is a
generator, on-chip oscillator, 2 16-bit counter/timers each necessity.
with an 8-bit prescaler, a Direct Memory Access controller
(DMA), Watch Dog Timer (WDT), and STOP mode.
793
GENERAL DESCRIPTION (Continued)
Figure 1 is the functional block diagram of Z88Caa. The Note: All Signals with a preceding front slash, "I". are active
device is housed in a 48-pin DIP (Figure 2 ), and a 68-pin Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
PLCC package (Figure 3). The pin functions of the Z88Caa active Low, only); INIIS (NORMAL and SYSTEM are both
are shown in Figure 4. active Low).
ResetlWDT
ALU
Flags
Register
Pointers
794
Pl0 POO
P'll POl
P12 P02
P13 P03
P14 P04
P15 P05
P16 POO
P17 P07
P24 P34
P35
+5V lAS
XTAl2 Z88COO /OS
DIP
XTAL1 P40
P44 P41
P45 GND
P46 P42
P47 P43
P22 RlIW
P32 IAESET
P33 P36
P23 P37
P20 P27
P21 P26
P31 P30
9 8 7 6 5 4 3 2 1 68 67 68 65 64 63 62 61
NC 10 60 NC
Vee 11 59 NC
De-MUX 12 58 Vee
P16 13 57 POS
P17 14 56 P07
P24 15 55 P34
P25 16 54 P35
Vee 17
Z88COO 53 lAS
GND 18 52 IDS
(Top View)
Vee 19 51 P40
XTAl2 20 50 P41
XTAL1 21 49 GND
P44 22 48 GND
P45 23 47 P42
P46 24 46 P43
P47 25 45 RI/W
NC 26 44 NC
V~23~~~33~~$~~M~M.43
#~#~~~~~~~~#$;~t#
,g;
795
PIN FUNCTIONS
30
IRESET +5V
TIMING POWER
AND RIIW GND
CONTROL IDS XTAL1
CLOCK
lAS XTAl2
POO P20
POl P2l
P02 P22
P03 P23
PORTO PORT 2
P04 P24
P05 P25
POS P26
P07 P27
Pl0 Z88COO P30
Pll P31
P12 P32
P13 P33
PORT 1 PORT 3
P14 P34
P15 P35
P1S P3S
PH P37
P40 P44
PORT 4 P41 P45 PORT4
(112) (112)
P42 P46
P43 P47
796
NMOS PRODUCTS
797
~ ZiIm Product Specification
Z8600Z8®
Microcomputer
FEATURES
II Complete microcomputer, 2K bytes of ROM, 128 bytes of II Register Pointer so that short, fast instructions can
RAM, and 221/0 lines. access anyone of the nine working register groups.
II 144-byte register file, including 124 general-purpose III On-chip oscillator that accepts crystal or external
registers, four I/O port registers, and 14 status and clock drive.
control registers. EI 8 MHz
I!I Vectored, priority interrupts for I/O and counter/timers. I!!I Single + 5 power supply-all pins TTL-compatible.
.. Two programmable 8-bit counter/timers, each with a 6-bit l1li Average instruction execution time of 2.2 Ils,
programmable prescaler. maximum 1.5 Ils.
GENERAL DESCRIPTION
TIMING
AND
CONTROL
(- RESET
DS
+5V
XTAL'
-
-I CLOCK
+5V
XTAL2
P3.
P3,
~~.{~
po, XTAL2 XTAL, P2.
po, RESET P2,
po, PORT3 DS P2,
po. P3. P2,
Z8600
po, MCU P" --... GND P2,
po. P" -++- PO, P'7
..~,{~ -....--
P2,
P2,
P"
P"
-++- PO, p'.
PORT 1 PO, P"
P2, P" PO, P',
P2, P"
....
PO,
--
P"
P2. p'. PO. P"
GND P'7 P" P"
799
PIN DESCRIPTIONS
os. Oata Strobe (output, active Low). Data Strobe is RESET. Reset (input, active Low). RESET initializes the
activated once for each memory transfer. MCU. When RESET is deactivated, program execution
begins from internal program location OOOCH'
POo·POs. P1o·P17. P2 l ·P2 s • P3 l • P3s. P36. 110 Port lines
(bidirectional, TTL-compatible). These 22 1/0 lines are XTAL 1. XTAL2. Crystal 1, Crystal 2 (time-base input and
grouped infour ports that can be configured under program output). These pins connect a parallel-resonant 8 MHz
control for 1/0. crystal to the on-chip clock oscillator and buffer.
ARCHITECTURE
The MCU's architecture is characterized by a flexible 1/0 Two basic internal address spaces are available to support
schAme, an efficient register and address space structure, this wide range of configurations: program memory and the
and a number of ancillary features that are helpful in many register file. The 144-byte random-access register file is
applications. (Figure 3). composed of 124 general-purpose registers, four 1/0 port
registers, and 14 control and status registers.
Microcomputer applications demand powerful 1/0
capabilities. The MCU fulfills this with 22 pins dedicated to To unburden the program from coping with real-time
input and output. These lines are grouped in four ports and problems such as countingltiming, two counterltimers with
are configurable under software control to provide timing, a large number of user-selectable modes are offered
status signals, and parallel 110. on-chip.
PORT 2
800
ADDRESS SPACES
Program Memory. The 16-bit program counter addresses Instructions can access registers directly or indirectly with
2K bytes of program memory space as shown in Figure 4. an 8-bit address field. The MCU also allows short 4-bit
'register addressing using the Register Pointer (one of the
The first 12 bytes of program memory are. reserved for the
control registers). In the 4-bit mode, the register file is
interrupt vectors. These locations contain three 16-bit
divided into nine working-register groups, each occupying
vectors that correspond to the three available interrupts.
16 contiguous locations (Figure 6). The Register Pointer
Register File. The 144-byte register file includes four I/O addresses the starting location of the active working-register
port registers (R o-R3), 124 general-purpose registers group.
(R4-R127) and 14 control and status registers (R241-R255)'
Stacks. An 8-bit Stack Pointer (R 255) is used for the internal
These registers are assigned the address locations shown in
stack that resides within the 124 general-purpose registers
Figure 5.
(R4-R127)'
2047
ON·CHIP
LOCATION OF ROM
FIRST BYTE OF
INSTRUCTION
EXECUTED
AFTER RESET '2 ~------------
11 IRQS
10 IRQS
9 IRQ4
8 IRQ4
7 RESERveD
INTERRUPT
VECTOR 6 RESERVED
(LOWER BYTE)
5", IRQ2
4# IRQ2
INTERRUPT
VECTOR 3 RESERVED
(UPPER BYTE)
2 RESERVED
1 RESERVED
0 RESERVED
--
NIBBLE OF
THE REGISTER
127 SPECIFIED WORKING· FILE ADDRESS
REGISTER GROUP PROVIDED BY
\ THE INSTRUCTION
POINTS TO THE
GENERAL·PURPOSE
REGISTERS --{ SPECIFIED
REGISTER.
PORT 3 P3
--I 15
PORT 2
PORT 1
PORTO
P2
P1
PO
--{ r----I/OPORTS----- 3
801
COUNTER/TIMERS
The MCU contains two 8-bit programmable counter/timers mode) or to automatically reload the initial value and
(To and T1), each driven by its own 6-bit programmable continue counting (modulo-n continuous mode). The
prescaler. The T1 prescaler can be driven by internal or' counters, but not the prescalers, can be read any time
external clock sources; however, the To prescaler is driven without disturbing their value or count mode.
by the internal clock only.
The clock source for T1 is user·definable and can be the
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock (4 MHz maximum) divided by
clock source by any number from 1 to 64. Each prescaler four, or an external signal input via Port 3. The Timer Mode
drives its counter, which decrements the value (1 to 256) that register configures the external timer input as an external
has been loaded into the counter. When the counter reaches clock (1 MHz maximum), a trigger input that can be
the end of count, a timer interrupt request-IRQ4 (To) or retriggerable or non-retriggerable, or as a gate input for the
IRQ5 (T1)-is generated. internal clock. The counter/timers can be programmably
cascaded by connecting the To output to the input of T1-
The counters can be started, stopped, restarted to continue,
Port 3 line P36 also serves as a timer output (TOUT) through
or restarted from the' initial value. The counters can also be
which To, T1 or the internal clock can be output.
programmed to stop upon reaching zero (single·pass
I/O PORTS
The MCU has 22 lines dedicated to input and output Port 2 can be programmed independently as input or
grouped in four ports. Under software control, the ports can output and is always available for I/O operations. In addition,
be programmed to provide address outputs, timing, status Port 2 can be configured to provide open-drain outputs.
signals, and parallel I/O. All ports have active pull-ups and
Port 3 can be configured as 110 or control lines. P31 is a
pull-downs compatible with TTL loads.
general purpose input or can be used for an external
Port 0 can be programmed as an I/O port. interrupt request signal (IRQ2)' P35 and P36 are general
purpose outputs. P36 is also used for timer input (TIN) and
Port 1 can be programmed as a byte I/O port.
output (TOUT) signals.
INTERRUPTS
The MCU allows three different interrupts from three all subsequent interrupts, saves the Program Counter and
sources, the Port 3 line P31 and the two counter/timers. status flags, and branches to the program memory vector
These interrupts are both maskable and prioritized. The locations reserved for that interrupt. This memory location
Interrupt Mask register globally or individually enables or and the next byte contain the 16-bit address of the interrupt
disables the three interrupt requests. When more than one service routine for that particular interrupt request.
interrupt is pending, priorities are resolved by a
. Polled interrupt systems are also supported. To accom-
programmable priority encoder that is controlled by the
modate a polled structure, any or all of the interrupt inputs
Interrupt Priority register.
can be masked and the Interrupt Request register polled to
All interrupts are vectored. When an interrupt request is determine 'which of the interrupt requests needs service.
granted, an interrupt machine cycle is entered. This disables
CLOCK
802
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to Assignment of a value is indicated by the symbol "-': For
describe the addressing modes and instruction operations example,
as shown in the instruction summary.
dst - dst + src
IRR Indirect register pair or indirect working-register
indicates that the source data is added to the destination
pair address
data and the result is stored in the destination location. The
Irr Indirect working-register pair only
notation "addr(n)" is used to refer to bit "n" of a given
X Indexed address
location. For example,
DA Direct address
RA Relative address dst(7)
1M Immediate
refers to bit 7 of the destination operand.
R Register or working-register address
r Working-register address only Flags. Control Register R252 contains the following six
IR Indirect-register or indirect working-register flags:
address
C Carry flag
Ir Indirect working-register address only
Z Zero flag
RR Register pair or working register pair address
S Sign flag
Symbols. The following symbols are used in describing the V Overflow flag
instruction set. D Decimal-adjust flag
H Half-carry flag
dst Destination location or contents
src Source location or contents Affected flags are indicated by:
cc Condition code (see list)
@ Indirect address prefix
o Cleared to zero
1 Set to one
SP Stack pointer (control registers 254-255)
PC Program counter
* Set or cleared according to operation
Unaffected
FLAGS Flag register (control register 252)
X Undefined
RP Register pointer (control register 253)
IMR Interrupt mask register (control register 251)
CONDITION CODES
803
OPC CCF, 01, EI, IRET, NOP,
RCF, RET, SCF
.One-Byte Instructions
OPC MODE CLR, CPL, DA, DEC, ADC, ADD, AND, CP,
dsUsre OR 11 1 1 01 dstlsre I ~~~~'~~~R~~~~R:OP, sre OR 1 1 1 0 sre
LD, OR, SBC, SUB,
TCM, TM, XOR
RRC, SRA, SWAP dst OR 1 1 1 a dst
OPC I
f---'d"'s-=t---lOR 11 1 1 0 I dst
JP, CALL (Indirect)
OPC MODE ADC, ADD, AND, cp,
dst OR 111101 dst LD, OR, SBC, SUB,
TCM, TM, XOR
VALUE
OPC SRP
VALUE
MODE OPC LD
sre OR 1 1 1 0 sre
OPC MODE ADC, ADD, AND,
CP, OR, SSC, SUB, dst OR 1 1 1 0 dst
dst src
TCM, TM, XOR
MODE OPC LD
LD, LDC, LDCI
LD
cc OPC JP
'--"="'-----' OR 11 1 1 01 sre
DAu
DAL
dst I
OPC LD
VALUE
OPC CALL
INSTRUCTION SUMMARY
804
INSTRUCTION SUMMARY (Continued)
Addr Mode Opcode Flags Affected Addr Mode Opcode Flags Affected
Instruction Byte Instruction Byte
and Operation dst src (Hex) CZSVDH and Operation dst src (Hex) CZSVOH
EI 9F RLdst r==l R 90 ****--
IMR(7)<-1 0~IR 91
INCdst rE - * * * -- RLCdst~R 10 * * * *
dst-dst + 1 r= 0- F C 1 0 IR 11
R 20
L
o LDJ
RRdst EO ****--
IR 21
' , IRR E1
INCWdst RR
dst-dst + 1 IR RRC dst L{ri:::Ei}J IRR CO ****--
C 7 Q
C1
IRET SF * * * * * * SBC dst,src (Note 1) 30
FLAGS - @SP; SP - SP + 1
dst- dst -src-C
PC -@SP;SP-SP + 2; IMR (7)<-1
SCF OF 1-----
JPcc,dst OA cO
C<-1
ifcc is true c=O-F
PC-dst IRR 30 SRA dst L0 @""l R 00
IR 01
JRcc,dst RA cS
if cc is true, c=O-F SRPsrc 1m 31
PC <-PC + dst RP <- src
Range: + 127, -128
SUBdst,src (Note 1) 20
LOdst,src 1m rC dst - dst <- src
dst-src r R r8
R r9
SWAP dst I' 5?
--r~~'-,-.::J'IIR
R FO
L!...
F1
r= 0 - F
r X C7 TCMdst,src (Note 1) 60
X r 07 (NOT dst) ANO src
r Ir E3
TM dst,src (Note 1) 70
Ir r F3
dstANOsrc
R R E4
R IR E5 XORdsl,src (Note 1) SO
R 1M E6 dst - dst XOR src
IR 1M E7
NOTE 1: These instructions have an identical set of addressing modes,
IR R F5 which are encoded for brevity. The first opcode nibble IS found in
LDCdst,src the instruction set table above. The second nibble is expressed
Irr C2
symbolically by a 0 in this table, and its value is found in the
dst <- src Irr 02 following table to the right of the applicable addressing mode
LOCI dst,src Ir Irr C3 pair.
dst-src Irr Ir 03 For example, Ihe opcode of an ADC instruction using the
r <- r + 1; rr <- rr + 1 addressing modes r (destination) and Ir (source) is 13.
NOP FF AddrMode
Lower
ORdst,src (Note 1) 40 dst src Opcode Nibble
dst <- dst OR src
POPdst R 50
dst <- @SP; IR Ir
SP <-SP + 1
R R
PUSHsrc R 70 R IR
SP-SP-1;@SP<-src IR 71
R 1M
RCF CF 0-----
C-O IR 1M
RET AF
PC - @SP; SP - SP + 2
805
REGISTERS (CoJ;1tinued)
10,(0.10,10.10,10,10,10,1
~ ~---r-
U~lL§
PO,-POsMODE
OUTPUT", 00 L PO,.PO, MODE
00 = OUTPUT
' LUSERFLAGF1
LUSER FLAG F2
INPUT", 01 01 '" INPUT
HALF CARRY FLAG
RESERVED SJA:~N~~~~CAT~ON DECIMAL ADJUST FLAG
. OVERFLOW FLAG
Plo-P17 MODE
00 = BYTE OUTPUT SIGN FLAG
01 = BYTe INPUT _ ZERO FLAG
11 '" HIGH·IMPEDANCE OS
CARRY FLAG
R2491PR R253RP
INTERRUPT PRIORITY REGISTER REGISTER POINTER
(F9H; Write Only) (FDH; Read/Write)
,"_.:J
DON'T CARE
I I III
I~I~I~I~I~I~I~I~I
m",.,
RESERVED
452 = 001
524 =
542:::
_
= _ 'm
010
011
000
REGISTER
POINTER
245 = 100
DON'T CARE 425 '" 101
254", 110
DON'T CARE RESERVeD =111
I~I~I~I~I~I~I~I~I I~I~I~I~I~I~I~I~I
RESERVED T c= =
IRQ2 P311NPUT (02 = IROS)
=
JRQ4 To 1
.._ _ _ _ :~~~~s~~~~~~R LOWER
IRQS = T1
R2511MR
INTERRUPT MASK REGISTER
(FBH; Read/Write)
I~I~I~I~I~I~I~I~I
c=
I' 1 ENABLES 1RQo-IRQ5
(Do = IRQD)
' - - - - - - - - RESERVED
' - - - -_ _ _ _ _ 1 ENABLES INTERRUPTS
806
OPCODEMAP
Lower Nibble (Hex)
3 A B C o E F
-_.
o
65
DEC
65
DEC
-----
6.5
ADD
6,5
ADD
------~--.----
10,5
ADD
105
ADD
10,5
ADD
105
ADD
6,5
LD
6.5
LD,
- ~--
12110.5
DJNZ
12110
JR
° 65
LD
12110
JP
°
--
65
INC
- ---.--
R, In, " '2 (,. lr2 R? A, IA 2·R, R,IM IR,.IM (,.R? r~.Rl r, RA cc RA ".IM cc 0/\ rl
-~---
Sequence:
Opcode, First Operand, Second Operand
FIRST SECOND
OPERAND OPERAND NOTE: The blank areas are not defmed.
807
REGISTERS
NOT T,,,MODES
USED = 00
~~ g~~ ~ ~~,
INTERNAL CLOCK OUl '" 11
1 MODES
j
~ ~~O 1 = NO FUNCTION
= LOAD To
0 '" DISABLE To COUNT
1 = ENABLE To COUNT
0 = NO FUNCTION
~L
COUNTMODE
o
1
= To SINGLE·PASS
= To MODULO·N
RESERVED
EXTERNAL CLOCK IN~~T '" 00 1 = LOAD 1,
GATE INPUT = 01 0 = DISABLE 1, COUNT
PRESCALER MODULO
(NaN'R~~~~g~~~~:~~) = 10 1 = ENABLE 1, COUNT (RANGE. 1-64 DECIMAL
TRIGGER INPUT = 11 01-00 HEX)
(RETRIGGERABLE)
R242 T1 R246P2M
COUNTER TIMER 1 REGISTER PORT 2 MODE REGISTER
(F2H; Read/Write) (F6H; Write Only)
P2,-P2S DERNITION
' - - - - 0 DEFINES BIT AS OUTPUT
1 DEFINES BIT AS INPUT
~~
I
~L
COUNTMODE
o = 1, SINGLE·PASS
1 '" T1 MODULO·N
L LOPORT'PULLoUPSOP'NDRA'N
1 PORT 2 PULl·UPS ACTIVE
RESERVED
CLOCK SOURCE
1 = 1, INTERNAL' RESERVED
o= T, EXTERNAL. TIMING INPUT
(T'N) MODE RESERVED
PRESCALER MODULO o P31 = INPUT (TIN) P36 = OUTPUT (TOUT)
(RANGE. 1-64 DECIMAL
01-00 HEX)
RESERVED
L-_ _ _ _ _ _ _ _ RESERVED
R244 TO
COUNTER/TIMER 0 REGISTER
(F4H; Read/Write)
808
Figure 9. Timing
AC CHARACTERISTICS
Timing Table
Z8600
Number Symbol Parameter Min Max Notes·
NOTES:
1. Clock timing references use 3.BV for a logic "1" and O.BV for a logic "0':
2. Timing references use 2.0V for a logic "1" and O.BVfor a logic "0':
3. Interrupt request via Port 3 (p31,P33)'
• Units in nanoseconds (ns).
809
ABSOLUTE MAXIMUM RATINGS
Voltages on all pins. with respect Stresses greater than those listed under Absolute Maximum Ratings may
cause permanent damage to the device. This is a stress rating only;
to GND ......................... - O.3V to + 7.0V
operation of the device at any condition above those indicated in the
Operating Ambient operational sections of these specifications is not implied. Exposure to
Temperature ..............See Ordering Information absolute maximum rating conditions for extended periods may affect
Storage Temperature .............. - 65°C to + 150°C device reliability.
2.1K
The DC characteristics listed below apply for the following
standard test conditions, unless otherwise noted. All
voltages are referenced to GND. Positive current flows into
the referenced pin.
Standard conditions are:
• +4.75V";;;Vcc";;; +5.25V
• GND = OV
Figure 10. Test Load 1
DC CHARACTERISTICS
VCH Clock Input High Voltage 3.8 VCC V Driven by External Clock Generator
VCl Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.0 VCC V
Vil Input Low Voltage -0.3 0.8 V
VRH Reset Input High Voltage 3.8 VCC V
VRl Reset Input Low Voltage -0.3 0.8 V
810
~ ZiIm Product Specification
Z8601!Z8603
Z86U/Z8613 Z8®
Features III Complete microcomputer, 2K (8601) or 4K III Full-duplex UART and two programmable
(8611) bytes of ROM, 128 bytes of RAM, 32 8-bit counter/timers, each with a 6-bit
I/O lines, and up to 62K (8601) or 60K (86ll) programmable pres caler.
bytes addressable external space each for III Register Pointer so that short, fast instruc-
program and data memory. tions can access any of nine working register
&I 144·byte register file, including 124 general- groups in 1 /lS.
purpose registers, four I/O port registers, II On-chip oscillator which accepts crystal or
and 16 status and control registers. external clock drive.
III Average instruction execution time of 1.5 /ls, t:I Single + 5 V power supply-all pins TTL
maximum of 1 /lS. compatible.
III Vectored, priority interrupts for I/O, III 12.5 MHz.
counter/timers, and UART.
General The Z8 microcomputer introduces a new level stand-alone microcomputer with 2K or 4K bytes
Description of sophistication to single-chip architecture. of internal ROM, a traditional microprocessor
Compared to earlier single-chip micro- that manages up to 124K bytes of external
computers, the Z8 offers faster execution; more memory, or a parallel-processing element in a
efficient use of memory; more sophisticated system with other processors and peripheral
interrupt, input/output and bit-manipulation controllers linked by the Z-BUS® bus. In all
capabilities; and easier systeIlil expansion. configurations, a large number of pins remain
Under program control, the Z8 can be tailored available for I/O.
to the needs of its user. It can be configured as a
+5V P3,
XTAL2 P3,
XTAL1 P2,
P3, P2,
P3, P2,
RESET P2,
RIW P2,
PORTO
(NIBBLE
PORT 2
(BIT PRO·
os P2,
PROGRAMMABLE) GRAMMABLE) AS P2,
1/0 OR As-A15 110
P3, P2,
GND P3,
P3, P3,
PO, Pl,
PO, Pl,
po, Pl,
PORT 1 PORT 3 po, Pl,
(BYTE SERIAL AND
PROGRAMMABLE) PARALLEL itO po, Pl,
1/0 OR ADo-AD7 AND CONTROL
po, Pl,
po, Pl,
po, Pl,
811
Pin AS. Address Stiobe (output, active Low). program execution begins from internal
Description Address Strobe is pulsed once at the begin- program location OOOCH.
ning of each machine cycle. Addresses output
via Port 1 for all external program or data ROM less. (input, active LOW). This pin is only
memory transfers are valid at the trailing edge available on the 44 pin version of the Z8611.
of AS. Under program control, AS can be When connected to GND disables the internal
placed in the high-impedance state along with ROM and forces the part to function as a Z8681
Ports 0 and 1, Data Strobe and Read/Write. ROMless Z8. When left unconnected or pulled
high to Vee the part will function normally as a
DS. Data Strobe (output, active Low). Data
Z8611.
Strobe is activated once for each external
memory transfer. R/W. Read/Write (output). R/W is Low when
POa-Po,. Pla-PI7' P2a-P27' P3a-P37.1I0Port the 28 is writing to external program or data
Lines (input/outputs, TTL-compatible). These memory.
32 lines are divided into four 8-bit I/O ports XTALI. XTAL2. Crystal], Crystal 2 (time-base
that can be configured under program control input and output). These pins connect a parallel
for I/O or external memory interface. resonant 12.5 MHz crystal or an external single-
RESET. Reset (input, active Low). RESET ini- phase 12.5 MHz clock to the on-chip clock
tializes the 28. When RESET is deactivated, oscillator and buffer.
"'~ ",
~o 'I"" 'I'" .¢''t'.¢''t' .~ 'I"~ '1,,- '1",,<1'" <f"~
6 5 4 3 2 1 «~~ 41 ~
RESET 7 39 He
RfW 8 38 P2,
ilS 9 37 P2.
AS 10 36 P2,
P3s 11 35 P2,
Z8611
GND 12 34 P2.
P3, 13
MCU 33 P3.
PO. 14 32 P3,
PO, 15 31 P17
PO, 16 30 PI.
ROMless 17 29 PIS
18 19 20 21 22 23 24 25 26 27 28
qt;::,"2 qat:t.-qr::l? qt:::Jb qa1. q....tJ q....... <fl.....q"'''2 q....... ~CJ
2037·002
812
Architecture 28 architecture is characterized by a flexible Three basic address spaces are available to
I/O scheme, an efficient register and address support this wide range of configurations:
space structure and a number of ancillary program memory (internal and external), data
features that are helpful in many applications. memory (external) and the register file (inter-
Microcomputer applications demand power- nal). The 144-byte random-access register file
ful I/O capabilities. The 28 fulfills this with 32 is composed of 124 general-purpose registers,
ph1S dedicated to input and output. These lines four I/O port registers, 'and 16 control and
are grouped into four ports of eight lines each status registers .
and are configurable under software control to . To unburden the program from coping with
provide timing, status signals', serial or parallel real-time problems such as serial data com-
I/O with or without handshake, and an address/ munication and counting/timing, an asynchro-
data bus for interfacing external memory. nous receiver/transmitter (UART) and two
Because the multiplexed address/data bus is counter/timers with a large number of userse-
merged with the I/O-oriented ports, the 28 can lectable modes are offered on-chip. Hardware
assume many different memory and I/O con- support for the UART is minimized because one
figurations. These configurations range from of the on-chip timers supplies the bit rate.
a self-'contained microcomputer to a micropro-
cessor that can address 124K (28601) or 120K
(28611) bytes of external memory.
2037-003
813
Address Program Memory. The 16-bit program counter be included with or separated from the external
Spaces addresses 64K bytes of program memory space. program memory space. OM, an optional I/O
Program memory can be located in two areas: function that can be programmed to appear on
one internal and the other external (Figure 4). pin P34, is used to distinguish between data and
The first 2048 (28601) or 4096 (28611) bytes program memory space.
consist of on-chip mask-programmed ROM. At Register File. The 144-byte register file
addresses 2048 (28601) or 4096 (28611) and includes four I/O port registers (RO-R3), 124
greater, the 28 executes external program general-purpose registers (R4-RI27) and 16
memory fetches. control and status registers (R240-R255). These
The first 12 bytes of program memory are registers are assigned the address locations
reserved for the interrupt vectors. These loca-
shown in Figure 6.
tions contain six 16-bit vectors that correspond 28 instructions can access registers directly
to the six available interrupts. or indirectly with an 8-bit address field. The 28
Data Memory. The 28 can address 62K (28601) aiso allows short 4-bit register addressing using
or 60K (28611) bytes of external data memory the Register Pointer (one of the control regis-
beginning at location 2048 (28601) or 4096 ters). In the 4-bit mode, the register file is
(28611) (Figure 5). External data memory may
5535
EXTERNAL
ROM OR RAM
28601
....
2047 :~Z8611
ON·CHIP
Location 01 ROM
first byte of
Instruction
executed
after reset
;. ~------------ EXTERNAL
DATA
MEMORY
11 IRQS
IR05
"• IR04
8 IRQ4
Interrupt 7 IRD3
Vector ,8 IR03
(Lower Byte)
51" IR02
4~ IH02
Interrupt
Vector 3 IR01 Z8601 ~~~ 1-----------1 ~:;Z8611
(Upper Byto) 2 IR01
NOT ADDRESSABLE
IRDO
0 IROO
LOCATION IDENTIFIERS
255 STACK POINTER (BITS 7-0) SPL
255
254 STACK POINTER (BITS 15-8) .PH
... { r, ra rs r4 00 0 0 ...1253
253 REGISTER POINTER RP - '--_ _ _ _ _........
...1 2..
252 PROGRAM CONTROL FLAGS FLAGS
251 INTERRUPT MASK REGISTER IMR The upper nibble of the register file address
250 INTERRUPT REQUEST REGISTER IRa ;>-- provided by the register pointer specifies
the active working·reglster group.
24. INTERRUPT PRIORITY REGISTER IPR
248 PORTS 0-1 MODE P01M r-------------------,,~
247 PORT 3 MODE P3M
24. PORT 2 MODE P2M
245 TO PRESCAlER PREO
244 TIMER/COUNTER 0 TO
243 T1 PRESCALER PRE1
242 TIMER/COUNTER 1 Tt
241 TIMER MODE TMR
240 SERIAL 110 510
PORT 3 P3 1 - - - - - - - - - - - 1,•
PORT 2 P2
PORT 1 PI
PORTO PO
007
814
divided into nine working-register groups, each A 16-bit Stack Pointer (R254 and R255) is used for
occupying 16 continguous locations (Figure 6). the external stack, which can reside anywhere in
The Register Pointer addresses the starting data memory between locations 2048 (8601) or
location of the active working-register group. 4096 (8611) and 65535. An 8-bit Stack Pointer
Stacks. Either the internal register file or the (R255) is used for the internal stack that resides
external data me~ory can be used for the stack. within the 124 general-purpose registers
(R4-RI27).
Serial Port 3 lines P3 aand P3 7 can be programmed as selection. If parity is enabled, the eighth bit is
Input! serial I/O lines for full-duplex serial asynchro- the odd parity bit. An interrupt request (IRQ4) is
Output nous receiver/transmitter operation. The bit rate generated on all transmitted characters.
is controlled by Counter/Timer 0, at 12 MHz. Received data must have a start bit, eight data
bits and at least one stop bit. If parity is on, bit 7
The Z8 automatically adds a start bit and two of the received data is replaced by a parity error
stop bits to transmitted data (Figure 8). Odd flag. Received characters generate the IRQ3
parity is also available as an option. Eight data interrupt request.
bits are always transmitted, regardless of parity
I·I~I~I~I~I~I~I~I~I~I
T LSTARTBIT
' - - - - - - E I G H T DATA BITS
TWO STOP BITS
I LSTART BIT
' - - - - - - E I G H T DATA BITS
L - - - - - - - - - O N E STOP BIT
TL _LsTARTBIT
' - - - - - - S E V E N DATA BITS
000 PARITY
TWO STOP BITS
I L _LSTARTBIT
L - - - - - S E V E N DATA 81TS
PARITY ERROR flAG
L - - - - - - - - - O N E STOP BIT
Counter! The Z8 contains two a-bit programmable pass mode) or to automatically reload the initial
Timers counter/timers (Ta and T I ), each driven by its value and continue counting (modulo-n contin-
own 6-bit programmable prescaler. The TI uous mode). The counters, but not the presca-
pres caler can be driven by internal or external lers, can be read any time without disturbing
clock sources; however, the Ta pres caler is their value or count mode.
driven by the internal clock only. The clock source for T I is user-definable and
The 6-bit prescalers can divide the input fre- can be the internal microprocessor clock
quency of the clock source by any number from divided by four, or an external signal input via
1 to 64. Each pres caler drives its counter, which Port 3. The Timer Mode register configures the
decrements the value (l to 256) that has been external timer input as an external clock, a
loaded into the counter. When the counter trigger input that can be retriggerable or non-
reaches the end of count, a timer interrupt retriggerable, or as a gate input for the internal
request-IRQ4 (ta) or IRQs {TI)-is generated. clock. The counter/timers can be programmably
The counters can be started, stopped, cascaded by connecting the Ta output to the
restarted to continue, or restarted from the input of T I. Port 3 line P36 also serves as a timer
. initial value. The counters can also be pro- output (TOUT) through which Ta, TI or the inter-
grammed to stop upon reaching zero {single- nal clock can be output.
2037-009
815
1/0 Ports The Z8 has 32 lines dedicated to input and outputs, timing, status signals, serial I/O, and
output. These lines are grouped into four ports of parallel I/O with or without handshake. All ports
eight lines each and are configurable as input, have active pull-ups and pull-downs compatible
output or address/data. Under software control, with TTL loads.
the ports can be programmed to provide address
Port 1 can be programmed as a,byte I/O port allowing the 28 to share common resources in
or as an address/data port for interfacing multiprocessor and DMA applications. Data
external memory. When used as an I/O port, Port transfers can be controlled by assigning P33 as a
1 may be placed under handshake con- Bus Acknowledge input and P34 as a Bus
trol. In this configuration, Port 3 lines P33 and Request output.
P34 are used as the handshake controls RDY!
and DAV! (Ready and Data Available).
Memory locations greater than 2048 (28601) or PORT 1
(liD OR ADo-A~)
4096 (28611) are referenced through Port 1. To
interface external memory, Port 1 must be Z8
MCU
programmed for the multiplexed Address/Data
mode. If more than 256 external locations are
°
required, Port must output the additional
lines.
Port 1 can be placed in the high-impedance Figure 9a. Pori 1
state along with Port 0, AS, DS and RIW,
Port 0 can be programmed as a nibble I/O the lower nibble is used for addressing. When
port, or as an address port for interfacing
external memory. When used as an I/O port,
°
Port nibbles are defined as address bits, they
can be set to the highimpedance state along with
°
Port may be placed under handshake con-
trol. In this configuration, Port 3 lines P32 and
Port 1 and the control signals AS, DS and RIW.
°
Like Ports and 1, Port 2 may also be
placed under handshake control. In this con-
Z8
MCV
HANDSHAKE CONTROLS
figuration, Port 3 lines P3! and P36 are used as } DAV2 AND RDY2
(P3, AND P3S>
the handshake controls lines DAV2 and RDY2.
The handshake signal assignment for Port 3 lines
P3! and P36 is dictated by the direction (input or Figure 9c. Pori 2
output) assigned to bit 7 of Port 2.
2037-008
816
Interrupts The Z8 allows six different interrupts from cycle is entered. This disables all subsequent
eight sources: the four Port 3 lines P30-P33, interrupts, saves the Program Counter and status
Serial In, Serial Out, and the two counter/timers. flags, and branches to the program memory
These interrupts are both maskable and vector location reserved for that interrupt. This
prioritized. The Interrupt Mask register globally memory location and the next byte contain the
or individually enables or disables the six inter- l6-bit address of the interrupt service routine for
rupt requests. When more than one interrupt is that particular interrupt request.
pending, priorities are resolved by a pro- Polled interrupt systems are also supported. To
grammable priority encoder that is controlled by accommodate a polled structure, any or all of the
the Interrupt Priority register. interrupt inputs can be masked and the Interrupt
All Z8 interrupts are vectored. When an inter- Request register polled to determine which of the
rupt request is granted, an interrupt machine interrupt requests needs service.
Clock The on-chip oscillator has a high-gain, (Cl ~ 15 pF) from each pin to ground. The
parallel-resonant amplifier for connection to a speCifications for the crystal are as follows:
crystal or to any suitable external clock source
• AT cut, parallel resonant
(XTALl = Input, XTAL2 = Output). • Fundamental type, 12.5 MHz maximum
The crystal source is connected across XTALl
• Series resistance, R, ~ 100 {}
and XTAL2, using the recommended capacitors
817
Z860S/1S The Z8 Protopack is used for prototype equipped with 12 ROM address lines, 8 ROM
Protopack development and preproduction of mask- data lines and necessary control lines for inter-
Emulator programmed applications. The Protopack is a face to 2732 EPROM for the first 4K bytes of
ROMless version of the standard Z8601 or Z8611 program memory.
housed in a pin-compatible 40-pin package Pin compatibility allows the user to design the
(Figure II). pc board for a final40-pin maskprogrammed
To provide pin compatibility and interchange- Z8, and, at the same time, allows the use of the
ability with the standard maskprogrammed Protopack to build the prototype and pilot
deVice, the Protopack carries piggy-back a 24- production units. When the final program is
-pin socket for a direct interface to program established, the user can then switch over to the
memory (Figure I). The Z8603 24-pin socket is 40-pin mask-programmed Z8 for large volume
equipped with II ROM address lines, 8 ROM production. The Protopack is also useful in
data lines and necessary control lines for inter- small volume applica tions where masked ROM
face to 2716 EPROM for the first 2K bytes of pro- setup time, mask charges, etc., are prohibitive
gram memory. The Z8613 24-pin socket is and program fleXibility is desired.
Compared to the conventional EPROM
versions of the single-chip microcomputers, the
Protopack approach offers two main
advantages:
• Ease of developing various programs during
the prototyping stage. For instance, in appli-
cations where the same hardware configura-
tion is used with more than one program, the
Protopack allows economical program
storage in separate EPROMs (or PROMs),
whereas the use of separate EPROM-based
single-chip microcomputers is more costly.
• Elimination of long lead time in procuring
Figure 11. The Z8 Microcomputer Protopack Emulator EPROM-based microcomputers.
Instruction Addressing Modes. The following notation is used Assignment of a value is indicated by the symbol
Set to describe the addressing modes and instruction "_". For example,
Notation operations as shown in the instruction summary. dst - dst + src
indicates that the source data is added to the
IRR Indirect register pair or indirect working-register
pair address destination data and the result is stored in the
destination location. The notation "addr(n)" is used
In Indirect working-register pair only
to refer to bit "n" of a given location. For example,
X Indexed address
dst (7)
DA Direct address
RA Relative address refers to bit 7 of the destination operand.
1M Immediate
Flags. Control Register R252 contains the following
R Register or working-register address six flags:
Working-register address only
IR Indirect-regIster or indirect working-register C Carry flag
address Z Zero flag
Ir Indirect working-register address only S Sign flag
RR Register pair or working register pair address V Overflow flag
Symbols. The following symbols are used in D Decimal-adjust flag
describing the instruction set. H Half -carry flag
dst Destination location or contents
Affected flags are indicated by:
src Source location or contents
cc Condition code (see list) 0 Cleared to zero
@ Indirect address prefix Set to one
SP Stack pOinter (control registers 254-255) Set or cleared according to operation
PC Program counter
'" Unaffeeled
FLAGS Flag register (control register 252) X Undefined
RP Register pOinter (control register 253)
IMR Interrupt mask register (control register 251)
818
Condition Value Mnemonic Meaning Flags Set
Codes 1000 Always true
0111 C Carry C ~ I
1111 NC No carry C ~ a
0110 Z Zero Z ~ I
1110 NZ Not zero Z ~ a
1101 PL Plus 5 = a
OlQ! MI Minus 5 ~ I
0100 OV Overflow V ~ I
1100 NOV No overflow V ~ a
0110 EO Equal Z ~ I
1110 NE Not equal Z ~ a
1001 GE Greater than or equal (5 XOR V) ~ a
0001 LT Less than (5 XOR V) = I
1010 GT Greater than [Z OR (5 XOR V)j ~ a
0010 LE Less than or equal [Z OR (5 XOR V)j ~ I
1111 UGE Unsigned greater than or equal C~O
0111 ULr Unsigned less than C ~ I
1011 UGT Unsigned greater than (C ~ a AND Z ~ 0)
0011 ULE Unsigned less than or equal (C OR Z) ~ I
0000 Never true
One-Byte Instructions
ope MODE CLR, CPL, CA, DEC, ope MODE ADe, ADD, AND, CP,
dstlsrc OR b 1 1 01 dstlsrc I DECW, INC, INeW, POP,
PUSH, RL, Ale, RR,
OR 1110
LO, OR, SSC, SUB,
TCM, TM, XOR
ARC, SRA, SWAP d" OR 1110 d"
ope JP, CALL (Indirect)
d" lOR b 1 1 01 d" ope MODE ADC, ADD, AND, CP,
LD, OR, SBC, SUB,
d" OR 11 1 101 d" TCM, TM, XOR
VALUE
ope SRP
VALUE
MODE ope La
OR 1110
ope MODE ADe, ADD, AND,
CP, OR, SSC, SUB, d" OR 1110 d"
d" TeM, 1M, XOR
MODE ope La
MODE ope LO, lOE, LOEI,
LOC, lOCI
dsllsrc
dsUsrc src/dst
ADDRESS
dst/src ope La
ope JP
srcldst OR 11 1 1 01 "c [ OA,
OA,
dst lope LD
VALUE
ope CALL
OA,
IdsliCCR~ ope DJNZ, JR OA,
819
Instruction Instruction Adclr Mode Opcode Flags Affected Instruction Adclr Mode Opcode Flags Affected
and Operation Byte and Operation Byte
Summary clst arc: (Hex) CZSVDH clst arc (Hex) CZSVDH
ADC dst,sre (Note I) ID • 0 • LDE clst,sre r Irr 82 ------
dot-dot + sre + C dst - sre Irr 92
ADD dst,sre (Note I) 00 • 0 • LDEI dBt,Bre Ir Irr 83 ------
dBt - dBt + sre dBt - Bre Irr Ir 93
r - r + 1; rr - rr + 1
AND dst,sre (Note I) 50 0--
dBt - dBt AND Bre NOP FF ------
L:EJ 4!::::::3J I~
DECW dst RR 80 -***-- RR dst EO
dst-dst-I IR 81 EI
RRC dst '-m--E::::;JJ Nt CO
DI
IMR (7) - 0 8F ------ SBC dst,sre
dst-dBt-sre-C
(Note I)
CI
30 •• 1 .
DJNZ r,dst RA rA ------
r - r- 1 r=O-F SCF DF 1 - - - - -
if r .. 0 C-l
PC-PC+dst
...... 0 -
Lm~I~
Range: + 127, -128 SRA dst DO
Dl
EI 9F ------ SRP sre 1m 31 ------
.
IMR(7) - 1 RP - sre
INC dst
dBt-dst+1
rE
r=O-F
- * * .. - - SUB dst,Bre (Note 1) 20 ........ 1
dst - dst - sre
R 20
IR 21 SWAPdst~ R FO X ... X - -
" IR Fl
INCW dst RR AO - * .... - -
dst - dst + IR AI TCM dst,sre (Note 1) 60 - .. '* 0 - -
(NOT dst) AND sre
IRET BF * * .. * .. '*
FLAGS -@SP; SP - SP + 1 TM dBt,sre (Note 1) 70 - .. '* 0 - -
PC - @SP; SP - SP + 2; IMR (7) - I dst AND ,;re
JP ee,dBt DA cD ------ XOR dBt,Bre (Note 1) BO • 0 - -
if co is true e=O-F dst - dstXOR Bre
PC - dst IRR 30
JR ee,dst RA eB ------ Nolel
if co is true, e=O-F
These instructions have an identical set of addressing
PC-PC+dst
modes. which are encoded for brevity. The first opcode
Range: + 127, -128 nibble Is found in the instruction set table above. The
LD dBt,Bre 1m rC ------ second nibble is expressed symbolically by a 0 in this
dBt - sre r R r8 table, and its value is found in the following table to the
R r9 right of the applicable addressing mode pair.
r=O-F, For example, to determine the opcode of a ADC
instruction use the addressing modes r (destination) and
r X C7
Ir (source). The result is 13.
X r D7
r Ir E3
Ir r F3
R R E4 Adclr Mode Lower
R IR E5 Opcoda Nibble
R 1m E6 clst Irc
IR 1m E7
IR R F5 III
Ir @)
LOC, dst,sre r Irr C2 ------
dst - Bre Irr D2 R R rn
LDCI dst,sre Ir Irr C3 ------ R JR lID
dst - Bre Irr Ir D3 R 1M []]
r-r+ 1; rr-rr+ 1
IR 1M III
USED = 00
NOT To"MOOES
~~ g~~
INTERNAL CLOCK OUT
T
: ~~
= 11
MODES
EXTERNAL CLOCK IN~~T = 00
j
-.J lS~o 1 =
0
"" NO
=
FUNCTION
lOAD To
DlSABl.E To COUNT
1 "" ENABLE To COUNT
0 = NO FUNCTION
1 = LOAD T,
~L
COUNTMODE
o = To SINGLE·PASS
1 '" To MODULO·N
RESERVED
L. 01 ponT
~L [S~
COUNTMODE
o = 1, SINGLE·PASS
PORT 2 PULL·UPS OPEN DRAIN
2 PUlL·UPS ACTIVE
1 = T, MODULO·N • RESERVED
CLOCK SOURCE
1 "" T, INTERNAL o P32 = INPUT pas = OUTPUT
1 P32 '" DAVOIRDYO P35 = RDYOIDAVO
o= 1, EXTERNAL TIMING INPUT
(TtNIMODE 00 P33 = INPUT P34 = OUTPUT
PRESCAlER MODULO ~~}P33 = INPUT P34 == 1m
(RANGE: 1-64 DECIMAL 1 1 P33 = ~/RDY1 P34 = RDY1/DAV1
01-00 HEX)
2037-014
821
Registers R24B POIM R252 FLAGS
(Continued) Port 0 and I Mode Register Flag Register
(FBH; Write Only) . (FCH ; Read/Write)
~-r
ll!~ll§
T 1 LUSER FLAG F'
PO._PO,MODE'j
OUTPUT"" 00
INPUT = 01
~ L PO,-PO,MODE
00 == OUTPUT
01 = INPUT
LUSER FLAG F2
A'2-A'5 = 1X 1X = As-A" HALF CARRY FLAG
EXTERNAL MEMORY TIMING STACK SELECTION DECIMAL ADJUST FLAG
NORMAL = 0 0 = EXTERNAL
EXTENDED = 1 1 = INTERNAL OVERFLOW FLAG
R2491PR R253 RP
Interrupt Priority Register Register Pointer
(F9H; Write Only) (FDH; Read/Write)
I~I~I~I~I~I~I~I~I
..._.:J
tRQa, IRQS PRIORITY (GROUP A)
o = lAOS> IRa3
1 = tRa3 > IROS
I I II j .,,-" .~"..."
RESERVED
C > A > B
A > B > C
A > C > B
= 000
= 001
= 010
= 011
LOON'TCARE
c=
II 1 ENABLES IROO-IRCS
(Do'" IRaO)
L -_ _ _ _ _ _ RESERVED
822 2037-014
Opcode Lower Nibble (Hex)
Map
o 3 4 5 6 A B C D E F
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5 6,5 6,5 12/10,5 12/10,0 6,5 12/10,0 6,5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DINZ IR LD IP INC
R. IR. 11,12 Il,Ir2 R2,R. IR2,R. R.,IM IR.,IM n,Rz I21Rl IIIRA cc,HA n,IM cc,DA
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
" -
RLC RLC ADC ADC ADC ADC ADC ADC
R. JR. 11,12 II, Ir2 R2,R. IR2,R. R.,!M JR.,IM
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
-
2 INC INC SUB SUB SUB SUB SUB SUB
R. IR. 11,12 11,112 R2,R. IR2,R. R.,!M IR.,IM
~
8,0 6,1 6,5 6,5 10,5 10,5 10,5 10,5
IP SRP SBC SBC SBC SBC SBC SBC
IRR. 1M 11,12 rl,Ir2 R2,R. 1R2,R. R.,IM IR.,IM
~
8,5 8,5 6,5 6,5 10,5 10,5 10,5 10,5
4 DA DA OR OR OR OR OR OR
R. IR. n,ll ll,Irz R2,R. IRz,R. R.,IM IRdM
c---
10,5 10,5 6,5 6,5 10,5. 10,5 10,5 10,5
5 POP POP AND AND AND AND AND AND
R. IR. 11,12 Il,ll2 Rz,R. IR2,R. R.,IM IR.,IM
r--
..
e
6
6,5
COM
R•
6,5
COM
IR.
6,5
TCM
n,I2
6,5
TCM
n,lr2
10,5
TCM
R2,R.
10,5
TCM
1R2,R.
10,5
TCM
R.,IM
10,5
TCM
IRdM
r--
10/12,1 12/14,1 6,5 6,5 10,5 10,5 10,5 10,5
.!
.Q 7 PUSH PUSH TM TM TM TM TM TM
:!! R2 JR2 11,12 n,Ir2 R2,R. IR2,R. R.,IM IR.,IM
Ii!: ~
!l 10,5 10,5 12,0 18,0 6,1
6, a
F SWAP SWAP LO LO NOP
R. IR. 111,12 R2,iR,
Bytes per
. . . ._ - -....-v-"---,.;; "-...._ - -..-v-"--_.../ . . . .- - - - -.. 'V'------; -- ---
Instruction 2 3 2
Lower
Opcodo
Nlbblo
Execution
Upper
Cycles
• Legend:
R = 8-Bit Address
r = 4-Bit Address
Rl or rI = Dst Address
Opcode-A Mnomonlc R2 or I::iI = ~rc _Address
Nibble
Sequence:
First Second Opcode, First Operand, Second Operand
Operand Operand
Note: The blank areas are not defined.
8085-002
823
Absolute Voltages on aU pins Stresses greater than those 'listed under Absolute Maxi·
mum Ratings may cause permanent damage to the device.
Maximum with respect to GND .......... '-0.3 V to + 7.0 V This is a stress rating only; operation 01 the device at any
Ratings Operating Ambient condition above those indicated in the operational sections
Temperature ........ See Ordering Information 01 these specifications is not implied. Exposure to absolute
maximum rating conditions lor extended periods may allect
Storage Temperature .... ',' .. -65°C to +150°C device reliability.
VeL Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
824
AC Characteristics
External I/O
or Memory
Read and
Write Timing PORT 0,
OM
PORT 1
I.-----~@r----~I
iii
(READ)
PORT 1 D~D70UT
iii
(WRITE)
2194-011
825
AC Characteristics
Additional
Timing
Table
Memory Port
=_~='
==~~,==:===(i)~1=====~'1~A=DD=RE=SS=VA=L1D=======:J~_
Timing
.00-.0'0
Do-D7 DON'T CARE ~ DATA IN VALID ~
DA~:~: ~_1·~.~~~.:
~ ~---------
Timing
___________ _____
RDV
(OUTPUT)
s=
DATA OUT ~.
-:Ei5---------
DATA OUT VALID
DiY
RDV
1 CD CI~~
---------------J===~===fL==
:
~.
(OUTPUTl
(INPUT)
Clock-
Cycle-Time- Number Symbol Equation
Dependent
Characteristics TdA(AS) TpC-SO
2 TdAS(A) TpC-4Q
3 TdAS(DR) 4TpC-IIO*
4 TwAS TpC-30
S--TwDSR-------------3TpC-6S*------------
7 TwDSW 2TpC-SS*
8 TdDSR(DR) 3TpC-120*
10 Td(DS)A TpC-40
II TdDS(AS) TpC-30
12--TdRlW(AS) - - - - - - - - - - - - T p C - S S - - - - - - - - - - - -
13 TdDS(RIW) TpC-SO
14 TdDW(DSW) TpC-SO
IS TdDS(DW) TpC-40
16 TdA(DR) STpC-160*
17 TdAS(DS) TpC-30
2194-013
827
PRELIM/NARY PRODUCT SPEC/FICA TlON
~ZiIill
Z8602
NMOS Z8® 8-BIT
MCU KEYBOARD CONTROLLER
FEATURES
• +4.75 to +5.25 Vcc range • Two programmable 8-bit Counter/Timers each with
6-bit programmable prescaler
• Low power consumption - 750mW
• Six vectored, priority interrupts from eight different
• Fast instruction pointer - 1.5 microsecond @ 4 MHz sources
• All digital inputs NMOS levels • On-chip oscillator that accepts a crystal, ceramic
resonator or external clock drive
• 2K bytes ROM
• Low EMI emission
DESCRIPTION
The Z8602 Keyboard Controller (KBC) introduces a new consists of 8 lines, and are configurable under soltware
level of sophistication to single-chip architecture. The control to provide timing, status signals, and serial or
Z8602 is a member of the Z8 single-chip microcomputer parallel I/O ports.
family with 2K bytes of ROM.
The Z8602 offers Low EMI emission and is achieved by
The Z8602 KBC is housed in a 40-pin DIP, and is manufac- means of several modifications in the output drivers and
tured in NMOS technology. Zilog's microcontroller offers clock circuitry of the device.
fast execution, more efficient use of memory. more sophis-
ticated interrupt, input/output bit-manipulation capabili- There are two basic address spaces which are available to
ties, and easy hardware/software system expansion along support this wide range of configurations: Program Mem-
with low cost and low power consumption. ory and 124 General-Purpose Registers.
The KBC architecture is characterized by a flexible I/O The KBC offers two on-chip counter/timers with a large
scheme, an efficient register, I/O, and a number of ancil- number of user selectable modes. and an asynchronous
lary features that are useful in many industrial and ad- receiver/transmitter (UART). This unburdens the program
vanced scientific applications. from coping with real-time problems such as counting/
timing and serial data communications. Hardware support
The device applications demand powerful I/O capabilities. for the UART is minimized because one of the on-chip
The KBC fulfills this with 32-pins dedicated to input and timers supplies the bit rate (Figure 1).
output. These lines are grouped into four ports, each port
829
Output Input Vee GND XTAL1 XTAL2 {RESET
i Machine
.-----, .-----0/'1 Timing & Insl.
Control
ALU
Flags
Register
Pointer
830
Vee 40 P36
XTAL2 2 39 P31
XTAU 3 38 P27
P37 4 37 P26
P30 5 36 P25
IRESET 6 35 P24
RlfIN 7 34 P23
IDS 8 33 P22
NC 9 32 P21
P35 10 31 P20
GND 11 30 P33
P32 12 29 P34
POO 13 28 PH
P01 14 27 P16
P02 15 26 P15
P03 16 25 P14
P04 17 24 P13
P05 18 23 P12
P06 19 22 P11
P07 20 21 P10
831
PIN IDENTIFICATION
PIN FUNCTIONS
XTAL1, XTAL2. Crystal 1, CrystaI2(time-based input and Port 0 P07-POO. Port 0 is an 8-bit, nibble programmable,
output, respectively). These pins connect a parallel-reso- bidirectional, NMOS compatible I/O port. These 81/0 lines
nant crystal or an external single-phase clock to the on- can be configured under software control as a nibble input
chip clock oscillator and buffer. port, or as a nibble open drain output port. When used as
an I/O port, inputs are standard NMOS and outputs are
open drain (Figure 3),
832
4
Port 0
1/0
(Open Drain Output)
Input
OEN
OUT
833
Port 1 P17-P10. Port 1 is an 8-bit, byte programmable. input port or as an open drain output port. When used as
bidirectional. NMOS compatible I/O port. These 81/0 lines an I/O port. inputs are standard NMOS and outputs are
are configured under software control program as byte open drain ,(Figure 4).
Port 1
I/O
(Open Drain Output)
Input ---~lX.
~~~ ---D'----i
Figure 4. pon 1 Configuration
834
Port 2 P27-P20. Port 2is an 8-bit. bit programmable, Port 2 can be programmed as bit-by-bit independently, as
bidirectional, NMOS compatible I/O port. These 81/0 lines input or output, or configured to provide open-drain out-
are configured under the software control program for I/O. puts (Figure 5).
-
-.. ..
Z8602 - -""
Port 2
- -'"
(1/0)
- -
OEN ------'i/------{-.......
Open Drain ---~~---:j
OUT---Q--------~
IN-----------------------~~
835
Port 3 P37-P30. Port 3 is an S-bit, NMOS compatible four- Port 3 is configured under software control to provide the
fixed-input and four-fixed-output I/O port. These SI/O lines following control functions: four external interrupt request
have four-fixed-input (P33 P30) and four-fixed-output (P37- signals (IRQ3-IRQO); timer input and output signals (Tin
P34) ports. Port 3, when used as serial I/O, are pro- and Tout - Figure 6).
grammed as serial in and serial out, respectively. Port 3
outputs have the capability of driving LED's directly with a
pull-up resistor (output voltage or port 3 is O.SV @ 10mA).
-
-
Z8602
- ..
Port 3
(1/0 or
Control)
..
..
-
OUT
IN '"-'--(]IC
836
Port 3 lines, P30 and P37, are programmed as.seriall/O The KBC automatically adds a start bit and two stop bits to
lines for full-duplex serial asynchronous receiver/transmit- transmitted data (Figure 7). Odd parity is also available as
ter operation. The bit rate is controlled by Counter/TimerO, an option. 8 data bits are always transmitted, regardless of
with a maximum rate of 60K bits/second at 4MHz. parity selection. If parity is enabled, the 8th bit is the odd
parity bit. An interrupt request (IR04) is generated on all
transmitted characters.
1~1~1~1~1~loolool~lool~1
Start Bit
Eight Data Bits
(a) Transmitted Data (No Parity) (c) Received Data (No Parity)
(b) Transmitted Data (With Parity) (d) Received Data (With Parity)
Receive data must have a start bit, 8 data bits and at least IRESET (input, active Low). When activated, IRESET ini-
one stop bit. If parity is on, bit 7 of the received data is tializes the 8602. When IRESET is deactivated, program
replaced by a parity error flag. Received characters gen- execution begins from the internal program location at
erate the IR03 interrupt request. OOOC (HEX).
SPECIAL FUNCTIONS
The device incorporates special functions to enhance Program Memory. The 16-bit program counter address
Zilog's Z8 applications as a keyboard controller, scientific 64K bytes of program memory space at internal locations
research and advanced technologies applications. (Figure 8).
837
65535
Reserved
2048
2047
Location of
First Byte of On-Chip
Instruction ROM
Executed ............ ......... - - - - - - -
After RESET 12
11 IR05
10 IR05
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 ......... IR02
Interrupt
Vector
>- ..-.r
3
IR02
IR01
(Upper Byte)
2 IR01
1 IROO
0 IROO
The first 12 bytes of program memory are reserved for the trol and status registers (R3-RO, R127-R4, and R255-R240
interrupt vectors. These locations have six 16-bit vectors respectively). The instructions can access registers di-
that correspond to the six available interrupts. rectly or indirectly via an 8-bit address field. This allows
short. 4-bit register addressing using tile Register Pointer
Byte 13 to byte 2047 consists of 'on-chip, mask-pro- (Figure 10). In the 4-bit mode, the register file is divided into
grammed ROM. Addresses 2048 and greater are re- 9 working-register groups, each occupying 16 continuous
served. locations. The Register Pointer addresses the starting
location of the active working-register group.
Register File. The register file (Figure 9) consists of 4 I/O
port registers, 124 general-purpose registers and 16 con-
838
LOCATION IDENTIFIERS
244 Timer/Counter 0 TO
242 Timer/Counter 1 T1
Not Implemented
127
General-Purpose
Registers
4
3 Port 3 P3
2 Port 2 P2
Port1 P1
o Port 0 PO
839
--~ I '7 '6 '5 '4 I 0 0 0 0 p: 240
127
15
f-- - - - - - - - - 3
1/0 Poris
o
840
Stack. The KBC internal register files are used for the stack. CounlerfTimers. There are two 8-bit programmable counter!
An 8-bit Stack Pointer (R255) is used for the internal stack timers (TO-T1). each driven by its own 6-bit programmable
that resides within the 124 general-purpose registers. prescaler. The T1 prescaler can be driven by internal or
external clock sources however. the TO prescaler is driven
by the internal clock only (Figure 11).
The 6-bit prescalers can divide the input frequency of the The counter can be programmed to start. stoP. restart to
clock source by any integer number from 1 to 64. Each continue. or restart from the initial value. The counters can
prescaler drives its own counter. which decrements the also be programmed to stop upon re~ching zero (single
value (1 to 256) that has been loaded into the counter. pass mode) or to automatically reload the initial value and
When both the counter and prescaler reach the end of continue counting (modulo-n continuous mode).
count. a timer interrupt request. IR04 (TO) or IR05 (T 1). is
generated.
841
The counters, but not the prescalers, are read at any time Interrupts. The KBC have six different interrupts from eight
without disturbing their value or count mode. The clock different sources. These interrupts are rnaskable and
source for T1 is user-definable and are either the internal prioritized (Figure 12). The 8 sources are divided as follow:
microprocessor clock divided by four, or an external signal 4 sources are claimed by Port 31ines P33-P30, one in Serial
input via Port 3. The Timer Mode register configures the Out, one in Serial In, and 2 in counter/timers. The Interrupt
external timer input as an external clock, a trigger inputthat Masked Register globally or individually enables or dis-
can be retriggerable or non-retrigerable, or as a gate input ables the six interrupts requests.
for the internal clock. The counter/timers can be program-
mably cascaded by connecting the TO output to the input
of T1. Port 3 line P36 also serves as a timer output (Tout)
through 'which TO, T1 or the internal clock are output.
IROQ-IR05
IRa
IMR
6
Global
Interrupt IPR
Enable
Interrupt PRIORITY
Request LOGIC
Vector Select .
842
When more than one interrupt is pending, priorities are The crystal should be connected across XTAL 1 and XTAL2
resolved by a programmable priority encoder that is con- using the recommended capacitors from each pin to
trolled by the Interrupt Priority register. All interrupts are ground (Figure 13). Capacitance is between 15pF to 40pF
vectored through locations in the program memory. When depending upon the manufacturer of crystal, ceramic
an interrupt machine cycle is activated an interrupt request resonator and PCB layout.
is granted. Thus, this disables all of the subsequent inter-
rupts, saves the Program Counter and status flags, and EMI. The Z8602 offers low EMI emission due to circuit
then branches to the program memory vector location modifications to improve EMI performance. Tile internal
reserved for that interrupt. This memory location and the divide-by-two circuit has been removed to improve LMI
next byte contain the 16-bit address of the interrupt service performance.
routine for that particular interrupt request.
The EMI measurements for the KBC are done in a closed
To accommodate polled interrupt systems, interrupt in- field environment (e.g., indoor, at room temperature) willl
puts are masked and the interrupt request register is 5.1Vapplied to the Vcc, where the EMI probe is positioned
polled to determine which of the interrupt requests needs directly above the Z8602. Far field EMI measurements
service. should be conducted at an enclosed, shielded lacility.
Clock. The KBC on-chip oscillator has a high-gain, paral- Figures 14 through 17 show tile EMI plots for the Z8602
lel-resonant amplifier for connection to a crystal, ceramic running at 2 and 4 MHz crystals with 40 and 100 MHz
resonator, or any suitable external clock source (XTAL 1= frequency span.
Input, XTAL2= Out Put). The internal clock oscillates at the
crystal frequency. The crystal should be AT cut, 4MHz
max, with a series resistance (RS) less than or equal to 100
Ohms.
XTAL2 - - - . XTAL2
1
External Clock
843
REF -10 0 dBm ATTEN 10 dB
PEAK
LOG
10
dB!
START
o Hz
WA SB
SC FC
CORR
844
REF -10.0 dBm ATTEN 1Z d8
PEAK
LfY3
10
dB/
STJP ,
1210.0 MHz
WA SB
SC FC
CORR
I
845
REF -10 0 dBm ATTEN 10 dB
PEAK
LOG
10
dB/
STOP
40.00 MHz
WA SB
SC FC
CaRR
846
REF -10.0 dBm ATTEN 10 dB
PEAK
LOG
10
dB/
STOP
100.0 MHz
WA .SB
SC FC
CORR
I
847
STANDARD TEST CONDITIONS
2.1 KU
From Output
Under Test
Stress greater than those listed under Absolute Maximum tions of these specifications is not implied. Exposure to
Ratings may cause permanent damage to the device. This absolute maximum rating conditions for extended periods
is a stress rating only; operation of the device at any may affect device reliability.
condition above those indicated in the operational sec-
848
DC CHARACTERISTICS
Vcc = 4.75 V to 5.25V@ ooe to +70oe
Symbol Parameter Min Max Typt Unit Condition
Va-! Clock Input High Voltage 3.8 Vee V Driven by External Clock Generator
Vet. Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.0 Vee V
VIL Input Low Voltage -0.3 0.8 V
VOL Output Low Voltage 0.8 V IOL= +2.0 rnA (Port 0,1,2)
Output Low Voltage 0.4 V IOL= +2.0 rnA (Port 3 only)
IlL Input Leakage -10 10 IJA VIN = OV, 5.25V
IOL Output Leakage -10 10 IJA VIN = OV, 5.25V
t Typical @ 25"C
CONTROL REGISTERS
Iwl~I~I~lool~lrnlool
I Serial Data (DO Q LSB) 0= No Function
1 = Load To
0= Disable TO Count
1 = Enable To Count
0= No Function
Figure 19. Serial I/O Register 1 = LoadT1
(FOH; Read/Write)
0= Disable T 1 Count
1 = Enable T1 Count
TIN Modes
00 = External Clock Input
01 = Gate Input
10 Trigger Input
Q
(Non'retrlggerable)
11 =Trigger Input
(Retriggerable)
Tour Mode
00= Not Used
01 =ToOUT
10=T1 0UT
11 = Internal Clock Out
849
R242T1 R24SPREO
Iwloolwl~loolool~lool
I T1 Inkial Value Count Mode
(When Written) o = TO Single Pass
(Range 1-256 Oeclmal 1 = TO Modulo N
01-00 HEX) Reserved
T1 CUrrent Value
(When REAO) Prescaler Modulo
(Range: 1-64 Oecimal
01-00 HEX)
1 07 1 06 1 Osl 041031021 01 I 00 I
R246P2M
L Count Mode
0= T 1 Single Pass
1 = T1 Modulo N
Clock Source
1 = T1 1ntemal
0= T 1 External Timing Input
(TIN) Mode
10710610SI041031021011 00 1
PrescaJer Modulo
(Range: 1-64 Oecimal
01-00 HEX)
Figure 25. Port 2 Mode Register.
(F6H; Write Only)
Iwloolwl~loolool~lool
R244 TO
I TO Inkial Value
Reserved
(When Wrkten) o P30 = Input P37 = OUlput
(Range: 1-256 Oecimal 1 P30 _ Serial In P37 _ Serial Out
01-00 HEX)
TO Current Value o Parity Off
(When REAO) 1 Parity On
850
R248POIM R251IMR
Iwlool~I04I00I~I~lool
POO - P03 Mode
00= Output
01 = Input
Stack Selection
1 = Internal (Must be 1)
11,------ 1 Enables IROO-IROS
(Do = IROO)
Reserved
1 Enables Interrupts
PHI-P17 Mode
o = Byte Output
1 = Byte Input
Reserve (Must be 0) Figure 30. Interrupt Mask Register
P04 - P07 Mode
(FBH; Read/Write)
00= Output
01 = Input
R2S2 Flags
Iwlool~I04I00I~I~lool
1 = IR03, > IROS
Reserved
I''----
Reserved
r7
R250 IRO
851
R254GPR R255SPL
Iwl~lool~lool~I~lool Iwloolool~lool~I~lool
I GPR
I Stack PoInter Lower
Byte (SPo - SP7)
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate
R Register or working-register address Affected flags are indicated by:
r Working-register address only
.IR Indirect-register or indirect o Clear to zero
working-register address 1 Set to one
Ir Indirect working-register address only Set to clear according to operation
RR Register pair or working register pair Unaffected
address x Undefined
Symbol Meaning
852
Condition Codes
853
INSTRUCTION FORMATS
dsl OPC
One-Byte Instructions
MODEL OPC LD
src OR
dsl OR
MODE I OPC LD
dsllsre I x
ADDRESS
cc I OPC JP
DAU
DAL
OPC CALL
DAU
DAL
Three-Byte Instructions
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol indicates that the source data is added to \tIe destination
"-", For example: data and the result is stored in the destination location. The
notation "addr (n)" is used to refer to bit (n) of a given
dst - dst + src operand location.
854
INSTRUCTION SUMMARY (Continued)
AOCdst, sre t 1
dstt-dst + sre +C
1[
****0 * INCdst
dstt-dst + 1
rE
r= 0- F ***
R 20
AOOdst, sre t O[ 1 **** IR 21
dstt-dst + sre
0 *
INCWdst RR AO -
***- -
ANOdst, sre
dstt-dst AND sre
t 5[ 1 -
** 0
- - dstt-dst + 1 IR A1
IRET BF
CALLdst DA D6 - - - - - - FLAGSt-@SP; ******
SPt-SP- 2 IRR D4 SPt-SP + 1
@SPt-PC, PCt-@SP;
PCt-dst SPt-SP + 2;
IMR(7)t-1
CCF
Ct-NOTC
EF *. - - - - -
JPee, dst DA cD
if ee is true e = 0- F
CLR dst R BO - - - - - - PCt-dst IRR 30
dstt-D IR B1
JR ee, dst RA eB - - - - - -
COMdst R 60 - ** 0
- - if ee is true, e = 0- F
dstt-NOT dst IR 61 PCt-PC + dst
Range: +127,
CPdst, sre t A[ 1 ****- - -128
dst - sre
LO dst, sre 1m rC - - - - - -
OAdst R 40
*** X
- - dstt-sre r R r8
dstt-DAdst IR 41 R r9
r = 0- F
OECdst
dstt-dst -1
R
IR
00
01
-
***- - r
X
X
r
C7
D7
r Ir E3
OECWdst RR 80 - ** *- - Ir r F3
dstt-dst - 1 IR 81 R R E4
R IR E5
01 8F - - - - - - R 1M E6
IMR(7)t-0 IR 1M E7
IR R F5
OJNZr, dst RA rA - - - - - -
rt-r - 1 =
r 0-F LOC dst, sre Irr C2
ifr;tO
PCt-PC + dst
Range: +127, LOCI dst, sre Ir Irr C3 - - - - - -
-128 rt-r +1;
rrt-rr + 1
EI gF - - - - - -
IMR(7)t-1
855
INSTRUCTION SUMMARY (Continued)
OR dst, src t I -
** - - SUB dst, src t I 1
dst~dst OR src
4[
0
dst~dst~src
2[
**** *
POPdst R 50 - - - - - .- SWAPdst R FO X
** X
- -
dst~@SP; IR F1
~
IR 51
SP~SP+ 1 17 01
PUSH src R 70 - - - - - -
SP~SP-1; IR 71 TCM dst, src t 6[ I - ** 0
-
@SP~src (NOT dst)
ANOsrc
RCF CF 0 - - - - -
C~ TMdst, src
dstANO src
t 7[ I - ** 0
- -
RET AF - - - - - -
PC~@SP;
SP~SP+ 2
XOR dst, src
dst~dst
t B[ I - ** 0
- -
XORsrc
-
RLdst R
IR
90
91
****-
~ t These instructions have an identical set of addressing modes, which
are encoded for brevity. The first opcode nibble is found in the instruction
RLC dst
~
R
IR
10
11
** * * - -
set table above. The second nibble is expressed symbolically by a '[ ]'
in this table, and its value is found in the following table to the left of the
applicable addressing mode pair.
SBCdst, src t 3[ I 1
dst~dst~src~C
**** * Ir (3)
R R (4)
SCF OF 1 - - - - -
C~l
R IR [5]
SRA dst R
IR
00
01
*** 0
- -
R 1M (6)
@ IR 1M [7]
856
OPCODE MAP
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl IRl rl, r2 rl,lr2 R2, Rl IR2, Rl Rl,IM IR1,IM rl. R2 r2, Rl rl, RA cc, RA rl,IM cC,OA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl rl, r2 rl.lr2 R2, Rl IR2, Rl Al,IM IAI,IM
6,5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
Al IAl rl, r2 rl,lr2 A2, AI IA2, Rl AI,IM IA1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10,5 r--
3 JP SRP SBC SBC SBC SBC SBC SBC
IAAl 1M rl, r2 rl, 1r2 A2, Al IA2, Al Al.IM IAI,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
4 DA DA OR OR OR OR OR OR
Al IAl rl, r2 rl,lr2 R2, Al IA2, Al Al,IM IA1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
5 POP POP AND AND AND AND AND AND
Al IAI rl, r2 rl,lr2 A2, Al IA2, Al Al.IM IA1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
6 COM COM TCM TCM TCM TCM TCM TCM
.,
)( Al IAl rl, r2 rl,lr2 R2, AI IA2, Al Al,IM IA1,IM
r---
;;.
., 7
10/12.1 12/14.1
PUSH PUSH
6.5
TM
6,5
TM
10.5
TM
10.5
TM
10,5
TM
10.5
TM
:c.c A2 IA2 r1, r2 r1,lr2 A2, Rl IR2, Al Rl,IM IA1,IM
Z 10.5 10.5 r---
01
~ 8 DECW DECW
0.
0. AAl IAl
::>
6.5 6.5 ~
9 RL RL EI
Rl IRl
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10,5 114:0
A INCW INCW CP CP CP CP CP CP RET
ARl IAl rl, r2 rl,lr2 A2, AI IA2, Rl Al,IM IAI,IM
B
6.5
CLR
6.5
CLR
6.5
XOR
6.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
10,5
XOR
rw.o
IRET
Rl IRl rl, r2 rl,lr2 R2, Al IR2, Al Al,IM IR1,IM
6,5 6.5 12.0 18.0 10.5 t--s:5
C RRC RRC LDC LDCI LD RCF
Al IAl rl,lrr2 Irl,lrr2 rl,x,A2
6.5 6.5 20.0 20.0 10.5 ~
D SRA SRA CALL' CALL LD SCF
Al IAl IAAl OA r2,x,Al
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ts5
E RR RR LD LD LD LD LD CCF
Al IAl rl,IA2 A2, Al IA2, Al Al,IM IAI,IM
8.5 8.5 6.5 10.5 t--s:o
F SWAP SWAP LD LD NOP
Al IRl Irl, r2 R2,IRl
... ,. '" ,.. ... ,.. ~
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = S-bit address
Nibble r = 4-bit address
Pipeline
1 Cycles
R 1 or r 2 = Dst address
R 1 or r 2 = Src address
Sequence:
Ope ode, First Operand,
Mnemonic Second Operand
857
PRELIMINARY PRODUCT SPECIFICA T/ON
,
~Zim
Z8604
NMOS Z8® 8-BIT
MICROCONTROLLER
FEATURES
• 8-bit NMOS Microcomputer, 18-pin DIP • Two programmable 8-bit Counter/Timers each with 6-
bit programmable prescaler
• Low Cost
• 6 vectored, priority interrupts from 5 different sources
• 4.5 to 5.5 Volt Operating Range
• Clock speed 1 to 8M Hz
• Low Power Consumption-600 mW (typical)
• Watchdog/Power-On Reset Timer
• Fast instruction pointer-1.5 microseconds at 8MHz
• Bit Programmable RC Oscillator
III 14 input/output lines
• On-chip oscillator that accepts a crystal, ceramic
II All inputs are Schmitt triggered resonator, RC or external clock drive.
II 1K byte of ROM
GENERAL DESCRIPTION
The Z8604 microcontroller (MCU) introduces a new level of The device applications demand powerful I/O capabilities.
sophistication to single-chip architecture. The Z8604 is a The MCU fulfills this with 14 pins dedicated to input and
member of the Z8 single-chip microcontroller family with output. These lines are grouped into two ports, and are
1K of ROM. The device is housed in a 18-pin DIP, and is configurable under software control to provide liming,
NMOS compatible. Zilog's NMOS microcontroller offers status signals, or parallel I/O.
fast execution, more efficient use of memory, more sophis-
ticated interrupts, input/output bit manipulation capabili- There are two basic address spaces available to support
ties, and easy hardware/software system expansion along the wide range of configurations: Program Memory and 76
with low cost and low power consumption. bytes of General Purpose Registers.
The Z8604 architecture is characterized by Zilog's 8-bit To unburden the program from coping with tile real-time
microcontroller core. The MCU offers a flexible I/O scheme, problems such as counting/timing and input/output data
an efficient register, I/O, and a number of ancillary features communication, the Z8604 offers two on-chip counter/
that are useful in many industrial, high volume, peripheral timers with a large number of user selectable modes
types, and advanced scientific applications. (Figure 1).
859
. Vcc GND XTAL1 XTAL2
! ~
A
Port 3
A . Machine Timing
f'r- & Instruction Control
~! WDT,POR
Counterl ,II-
Timers (2) \r- ALU
FLAG
Interrupt
Control
<= Register
Prg. Memory
1K Byte
Pointer
Program
Register File Counter
76 x8-Bit
,i.
~
II
.' "i
Port 2
.~: A
, ~
110
(Bit Programmable)
860
Z8604 Z8604
P24 P23
P25 P22
P26 P21
P27 P20
Vee GND
XTAL2 P36
XTAL1 P35
P31 P34
P32 P33
PIN DESCRIPTION
PIN FUNCTIONS
XTAL1. Crystalt (time-based input). Port 2 P20-P27. Port 2 is an 8-bit. bidirectional, NMOS
This pin connects a parallel-resonant crystal, ceramic compatible I/O port. These 8 I/O lines can be configured
resonator or an external Single-phase clock to the on-chip under software control to be an input or output, independ-
oscillator input. ently. Input buffers are Schmitt triggered. Bits programmed
as outputs are globally programmed as either push-pull or
XTAL2. Crystal 2 (time-based output). open drain (Figure 3).
This pin connects a parallel-resonant crystal, <;:eramic
resonator to the on-chip oscillator output.
861
- .....,
Z8604
Port2 (VO)
-
Open Drain
OEN
Out
In
862
Port 3 P31-P36. Port 3 is a 6-bit port, NMOS compatible standard Schmitt triggered NMOS inputs. Pins P34,P35,and
with three fixed input and three fixed output lines. These six P36 are pusl)-pull outputs. Access to counter/timer 1 is
lines consist of three fixed input (P31-P33) and three fixed made ti)rougl) P31 (Tin) and P36 (Toul) (Figure 4).
output port (P34-P36) lines. Pins P31, P32 and P33 are
Z8604 Port 3
(110 or Control)
--
-
Out
In
863
FUNCTIONAL DESCRIPTION
1048
Location of
First Byte of On-Chip
Instruction ROM
Executed .............. - - - - - - -
After RESET 12 ~
11 IR05
10 IR05
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 .......... IR02
1 IROO
0 IROO
864
Register File
The Register File consists of two I/O port registers, 76 (r'igure 7). In tile 4-bit mode, the Register File is divided
general-purpose registers and 15 control and status reg- into 16 working register groups, each occupying 16 con-
isters (Figure 6). The instructions can access registers tinuous locations. The Register Pointer addresses the
directly or indirectly via an 8-bit address field. This allows starting location of the active working-register group.
a short 4-bit register address using the Register POinter
Location Indentifiers
244 Timer/Counter 0 TO
242 Timer/Counter 1 T1
240 Reserved
Not Implemented
79
General Purpose
Registers
4
3 Port 3 P3
2 Port 2 P2
P1
o PO
865
The upper nibble of the register file address
0 - - - provided by the register pointer specifies
the active working-register group
R127
R15
-- - - - - - - - - R3
866
Stack
The Z8604 has an 8-bit Stack Pointer (R255) that is used for
the internal stack that resides within the 76 general pur-
pose registers.
FO Not Implemented
F1 TMR Unchanged 0 0 0 0 0 0 0 0
F2 Timer/CNTR1 Unchanged U U U U U U U U
F3 PRE1 Unchanged U U U U U U 0 0
F4 Timer/CNTRO Unchanged U U U U U U U U
F5 PREO Unchanged U U U U U U U 0
F9 IR Priority Unchanged U U U U U U U U
FA IR Request XX543210 U U 0 0 0 0 0 0
DO=IROO=P32 Input
D1=IR01=P33 Input
D2=IR02=P31 Input
FB IR Mask Unchanged 0 U U U U U U U
FC Flags Unchanged U U U U U U U U
FD RP RP Bank U U U U U U U U
FE SPH XXXXX210 U U U U U U U U
FF SPL Unchanged U U U U U U U U
867
Countermmers
There are two 8-bit programmable counter/timers (TO-T1), however, the TO prescaler is driven by the internal clock
each driven by its own 6-bit programmable prescaler. The only (Figure 8).
T1 prescaler is driven by internal or external clock sources,
PREO TO TO.
Initial Value Initial Value Current Value
Register Register Register
6-Bit 8-bit
Down Down
Internal Counter Counter IRQ4
Clock
External Clock
Clock
Logic
6-Bit 8-Bit IRQ5
Down Down
Counter Counter
Internal Clock
Gated Clock PRE1 T1 T1
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
The 6-bit prescaler divides the input frequency of the clock The counters, but not the pre scalers, are read at any time
source by any integer number from 1 to 64. Each prescaler without disturbing their value or cpunt mode. lhe clock
drives its counter, which decrements the value (1 to 256) source for T1 is user-definable and is either the internal
that has been loaded into the counter. When both the microprocessor clock divided by four, or an external signal
counter and prescaler reach the· end of count, a timer input via Port 3. The Timer Mode register configures tile
interrupt request-IRQ4 (TO) or IRQ5 (T1) is generated. external timer input (P31) as an external clock, a trigger
input that is retriggerable or not-retriggerable, or as a gale
The counters are programmed to start, stop, restart to input for the internal clock. Port 3line P36 serves as a timer
continue, or restart from the initial value. The counters are output (Tout) through Wllich TO, T1 or tile inlernal clock are
also programmed to stop upon reaching zero (single pass output. The counter/timers can be cascaded by connect-
mode) or to automatically reload the initial value and ing the TO output to the input of T1.
continue counting (modulo-n continuous mode).
868
Interrupts
The Z8604 has six different interrupts from five different sources are claimed by Port 3 lines P31-P33, and Iwo in
sources. The interrupts are maskable and prioritized (Fig- counter/timers. Tile Interrupt Mask Register globally or
ure 9). The five sources are divided as follow: three individually enables or disables the six interrupt requests,
(Table 2).
When more than one interrupt is pending. priorities are and the next byte contain the 16-bit starting address of tile
resolved by a programmable priority encoder that is con- interrupt service routine for that particular interrupt re-
trolled by the Interrupt Priority Register. All Z8604 inter- quest.
rupts are vectored through locations in the program
memory. When an interrupt machine cycle is activated, an To accommodate polled interrupt systems, interrupl in-
interrupt request is granted. Thus, this disables ali subse- puts are masked and the interrupt request regisler is
quent interrupts, saves the Program Counter and Status polled. This determines which of the interrupt requests
Flags, and then branches to the program memory vector needs services.
location reserved for that interrupt. Tllis memory location
IRQO-IRQ5
Interrupt
Request
Vector Select
869
Clock
The Z8604 on-chip oscillator has a high-gain, parallel- external resisitor is connected between VCC and XTAL 1.
resonant amplifier for connection to a crystal, RC, ceramic Resistor values range 'from 0 to lOOK. By connecting
resonator, or any suitable external clock source (XTAL 1 = XT AL lto VCC the maximum frequency is obtained (Figure
Input, XTAL2 = Output). The crystal should be AT cut, 1 to lOb).
8 MHz max, with a series resistance (RS) less than or equal
to 100 Ohms (Figure lOa). The crystal should be cormected across XTAL 1 and XTAL2
using the recommended capacitors (capacitance is be-
The Z8604 has an on-chip bit programmable RC Oscilla- tween 15pf to 25pf which depends on the manufacturer of
tor. The RC oscillator uses an internal capacitor and an crystal, ceramic resonator and PCB layout) from each pin
external resistor t6 determine its operation frequency. The to ground .
C2;h
XTAL2 XTAL2
Power-On Reset
A timer circuit clocked by a dedicated on-board RC instruction every 10 ms; otherwise the Z8604 will reset
oscillator and by the XTAL oscillator is used forthe Power- itself.
On Reset (POR) timer function. The POR time allows Vcc
and the oscillator circuit to stabilize before instruction WDT =5F (HEX)
execution begins. The POR timer circuit is a one-shot timer
triggered by WDT timeout. The POR time is a nominal Opcode WDT (SF%). The first time opcode %5F is exe-
4OmS. cuted, the WDT is enabled, subsequent execution clears
the WDT counter. This has to be done at least every 10 ms.
Watch Dog Timer (WOT). The WDT is enabled by instruc- Otherwise, the WDT will time out and generate a reset. The
tion WDT. When the WDT is enabled, it cannot be generated reset is the same as a power on reset of 40
stopped,and must be refreshed by executing the WDT ms+ 18 XTALK clock cycles.
870
STANDARD TEST CONDITIONS
+5V
The characteristics listed below apply for standard test
conditions as noted. All voltages are referenced to ground.
Positive current flows into the referenced pin (Figure 11). 2.1 KQ
150pf
I
Figure 11. Test Load Diagram
Symbol Description Min Max Units Note n. Voltage on all pins with respect to GND Stress
greater than those listed under Absolute Maximum Rat-
Vee Supply Voltage' -0.3 +7.0 V ings may cause permanent damage to the device. This is
TSTG Storage Temp -65 +150 C a stress rating only; operation of the device at any condi-
TA Oper Ambient Temp t C tion above those indicated in the operational sections of
these specifications is not implied. Exposure to absolute
maximum rating conditions for extended periods may
t See Ordering Information affect device reliability.
DC CHARACTERISTICS
Vcc=+4.5 to +5.5V
T A=O°C to 70°C
Sym Parameter Min Max Typ Unit Condition
VCH Clock Input High Voltage 3.8 Vcc V Driven by External Clock Generator
VCl Clock Input Low Voltage Vss-0.3 8.0 V Driven by External Clock Generator
871
REGISTER DIAGRAMS
Iwl~I~I~lool~lmlool
I ReselVed Count Mode
o = T 1 Single Pass
1 = T1 Modulo N
Clock Source
Figure 12. Reserved 1 = T1 Internal
o = T 1 External Timing Input
(T IN) Mode
Prescaler Modulo
R241 TMR (Range: 1-64 Decimal
01-00 HEX)
TOUT Mode
00= Not Used
01 =TOOUT
10=T10UT
Figure 16. CounterlTimer 0 Register
11 = Intemal Clock Input (F4H; Read/Write)
Iwl~I~I~lool~lmlool
R242T1
Iwl~I~I~lool~lmlool
I 'T1 Initial Value
I Low"""" X
o= To Single Pass
1 = TO Modulo N
872
R246P2M R250 IRO
Iwloolml~lool~lmlool
I I
I
R2S11MR
Reserved
1 Enables IROO-IROS
(Do =IRQO)
Reserved
Figure 19. Port 3 Mode Register 1 Enables Interrupts
(F7H; Write Only)
1 Reserved
R252 Flags
873
R254SPH R255SPL
Iwlool~I~lool~I~lool Imlool~I~lool~I~lool
I L-I_ GPR
Reserved
I Stack PoInter Lower
Byte (SPo • SP7)
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed Address D Decimal-adjust flag
DA Direct Address H Half-carry flag
RA Relative Address
1M Immediate
R Register or working-register address Affected flags are indicated by:
r Working-register address only
IR Indirect-Register or indirect o Clear to zero
working-egister address 1 Set to one
Ir Indirect working-register address only Set to clear according to operation
RR Register pair or working register pair Unaffected
address x Undefined
Symbol Meaning
874
Table 3. Condition Codes
875
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
CLR. CPL, DA. DEC, OPC I MODE ADC. ADD. AND. CPo
L-_';;;;';';';';"'_...I
OR 11 11 0
_
I dsVsre I DECW.
. •
INC. INCW.
POP. PUSH. RL. RLC.
src OR
LD. OR. SBC, SUB.
TCM. TM.XOR
RR. RRC. SRA. SWAP dst OR
OPC
I - - -d- s-t ---lOR
I 111 1 0 I dst
JP. CAll (Indirect)
OPC I MODE ADC. ADD. AND. CPo
dst OR 1111 0 I dst
LD. OR. SBC, SUB.
TCM. TM.XOR
OPC SRP VALUE
VALUE
MODE I OPC LD
ADC. ADD. AND. CPo sre OR
OR. SBC. SUB. TCM.
dst OR
TM.XOR
rn DAU
DAl
CAll
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol indicates that the source data is added to the destination
"-". For example: data and the result is stored in the destination location. The
notation "addr (n)" is used to refer to bit (n) of a given
dst - dst + src operand location.
876
INSTRUCTION SUMMARY (Continued)
0
dstf-dst AND src --------------
IRET BF
CALL dst OA 06 - - - - - - FLAGSf-@SP; ******
SPf-SP- 2 IRR D4 SPf-SP + 1
@SPf-PC, PCf-@SP;
PCf-dst SPf-SP + 2;
IMR(7)f-1
CCF EF *- - - - -
Cf-NOTC JPcc, dst DA cD
if cc is true =
c 0- F
eLR dst R BO - - - - - - PCf-dst IRR 30
dstf-O IR B1
JRcc, dst RA cB - - - -
COMdst R 60 - ** 0
- - if cc is true, =
c 0- F
dstf-NOT dst IR 61 PCf-PC + dst
Range: +127,
CP dst, src t A[ 1 ****- - -128
dst - src
LD dst, src 1m rC - - - - -
DAdst
dstf-OA dst
R
IR
40
41
*** X
- - dstf-src
R
R r8
r9
=
r 0-F
DECdst
dstf-dst - 1
R
IR
00
01
-
***- -
X
X
r
C7
07
r Ir E3
DECWdst
dstf-dst - 1
RR
IR
80
81
-
***- - Ir
R
r
R
F3
E4
R IR E5
01 8F - - - - - - R 1M E6
IMR(7)f-0 IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
rf-r - 1 =
r 0- F LDC dst, src Irr C2
if r;t.O
PCf-PC + dst LOCI dst, src Ir Irr C3
Range: +127, rf-r +1;
-128 rrf-rr + 1
EI 9F - - - - - -
IMR(7)f-1
WDT 5F - - - - - -
877
INSTRUCTION SUMMARY (Continued)
NOP FF - - - - SRPsrc 1m 31
RP~src
OR dsl, src t 4[ ] -
** 0
- - SUB dst, src t 2[ ]
****1 *
dst~dst OR src dst~dst~src
PUSH src
1
R 70 - - - - - -
17
2!3 o1
SP~P-1;
@SP~src
IR 71 TCM dst, src
(NOTdst)
t 6[ ] -
**0 - -
ANOsrc
RCF CF 0 - - - - -
C~O TM dst, src
dstANO src
t 7[ ] - ** 0
- -
RET AF - - - - - -
PC~@SP;
SP~SP+ 2
XOR dst, src
dst~dst
t B[ ] - ** 0
- -
XORsrc
RLdst R
IR
90
91
****- -
t These instructions have an identical set of addressing modes, which
~ are encoded for brevity. The first opcode nibble is found in the instruction
set table above. The second nibble is expressed symbolically by a '[ )'
in this table, and its valu'e is found in the following table to the left of the
RLC dst R
IR
10
11
****- - applicable addressing mode pair.
LEi=riS}J For example. the opcode of an ADC instruction using the addressing
modes r (destination) and Ir (source) is 13.
RR dst R EO
****- -
4JL:E:5]J IR E1
Address Mode Lower
dst src Opcode Nibble
RRCdst R
IR
CO
C1
****- " [2]
~7 orJ
Ir [3]
SBC dst, src t 3[ ]
**** 1
*
dst~dst~src~C
R R [4]
SCF OF 1 - - - - -
R IR [5]
C~1
- R 1M [6]
SRA dst R
IR
00
01
*** 0
-
~
IR 1M [7]
878
Lower Nibble (Hex)
o 2 3 4 5 6 7 8 9 A B C D E F
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 6.5 6.5 12/10.5 12/10.0 6.5 12.10.0 6.5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
Rl. IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM n, R2 r2, Rl rl, RA ee, RA rl,lM ee,DA rl
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
RLC RLC ADC ADC ADC ADC ADC ADC
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 r--
2 INC INC SUB SUB SUB SUB SUB SUB
Rl IRl rl, r2 rl,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.0 6.1 6.5 6.5 10.5 10.5 10.5 10.5
-
3 JP SRP SBC SBC SBC SBC SBC SBC
IRRl 1M rl, r2 rl,I,2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 6.5 10.5 10.5 10.5 10.5
-
4 DA DA OR OR OR OR OR OR
Rl IRl rl, r2 rl,I,2 R2, Rl IR2, Rl Rl,lM IR1,IM
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5
-
5 POP POP AND AND AND AND AND AND
Rl IRl rl, r2 rl,I,2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 'S:O
6 COM COM TCM TCM TCM TCM TCM TCM WDT
x Rl IRl rl, r2 rl,I,2 R2, Rl IR2, Rl Rl,lM IR1,IM
e-" 7
10/12.1 12/14.1
PUSH PUSH
6.5
TM
6.5
TM
10.5
TM
10.5
TM
10.5
TM
10.5
TM
I--
"
:;;
.0
R2 IR2 rl, r2 rl,lr2 R2, Rl IR2,Rl Rl,lM IR1,IM
Z 10.5 10.5 I--
~
B DECW DECW Of
"
0.
0. RRl IRl
:::J
6.5 6.5 ~
9 RL RL EI
Rl IRl
10.5 10.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
A INCW INCW CP CP CP CP CP CP RET
RRl IRl '1, ,2 rl,I,2 R2, Rl IR2, Rl Rl,lM IR1,IM
B
6.5
CLR
6.5
CLR
6.5
XOR
6.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
10.5
XOR
rw:oIRET
Rl IRl '1, ,2 'l,Ir2 R2, Rl IR2, Rl Rl,lM IR1,IM
6.5 6.5 12.0 10.5 ~
C RRC RRC LDC LD RCF
Rl IRl ,l,Irr2 rl,x,R2
6.5 6.5 20.0 20.0 10.5 ~
D SRA SRA LDCI CALL' CALL LD SCF
Rl IRl l,l,Irr2 IRRl DA r2,x,Rl
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
E RR RR LD LD LD LD LD CCF
Rl IRl ,l,IR2 R2, Rl IR2, Rl Rl,lM IR1,IM
8.5 8.5 6.5 10.5 r--;;n
F SWAP SWAP LD LD NOP
Rl IRl Irl, r2 R2,IRl
\.
~
.A, .A,
'Y' T T
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode R = 8-bit address
Nibble r = 4-bit address
Execution Pipeline
Cycles 1 Cycles
R 1 or r 2 = Ost address
R 1 or r 2 = Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
879
PRODl!CT SPECIFICATION
~ZilID
Z8612
NMOS Z8® ICE
IN-CIRCUIT EMULATOR
FEATURES
II All digital inputs are TTL levels
II 8-bit microcontroller emulator, 64-pin shrink DIP or
68-pin PLCC package II 124 bytes of RAM
II 4.5 to 5.5 Voltage operating range II Two programmable 8-bit Counter/Timers eacll wi III
6-bit programmable prescaler
II Average instruction execution time of 1.5 its
• Six vectored, priority interrupt from eight different
II Fast instruction pointer - 1 !1S @ 12 MHz sources
II 32 input/output lines III Clock speeds 8 and 12 MHz
1/1 Full-duplex UART &II On-chip oscillator that accepts a crystal, ceramic
resonator, LC or external clock drive
II 4K Internal Program Emulation
GENERAL DESCRIPTION
The Z8612 ICE (In-Circuit Emulator) introduces a new level IliiI Control line (lDAS) is added to interface with external
of sophistication to single-chip architecture. program memory.
The ICE is housed in a 64-pin shrink DIP or 68-pin PLCC III The Timing and Control, I/O ports, and clock pins on
package, and is manufactured in NMOS technology. the Z8612 are identical in function to those on tile
Z8611.
The ICE development device allows users to prototype a
system with an actual hardware device and to develop the The ICE architecture is characterized by Zilog's 8-bit
code. This code is eventually mask-programmed into the microcontroller core. The device offers; fast execution,
on-chip ROM for any of the Z86XX devices. Development more efficient use ofrnemory, more sophisticated interrupts,
devices are also useful in emulator applications where the input/output bit manipulation capabilities, easy hardware/
final system configuration, I/O, interrupt inputs, etc. are software system expansion, a lIexible I/O scheme, an
unknown. The ICE development device is identical to its efficient register and address space structure, multiplexed
equivaientZ8611 rnicrocontrollerwith the following excep- capabilities between address/data, and a number of an-
tions: cillary features that are useful i[l many industrial and
advanced scientific applications.
.. No internal ROM is provided, so that code is developed
in off-chip memory. Industrial applications demand powerfulI/O capabilities.
The ICE fulfills this with 32 pins dedicated to input and
II The normally internal ROM address and data lines are output. These lines are grouped into four ports. Each port
buffered and brought out to externat' pins to interface consists of eight lines and is configurable under software
with the external memory. control to provide timing, status signals, serial or parallel
I/O with or without handshake, and an address/data bus
for interfacing external memory.
881
GENERAL DESCRIPTION (Continued)
There are three basic address spaces available to support large number of user selectable modes, and an asynchro-
this wide range of configuration: Program Memory, Data nous receiver/transmitter (UART - Figure 1).
Memory, and 124 General-Purpose Registers.
Note: All Signals with a preceding front slash, .1", are active
To unburden the program from coping with the real-time low, e.g.: BINI (WORD is active low); IBNI (BYTE is
problems such as counting/timing and serial data commu- active low, only).
nication, the ICE offers two on-chip counter/timers with a
XTAL !RESET
Output Input Vcc GND
Machine Timing
and
Instruction Control
/lACK
ICE Control /MDS
Block /SYNC
SCLK
Intemal
Program
Memory
Data
Bus
882
PIN DESCRIPTION
Vee P36
XTAL2 P31
XTAL1 P27
P37 P26
P30 P25
IRESET P24
RIW P23
IDS P22
lAS P21
P35 P20
P32 P33
POO P34
POl P17
P02 P16
P03 Z8612 P15
MCU
P04 P14
GND P13
P05 P12
P06 Pll
P07 Pl0
lACK D7
ISYNC D6
SCLK D5
IMDS D4
DO AO
Dl Al
D2 A2
D3 A3
All M
Al0 A5
A9 A6
AS A7
883
PIN DESCRIPTION (Continued)
9876543216867666564636261
lAS 10 60 P21
P35 11 59 P20
P32 12 58 P33
POD 13 57 P34
POl 14 56 P17
P02 15 55 P16
P03 16 54 P15
P04 17 Z8612 53 P14
NC 18 MCU 52 NC
GNO 19 51 P13
P05 20 50 P12
P06 21 49 Pll
P07 22 48 Pl0
flACK 23 47 07
/SYNC 24 46 06
SCLK 25 45 05
IMOS 26 44 D4
IDS. (output, active Low). Data Strobe is activated once for of four external clocks (4TpC). If the external IRESET
each external memory transfer. For a READ operation, signal is less than 4TpC in duration, no reset occurs. On the
data must be available prior to the trailing edge of IDS. For 5th clock after IRESET is detected, an internal RST signal
WRITE operations, the falling edge of IDS indicates that is latched and held for an internal register count of 18
output data is valid. external clocks, or for the duration of the external IRESET,
whichever is longer. During the reset cycle, IDS is held
lAS. (output, active Low). Address Strobe is pulsed once active low while lAS cycles at a rate of TpC/2. When
at the beginning of each machine cycle. Address output is IRESET is deactivated, program execution begins at
via Port 1 for all external programs. Program or data location OOOC (HEX). Reset time must be held low for 50
memory address transfers are valid at the trailing edge of ms, or until Vcc is stable, whichever is longer.
lAS. Under program control, lAS can be placed in the high-
a
impedance state along with Ports and 1, Data Strobe, 07 - ~O. (1/0, TIL compatible) Internal Data bus. These
and Read/Write. eight lines provide the data bus to access external memory
emulating the on-chip ROM. During read cycles in the
XTAL1 , XTAL2. Crystal 1, Crystal 2 (time-based input and internal memory space, the data on these lines is latched
output, respectively). These pins connect a parallel- in just prior to the rise of the 1M OS data strobe.
resonant crystal, ceramic resonator, LC, or any external
single-phase clock to the on-chip oscillator and buffer. All - AO. (outputs TIL compatible) Internal Address bus.
During T1 these lines output the current memory address.
R/tw. (output, write Low). The Read/Write signal is low All addresses, whether internal or external, are output.
when the ICE is writing to external program or data memory.
IMOS. (output, TTL compatible) Memory Data Strobe. This
IRESET. (input, active-Low). To avoid asynchronous and is a timing signal used to enable the external memory to
noisy reset problems, the ICE is equipped with a reset filter emulate. the on-chip ROM. It is active only
884
during accesses to the on-chip ROM memory space (the and P35 are used as the handshake control /GAVO and
bottom 4K of program memory). RDYO (Data available and Ready). Handshake signal
assignment is dictated by the I/O direction of ttle upper
ISCLK. (output, TTL compatible) System Clock. This line nibble P04-P07. The lower nibble must have the same
is the internal system clock. direction as the upper nibble to be under handshake
control. For the ROMless option. Port 0 appears as A 15-A8
ISYNC. (output, TTL compatible) Sync signal. This signal Address lines after reset.
indicates the last clock cycle of the currently executing
instruction. For external memory references, Port 0 can provide ad-
dress bits A11-A8 (lower nibble) or A15-1\8 (lower and
flACK. (output, TTL compatible) Interrupt Acknowledge. upper nibble) depending on the required address space.
This output, when low, indicates that the ICE is an interrupt If the address range requires 12 bits or less, the upper
cycle. nibble of Port 0 can be programmed independently as I/O
while the lower nibble is used lor addressing. If one or both
nibbles are needed for I/O operation, they are configured
1/0 PORTS by writing to the Port 0 Mode register. In ROMless mode,
after a hardware reset, Port 0 lines are defined as address
Port 0 POO-P07. Port 0 is an 8-bit, nibble programmable, lines A 15-A8, and extended timing is set to accommodate
bidirectional, TTL compatible port. These eight 1/0 lines slow memory access. The initialization routine can include
can be configured under software control as a nibble I/O reconfiguration to eliminate this extended timing mode
port, or as an address portfor interfacing external memory. (Figure 4).
When used as an I/O porI, Port 0 may be placed under
handshake control. In this configuration, Port 3, lines P32
Pori 0
} (110)
Handshake Controls
IDAVO and RDYO
(P32 and P35)
OEN
OUT
TIL Level Shifter
IN
885
PIN FUNCTIONS (Continued)
Port 1 P10-P17. Port 1 is an 8-bit, byte programmable, programmed for the multiplexed Address/Data mode. If
bidirectional, TTL compatible port. It has multiplexed more than 256 external locations are required, Port 0 must
Address (A7-AO) and Data (07-00) ports. For the ICE, output the additional lines.
these eight I/O lines are programmed as Input or Output
lines orthe port can be configured, under software control. Port 1 can be placed in high-impedance state along with
as an address/data port for interfacing external memory. Port 0, /AS, IDS and R/lW, allowing the ICE to share
When used as an I/O port. Port 1 may be placed under common resource in multiprocessor and DMA applications.
handshake control. In this configuration, Port 3, lines P33 Data transfers can be controlled by assigning P33 as a Bus
and P34 are used as the handshake controls,RDY1 and Acknowledge input, and P34 as a Bus Request output
/DAV1. (Figure 5).
Port 1
(1/0 or AD7 - ADO)
Z8612
ICE
Handshake Controls
IDAV1 and IRDY1
I----II~ (P33 and P34)
OEN--.....- ....
OUT - - - - - - - -.....- - - - f
TTL Level Shifter
IN
886
Port 2 P20-P27. Port 2 is an 8-bit, bit programmable, Port2 may be placed under handshake control. In this
bidirectional, CMOS compatible port. Each of these eight configuration, Port 3, lines P31 and P36 are used as the
I/O lines can be independently programmed as an input or handshake controls lines /DAV2 and RDY2. The hand-
output or globally as an open-drain output. Port 2 is always shake signal assignment for Port 3 lines P31 and P36 is
available for I/O operation. When used as an I/O port, dictated by the direction (input or output) assigned to P27
(Figure 6).
-
""'- ..
...
Port2 (1/0)
Z861 2
ICE ... .
Handshake Controls
IDAV2 and RDY2
(P31 and P36)
-
Open Drain - - - - - - - - - . ,
OEN - - - t - -....
OUT -------------1
TTL Level Shifter
IN----<
887
PIN FUNCTIONS (Continued)
Port 3 P3D-P37. Port 3 is an 8-bit, CMOS compatible four- Port 3 is configured under software contralto provide the
fixed input and four-fixed output port. These eight I/O lines following contral functions: handshake for Ports 0 and 2
have four-fixed (P33-P30) input and four fixed (P37-P34) (lDAV and RDY); four external interrupt request signals
output ports. Port 3, when used as serial I/O, are pro- (IROO-IR03); timer input and output signals (T'N and TOUT);
grammed as serial in and serial out, respectively (Figure 7 Data Memory Select (lDM).
and Table 1).
Z861 2
- Port 3
ICE . (110 or Control)
.
-
Figure 7. Port 3 Configuration
Notes
HS = Handshake Signal
D = Data Available
R = Ready
888
Port 3, lines P30 and P37, can be programmed as serial less of parity selection. If parity is enabled, the eighth bit
I/O lines for full-duplex serial asynchronous receiver/trans- is ttle odd parity bit. An interrupt request (IR04) is gener-
mitter operation. The bit rate is controlled by the Counter/ ated on all transmitted characters.
Timer O.
Received data must have a start bit, eight data bils and at
The ICE automatically adds a start bit and two stop bits to least one stop bit. If parity is on, bit 7 of the received data
transmitted data (Figure 8). Odd parity is also available as is replaced by a parity error flag. Received characters
an option. Eight data bits are always transmitted, regard generate the IR03 interrupt request.
1·lplool~I~lool~lrnlool~1
Start Bit
Seven Data Bits
Odd Parity
II L..-_ _ _ _ _ .
L Start Bit
889
PROGRAMMING
Address Space
Program Memory. The ICE can address up to programmed to appear on pin P34, is used to distinguistl
64 Kbytes of external program memory (Figure 9). The first between data and program memory space (Figure 10).
12 bytes of program memory are reserved for the interrupt The state of the IDM signal is controlled by the type
vectors. These locations contain six 16-bit vectors that instruction being executed. An LDC opcode references
correspond to the six available interrupts. OOOC to 4095 is PROGRAM (10M inactive) memory, and an L DE instruction
the memory map for the Internal ROM to be emulated, and references DATA (10M active low) memory. The lower
4096 to 65535, the remaining program memory for which unaddressable part of the data memory is in fact addres-
the ICE executes external memory. fetches. sable with the ICE chip's IMDS line (as IDS is not active for
internal ROM reads), but there is no need for this.
Data Memory (/DM). External data memory is included
with, or separated from, the extemal program memory
space. IDM, an optional 1/0 function that can be
65535 65535
Extemal
ROM or RAM
4096
40 95
Location of Emulation
,,-
First Byte of ROM or RAM
Instruction
. Executed .............
12
--- - - --
After RESET
11 IR05
External
10 IR05 Data
Memory
9 IR04
8 IR04
7 IR03
Interrupt
Vector 6 IR03
(Lower Byte)
5 r-... IR02
Interrupt
Vector
....!- ~ IR02
4096
3 IR01
(Upper Byte)
4095
2 IR01
0 IROO
o
890
Register File. The Register File consists of four I/O port using the Register Pointer (Figure 12). In tile 4-bit mode,
registers, 144 general-purpose registers and 16 control tile Register File is divided into 16 working register groups,
and status registers (Figure 11). The instructions can eactl occupying 16 continuous locations. The Register
access registers directly or indirectly via an 8-bit address Pointer addresses the starting location of the active work-
field. The ICE also allows short 4-bit register addressing ing-register group.
LOCATION IDENTIFIERS
244 Timer/Counter 0 TO
242 Timer/Counter 1 T1
Not
Implemented
127
General-Purpose
Registers
3 Port 3 P3
2 Port 2 P2
Port1 P1
o PortO PO
891
PROGRAMMING (Continued)
R255
--~ r7 o 0 0 0 R253
~----------~------------~
R240
The upper nibble of the register file address
0----- provided by the register pOinter specifies
the active working-register group
R239
15
-------------------
1/0 Ports 3
Stack. The ICE has a 16-bit Stack Pointer (R254-R255) An 8-bit Stack Pointer (R255) is used for tile in ternal stack
used for external stack that resides anywhere in the data that resides within the 124 general-purpose registers (R4-
memory for the ROMless mode, but only from 4096 to R127). The high byte of tile Stack Pointer (SPH-Bit 8-15)
65535 in ROM mode. can be used as a general purpose register wilen using
internal stack onty.
892
FUNCTIONAL DESCRIPTION
Countermmers. There are two 8-bit programmable counter/ also be programmed to stop upon reaching zero (single
timers (TO-T1), each driven by its own 6-bit programmable pass mode) or to automatically reload the initial value and
prescaler. The T1 prescaler is driven by internal or external continue counting (modulo-n continuous mode).
clock sources; however, the TO prescaler is driven by the
internal clock only (Figure 13). The counter, but not the prescalers, can be read at any
time without disturbing their value or count mode. The
The 6-bit prescalers can divide the input frequency of the clock source for T1 is user-definable and can be eitiler tile
clock source by any integer number from 1 to 64. Each internal microprocessor clock divided by four, or an external
prescaler drives its counter, which decrements the value signal input via Port 3. The Timer Mode register configures
(1 to 256) that has been loaded into the counter. When both the external timer input (P3l ) as an external clock, a Irigger
the counters and prescaler reach the end of the count, a input that'can be retriggerable or non-retriggerable, or as
timer interrupt request, IR04 (TO) or IR05 (T1), is a gate input for the internal clock. Port 3 line P36 also
generated. serves as a timer output (Tout) through Wlliclll 0, T1 or IIle
internal clock can be output. The counter/timers can be
The counter can be programmed to starl, stop, restart to cascaded by connecting the TO output to the input of T 1
continue, or restart from the initial value. The counters can
I I
OSC PREO
Initial Value
TO
Initial Value
TO
Current Value
Register Register Register
6-Bit a-bit
Down Down
Counter Counter IRQ4
Internal
Clock . - - _ Serial 1/0
Clock
External Clock
-Tout
P36
Clock
Logic 6-Bit a-Bit IRQ5
Down Down
Counter Counter
Internal Clock
Gated Clock PREl T1 Tl
Triggered Clock Initial Value Initial Value Current Value
Register Register Register
TIN P3l
893
FUNCTIONAL DESCRIPTION (Continued)
Interrupts. The ICE has six different interrupts from eight service. Software initialed interrupts are supported by
different sources. The interrupts are maskable and priori- setting the appropriate bit in the Interrupt Request
tized. The eight sources are divided as follows: four sources Register (IRQ).
are claimed by Port 3 lines P30-P33, one in Serial Out, one
in Serial In. and two in the counter/timers (Figure 14). The Internal interrupt requests are sampled on the falling edge
Interrupt Mask Register globally or individually enables or of the last cycle of every instruction, and the interrupt
disables the six interrupt requests. When more than one request must be valid 5TpC before the falling edge of the
interrupt is pending, priorities are resolved by a pro- last clock cycle of the currently executing inslruction.
grammable priority encoder that is controlled by the In-
terrupt Priority register. All ICE interrupts are vectored For the ROMless mode, when the device samples a valid
through locations in the program memory. When an interrupt interrupt request, the next 48 (external) clock cycles are
machine cycle is activated, an interrupt request is granted. used to prioritize the interrupt. and push the two PC bytes
Thus, this disables all of the subsequent interrupts, saves and the FLAG register on the stack. The following nine
the Program Counter and Status Flags, and then branches cycles are used to fetch the interrupt vector from external
to the program memory vector location reserved for that memory. The first byte of the interrupt service routine is
interrupt. This memory location and the next byte contain fetched beginning on the 58th TpC cycle (allowing the
the 16-bit address of the interrupt service routine for that internal sample point, which corresponds to lhe 63rd TpC
particular interrupt request. cycle following the external interrupt sample paint.
IROO-IR05
Global
Interrupt
Enable
Interrupt
Request
Vector Select
894
Clock. The ICE on-chip oscillator has a high-gain, parallel- less than or equal to 100 Ohms. The crystal should be
resonant amplifier for connection to a crystal, LC, ceramic connected across XT AL 1 and XT AL2 using the recom-
resonator, or any suitable external clock source mended capacitors (10 pF < CL < 100 pF) from each pin
(XTAL 1=Inpul, XTAL2=Output). The crystal should be AT to ground (Figure 15).
cut, 1 MHz to 12 MHz max, and series resistance (RS) is
C2:;;!;
895
INSTRUCTION CYCLE TIMING
T1
M1
T2 T3 I T1
M2
T2 T3 T1
M3
T2 T3
Clock
PO
X Al5-A8 X A15-A8 )C
P1
07-00 IN
lAS
V V V
IDS , \ I \ I
RlIW
7
ISYNC --V V
j..-Fetch Instructionl--l.~~__-Fetch 1st Byte of Next Instruction~
M1 M2 M1 or M3
T1 T2 T3 T1 T2 T3
Clock
PO ____JX~__~A1~5~~:8___JX~__~A~15~~=8~_JX~__~A~15~~~8~___
P1
07-00 A7-AO 07-00. A7-AO 07-00
lAS v V V,..----
' ...___1
IDS
''''''_--I '''''' ___r
R/IW 7 (FOr 2-Byte Instr. Only
ISYNC -V « ."
• •....
I. Fetch 1st Byte Fetch 2nd Byte Fetch 3rd Byte
(3-Byte
Instruction)
Fetch 1st Byte
(lor 2 Byte
Instruction)
896
The addresses. Address Strobe (lAS) and Read Write Ports 0 and 1; however, /DS and R//W are inactive. If
(R//W) are output at the beginning of each machine cycle configured for internal memory only, Ports 0 and 1 are used
(Mn). The addresses output via Port) (if used) remain for I/O, /DS outputs, and /SYNC; R//W is inactive.
stable throughout the maclline cycle, wllereas addresses
output via Port 1 remain valid only during MnT1. The The exception to the instruction fetch timing is during tile
addresses are guaranteed valid at the rising edge of /AS, opcode fetcll of an instruction following the fetctl of a one
which is used to latch the Port 1 output. Port 1 is placed in byte instruction. One-byte instructions require two maclline
an input mode at the end of MnT1. The Data Strobe is cycles of execute. The pipeline causes the following
output during MnT2, allowing data to be placed on the Port opcode fetc!l to begin one maclline cycle early.
1 bus. The Z8 accepts the data during MnT3 and /DS is
terminated.
External Memory or I/O Timing
An instruction synchronization pulse /SYNC is output one
clock pulse period prior to tile beginning of an opcode When external memory is addressed, Ports 0 and 1 are
fetch matching cycle (M1). This output is directly available configured to output the required number of address bits.
on the 64-pin version of the Z8; whereas, on the 40-pin Port 1 is used as a multiplexed address/data bus for AD?-
version, the Data Strobe pin outputs /SYNC only if external ADO and Port 0 outputs address bits A 15-A8. The timing
memory is not used. relationships for addressing external memory and I/O are
illustrated in Figures 18,19, 20and 21. Themain difference
Note that all instruction fetch cycles have the same ma- between these figures is tllat Figures 20/21 contain an
chine timing regardless of whether the memory is internal added timing cycle (Tx) that extends external memory
or not. If configured for external memory and internal timing to allow for slower memory.
memory is referenced, the addresses are still output via
1<I1~I---T-1-MaChin~~YCle--T-3-"'~1
Clock
PO
X A15-A8 x::::
P1
X A7-AO ) C>----C
D7-DO IN
lAS
'-1 "-
IDS
\ I
RI/W
/
IDM
X x::
I" Read Cycle ·1
Figure 18. External Instruction Fetch, 110, or Memory Read Cycle
897
FUNCTIONAL DESCRIPTION (Continued)
14~---Machine cycle-T-3---<"~1
Clock
PO
X A15-A8 x::::::
P1
X A7-AO X D7-000UT x::::::
lAS
'--' '-
lOS \ I
RIIW
~
10M
X x::::
~ Write Cycle ~I
Clock
t T1
Machine Cycle
T2 Tx T3 "I
PO :x A15-A8 x::::::
P1
:x A7-AO ) <=>--C:
07-00 IN
lAS
~ '-
lOS
\ /
RlIW
:..J
10M
=x x::::
~ Read Cycle. ~I
Figure 20. Extended External Instruction Fetch, 110, or Memory Read Cycle
898
Clock
r T1
Machine Cycle
T2 Tx T3 ·1
PO ::x A15-AO x::::::
P1
::x A7-AO X 07-00 OUT x::::::
lAS
'--' '--
IDS
\ I
":x
RlIW
10M
x::::
I~ Write Cycle ~I
Address bits A 15-AO are valid on Ports 0 and 1 at the During the write cycle, the address outputs follow the same
trailing edge of /AS for both the read and write memory timing relationships as for the read cycle. However, the
cycles. Because Port 0 is not multiplexed. address bits output data is valid for the entire period IDS is active, and
A 15-A8, if used, are present all through the read/write RI/W is active (low) during the entire write cycle.
memory cycles.
Interrupt requests are sampled before each instruction
During the read cycle, the input data must be valid on Port fetch cycle (Figure 22). Firsl, external interrupt requests
1 at the trailing edge of the Data Strobe output (IDS). The are sampled four clock periods prior to the active / AS pu Ise
Data Memory Select output (10M) is used to select external that corresponds to an instruction felch cycle. Then,
, data memory or external program memory. If selected, internal interrupt requests are samples one clock period
10M is active during the execution of certain instructions. preceding lAS.
899
8 "z
c:
~
o
Z
l>
r
C
MN I Ml M2 IM31 M4 M5 M6 I.f7 Ml
rn
(")
1M2' TMl' _ TM T1 'T2 13 T1' T2 13 Tl T2 13 Tl' T2 13 T1' T2 13 T4 Tl' T2 13 Tl' T2
2:!
Clock ~
PO X Al5-J<Jl_ X Al5-AO X Al5-AO X Al5-AO ~ o
z
Pl ~
07·00 IN
~ D7.DOOUT~
PCl
07·00 OUT
PCU
~ D7.DOOUT~
FLAGS
oo
lAS V V V V V V V a::i"
c::
/OS \ I CD
S
- 7 , I
10M / Internal Interrupt
, I
~
ReqUests Sampled
....". ", Fetch 1st Byte Internal _ _ Save PCl _I_ Save PCU ~. Save Flags _~ I ~e~. _
",-
,:,:-' :-.:
External Interrupt
(Dam Ignored)4 Execution On Stack On Stack On Stack ---r- nSF~tc~on
Inputs Sampled
I First Machine
Cycle
T1 I
Clock
SCLK
IRESET
lAS
IDS
In addition to their uses in memory transfers, the control IDS has several alternative uses: as a ICAS (Column
signals lAS, IDS and RI/W are used,in the following inter- Address Strobe) for dynamic memory inlerface, as a Chip
face applications. Enable for memory and other interface devices, and as an
Enable input for 3-state bus driverslreceivers for memory
lAS can be modified to provide the IRAS (Row Address and interface devices.
Strobe) Signal for dynamic memory interface. IRAS can be
derived from the trailing edge of fDS to the trailing edge of RI/W is used as a Write input to memory interfaces, and as
lAS. an Early Status output to switch the direction 013-state bus
drivers/receivers.
901
ABSOLUTE MAXIMUM RATINGS
Stress greater than those listed underAbsolute Maximum
Symbol Description Min Max Units Ratings may cause permanent damage to the device. Tl1is
is a stress rating only; operation of tile device at any
vco Supply Voltage* -0.3 +7.0 V
condition above those indicated in the operational sec-
TSTG Storage Temp -65°C +150° C
tions of these specifications is not implied. Exposure to
TA Oper AmbientTemp** C
absolute maximum rating conditions for an extended pe-
riod may affect device reliability.
Noles:
* Voltages on all pins with respect to GND .
.. See Ordering Information
+5V
~~I T lOOflA
.". .".
902
DC CHARACTERISTICS
VCl Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.0Vcc V
Nole:
For A ll-AO./MDS./SYNC./IACK and SCLK, IOH = -100 J1A and 1,,- = 1 rnA
903
AC CHARACTERISTICS ,
External I/O or Memory Read or Write Timing Diagram
RlIW
PortO,lOM
Port 1
lAS
IDS
(Read)
IDS
(Write)
904
AC CHARACTERISTICS
External If0 C?r Memory Read or Write Timing Table
Noles:
[1] When using extended memory timing add 2 TpC.
[2] TIming numbers given are for minimum TpC.
[3] See clock cycle dependent characteristics table.
905
AC CHARACTERISTICS
Additonal Timing Diagram
Clock
TIN
IRON
AC CHARACTERISTICS
Additional Timing Table
Noles:
[1 J Clock timing references use 3.BV for a logic 1 and O.BV for a logic O.
[2J Timing references use 2.0V for a logic 1 and O.BV for a logic O. '
[3J Interrupt references request via Port 3.
[4J Interrupt request via Port 3 (P31-P33r.
[5J Interrupt request via Pori 30.
906
AC CHARACTERISTICS
Memory Port Timing Table
Notes:
1. Test load 2
2. This is a clock cycle dependent parameter. For frequencies other than
the maximum, use the following formula: 5TpC - 95.
AC CHARACTERISTICS
Memory Port Timing Diagram
907
AC CHARACTERISTICS
Handshake Timing Diagram
Datal"
r""" """ """""""" """ """""""""""""" """" """"""""
Next Data In Valid .
r" """ """"""" """"""" """""""""""" """" """" """""
IOAV
· nn~~:~"~~~"m1~mm"mn/[:" ."
'q
(Input)
':t=,r--1-
ROY
(OuIput) ---'------ ,Jr-L""~~"a~~"~~~";
Figure 28. Input Handshake Timing
r---------------------~~-----------.
DataOJt Data Oul Valid Next Data Out Valid
I'--------------\~ - - - - - - - - - - -.,
IOAV
(Oulput)
ROY
(Input)
AC CHARACTERISTICS
Handshake Timing Table
Noles:
1. Test load 1
2. Input handshake
3. Output handshake
All timing references use 2.0 V for a logic 1 and 0.8 V for logic o.
Units in nanoseconds
908
CLOCK DEPENDENT
AC Characteristics
No Symbol Equation
1 TdA(AS) 0.40TpC + 0.32
2 TdAS(A) 0.59TpC - 3.25
3 TdAS(OR) 2.38TpC + 6.14
4 TwAS 0.66TpC - 1.65
6 TwOSR 2. 33TpC - 10.56
14 TdOW(OSW) O.4TpC
15 TdOS(OW) 0.88TpC - 19
16 TdA(OR) 4TpC - 20
17 TdAS(OS) 0.91TpC - 10.7
18 T801(OS) 0.8TpC - 10
19 TdOM(AS) 0.9TpC - 26.3
909
Z8 CONTROL REGISTER DIAGRAMS
_0 R244TO
1~lool~I~lool~lrnlool
I to InlUaiValue
Figure 30. Serial 110 Register (When WriHen)
(Range: 1·256 Oadmal
(FOH: ReadlWrlte) 01-00 HEX)
TO CurrontValue
(When Road)
R2411MR
o Disable TO COl.llt
1 Enable TO Count
o NoFuncllon
1 load T1
Count Mode
o Disable T1 Count
o TO Single Pass
1 Enable T1 Comt
1 TO Modulo-n
TIN Mod..
00 Ex1arnal Clock Input Reserved
01 Gale Inpul
10 Trlg9"r Input Prescaler Modulo
(Non-relrlggerablo) (Range: 1-64 Decimal
11 Trigger Input 01-00 HEX)
(RolrIggerablo)
TOUTModos
00 NotUsed Figure 35. Prescaler 0 Register
01 TO Out
10 T1 Out (F5H: Write Only)
11 Internal Clock Out
R246 P2M
-~~
(Whon Read)
o Pori 2 Pull-Ups Open Drain
I Pori 2 Pull-Ups Adlve
Figure 32. CounterlTimer 1 Register Reserved
(F2H: ReadlWrite)
o P32.lriput
R243PREI P35.0utput
I P32 = IDAVOIRDYO
P35 _ ROYO/IDAVO
00 P33 - Input
Count Mode P34 • Output
o T1 Single Pass
o P31. Input (TIN)
1 T1 ModuloN
, P3S - OUlput (TOUT)
Clock Source 1 P31 .IOAV2IRDY2
1 Tlintornal P3S _ RDY2/1DAV2
o T1 External Timing Input
(TIN) Modo o P30 -InPut
P37 _ Output
Prascaler Modulo I P30. Sortalln
(Range: l-M Dodmal P37 _ Sortal Out
01-00 HEX)
o Partly Off
1 PartlyOn
910
R24BPOIM R2511MR
R250lRO
Imlool~I~lool~I~lool
I IROO = P32 Input
IROl = P33 Input
IR02 = P3l Input
IR03 = P30 Input
IR04=TO
IR05=Tl
Reserved
911
Z8 CONTROL REGISTER DIAGRAMS (Continued)
1071 OSI OSI041 03102101100 I 1 07 1Osl 05 104 103 102 101 1001
II-______ Stack Pointer
Upper Byte
I Stack Pointer Lower
(SPII-SP1S) Byte (SPO - SP7)
Figure 44. Stack Pointer Register Figure 45. Stack Pointer Register
(FEH: ReadIWrite) (FFH: Read/Write)
912
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to de- Flags. Control register (R252) contains the following six
scribe the addressing modes and instruction operations flags:
as shown in the instruction summary.
Symbol Meaning
Symbol Meaning
C Carry flag
IRR Indirect register pair or indirect working- Z Zero flag
register pair address S Sign flag
Irr Indirect working-register pair only V Overflow flag
X Indexed address D Decimal-adjust flag
DA Direct address H Half-carry flag
RA Relative address
1M Immediate Affected flags are indicated by:
R Register or working-register address
r Working-register address only o Clear to zero
IR Indirect-register or indirect 1 Set toone
working-register address Set to clear according to operation
Ir Indirect working-register address only Unaffected
RR Register pair or working register pair x Undefined
address
Symbol Meaning
913
CONDITION CODES
914
INSTRUCTION FORMATS
dst OPC
One-Byte Instructions
MODE I OPC LD
src
OR 1---+---1
dst OR L....;....;,..;...:..J..~..;,..;..J
MODE I OPC LD
dstlsrc I x
ADDRESS
cc I OPC JP
DAU
DAL
OPC CALL
DJNZ, JR DAU
DAL
FFH STOP/HALT
6FH 7FH
INSTRUCTION SUMMARY
Note: Assignment of a value is indicated by the symbol notation "addr (n)" is used to refer to bit (n) of a given
" ~ ". For example: operand location. For example:
indicates that the source data is added to the destination refers to bit 7 of the destination operand.
data and the result is stored in the destination location. The
915
INSTRUCTION SUMMARY
ADCdst, sre t 1[ 1
** *~ 0
* INCdst rE - ***
dst~dst + sre +C dst~dst +1 r = 0- F
R 20
ADD dst, sre t O[ 1 **** IR 21
dst~dst + src
0 *
-
AND dst, sre t 5[ 1 - ** - -
INCWdst
dst~dst + 1
RR
IR
AO
A1
-
***-
0
dst~dst AND sre
IRET BF
CALLdst OA 06 - - - - -, - FLAGS~@SP; ******
SP~P-2 IRR 04 SP~P+ 1
@SP~PC, PC~@SP;
PC~dst SP~SP+ 2;
IMR(7)~1
CCF
C~NOTC
EF *- - - - -
JP ee, dst OA cD - - - - - -
if ee is true e = 0- F
CLRdst R BO - - - - - - PC~dst IRR 30
dst~O IR B1
JRee, dst RA eB - - - - - -
COMdst
dst~NOTdst
R
IR
60
61
** 0
- - if ec is true,
PC~PC + dst
e=0-F
Range: +127,
CPdst, src
dst - sre
t A[ 1 ****- - -128
LD dst, src 1m rC - - - - - -
dst~sre
DAdst
dst~OA dst
R
IR
40
41
*** X
- - r
R
R r8
r9
r = 0- F
DECdst
dst~dst -1
R
IR
00
01
-
***- - r
X
X
r
C7
07
r Ir E3
DECWdst RR 80 - * **- - Ir r F3
dst~dst -1 IR 81 R R E4
R IR E5
01 8F - - - - - - R 1M E6
IMR(7)~ IR 1M E7
IR R F5
DJNZr, dst RA rA - - - - - -
r~r -1 r = 0- F LDCdst, sre Irr C2
ifr .. O
PC~PC + dst LOCI dst, sre Ir Irr C3
Range: +127, dst~sre
-128 r~r +1;
rr~rr +1
EI 9F - - - - - -
IMR(7)~1
916
INSTRUCTION SUMMARY (Continued)
POP dst
dstf-@SP;
R
IR
50
51
- - - - - -
I'
~ o1
- - Ir [3]
RRC dst R CO
IR C1
* ***
~7 o~ R R [4]
SBC dst, src t 3[ ] 1
dstf-dstf-srcf-C
**** * R IR [5]
SCF DF 1 - - - - - R 1M [6]
Cf-1
IR 1M [7]
SRA dst R DO 0 - -
IR D1 ***
~
SRP src 1m 31 - - - - - -
RPf-src
917
OPCODEMAP
8
10.5 10.5 12.0
DECW OECW LOE
18.0 r-sT
LOE! J85 DI
RRl 1RI rl,lrr2 irl,lrr2
9
6.5
RL
6.5
RL
12.0
LOE
18.0 r-sT
LOE! EI
Rl 1Rl r2,lrrl 1r2,lrrl
A
10.5
INCW
10.5
INCW
6.5
CP
6.5
CP
10.5
CP
10.5
CP
10.5
CP
10.5 'Mn
CP RET
RRl IRl rl, r2 rl,lr2 R2,Rl IR2, Rl Rl,IM IR1,IM
B
6.5 6.5 6.5 6.5 10.5 10.5 10.5 10.5 16.0
CLR CLR XOR XOR XOR XOR XOR XOR IRET
Rl IRl rl, r2 rl,lr2 R2,Rl IR2, RI Rl,IM 1RI,IM
6.5 6.5 12.0 18.0 10.5 ~
C RRC RRC LOC LDCI LO RCF
Rl IRl rl,lrr2 Irl,lrr2 rl,x,R2
6.5 6.5 12.0 lS.0 20.0 20.0 10.5 ~
>< D SRA SRA LOC LOCI CALL' CALL LD SCF
e-'" Rl IRl r2,lrrl 1r2,lrrl IRRI DA r2,x,Rl
'"
:0 E
6.5 6.5 6.5 10.5 10.5 10.5 10.5 ~
.D
RR RR LO LO LO LO LO CCF
Z Rl IRl rl,1R2 R2,Rl IR2, Rl Rl,IM 1R1,IM
~
'a.a." F
8.5 8.5
SWAP SWAP
6.5
LD
10.5
LD
rs:o
.
NOP
::;) Rl 1Rl Irl, r2 R2,IRl
... ,A
'T'
,A
'T' ~ T
,J
2 3 2 3
Bytes per Instruction
Lower Legend:
Opcode =
R B·bit address
Nibble =
r 4·bit address
Execution Pipeline =
R 1 or r 2 Ost address
Cycles 1 Cycles =
R 1 or r 2 Src address
Sequence:
Opcode, First Operand,
Mnemonic Second Operand
918
~ ZiIm Product Specification
FEATURES
• The Z8671 MCU is a complete microcomputer • The BASIC/Debug interpreter can call machine
preprogrammed with a BASIC/Debug interpreter. language subro~tines to increase execution speed.
Interaction between the interpreter and its user is
• The Z8671's auto start-up capability allows a program to
provided through an on-board UART.
be executed on power-up or Reset without operator
• BASIC/Debug can directly address the Z8671'S internal intervention .
registers and all external memory. It provides quick
• Single + 5V power supply-all I/O pins TTL-compatible.
examination and modification of any external memory
location or I/O port. .8MHz
GENERAL DESCRIPTION
The Z8671 Single-Chip Microcomputer (MCU) is one of a Because the BASICIDebug interpreter is already part of the
line of preprogrammed chips-in this case with a chip circuit, programming is made much easier. The Z8671
BASIC/Debug interpreter in ROM-offered by Zilog. As a MCU thus offers a combination of software and hardware
member of the Z8 Family of microcomputers, it offers the that is ideal for many industrial control applications. The
same abundance of resources as the other Z8 Z8671 MCU allows fast hardware tests and bit-by-bit
microcomputers. examination and modification of memory location, I/O ports,
I1---+
RESET +5V P3,
+5V
TIMING R/Vol GND
XTAL2 P3,
AND
CONTROL os XTAL1
XTAl1 P2,
AS XTAL2 P3, P2,
PO, P2,
P3, P2,
po, P2,
RESET P2.
po, P2,
R/W P2,
PORTO
(NIBBLE PO, P2,
OS P2,
PROGRAMMABLE) PO, P2.
110 or A8-A15 AS P2,
PO, Z8671 P2,
P3, P20
PO, MCU P2,
GND P3,
PO, P2, P3, P3,
Pl, P3, po, AD1
Pl, P3, po, ADs
Pl, P3, PO, ADs
Pl, P3, PO,
PORT 1 AD.
I/O OR ADD-AD] Pl. P3.
PO. AD,
Pl, P3,
PO, AD,
Pl, P3,
PO, AD,
Pl, P3,
PO, ADo
919
or registers. It also allows bit manipulation and logical
operations. A self-contained line editor supports interactive ~ .. ~ra.
~v q":JQq"'.J.... .¢'tl.¢~ II.~ qnfoqtt.J... <l. . . .qrt,,'Oq'l-c,
debugging, further speeding up program development.
6 S
• 3 2 1 44 43 42 41 40
The BASIClDebug interpreter, a subset of Dartmouth
BASIC, operates with three kinds of memory: on-chip =
R/W
.7
8
39
38
NC
P2,
registers and external ROM or RAM. The BASIC/Debug DS 9 37 P2.
interpreter is located in the 2K bytes of on-chip ROM. AS 10 36 P2,
P3, 11 3S P2,
Additional features of the 28671 MCU include the ability to GND 12
Z8671
3. P2.
MCU
call machine language subroutines to increase execution P3, 13 33 P33
speed and the ability to have a program execute on PO. 1. 32 P3,
power-up or Reset, without operator intervention. PO, lS 31 Pl,
PO, 16 30 Pl.
Maximum memory addressing capabilities include 62K NC 17 29 Pl,
bytes of external program memory ana 62K bytes of data 18 19 20 21 22 23 24 25 26 27 28
memory with program storage beginning at location 800H. q~~ qt:::J'toIlf()+' qaro q().... q....Q q....... q....~q....~q...... ~CJ
This provides up to 124K bytes of useable memory space.
Very few 8-bit microcomputers can directly access this
amount of memory. Figure 2b. 44-pin Chip Carrier,
Pin Assignments
Each 28671 Microcomputer has 32 I/O lines, a 144-byte
register file, an on-board UART, and two counter/timers.
920
ARCHITECTURE
Z8671 architecture is characterized by a flexible I/O to a microprocessor that can address 124K bytes of external
scheme, an efficient register and address space structure, memory.
and a number of ancillary features that are helpful in many
Three basic address spaces are available to support this
applications.
wide range of configurations: program memory (internal
Microcomputer applications demand powerful I/O and external), data memory (external) and the register file
capabilities. The Z8671 fulfills this with 32 pins dedicated to (internal). The 144-byte random-access register file is
input and output. These lines are grouped into four ports of composed of 124 general·purpose registers, four I/O port
eight lines each and are configurable under software control registers, and 16 control and status registers.
to provide timing, status signals, serial or parallel 110 with or
To unburden the program from coping with real-time
without handshake, and an address/data bus for interfacing
problems such as serial data communication and
external memory.
counting/timing, an asynchronous receiver/transmitter
Because the multiplexed address/data bus is merged with (UART) and two counter/timers with a large number of
the I/O-oriented ports, the Z8671 can assume many userselectable modes are offered on-chip. Hardware
different memory and I/O configurations. These support for the UART is minimized because one of the
configurations range from a self-contained microcomputer on-chip timers supplies the bit rate.
PIN DESCRIPTION
AS. Address Strobe (output, active Low). Address Strobe is program control for I/O or external memory interface.
pulsed once at the beginning of each machine cycle.
RESET. Reset (input, active Low). RESET initializes the
Addresses output via Port 1 for all external program or data
Z8671. When RESET is deactivated, program execution
memory transfers are valid at the trailing edge of AS. Under
begins from internal program location OOOC H .
program control, AS can be placed in the high-impedance
state along with Ports 0 and 1, Data Strobe, and Read/Write. R/W. ReadlWrite (output). RiW is Low when the Z8671 is
writing to external program or data memory.
OS. Data Strobe (output, active. Low). Data Strobe is
activated once for each external memory transfer. XTAL 1, XTAL2. Crystal 1, Crystal 2 (time-base input and
output). These pins connect a parallel-resonant crystal (8
POo·P07, P10·P17, P20·P27, P30·P37' //0 Port Lines
MHz maximum) or an external single-phase clock (8 MHz
(input/outputs, TTL-compatible). These 32 lines are divided
maximum) to the on-chip clock oscillator and buffer.
into four 8-bit I/O ports that can be configured under
EXTERNAL
Program Memory. The Z8671's 16-bit program counter ROM OR RAM
can address 64K bytes of program memory space.
2048
Program memory consists of 2K bytes of internal ROM and 2047
up to 62K bytes of external ROM, EPROM, or RAM. The first ON·CHIP BASICI
12 bytes of program memory are reserved for interrupt Location of
first byteDf
ROM } DEBUG
vectors (Figure 4). These locations contain six 16-bit vectors instruction
~ 1;"------------
ell:eculad
that correspond to the six available interrupts. The after reset
• IRQO
IRQO
0
921
Data Memory. The Z8671 can address up to 62K bytes of illustrates the contents of the general-purpose registers in
external data memory beginning at location 2048 (Figure 5). the Z8671 system with external RAM. When BASIC/Debug
External data memory may be included with, or separated tests memory and finds no RAM, it uses an internal stack
from, the external program memory space. DM, an optional and shares register space with the input line buffer and
I/O function that can be programmed to appear on pin P3 4 , variables. Figure 7b illustrates the contents of the
is used to distinguish data and program memory space. general-purpose registers in the Z8671 system without
external RAM.
Register File. The 144-byte register file may be accessed
by BASIC programs as memory locations 0-127 and Stacks. Either the internal register file or the external data
240-255. The register file includes four I/O port registers memory can be used for the stack. A 16-bit Stack Pointer
(RO-R3), 124 general-purpose registers (R4-R127), and 16 (R254 and R255) is used for the external stack, which can
control and status registers (Figure 6). reside anywhere in data memory between location 2048
and 65535. An 8-bit Stack Pointer (R255) is used for the
The BASIC/Debug Interpreter uses many of the general-
internal stack that resides within the 124 general-purpose
purpose registers as pointers, scratch workspace, and
registers (R4-R127).
internal variables. Consequently, these registers cannot be
used by a machine language subroutine or other user Register Addressing. Z8671 instructions can directly or
programs. On power-up/Reset, BASIC/Debug searches for indirectly access registers with an 8-bit address field. The
external RAM memory and checks for an auto start-up Z8671 also allows short 4-bit register addressing using the
program. In a non-destructive method, memory is tested at Register Pointer, which is one of the control registers. In the
relative location xxFDH' When BASIClDebug discovers 4-bit mode, the register file is divided into nine
RAM in the system, it initializes the pointer registers to mark working-register groups, each group consisting of 16
the boundaries between areas of memory that are assigned contiguous registers (Figure 8). The Register Pointer
specific uses. The top page of RAM is allocated for the line .addresses the starting location of the active working-register
buffer, variable storage, and the. GOS\jB stack. Figure 7a group.
NOT
2048 IMPLEMENTED
2047
NOT ADDRESSABLE
922
127 127
SHARED BY EXPRESSION
104 STACK AND LINE BUFFER
103 GOSUB
EXPRESSION
EVALUATION
86 STACK
STACK
85 SHARED BY GOSUB
64 AND VARIABLES 64
63 63
VARIABLES
34 FREE
FREE, AVAILABLE
33 FOR USR ROUTINES 34
33
32 COUNTER COUNTER
32
31 USED INTERNALLY 1 USED INTERNALLY
30 SCRATCH 30 SCRATCH
29 POINTER TO 29 POINTER TO
28 CONSTANT BLOCK 28 CONSTANT BLOCK
27 27
USED INTERNALLY USED INTERNALLY
24 24
23 23
LINE NUMBER LINE NUMBER
22 22
21 ARGUMENT FOR 21 ARGUMENT FOR
20 SUBROUTINE CALL 20 SUBROUTINE
19 ARGUMENTIRESULT FOR 19 ARGUMENT/ROUTINE FOR
18 SUBROUTINE CALL 18 SUBROUTINE CALL
17 17
SCRATCH SCRATCH
16 16
15 POINTER TO NEXT 15 POINTER TO INPUT
14 CHARACTER 14 LINE BUFFER
13 POINTER TO LINE I 13 POINTER.TO END OF
12 BUFFER 12 LINE BUFFER
11 11 POINTER TO STACK
POINTER TO GOSUB
10 10 BonOM
9 POINTER TO BASIC 9 ADDRESS OF USER
PROGRAM PROGRAM
POINTER TO GOSUB
POINTER TO GOSUB
STACK
POINTER TO END
FREE
OF PROGRAM
Figure 7a. General.Purpose R.egisters with External RAM Figure 7b. General·Purpose Registers without External RAM
255
-~I r---~--~--------~
253
L..._ _ _ _ _ _ _ _ _ _....I240
THE UPPER NIBBLE OF THE REGISTER
FilE ADDRESS PROVIDED BY THE
REGISTER POINTER SPECIFIES THE
ACTIVE WORKING REGISTER GROUP
127
-~I
--I
--I
--I SPECIFIED WORKING·
THE LOWER
NIBBLE OF
THE REGISTER
FILE ADDRESS
--I SPECIFIED
REGISTER.
--I
--I
1
f- - - -,/oPoRTS- - - -- 3
0
923
PROGRAM EXECUTION
Automatic Start-up. The Z8671 has an automatic start·up Programs are edited and interactively debugged in the
capability which allows a program stored in ROM to be Immediate mode. Some BASIClDebug commands are
executed without operator intervention. Automatic used almost exclusively in this mode. The Run mode is
execution occurs on power-on or Reset when the program is entered from the Immediate mode by entering the
stored at address 1020H. command RUN. If there is a program in RAM, it is executed.
The system returns to the Immediate mode when program
Execution Modes. The Z8671's BASIC/Debug Interpreter
execution is complete or interrupted by an error.
operates in two execution modes: Run and Immediate.
INTERACTIVE DEBUGGING
Interactive debugging is accomplished with the self- program run to correct errors and add new instructions
contained line editor which operates in the Immediate without disturbing the sequential execution of the program.
mode. In addition to changing program lines, the editor can A program run is interrupted with the use of the escape key.
correct an immediate command before it is executed. It also The run is restarted with a GOTO command, followed by the
allows the correction of typing and other errors as a program appropriate line number, after the desired changes are
is entered. entered. The same procedure is used to enter corrections
after BASIC/Debug returns an error.
BASIClDebug allows interruptions and changes during a
COMMANDS
BASIClDebug recognizes 15 command keywords. For any values left in the buffer first, then requests
detailed instructions of command usage, refer to the new data.
BASIC/Debug Software Reference Manual (#03-3149-02).
LET LET assigns the value of an expression to a
FO The GO command unconditionally branches variable or memory location.
to a machine language subroutine. This
statement is similar to the USR function LIST This command is used in the interactive mode
except that no value is returned by the to generate a listing of program lines stored in
assembly language routine. memory on the terminal device.
GOSUB GOSUB unconditionally branches to a NEW The NEW command resets pointer R1 0-11 to
subroutine at a line number specified by the the beginning of user memory, thereby
user. marking the space as empty and ready to
store a new program.
GOTO GOTO unconditionally changes the se-
quence of program execution (branches to a PRINT PRINT lists its arguments, which may be text
line number). messages or numerical values, on the output
terminal.
IFITHEN This command is used for conditional
operations and branches. REM This command is used to insert explanatory
messages into the program.
INPUT/IN These commands request information from
the user with the prompt "7", then read the RETURN This command returns control to the line
input values (which must be separated by following a GOSUB statement.
commas) from the keyboard, and store them RUN RUN initiates sequential execution of all
in the indicated variables. INPUT discards instructions in the current program.
any values remaining in the buffer from
previous IN, INPUT, or RUN statements, and STOP STOP ends program execution and clears the
requests new data from the operator. IN uses GOSUB stack.
924
FUNCTIONS
BASIC/Debug supports two functions: AND and USR. The USR function calls a machine language subroutine and
returns a value. This is useful for applications in which a
The AND function performs a logical AND. It can be used to
subroutine can be performed more quickly and efficiently in
mask, turn off, or isolate bits. This function is used in the
machine language than in BASIClDebug.
following format:
The address of the first instruction of the subroutine is the
AND (expression, expression)
first argument of the USR function. The address can be
The two expressions are evaluated, and their bit patterns are followed by one or two values to be processed by the
ANDed together. If only one value is included in the subroutine. In the following example, BASIC/Debug
parentheses, it is ANDed with itself. A logical OR can also be executes the subroutine located at address 2000 using
performed by complementing the AND function. This is values literal 256 and variable C.
accomplished by subtracting each expression from -1. For
USR(%2000,256,C)
example, the function below is equivalent to the OR of A
and B. The resulting value is stored in Registers 18-19.
-1-AND(-1-A, -1-B)
SERIAL INPUT/OUTPUT
Port 3 lines P30 and P37 can be programmed as serial I/O parity selection. If parity is enabled, the eighth data bit is
lines for full-duplex serial asynchronous receiver/transmitter used as the odd parity bit. An interrupt request (IR04) is
operation. The bit rate is controlled by Counter/Timer 0, with generated on all transmitted characters.
a maximum rate of 62.5K bits/second.
Received data must have a start bit, eight data bits, and at
The Z8671 automatically adds a start bit and two stop bits to least one stop bit. If parity is on, bit 7 of the received data is
transmitted data (Figure 9). Odd parity is also available as an replaced by a parity error flag. Received characters
option. Eight data bits are always transmitted, regardless of generate the IR03 interrupt request.
I~I~I~I~I~I~I~I~I~I~I
LSTART BIT LSTART BIT
' - - - - - - E I G H T DATA BITS L - - - - - E I G H T DATA BITS
TWO STOP BITS L - - - - - - - - - O N E STOP BIT
1 1,
_ _ LSTARTBIT
' - - - - - - S E V E N DATA
ODD PARITY
TWO STOP BITS
BITS
I L _LsTARTBIT
L - - - - - S E V E N DATA BITS
PARITY ERROR FLAG
' - - - - - - - - - - O N E STOP BIT
925
I/O PORTS
The Z8671 has 32 lines dedicated to input and output. For external memory references, Port 0 can provide address
These lines are grouped into four ports of eight lines each bits As-A11 (lower nibble) or As-A15 (lower and upper nibble)
and are configurable as input, output or address/data. depending on the required address space. If the address
Under software control, the ports can be programmed to range requires 12 bits or less, the upper nibble of Port 0 can
provide address outputs, timing, status signals, serial 1/0, be programmed independently as 1/0 while the lower nibble
and parallel 1/0 with or without handshake. All ports have is used for addressing. When Port 0 nibbles are defined as
active pull-ups and pull-downs compatible with TTL loads. ' address bits, they can be set to the high-impedance state
along with Port 1 and the control signals AS, DS and RIW.
Port 1 can be programmed as a byte 1/0 port or as an
addressldata port for interfacing external memory. When Port 2 bits can be programmed independently as input or
used as an 1/0 port, Port 1 may be placed under handshake output. The port is always available for 1/0 operations. In
control. In this configuration, Port 3 lines P33 and P34 are addition, Port 2 can be configured to provide open-drain
used as the handshake controls RDY1 and DAV1 (Ready outputs.
and Data Available).
Like Ports 0 and 1, Port 2 may also be placed under
Memory locations greater than 2048 are referenced handshake control. In this configuration, Port 3 lines P31
through Port 1. To interface external memory, Port 1 must be and P36 are used as the handshake controls lines DAV2 and
programmed for the multiplexed Address/Data mode. If RDY2. The handshake signal assignment for Port 3 lines
more than 256 external locations are required, Port 0 must P31 and P36 is dictated by the' direction (input or output)
output the additional lines. assigned to bit 7 of Port 2.
Port 1 can be placed in the high-impedance state along with Port 3 lines can be configured as 1/0 or control lines. In
Port 0, AS, OS and R/Vii, allowing the .l8671 to share either case, the direction of the eight lines is fixed as four
common resources in multiprocessor and DMA input (P30-P33) and four output (P34-P37)' For serial 1/0,
applications. Data transfers can be controlled by assigning lines P30 and P37 are programmed as serial in and serial out
P33 as a Bus Acknowledge input and P34 as a Bus Request respectively.
output.
Port 3 can also provide the following control functions:
Port 0 can be programmed as a nibble 1/0 port, or as an handshake for Ports 0, 1 and 2 (DAV and RDY); four external
. address port for interfacing external memory. When used as interrupt request signals (IROO-IR03); timer input and
an 1/0 port, Port 0 may be placed under handshake control. output signals (TIN and Tour) and Data Memory Select
In this configuration, Port 3 lines P32 and P35 are used as (DM).
the handshake controls DAVO and RDYO. Handshake signal
assignment is dictated by the 1/0 direction of the upper
nibble P04-P07.
PORT 1
(1/0 OR ADD-AD,) Plo-Pl,
PORT'2U/0)
ZB671
MCU
P27
HANDSHAKE CONTROLS HANDSHAKE CONTROLS
} DAV1 AND RCYl } DAV2 AND ADV2
(P3, AND P3.) (Pl,ANDP3,1
ZB671
MCU
}
Po,-PO,
POD-PO,
} PORT 0
(110 OR As-A1SI
ZB671
MCU
-- PORT 3
(1/0 OR CONTROL)
_ } HANDSHAKE CONTROLS
DAVO AND RDVO
(P3, AND P3s)
926
COUNTER/TIMERS
The Z8671 contains two 8-bit programmable counter/timers mode) or to automatically reload the initial value and
(TO and T1), each driven by its own 6-bit programmable continue counting (modulo-n continuous mode). The
prescaler. The T1 prescaler can be driven by internal or • counters, but not the prescalers, can be read any time
external clock sources; however, the TO prescaler is driven without disturbing their value or count mode.
by the internal clock only.
The clock source for T1 is user-definable; it can be either the
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock (4 MHz maximum) divided by
clock source by any number from 1 to 64. Each prescaler four, or an external signal input via Port 3. The Timer Mode
drives its counter, which decrements the value (1 to 256) that register configures the external timer input as an external
has been loaded into the counter. When the counter reaches clock, a trigger input that can be retriggerable or
the end of count, a timer interrupt request-IR04 (To) or nonretriggerable, or as a gate input for the internal clock.
IR05 (T1)-is generated. The counter/timers can be programmably cascaded by
connecting the TO output to the input of T1. Port 3 line P3 6
The counters can be started, stopped, restarted to continue,
also serves as a timer output (TOUT) through which TO, T1 or
or restarted from the initial value. The counters can also be
the internal clock can be output.
programmed to stop upon reaching zero (single-pass
INTERRUPTS
The Z8671 allows six different interrupts from eight sources: interrupts, jump instructions can be entered to the interrupt
the four Port 3 lines P30-P33, Serial In, Serial Out, and the handling routines at the appropriate addresses as shown in
two counter/timers. These interrupts are both maskable and Table 1
prioritized. The Interrupt Mask register globally or
individually enables or disables the six interrupt requests. Table 1. Interrupt Jump Instructions
When more than one interrupt is pending, priorities are
resolved by a programmable priority encoder that is Hex Contains Jump Instruction and
controlled by the Interrupt Priority register. Address Subroutine Address for:
All Z8671 interrupts are vectored; however, the internal
1000-1002 IROO
UART operates in a polling fashion. To accommodate a
1003-1005 IR01
polled structure, any or all of the interrupt inputs can be
masked and the Interrupt Request register polled to 1006-1008 IR02
determine which of the interrupt requests needs service. 1009-1 OOB IR03
100C-100E IR04
The BASIC/Debug Interpreter does not process interrupts.
100F-1011 IR05
Interrupts are vectored through locations in internal ROM
which point to addresses 1000-1011 H. To process
927
CLOCK
The on-chip oscillator has a high-gain, parallel-resonant • AT cut, parallel resonant
amplifier for connection to a crystal or to any suitable
• Fundamental type, 8 maximum
external clock source (XTAL 1 = Input, XTAL2 = Output).
• Series resistance, R", 100 Q
The crystal source is connected across XTAL 1 and XTAL2,
using the recommended capacitance (Cl = 15 pf • 8 MHz maximum
maximum) from each pin to ground. The specifications for
the crystal are as follows:
928
CONDITION CODES
INSTRUCTION FORMATS
OPC CCF, DI, EI, IRET, NOP,
ReF, RET, SCF
ONE-BYTE INSTRUCTION
OPC
I----'::-ds-",'---l OR
I I••• 01 dst
JP, CALL (Indirect)
ADC, ADD, AND, CP,
LD, OR, SBC, SUB,
1 - - = - - 1 OR I••• 01 dst TCM, TM, XOR
OPC SRP
VALUE
LD
MODE OPC LD
LD, LDE, LDEI,
LDC, LDCI
dst/src ope LD
cc ope JP
src/dst OR 11 1 1 01 src
DAu
DAL
dst I
OPC LD
VALUE
CALL
929
INSTRUCTION SUMMARY
Addr Mode Opcode Flags Affected Addr Mode Opcode Flags Affected
Instruction Byte Instruction Byte
and Operation dst src (Hex) C Z 5 V D H and Operation dst src (Hex) C Z 5 V D H
930
INSTRUCTION SUMMARY (Continued)
SBC dst,src (Note 1) 3D NOTE' These Instructions have an Identical set of addressing modes,
dst -dst -src-C which are encoded for brevity. The first opcode nibble IS found In
the instruction set table above. The second nibble is expressed
SCF OF 1----- symbolically by a 0 In this table, and ItS value IS found In the
C-1 following table to the left of the applicable addressing mode pair
SRA dst L@] @ R DO For example, the opcode of an ADC Instruction using the
addressing modes r (destination) and Ir (source) is 13.
IR 01
SRPsrc 1m 31 AddrMode
RP ..... src Lower
dst src Opcode Nibble
SUBdst,src (Note 1) 20
dst - dst - src
0
SWAP dst 17 5iC 01 R
IR
FO
F1
x* * X Ir ill
TCM dst,src (Note 1) 60
R R GJ
(NOT dst) AND src
R IR [[]
TM dsl,src (Note 1) 70
R 1M [I]
dstANosrc IR 1M 12]
931
REGISTERS R240SI0 R244 TO
Serial I/O Register Counter/Timer 0 Register
(FOH; Read/Write) (F4H; Read/Write)
' - - - - SERIAL DATA (Do ::: LSB) To INITIAL VALUE (WHEN WRITTEN)
'----IRANGE: 1-256 DECIMAl. 01-00 HEX)
To CURRENT VALUE (WHEN READ)
EXTERNAL CLOCK
USED = 00
NOT T."MODES
~og~~ ~ ~~
INTERNAL CLOC~ OUT:; 11
T MODES
INPD, = DO
~j ~~o = 1 NO FUNCTION
LOAD To
0 c DISABLE Tn COUNT
1 '" ENABLE To COUNT
0 c NO FUNCTION
1 "" LOAD 1,
~L
COUNTMODE
o '" To SINGLE·PASS
1 = To MODULO·N
RESERVED (MUST BE OJ
R242T1 R246P2M
Counter Timer 1 Register Port 2 Mode Register
(F2H; ReadlWrite) (F6H; Write Only)
R243PRE1 R247P3M
Prescaler 1 Register Port 3 Mode Register
(F3H; Write Only) (F7H; Write Only)
[g~
LOPORT2PULL'UPSOPEN
~L
COUNTMODE
1 ::: T1 MODUlO·N L1 PORT 2 PULL·UPS ACTIVE
DRAIN
932
REGISTERS R248 P01M R252 FLAGS
(Continued) Port 0 Register Flag Register
(F8H; Write Only) (FCH; ReadlWrite)
~--y- I
~~~
LUSER FLAG F.
PO"PO, MODE?]
OUTPUT '" 00
INPUT = 01
L po.,po, MODE 00 '" OUTPUT
01 = INPUT LUSER FLAG F2
A12·A15 ::: tX 1X '" As-Au HALF CARRY FLAG
EXTERNAL STACK SELECTION DECIMAL ADJUST FLAG
MEMORY TIMING 0 '" EXTERNAL
NORMAL::: 0 1 = INTERNAL OVERFLOW FLAG
·EXTENDED ::: 1 SIGN FLAG
ZERO FLAG
RESERVED (MUST BE 0)
CARRY FLAG
R2491PR R253RP
Interrupt Priority Register Register Pointer
(F9H; Write Only) (FDH; Read/Write)
I~I~I~I~I~I~I~I~I
..... :J
IRQ3, IRDS PRIORITY (GROUP Al
o '" IROS > IRa3
1 == IR03 > lAOS
I I III '"."~.~"....."
RESERveD
C > A> B
A > B > C
A> C > B
'" 000
'" 001
'" 010
= 011
REGISTER
POINTER
R250lRQ R254SPH
Interrupt Request Register Stack Pointer
(FAH; Read/Write) (FEH; Read/Write)
I~I~I~I~I~I~I~I~I
RESERVED (MUST BE 0) ~ c== IROO
IRQl
P32 INPUT (Do = IROO)
P331NPUT
IRQ2 P3, INPUT
IR03 P30 INPUT, SERIAL INPUT
IRQ4 To. SERIAL OUTPUT
IR05 T,
R2511MR R255SPL
Interrupt Mask Register Stack Pointer
(FBH; ReadlWrite) (FFH; ReadlWrite)
I~I~I~I~I~I~I~I~I
c==
II .
1 ENABl.ES IRQO-IROS
(Do;:; IROO)
' - - - - - - - R E S E R V E D (MUST BE 0)
933
OPCODEMAP
Lower Nibble (Hex)
3 4 6 7 9 A B C o E F
6.5 6.5 6,5 6,5 10,5 10,5 10,5 10,5 6,5 6,5 12110,5 12110,0 6,5 12110,0 6,5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R, IR, r,.r2 f1. lr2 R2,R, IR2,R, R"IM IR"IM fl,R2 f2,R, r"RA cC,RA r,:IM cC,DA rl
I-
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
RLC RLC ADC ADC ADC ADC ADC ADC
R, IR, (,.f2 f1, lr2 R2,R, IR2,R, R"IM IR"IM
6,5 6,5
I-
6,5 6,5 10,5 10,5 10,5 10,5
INC INC SUB SUB SUB SUB SUB SUB
R, IR, (1,'2 f1, lr2 R2,R, IR2,R, R"IM IR"IM
8,0 6,' . 6,5 6,5 10,5 10,5 10,5 10,5
I-
JP SRP SBC SBC SBC SBC sec sec
IRR, 1M (',(2 (,.Ir2 R2,R, IR2,R, R"IM IR"IM
I-
8,5 8,5 6,5 6,5 10,5 10,5 10,5 10,5
4 DA DA OR OR 'OR OR· OR OR
R, IR, (,.f2 (1, lr2 R2,R, IR2,R, R"IM IR"IM
10,5 10,5 6,5
I-
6,5 10,5 10,5 10,5 10,5
POP POP AND AND AND AND AND AND
R, IR, (1. r2 f1.lr2 R2,R , IR 2,R, R"IM IR"IM
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
I-
COM COM TCM TCM TCM TCM TCM TCM
R, IR, '1. r2 f1.lr2 R2,R, IR2,R, R"IM IR"IM
;c I-
10112,1 12114,1 6,5 6,5 10,5 10,5 10,5 10,5
e." 7 PUSH PUSH TM TM TM TM TM TM
"
:;; R2 IR2 [1,(2 f1, lr2 R2,R, IR2,R, R"IM IR"IM
Jl
Z 10,5 '0,5 12,0 '8,0 re,;-
~ 8 DECW DECW LDE LDEI 01
Q.
Q. RR, IR, f1, lrr2 Ir1,lrr2
::::>
6,5 6,5 12,0 18,0 re,;-
9 RL RL LDE LDEI EI
R, IR, f2,lrr, Ir2,lfr,
10,5 10,5 6,5 6,5 10,5 10,5 10,5 10,5 t--;;;:o
A INCW INCW CP CP CP CP CP CP RET
RR, IR, (1·(2 '1, lr2 R2,R, IR2,R, R"IM IR"IM
6.5 6,5 6,5 6,5 10,5 10,5 10,5 10,5 ~
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
R, IR, (,.f2 '1, lr2 R2,R, IR2,R, R"IM IR"IM
6,5 6,5 12,0 18,0 10,5 r---e;-
C RRC RRC LDC LOCI LD RCF
R, IR, fl,lrr2 Irl,lrr2 fl. X,R2
6,5 6,5 12,0 18,0 20,0 20,0 10,5 ~
0 SRA SRA LDC LOCI CALL· CALL LD SCF
R, IR, f2.lrr1 Ir2,lrr, IRR, DA f2,x.R,
6,5 6,5 6,5 10,5 10,5 10,5 10,5
r---'----
6,5
E RR RR LD LD LD LD LD CCF
R, IR, rl, IR2 R2,R, IR2,R, R"IM IR"IM
8.5 8.5 6,5 10,5 t-6.0
F SWAP SWAP LD LD NOP
R, IR, Ir1,(2 R2.1R,
\"
' _ _ _ _............
""_ _ _ _....J '-
...._ _ _ _............
, ._ _ _ _....
" ,\,,------'V,.------,j~'_v___'
3 2 3
Bytes per Instruction
LOWER
OPCODE
NllLE
Sequence:
Dpcode, First Operand, Second Operand
FIRST SECOND
OPERAND OPERA1'ID NOTE: The blank areas are not defined.
934
ABSOLUTE MAXIMUM RATINGS
Voltages on all pins with respect Stresses greater than those listed under Absolute Maximum Ratings may
toGND ......................... -O.3Vto +7.0V cause permanent damage to the device. This is a stress rating only;
operation of the device at any condition above those indicated in the
Operating Ambient operational sections of these specifications is not implied. Exposure to
Temperature .............. See Ordering Information absolute maximum rating conditions for extended periods may affect
Storage Temperature ....... .' ...... -65°Cto +150°C device reliability.
The DC characteristics listed below apply for the following The Ordering Information section lists package temperature
standard test conditions, unless otherwise noted. All ranges and product numbers. Package drawings are in the
voltages are referenced to GND. Positive current flows into Package Information section. Refer to the Literature List for
the referenced pin. additional documentation.
Standard conditions are:
IJI +4.75V ~ Vee~ +5.25V
• GND = OV
+5V
DC CHARACTERISTICS
VeH Clock Input High Voltage 3.8 Vee V Driven by External Clock Generator
VeL Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.0 Vee V
VIL Input Low Voltage -0.3 0.8 V
VRH Reset Input High Voltage 3.8 Vee V
VRL Reset Input Low Voltage -0.3 0.8 V
935
). X
- ). HV- -®--l
PORTO,
DM
CD
C
• 16
"
PORT 1 ) Ao,-A, ) < Do-D7IN } <
~ -+---CD--
• CD
-- ~I\CDI--
·I---<D-- "
~I • CD
os
(READ) ~~
",l;
-®-
PORT 1 Ao-A7
X Do-D,OUT }(
I---®---I -®-I
DS
'i" CD ~,V
(WRITE)
AC CHARACTERISTICS
External 110 or Memory ReadlWrite Timing
936
Figure 17. Additional Timing
AC CHARACTERISTICS
Additional Timing
DO-D7
---'_1-.
- _CD---,'1
,XI:DON'T CARE DATA IN VALID
T~~,- ~
AC CHARACTERISTICS
Memory Port Timing
937
DATA IN )( DATA IN VALID )(
-==d)~)+_i
_ ==:m=~===:j:~
~S-
DAY =il-1f;,
9
(INPUT)
RDY
(OUTPUTI
DAY
(OUTPUT)
RDY
(INPUT)
AC CHARACTERISTICS
Handshake Timing
Z8671-8 Z8671-8
Number Symbol Equation Number Symbol Equation
1 TdA(AS) TpC - 75 13 TdDS(R/W) TpC - 65
2 TdAS(A) TpC - 55 14 TdDW(DSW) TpC - 75
3 TdAS(DR) 4TpC - 140* 15 TdDS(DW) TpC - 55
4 TwAS TpC - 45 16 TdA(DR) 5TpC - 215*
6 TwDSR 3TpC - 125* 17 TdAS(DS) TpC - 45
7 TwDSW 2TpC - 90*
8 TdDSR(DR) 3TpC - 175*
10 Td(DS)A. TpC - 55
11 TdDS(AS) TpC - 55
12 TdRIW(AS) TpC - 75
* Add 2TpC when using extended memory timing
938
~ ZiIm Product Specification
Z8681/82 Z8®
ROMless MCU
FEATURES
• Complete microcomputer, 24 I/O lines, and up to 64K • Full-duplex UART and two programmable 8-bit
bytes of addressable external space each for program counter/timers, each with a 6-bit programmable
and data memory. prescaler.
• 143-byte register file, including 124 general-purpose • Register Pointer so that short, fast instructions can
registers, 3 I/O port registers, and 16 status and control access anyone of the nine working-register groups.
registers.
• Single + 5V power supply-all I/O pins TTL compatible.
• Vectored, priority interrupts for I/O, counter/timers, and
UARl • Z8681/82 available in 8 MHz. Z8681 also available
in 12 MHz.
• On-chip oscillator that accepts crystal or external clock
drive.
GENERAL DESCRIPTION
The Z8681 and Z8682 are ROMless versions of the Z8 The Z8681/82 offers all the outstanding features of the Z8
single-chip microcomputer. The Z8682 is usually more cost family architecture except a'n on-chip program ROM, Use of
effective. These products differ only slightly and can be external memory rather than a preprogrammed ROM
used interchangeably with proper system design to provide enables this Z8 microcomputer to be used in low volume
maximum flexibility in meeting price and delivery needs. applications or where code flexibility is required.
TIM~:~
CONTROL
1 RIW
os
GNO
XTAL1
XTAL2
XTAl1
P3,
P2,
AS XTAL2
P3, P2,
939
The Z8681/82 can provide up to 16 output address lines, There are 143 bytes of RAM located on-chip and organized
thus permitting an address space of up to 64K bytes of data as a register file of 124 general-purpose registers, 16 control
or program memory. Eight address outputs (ADo-AD7) are and status registers, and three I/O port registers. This
provided by a multiplexed, 8-bit, Address/Data bus. The register file can be divided into nine groups of 16 working
remaining 8 bits can be provided by the software registers each. Configuring the register file in this manner
configuration of Port 0 to output address bits Aa-A15. allows the use of short format instructions; in addition, any of
the individual registers can be accessed directly.
Available address space can be doubled (up to 128K bytes
for the Z8681 and 124K bytes for the Z8682) by The pin functions and the pin assignments of the
programming bit 4 of Port 3 (P3 4 ) to act as a data memory Z8681/82 40- and 44-pin packages are illustrated in
Figures 1 and 2, respectively.
select output (OM). The two states of OM together with the
16 address outputs can define separate data and memory
address spaces of up to 64K/62Kbytes each.
6 5 4 3 2 1 44 ~ 42 41 40
RESEf 7 39 NC
RfW 8 38 P2,
55 9 37 P23
AS 10 3. P2,
P35 11 35 P2,
ZB6Bl
GND 12 3. P20
MCU
P3, 13 33 P33
POo 1. 32 P3,
PO,
PO,
NC
,.
15
17
31
30
29
Pl,
P16
P15
18 19 20 21 22 23 24 25 26 27 28
UtttlttliD
(BIT PROGRAMMABLE)
ADDRESS OR liD
(NIBBLE PROGRAMMABLE)
ADDRESSIDATA OR liD
(BYTE PROGRAMMABLE)
'--~------------v~------------~'
Z·BUS·WHEN USED AS
ADDRESSIDATA BUS
940
ARCHITECTURE
Z8681/82 architecture is characterized by a flexible I/O memory, data memory and the register file (internal). The
scheme, an efficient register and address space structure 143-byte random-access register file is composed of 124
and a number of ancillary features that are helpful in many general-purpose registers, three I/O port registers, and 16
applications. control and status registers.
Microcomputer applications demand powerful I/O To unburden the program from coping with real-time
capabilities. The Z8681/82 fulfills this with 24 pins available problems such as serial data communication and
for input and output. These lines are grouped into three counting/timing, an asynchronous receiver/transmitter
ports of eight lines each and are configurable under (UART) and two counter/timers with a large number of
software control to provide timing, status signals, serial or user-selectable modes are offered on-chip. Hardware
parallel I/O with or without handshake, and an Address bus support for the UART is minimized because one of the
for interfacing external memory. on-chip timers supplies the bit rate. Figure 3 shows the
Z8681/82 block diagram.
Three basic address spaces are available: program
PIN DESCRIPTION
AS_ Address Strobe (output, active Low). Address Strobe is program and data memory.
pulsed once at the beginning of each machine cycle.
RESET . Reset (input, active Low). RESET initializes the
Addresses output via Port 1 for all external program or data
Z8681/82. After RESET the Z8681 is in the extended
memory transfers are valid at the trailing edge of AS.
memory mode. When RESET- is deactivated, program
OS. Data Strobe (output, active Low). Data Strobe is execution begins from program location OOOCH for the
activated once for each external memory transfer. Z8681 and 0812H for the Z8682.
POO·P07, P20·P27, P30·P37. //0 Port Lines (input/outputs, RlW. Read/write (output). R/W is Low when the Z8681/82 is
TIL-compatible). These 24 lines are divided into three 8-bit writing to external program or data memory.
I/O ports that can be configured under program control for
XTAL 1, XTAL2. Crysta/1, Crysta/2 (time-base input and
I/O or external memory interface (Figure 3)
output). These pins connect a parallel-resonant crystal to the
P10·P17. Address/Data Port (bidirectional). Multiplexed on-Chip clock oscillator and buffer.
address (Ao-A7) and data (0 0 -0 7) lines used to interface with
941
ADDRESS SPACES
Program Memory'. The Z8681/82 addresses 64K/62K port registers (RO, R2, R3), 124 general-purpose registers
bytes of external program memory space (Figure 4). (R4-R127) and 16 control and status registers (R240-R255).
These registers are assigned the address locations shown in
For the Z8681. the first 12 bytes of program memory are
Figure 5.
reserved for the interrupt vectors. These locations contain
six 16-bit vectors that correspond to the six available Z8681/82 instructions can access registers directly or
interrupts. Program execution begins at location OOOCH indirectly with an 8-bit address field. This also allows short
after a reset. . 4·bit register addressing using the Register Pointer (one of
the control registers). In the 4-bit mode, the register file is
The Z8682 has six 24-bit interrupt vectors beginning at
divided into nine working-register groups, each occupying
address 0800H. The vectors consist of Jump Absolute
16 contiguous locations (Figure 5). The Register Pointer
instructions. After a reset, program execution begins at
addresses the starting location ofthe active working-register
location O~12H for the Z8682.
group (Figure 6).
Data Memory" . The Z8681 /82 can address 64K/62K bytes
Stacks. Either the internal register file or the external data
of external data memory. External data memory may be
memory can be used for the stack. A 16-bit Stack Pointer
included with or separated from the external program
(R254 and R255) is used for the external stack. which can
memory space. OM, an optional I/O function that can be
reside anywhere in data memory. An 8·bit Stack Pointer
programmed to appear on pin P3 4 ,. is used to distinguish
(R255) is used for the internal stack that resides within the
between data and program memory space.
124 general-purpose registers (R4-R127).
Register File. The 143-byte register file includes three I/O
ZB6B1 ZB6B2
5536 655a
PROGRAM
MEMORY
LOCATION OF FIRST
PROGRAM BYTE OF INSTRUCTION
MEMORY
------
,i<
V EXECUTED AFTER
RESET (Z8682)
(812" ) 2066
= IRQ5
= (811" ) 2065
=
=
=
=
IRQ4
IRQa
IRQ2
IRQl
=
=
=
=
-- a BYTE INTERRUPT
JUMP INSTRUCTIONS
= IRQO
= (POOH ) 2048
2047
LOCATION OF FIRST
BYTE OF INSTRUCTION
EXECUTED AFTER
RESET (Z8681)
INTERRUPT
- f-----
r--
f--
f--
IRQ5
IRQ.
NOT
ADDRESSABLE
-
-
12
11
10
9
8
VECTOR
(LOWER BYTE)
f- IRQa - 7 2 BYTE
6 _ _ INTERRUPT
INTERRUPT
~
~ IRQ2 - 5
4
VECTORS
a
VECTOR
(UPPER BYTE)
f- IRQ1 - 2
f- IRQO - 1
0
942
DEC HEX IDENTIFIERS
255 STACK POINTER (BITS 7-0) FF SPL 1--[1=:;:;:[;:;::::;:::;:=::;::;::::;::;::=1 255
254 STACK POINTER (BITS 15-8) FE SPH - ..... [ I---'-'-..:..-'..--L----\
L..._ _ _ _ _ _ _ _ _-I240
253
253 REGISTER POINTER FD RP
252 PROGRAM CONTROL FLAGS FC FLAGS THE UPPER NIBBLE OF THE REGISTER
251 INTERRUPT MASK REGISTER FB IMR FILE ADDRESS PROVIDED BY THE
REGISTER POINTER SPECIFIES THE
250 INTERRUPT REQUEST REGISTER FA IRQ ACTIVE WORKING-REGISTER GROUP,
249 INTERRUPT PRIORITY REGISTER F9 IPR 127
248
247
PORTS 0-1 MODE
PORT 3 MODE
F8
F7
P01M
P3M
- ..... (
246 PORT 2 MODE F6 P2M
245
244
TO PRESCALER
TIMER/COUNTER 0
F5
F4
PREO
TO
- ..... (
243 T1 PRESCALER F3 PRE1
242
241
TIMER/COUNTER 1
TIMER MODE
F2
F1
T1
TMR
-..... 1
240 SERIAL 110 FO SIO
--
IMPLEMENTED
THE REGISTER
127 7F
I SPECIFIED WORKING· FILE ADDRESS
PROVIDEDBV
I REGISTER GROUP
THE INSTRUCTION
POINTS TO THE
SPECIFIED
GENERAL·PURPOSE
REGISTERS
-..... 1 REGISTER.
- ..... 1
04
1
PORT 3 03 P3
PORT 2
PORT 1
02
01
P2
P1
-..... 1 1-------------3
110 PORTS 0
PORT 0 00 PO
SERIAL INPUT/OUTPUT
Port 3 lines P30 and P37 can be programmed as serial I/O transmitted, regardless of parity selection. If parity is
lines for full-duplex serial asynchronous receiver/transmitter enabled, the eighth data bit is used as the odd parity bit. An
operation. The bit rate is controlled by CounterlTimer O. interrupt request (IR04) is generated on all transmitted
characters.
Received data must have a start bit, eight data bits, and at
The Z8681/82 automatically adds a start bit and two stop least one stop bit. If parity is on, bit 7 of the received data is
bits to transmitted data (Figure 7). Odd parity is also replaced by a parity error flag. Received characters
available as an option. Eight data bits are always generate the IR03 interrupt request.
I~I~I~I~I~I~I~I~I~I~I
LSTART BIT
L - - - - - - E I G H T DATA BITS
TWO STOP BITS
I
L.
LSTART BIT
' - - - - - - E I G H T DATA BITS
- - - - - - - - - - O N E STOP BIT
T I
L
.
LSTART BIT
_ _ _ _ _ _ _ _ _ SEVEN DATA BITS
ODD PARITY
TWO STOP BITS
II
L.
LSTART BIT
' - - - - - - S E V E N DATA BITS
' - - - - - - - - - - - P A R I T Y ERROR FLAG
- - - - - - - - - - - O N E STOP BIT
943
COUNTER/TIMERS
The Z8681/82 contains two 8-bit programmable mode) or to automatically reload the initial value and
counter/timers (To and T1), each driven by its own 6-bit continue counting (modulo-n continuous mode). The
programmable prescaler. The T1 prescaler can be driven by counters, but not the prescalers, can be read any time
internal or external clock sources; however, the To prescaler without disturbing their value or count mode.
is driven by the internal clock only.
The clock source for T1 is user-definable; it can be either the
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock divided by four, or an external
clock source by any number' from 1 to 64. Each prescaler signal input via Port 3. The Timer Mode register configures
drives its counter, which decrements the value (1 to 256) that the external timer input as an external clock, a trigger input
has been loaded into the counter. When the counter reaches that can be retriggerable or nonretriggerable, or as a gate
the end of count, a timer interrupt request-IR04 (To) or input for the internal clock. The counter/timers can be
IR05 (T1)-is generated. programmably cascaded by connecting the To output to the
input of T1. Port 3 line P36 also serves as a timer output
The counters can be started, stopped, restarted to continue,
(TOUT) through which To, T1 or the internal clock can be
or restarted from the initial value. The counters can also be
output.
programmed to stop upon reaching zero (single-pass
I/O PORTS
The Z8681/82 has 24 lines available for input and output. address outputs, timing, status signals, serial I/O, and
These lines are grouped into three ports of eight lines each parallel I/O with or without handshake. All ports have active
and are configurable as input, output or address. Under pull-ups and pull-downs compatible with TIL loads.
software control, the ports can be programmed to provide
Port 1 is a dedicated Z-BUS compatible memory interface. be configured to supply address bits As-A11 for 4K byte
The operations of Port 1 are supported by the Address addressing or both nibbles of Port 0 can be configured to
Strobe (AS) and Oata Strobe (OS) lines, and by the supply address bits As-A15 for 64K byte addressing.
ReadlWrite (RIW) and Oata Memory (OM) control lines. The
low-order program and data memory addresses (Ao-A7) are
output through Port 1 (Figure 8) and are multiplexed with
data in/out (00-07)' Instruction fetch and data memory
read/write operations are done through this port.
r-v
fa--\POAT1
(110 OR ADO-AD7
TO EXTERNAL
MEMORV
Z8681182
Port 1 cannot be used as a register nor can a handshake MCU
mode be used with this port.
Both the Z8681 and Z8682 wake up with the 8 bits of Port 1
configured as address outputs for external memory. If more
than eight address lines are required with the Z8681 ,
additional lines can be obtained by programming Port 0 bits Figure 8. Port 1
as address bits. The least-significant four bits of Port 0 can
Port O· can be programmed as a nibble I/O port, or as an Such an initialization routine must reside within the first 256
address port for interfacing external memory (Figure 9). bytes of executable code and must be physically mapped
When used as an I/O port, Port 0 can be placed under into memory by forcing the Port 0 address lines to a known
handshake control. In this configuration, Port 3 lines P32 state (Figure 10). The proper port initialization sequence is:
and P35 are used as the handshake controls OAVo and
1. Write initial address (As-Ad of initialization routine to
ROYo. Handshake signal assignment is dictated by the I/O
Port 0 address lines.
direction olthe upper nibble P04-P07.
2. Configure Port 0 Mode register to output As-A15 (or
For external memory references, Port 0 can provide address
As-A11)'
bits As-A11 (lower nibble) or As-A15 (lower and upper
nibbles) depending on the required address space. If the To permit the use of slow memory, an automatic wait mode of
address range requires 12 bits or less, the upper nibble of two oscillator clock cycles is configured for the bus timing of
Port 0 can be programmed independently as I/O while the the Z8681 after each reset. The initialization routine could
lower nibble is used for addressing. include reconfiguration to eliminate this extended timing
In the Z8681 ., Port 0 lines float after reset; their logic state is mode.
unknown until the execution of an initialization routine that
configures Port O.
"This feature differs in the ZS6S1 and ZS6S2.
944
The following example illustrates the manner in which an 1/0 operation, they must be configured by writing to the Port
initialization routine can be mapped in a Z8681 system with o Mode register. The Z8682 is in the fast memory timing
4K of memory. mode after Reset, so the initialization routine must be in fast
memory.
Example. In Figure 10, the initialization routine is mapped to
the first 256 bytes of program memory. Pull-down resistors
maintain the address lines at a logic 0 level when these lines
are floating. The leakage current caused by fanout must be
taken into consideration when selecting the value of the P04-P07 ) PORT 0
) POO-P03 (110 OR As-A15
pulldown resistors. The resistor value must be large enough
Z8681/82
to allow the Port 0 output driver to pull the line to a logic 1. MCU
Generally, pulldown resistors are incompatible with TTL
loads. If Port 0 drives into TTL input loads (ILOW = 1.6 mAl _ } HANDSHAKE CONTROLS
DAV, AND RDY,
the external resistors should be tied to Vee and the (P3, AN D P3,)
< >
pORn ADo-AD7
-- --
Figure 10. Port 0 Address Lines Tied to Logic 0
.....-
Z86B1/B2 : : : : :
MCU ___
P20
PORT 2(110)
945
INTERRUPTS·
The Z8681182 allows six different interrupts from eight opcode and a 2-byte starting address for the interrupt
sources: the four Port 3 lines P30-P33, Serial In, Serial Out, service routine.
and the two counter/timers. These interrupts are both
maskable and prioritized. The Interrupt Mask register
globally or individually enables or disables the six interrupt
Table 1. Z8682 Interrupt Processing
requests. When more than one interrupt is pending,
priorities are resolved by a programmable priority encoder
that is controlled by the Interrupt Priority register. Hex Contains Jump Instruction and
Address Subroutine Address For
All Z8681 and Z8682 interrupts are vectored through
locations in program memory. When an interrupt request is 800-802 IROO
granted, an interrupt machine cycle is entered. This disables 803-805 IR01
all subsequent interrupts, saves the Program Counter and 806-808 IR02
status flags, and accesses the program memory vector 809-80B IR03
location reserved for that interrupt. In the Z8681 , this 80C-80E IR04
memory location and the next byte contain the 16-bit 80F-811 IR05
address of the interrupt service routine for that particular
interrupt request. Tile Z8681 takes 63 crystal cycles to
enter an interrupt subroutine.
Polled interrupt systems are also supported. To
The Z8682 has a small internal ROM that contains six 2-byte accommodate a polled structure, any or all of the interrupt
interrupt vectors pointing to addresses 2048-2065, where inputs can be masked and the Interrupt Request register
3-byte jump absolute instructions are located (Figure 4 and polled to determine which of the interrupt requests needs
Table 1). These jump instructions each contain a 1-byte service.
CLOCK
Z8681/Z8682 INTERCHANGEABILITY
Although the Z8681 and Z8682 have minor differences, a External Interface. The Z8682 requires a 7.5V positive
system can be designed for compatibility with both logic level on the RESET pin for at least 6 clock periods
ROM less versions. To achieve interchangeability, the design immediately following reset, as shown in Figure 13. The
must take into account the special requirements of each Z8681 requires a 3.8V or higher positive logic level, but is
device in the external interface, initialization, and memory compatible with the Z8682 RESET waveform. Figure 14
mapping. shows a simple circuit for generating the 7.5V level.
+V
7.35 TO B.O V
VRL
_ -----J/~-r:--\ -VRH
L----VRH
3.BV MIN
~ XT~L
ClKS
MAX
....... XT~L
ClKS
MIN
......
}------<I__---f RESET
7.35 - B.O V
Z8881
OR
Z8882
OPEN
COllECTOR
Figure 13. Z8682 RESET Pin Input Waveform TTL GATE
'This feature differs in the Z8681 and Z8682 . Figure 14. RESET Circuit
. 946
Initialization. The Z8681 wakes up after reset with Port 0 65536
..
IRO'
IR03 Z8681
0012 8008 12 JP START Execute application VECTORS
IR02
ADDRESS program. IRQ1
IROO
947
· Memory Mapping. The Z8681 and Z8682 lower memory address 0 and the Z8682 3-byte vectors Uump instructions)
boundaries are located at 0 and 2048, respectively. A single must be at address 2048 and higher. Addresses in the range
program ROM can be used with either product if the logical 21-2047 are not used. Figure 16 shows practical schemes
program memory map shown in Figure 15 is followed. The for implementing this memory map using 4K and 2K ROMs.
Z8681 vectors and initialization routine must be starting at
17FF 6K
APPLICATION
PROGRAM I----
1015
1014
NOT USED CHIP SELECT = (A12 + A11) . A13 • A4
1000 4K
FFF FFF
APPLICATION
PROGRAM
812 812
811 811
Z8682 VECTORS
800 2K
800
7FF 7FF
FFF
APPLICATION
PROGRAM CHIP SELECT = At; . A12 . i13 . A14 .A;5
835
834
820
NOT USED A10
As
:D--- As TO ROM
81F
812
811
800
7FF
APPLICATION
PROGRAM
Z8682 VECTORS -,
- 7FF
35
34
20
NOT USED 1F
15
'--- 12
14 11
Z8681 VECTORS
AND INITIALIZATION I-
LOGICAL PHYSICAL
MEMORY MEMORY
Figure 16. Practical Schemes for Implementing Z8681 and Z8682 Compatible Memory Map
948
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to Assignment of a value is indicated by the symbol u+-': For
describe the addressing modes and instruction operations example,
as shown in the instruction summary.
dst +- dst + src
IRR Indirect register pair or indirect working-register
indicates that the source data is added to the destination
pair address
data and the result is stored in the destination location. The
Irr Indirect working-register pair only
notation Uaddr(n)" is used to refer to bit unu of a given
X Indexed address
location. For example,
DA Direct address
RA Relative address dst(7)
1M Immediate
refers to bit 7 of the destination operand.
R Register or working-register address
r Working-register address only
Flags. Control Register R252 contains the following six
IR Indirect-register or indirect working-register
flags:
address
Ir Indirect working-register address only C Carry flag
RR Register pair or working register pair address Z Zero flag
Symbols. The following symbols are used in describing the
S Sign flag
V Overflow flag
instruction set.
o Decimal-adjust flag
dst Destination location or contents H Half-carry flag
src Source location or contents
Affected flags are indicated by:
cc Condition code (see list)
@ Indirect address prefix o Cleared to zero
SP Stack pointer (control registers 254-255) 1 Set to one
PC Program counter * Set or cleared according to operation
FLAGS Flag register (control register 252) Unaffected
RP Register pointer (control register 253) X Undefined
IMR Interrupt mask register (control register 251)
CONDITION CODES
949
INSTRUCTION FORMATS ' I----:o::C
pC =--' CCF, DI, EI, IRET, NOP,
RCF, RET, SCF
o"ne-ayte Instruction
CLR, CPL, DA, DEC, OPC MODE ADC, ADD, AND, CP,
'---===----' OR I, , , 01 dsHsre I ~~~~'~~,CRL~?~R,POP' sre OR , , , 0 sre LD, OR, SBC, SUB,
TCM, TM, XOR
RRC, SRA, SWAP dsl OR , , , 0 dsl
OPC
l----'d s"::',
7 ---lOR
I I' I , 0 Ids,
JP, CALL (Indirect)
OPC MODE ADC, ADD, AND, CP,
dsl OR I, , , 01 dsl LD, OR, SBC, SUB,
TCM, TM, XOR
VALUE
OPC SRP
VALUE
MODE OPC LD
sre OR 1 1 1 0 sre
OPC MODE ADC, ADD, AND, , , , 0
CP, OR, SBC, SUB, dsl OR dsl
dsl
TCM, TM, XOR
MODE OPC LD
MODE ope LO. LOE, LOEI,
dstlsrc srcldst LDC, LDCI
dstlsrc ope LD
ee OPC JP
src/dst OR 11 1 1 01 src
DAu
DAL
dsl I
OPC LD
VALUE
OPC CALL
DJNZ, JR
INSTRUCTION SUMMARY
950
INSTRUCTION SUMMARY (Continued)
Addr Mode Opcode Flags Affected Addr Mode Opcode Flags Affected
Instruction Byte Instruction Byte
and Operation dst src (Hex) C Z S V D H and Operation dst src (Hex) C Z S V D H
PUSH src R 70 R R
SP - SP - 1; @SP - src IR 71
R IR
RCF CF 0-----
R 1M
C-O
IR 1M
RET AF
PC - @SP; SP - SP + 2
RLdst 90
91
951
REGISTERS R240sI0 R244 TO
Serial 110 Register Counter/Timer 0 Register
(FOH; Read/Write) (F4H; Read/Write)
NOT To"MODES
USED .. 00
~~ g~~ ~ ~~
INTERNAl. CLOCK OUT .. 11
, T MODES
j
~ llli~D 1 =
= NO FUNCTiON
LOAD To
0 = DISABLE To COUNT
1 = ENABLE To COUNT
0 = NO FUNCTION
'
~L
,
COUNTMODE
= To SINGLE·PASS
(I
1 := To MODULO·N
RESERVED (MUST BE 0)
EXTERNAL CLOCK INPOT "" DO 1 = LOAD T,
GATE INPUT = 01 0 = DISABLE T, COUNT PRESCALER MODULO
(NON'R~~~g~~~::~~, = 10 1 = ENABLE T, COUNT (RANGE: 1-64 DECIMAL
TRIGGER INPUT .. 11 01-00 HEX)
(RETAIGGERABLE)
R242T1 R246P2M
Counter Timer 1 Register Port 2 Mode Register
(F2H; ReadIWrite) (F6H; Write Only)
1=1243PRE1 R247P3M
Prescaler 1 Register Port 3 Mode Register
(F3H; Write Only) (F7H; Write Only)
I ~Lo
~L
COUNTMODE
1 T, MODUlO·N
:c:
PORT 2 PULL·UPS OPEN DRAIN
1 PORT 2 PULL·UPS ACTIVE
o 'C Tt SINGLE·PASS RESERVED (MUST BE 0)
CLOCK SOURCE o P32 = INPUT P3s = OUTPUT
1 = Tf INTERNAL 1 P32 = DAVOIRDYO P3s =
RDYOIDAVO
o := 1, EXTERNAL
TIMING INPUT o0 P33 = INPUT P34 = OUTPUT
~~}P33=INPUT
(TIN) MODE
P3.t=t:JM
PRESCALER MODULO 11 RESERVED
(RANGE: 1-64 DECIMAL
01-00 HEX) '--______ ~ ~:! ~ ~N:VUJR~~~ ;~: ~ ~~~~~UT)
1-_ _ _ _ _ _ _ ~ ;~ ~ ~~~!L IN ::~ ~ ~~~~~TOUT
'--________ ~ ~~~:~~ g~F
952
REGISTERS R248 P01M R252 FLAGS
(Continued) Port 0 Register Flag Register
(F8H: Write Only) (FCH: Read/Write)
~C:PO'_PO'MODE
~~~
PD,_PO, MODE:] I LUSERFLAGFI
OUTPUT = 00 ~
INPUT::: 01
L 00 '" OUTPUT
01 = INPUT
LUSER FLAG F2
AI2 -A'5 "" lX lX = As-Au HALF CARRY FlAG
EXTERNAL STACK SELECTION DECIMAL ADJUST FLAG
MEMORY TIMING 0 = EXTERNAl.
NORMAL 0 = 1 '" INTERNAL OVERFLOW FLAG
·EXTENDED = 1 SIGN FLAG
ZERO FLAG
RESERVED (MUST BE 0)
CARRY FLAG
R2491PR R253 RP
Interrupt Priority Register Register Pointer
(F9H: Write Only) (FDH, Read/Write)
I~I~I~I~I~I~I~I~I
••~":J
tROl, IROS PRIORITY (GROUP Al
o :0" IROS ;> IRa3
1 = IRa3 > IROS
II III ,...."-"' ~~"
RESERVED
C ;> A > B
A > B > C
A> C ::> B
= ODD
= 001
= 010
= 011
REGISTER
POINTER
.LDON'TCARE
R250lRQ R254SPH
Interrupt Request Register Stack Pointer
(FAH: Read/Write) (FEH: Read/Write)
I~I~I~I~I~I~I~I~I
RESERVED (MUST BE o):::r- c== tROD
IRQ1
P32 INPUT (Do = IROO)
P331NPUT
IRQ2 P311NPUT
IRQ3 P30 INPUT, SERIAL INPUT
IRQ4 To. SERIAL OUTPUT
IROS T,
R2511MR R255SPL
Interrupt Mask Register Stack Pointer
(FBH: Read/Write) (FFH: Read/Write)
Jl____c==
___ ' ENABLES IRCO-IRCS
(Do = IRCO)
RESERVED (MUST BE 0)
953
Z8681 182 OPCODE MAP
Lower Nibble (Hex)
2 7 9 A' B C D E F
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5 6,5 6,5 12/10,5 12/10,0 6,5 12/10,0 6,5
o DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R, IR, 'I,T2 ".lr2 R2,R, ,IR2,R, R"IM IR"IM '"R2 T2. R{ r"RA cC,RA r"IM' cc,DA r1
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
r---
RLC RLC ADC ADC ADC ADC ADC ADC
R, IR, 'l,f2 '1, lr2 R2,R, IR2,R, R"IM IR"IM
6,5 6,5 6,5 6,5 la,S la,S 10,5 la,S
r---
2 INC INC SUB SUB SUB SUB SUB SUB
R, IR, ".T2 ".lr2 R2,R, IR2,R, R"IM IR"IM
8,0 6,1. 6,5 6,5 la,S la,S 10,5 la,S
r---
JP SRP SBC SBC SBC SBC SBC SBC
IRR, 1M f1. r2 f1, lr2 R2,R, IR2,R, R"IM IR"IM
8,5 8,5 6,5 6,5 la,S la,S 10,5 la,S
r---
DA DA OR OR OR OR OR OR
R, IR, r,.r2 '1. lr2 R2,R, IR2,R, R"IM IR"IM
la,S 10,5 6,5 6,5 10,5 10,5 10,5 ' 10,5
r---
POP POP AND AND AND AND AND AND
R, IR, r1,r2 '1, lr2 R2,R, IR2,R, R"IM IR"IM
r---
6,5 6,5 6,5 6,5 la,S la,S la,S la,S
COM COM TCM TCM TCM TCM TCM TCM
R, IR, '"f2 T1, lr2 R2,R, IR2,R, R"IM IR"IM
10112,1 12/14,1 6,5 6,5 la,S la,S 10,5 10,5 r---
PUSH PUSH TM TM TM TM TM TM
R2 IR2 '1,T2 f1.lr2 R2,R, IR2,R, R"IM IR"IM
10,5 10,5 12,0 18,0
r---
6,'
DECW DECW LDE LDEI DI
RR, IR, '1, lrr2 Ir" lrr2
6,5 6,5 12,0 18,0 ~
9 RL RL LDE LDEI EI
R, IR, '2,lrT, Ir2.lfT,
r---
10,5 10,5 6,5 6,5 10,5 la,S 10,5 10,5 14,0
A INCW INCW CP CP CP CP CP CP RET
RR, IR, r,J2 Tl.lr2 R2,R, IR2,R, R"IM IR"IM
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
r---
16,0
B CLR CLR XOR XOR XOR XOR XOR XOR IRET
R, IR, f,J2 '1,1r2 R2,R, IR2,R, R"IM IR"IM
6,5 6,5 12,0 18,0 10,5
r---
6,5
C RRC RRC LDC LDCI LD RCF
R, IR, ",1rr2 Ir,.lrr2 T"x,R2
r---
6,5 6,5 12,0 18,0 20,0 20,0 10,5 6,5
D SRA SRA LDC LDCI CALL" CALL LD SCF
R, IR, r2,lrr, Ir2,lrr, IRR, DA T2,x,R,
r---
6,5 6,5 6,5 10,5 10,5 10,5 10,5 6,5
E RR RR LD LD LD LD LD CCF
R, IR, Tl, IR2 R2,R, IR?,R, R"IM IR"IM
8,5 8,5 6,5 10,5
r---
6,0
F SWAP SWAP LD LD NOP
IR, Ir1.r2
R, R2,IR,
I
'-...- - - -...."'...- - - -...''-...- - - -....'''...____...''-....______'''...- - -- -...J~'----v---
2 2 3
Bytes per Instruction
LOWER
OPCODE
NIB!LE
954
ABSOWTE MAXIMUM RATIN'GS
Voltages on all pins except RESET Stresses greater than those listed under Absolute Maximum Ratings may
cause permanent damage to the device. This is a stress rating only;
with respect to GND ............... - O.3V to + 7.0V
operation of the device at any condition above those indicated in the
Operating Ambient operational sections of these specifications is not implied. Exposure to
Temperature .............. See Ordering Information absolute maximum rating conditions for extended periods may affect
Storage Temperature .............. -65°C to + 150°C device reliability.
• +4.75V"'Vcc'" +5.25V
• GND = OV
• ooe ... TA'" + 70°C for S (Standard temperature)
• - 40°C ... TA'" + 100°C for E (Extended temperature)
Figure 19. Test Load 1
DC CHARACTERISTICS
VCH Clock Input High Voltage 3.8 Vcc V Driven by External Clock Generator
VCl Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.0 VCC V
Vil Input Low Voltage -0.3 0.8 V
VRH Reset Input High Voltage 3.8 VCC V See Note
VRL Reset Input Low Voltage -0.3 0.8 V
<The Reset line (pin 6) is used to place the Z8682 in external memory mode. This is accomplished as shown in Figure 13.
955
) J(
~ ~I
PORTO,
DM ) )(
16
3
) }
-rv
Ao-A,
PORT 1
< 00-0, IN
<
~ -@- l-
• @ • ~l\
1-0- ~I • CD
os .~
(READ)
~~
~
PORT 1 Au-AT
X 00-0, OUT }(
I-®--I ~I
DS
(WRITE) '\t
J
-y
Figure 20. External I/O or Memory Read/Write Timing
AC CHARACTERISTICS
External 110 or Memory Read and Write Timing
16 TdA(DR) Address Valid to Read Data Required Valid 410 255 200 1,2,3
17 TdAS(DS)
-AS i to -DS J. Delay 80 55 40 2,3
NOTES:
1. When using extended memory timing add 2 TpC. • All units in nanoseconds (ns).
2. Timing numbers given are for minimum TpC. t Test Load 1
3. See clock cycle time dependent characteristics table. o All timing references use 2.0V for a logic "1" and O.BV for a logic "0':
4. 16 MHz limin, is preliminary and subjoc:t to chan,•.
956
Figure 21. Additional Timing
AC CHARACTERISTICS
Additional Timing Table
NOTES:
1. Clock timing references use 3.BV for a logic" 1" and O.BV for a logic "0':
2. Timing references use 2.0Vfor alogic "1" and O.BV for a logic "0':
3. Interrupt request via Port 3.
4. Interrupt request via Port 3 (P31-P33)
5. Interrupt request via Port 3 (P30)
6 . 16 MHz limin. is preliminary and subject to chan.o.
• Units in nanoseconds (ns).
957
DATA IN DATA IN VALID
----~~~~~==f------------
DAY
(INPUT)
RDY
(OUTPUT)
DAY
(OUTPUT)
RDY
---------J::::::32::::::::i[==]
(INPUT)
AC CHARACTERISTICS
Handshake Timing
958
CLOCK CYCLE TIME·DEPENDENT
CHARACTERISTICS
959
~ ZiIm Product Specification
Z8691 Z8®
ROMLESS MICROCONTROLLER
FEATURES
• Complete microcomputer, 24 I/O lines, and up to 64K • Full-duplex UART and two programmable 8·bit
bytes of addressable external space each for program counter/timers, each with a 6-bit programmable
and data memory. prescaler.
• 143-byte register file, including 124 general-purpose • Register Pointer so that short, fast instructions can
registers, 3 I/O port registers, and 16 status and control access anyone of the nine working-register groups.
registers.
• Single + 5V power supply-all I/O pins TIL compatible.
• Vectored, priority interrupts for I/O, counter/timers, and
• 8 MHz/12 MHz versions.
UART.
• On-chip oscillator that accepts crystal or external clock
drive.
GENERAL DESCRIPTION
The Z8691 is a ROM less version of the Z8 single'chip preprogrammed ROM enables this Z8 microcomputer to be
microcomputer. The Z8691 offers all the outstanding used in low volume applications or where code flexibility is
features of the Z8 family architecture except an on·chip required.
program ROM. Use of external memory rather than a
TIMING
AND
CONTROL 1- RESET
R/W
os
AS
PO,
GND
XTAL1
XTAL2
P20
+5V
XTAL2
XTAl1
P3,
P30
P3,
P3,
P2,
P2,
P2,
po, P2, RESET P2,
po, P2, R/W P2,
PORTO
(NIBBLE PO, P2, os P2,
PROGRAMMABLE) PO, P2, AS P2,
110 OR Aa-A15
PO, P2, P3, P20
Z8691
PO, MCU P;z. GND P3,
961
The Z8691 can provide up to 16 output address lines, thus There are 143 bytes of RAM located on-chip and organized
permitting an address space of up to 64K bytes of data or as a register file of 124 general-purpose registers, 16 control
program memory. Eight address outputs (ADo-AD7) are and status registers, and three 1/0 port registers. This
provided by a multiplexed, 8·bit, AddresslData bus, The register file can be divided into nine groups of 16 working
remaining 8 bits can be provided by the software registers each. Configuring the register file in this manner
configuration of FUrt 0 to output address bits Aa-A15 . allows the use of short format instructions; in addition, any of
the individual registers can be accessed directly.
Available address space can be doubled (up to 128K bytes)
by programming bit 4 of FUrt 3 (P34) to act as a data memory The pin functions and the pin assignments of the Z8691
select output (DM). The two states of DM together with the 40'pin and 44-pin packages are illustrated in Figures 1 and 2,
16 address outputs can define separate data and memory respectively.
address spaces of up to 64K bytes each.
~" -:vtt,
~CJ <l~f:) qtl:J\.¢'if' .¢'if' x~.;j. q,"bb <l':," q,..,,,'({,,b <[,,4)
6 5 4 3 2 1 «~~ 41 ~
RESET 7 39 >NC
R/W 8 38 P2,
os 9 37 P2,
Ali 10 36 P22
P3, 11 35 P2,
Z8691
GND 12 3' P2,
MCU
P32 13 33 P3,
PO, ,. 32 P3,
PO, 15 31 Ph
PO, 16 30 P1.
NC 17 29 P1,
18 19 20 21 22 23 24 25 26 27 28
qr::P ~'4>q~" <l::Jb <If.)'\. q'O .q..."q...".,q...."Jq.... bo ~v
962
ARCHITECTURE
Z8691 architecture is characterized by a flexible 110 data memory and the register file (internal). The 143-byte
scheme, an efficient register and address space structure random-access register file is composed of 124
and a number of ancillary features that are helpful in many general-purpose registers, three 110 port registers, and 16
applications. control and status registers.
Microcomputer applications demand powerful 110 To unburden the program from coping with real-time
capabilities. The Z8691 fulfills this with 24 pins available for problems such as serial data communication and
input and output. These lines are grouped into three ports of counting/timing, an asynchronous receiver/transmitter
eight lines each and are configurable under software control (UART) and two counter/timers with a large number of
to provide timing, status signals, serial or parallel 110 with or user-selectable modes are offered on-chip. Hardware
without handshake, and an Address bus for interfacing support for the UART is minimized because one of the
external memory. on-chip timers supplies the bit rate. Figure 3 shows the
Z8691 block diagram.
Three basic address spaces are available: program memory,
PIN DESCRIPTION
AS. Address Strobe (output, active LDw). Address Strobe is address (Ao-A7) and data (0 0 -0 7) lines used to interface with
pulsed once at the beginning of each machine cycle. program and data memory.
Addresses output via Port 1 for all external program or data
RESET. Reset (input, active LDw). RESET initializes the
memory transfers are valid at the trailing edge of AS.
Z8691. After RESET the Z8691 is in the extended memory
OS. Data Strobe (output, active LDw). Data Strobe is mode. When RESET is deactivated, program execution
activated once for each external memory transfer. begins from program location OOOCH.
POO·P07, P20·P27, P30·P37. /10 Port Lines (input/outputs, R/W. Read/Write (output). R/W is LDw when the Z8691
TTL-compatible). These 24 lines are divided into three 8-bit is writing to external program or data memory.
I/O ports that can be configured under program control for
XTAL1, XTAL2. Crystal 1, Crystal 2 (time-base input and
I/O or external memory interface (Figure 3).
output). These pins connect a parallel-resonant crystal to the
P10·P17. Address/Data Port (bidirectional). Multiplexed on-Chip clock oscillator and buffer.
963
ADDRESS SPACES
Program Memory. The Z8691 addresses 64K/62K bytes of Z8691 instructions can access registers directly or indirectly
external program memory space (Figure 4). with an 8-bit address field. This also allows short 4-bit
register addressing using the Register Pointer (one of the
The. first 12 bytes of program memory are reserved for the
control registers). In the 4-bit mode, the register file is divided
interrupt vectors. These locations contain six 16-bit vectors
into nine working-register groups, each occupying 16
that correspond to the six available interrupts. Program
contiguous locations (Figure' 5). The Register Pointer
execution beginsat location OOOCH after a reset:
addresses the starting location of the active working-register
Data Memory. The Z8691 can address 64K bytes of external group (Figure 6).
data memory. External data memory may be included with or
separated from the external program memory space. DM, Stacks. Either the internal register file or the external data
an optional 1/0 function that can be programmed to appear memory can be used for the stack. A 16-bit Stack Pointer
on pin P34, is used to distinguish between data and program (R254 and R255) is used for the external stack, which can
memory space. reside anywhere in data memory. An 8-bit Stack Pointer
(R255) is used for the internal stack that resides within the
Register File. The 143-byte register file includes three 1/0 124 general-purpose registers (R4-R127).
port registers (RO, R2, R3), 124 general-purpose registers
(R4-R127) and 16 control and status registers (R240-R255).
These registers are assigned the address locations shown in
Figure 5.
65 ,535
PROGRAM DATA
MEMORY MEMORY
LOCATION OF FIRST
BYTE OF INSTRUCTION
EXECUTED AFTER
RESET ~ ....
------
~~- IRQ5 -
INTERRUPT
VECTOR
:--
7
IRQ4
IRQ3
-
-
(LOWER BYTE) ....... 6
~
5
4
IRQ2 -
INTERRUPT
VECTOR ........ 3
(UPPER BYTE) 2 - IRQ1 -
~- IRQO -
964
DEC HEX IDENTIFIERS
255
254
253
STACK POINTER (BITS 7-0)
STACK POINTER (BITS 15-8)
REGISTER POINTER
FF
FE
FO
SPL
SPH
RP
- - [ t-1_73_
7 _',_',-----",_"'---_0_0_0_0 -tl : :
252 PROGRAM CONTROL FLAGS FC FLAGS THE UPPER NIBBLE OF THE REGISTER
251 INTERRUPT MASK REGISTER FB IMR FilE ADDRESS PROVIDED BY THE
REGISTER POINTER SPECIFIES THE
250 INTERRUPT REQUEST REGISTER FA IRO ACTIVE WORKING·REGISTER GROUP.
24. F. IPR
--I
INTERRUPT PRIORITY REGISTER 1 27
24B PORTS 0-1 MODE FB P01M
247 PORT 3 MODE F7 P3M
--I
246 PORT 2 MODE F6 P2M
245 TO PRESCALER F5 PREO
244 TIMER/COUNTER a F4 TO
--I
243 T1 PRESCALER F3 PRE1
242 TlMERfCOUNTER 1 F2 T1
241 TIMER MODE F1 TMR
--II
240 SERIAL 110 FO SID
GENERAl·PURPOSE
REGISTERS --\ SPECIFIED
REGISTER.
O' --I
--I
1
PORT 3 03 P3
PORT 2 02 P2
t-- - - -"OPORTS-- - -- 3
PORT 1 01 P1 0
PORT 0 00 PO
SERIAL INPUT/OUTPUT
Port 3 lines P30 and P37 can be programmed as serial I/O parity selection. If parity is enabled, the eighth data bit is
lines for full-duplex serial asynchronous receiver /transmitter used as the odd parity bit. An interrupt request (lR04) is
operation. The bit rate is controlled by Counter/Timer 0, with generated on all transmitted characters.
a maximum rate of 62.5K bits/second at 8 MHz or 93.75K
Received data must have a start bit, eight data bits, and at
bits/second at 12 MHz on the Z8691.
least one stop bit. If parity is on, bit 7 of the received data is
The Z8691 automatically adds a start bit and two stop bits to replaced by a parity error flag. Received characters
transmitted data (Figure 7). Odd parity is also available as an generate the IR03 interrupt request.
option. Eight data bits are always transmitted, regardless of
I~I~I~I~I~I~I~I~I~IRI
LST~RTBrT LSTART BIT
' - - - - - - EIGHT DATA BITS ' - - - - - - EIGHT DATA BITS
TWO STOP BITS ' - - - - - - - - - - - O N E STOP BIT
1~lsplpl~I~I~I~I~I~I~IRI 1~lpl~I~I~I~I~I~I~IRI
11'--- _LsTARTBIT
' - - - - - - - S E V E N DATA BITS
ODD PARITY
TWO STOP BITS
I L _LsTARTBIT
' - - - - - - S E V E N DATA BITS
PARITY ERROR flAG
' - - - - - - - - - - - - O N E STOP BIT
965
COUNTER/TIMERS
The Z8691 contains two 8-bit programmable counter /timers or to automatically reload the initial value and continue
(To and Tl), each driven by its own 6-bit programmable counting (modulo-n continuous mode). The counters, but not
prescaler. The Tl prescaler can be driven by internal or the prescalers, can be read any time without disturbing their
external clock sources; however, the To prescaler is driven value or count mode.
by the internal clock only.
The clock source for Tl is user-definable; it can be either the
The 6-bit prescalers can divide the input frequency of the internal microprocessor clock divided by four, or an external
clock source by any number from 1 to 64. Each prescaler signal input via Port 3. The Timer Mode register configures
drives its counter, which decrements the value (1 to 256) that the external timer input as an external clock, a trigger input
has been loaded into the counter. When the counter reaches that can be retriggerable or nonretriggerable, or as a gate
the end of count, a timer interrupt request-IR04 (To) or input for the internal clock. The counter/timers can be
IR05 (Tl)-is generated. programmably cascaded by connecting the To output to the
input ofTl . Port 3 line P36 also serves as a timer output (Tour)
The counters can be started, stopped, restarted to continue,
through which To, Tl or the internal clock can be output.
or restarted from the initial value. The counters can also be
programmed to stop upon reaching zero (single-pass mode)
I/O PORTS
The Z8691 has 24 lines available for input and output. These outputs, timing, status signals, serial I/O, and parallel I/O
lines are grouped into three ports of eight lines each and are with or without handshake. All ports have active pull-ups and
configurable as input, output or address. Under software pull-downs compatible with TTL loads.
control, the ports can be programmed to provide address
Port 1 is a dedicated Z-BUS compatible memory interface. least-significant four bits of Port 0 can be configured to
The operations of Port 1are supported by the Address Strobe supply address bits As-All for 4K byte addressing or both
(AS) and Data Strobe (OS) lines, and by the Read/Write nibbles of Port 0 can be configured to supply address bits
(R/iN) and Data Memory (OM) control lines. The low-order As-A15.for 64K byte addressing.
program and data memory addresses (Ao-A7) are output
through Port 1(Figure 8) and are multiplexed with data in/out
(0 0-0 7), Instruction fetch and data memory read/write J--a--l\
y...:--y PORT 1
ADO-AD7
operations are done through this port. TO EXTERNAL
Z8891 MEMORY
Port 1 cannot be used as a register nor can a handshake MCU
mode be used with this port.
The Z8691 wakes up with the 8 bits of Port 1 configured as
address outputs for external memory. If more than eight
address lines are required, additional lines can be obtained
by programming Port 0 bits as address bits. The Figure 8. Port 1
Port 0 can be programmed as a nibble I/O port, or as an To permit the use of slow memory, an automatic wait mode of
address port for interfacing external memory (Figure 9). two oscillator clock cycles is configured for the bus timing of
When used as an I/O port, Port 0 can be placed under the Z8691 after each reset. The initialization routine could
handshake control. In this configuration, Port 3 lines P32 and include reconfiguration to eliminate this extended timing
P35 are used as the handshake controls OAVo and ROYo. mode.
Handshake signal assignment is dictated by the I/O
direction of the upper nibble P04-P07'
For external memory references, Port 0 can provide address
P04-P07 ) PORT 0
bits As-All (lower nibble) or As-A15 (lower and upper nibbles) ) POO-P03 (110 OR AS-A,S
depending on the required address space. If the address Z8891
MCU
range requires 12 bits or less, the upper nibble of Port 0 can
be programmed independently as I/O while the lower nibble _ ) HANDSHAKE CONTROLS
is used for addressing. DAY. AND RDY.
(P3, AND P3,)
966
Port 2 bits can be programmed independently as input or
i
output (Figure 10). This port is always available for I/O - - ] P20
~~ ~
operations. In addition, Port 2 can be configured to provide
open-drain outputs.
1PORT 21 1101
Port 2 may also be placed under handshake control. In this
~ P27
configuration, Port 3 lines P3, and P36 are used as the
_ _ , HANDSHAKE CONTROLS
handshake controls lines OAV2 and ROY2. The handshake
signal assignment for Port 3 lines P3, and P36 is dictated by I ~~~~~~~:,fY2
the direction (input or output) assigned to bit 7 of Port 2.
Figure 10. Port 2
INTERRUPTS
The Z8691 allows six different interrupts from eight sources: interrupts, saves the Program Counter and status flags, and
the four Port 3 lines P3o·P33, Serial In, Serial Out, and the two accesses the program memory vector location reserved for
counter/timers. These interrupts are both maskable and that interrupt. This memory location and the next byte
prioritized. The Interrupt Mask register globally or contain the 16-bit address of the interrupt service routine for
individually enables or disables the six interrupt requests. that particular interrupt request. The Z8691 takes 63
When more than one interrupt is pending, priorities are crystal cycles to enter an interrupt subroutine.
resolved by a programmable priority encoder that is
Polled interrupt systems are also supported. To
controlled by the Interrupt Priority register.
accommodate a polled structure, any or all of the interrupt
All interrupts are vectored through locations in program inputs can be masked and the Interrupt Request register
memory. When an interrupt request is granted, an interrupt polled to determine which of the interrupt requests needs
machine cycle is entered. This disables all subsequent service.
CLOCK
The on-chip oscillator has a high-gain, parallel·resonant • AT cut, parallel-resonant
amplifier for connection to a crystal or to any suitable
• Fundamental type
external clock source (XTAL 1 = Input, XTAL2 = Output).
• Series resistance, Rs ~ 1000
The crystal source is connected across XTAL1 and XTAL2,
using the recommended capacitance (CL =
15 pf • 8 or 12 MHz maximum
maximum) from each pin to ground. The specifications for
the crystal are as follows:
967
INSTRUCTION SET NOTATION
Addressing Modes. The following notation is used to Assignment of a value is indicated by the symbol "+-". For
describe the addressing modes and instruction operations example,
as shown in the instruction summary.
dst +- dst + src
IRR Indirect register pair or indirect working-register
indicates that the source data is added to the destination
pair address
data and the result is stored in the destination location. The·
Irr Indirect working-register pair only
notation "addr(n)" is used to refer to bit "n" of a given
X Indexed address
location. For example,
DA Direct address
RA Relative address dst(7)
1M Immediate
refers to bit 7 of the destination operand.
R Register or working-register address
r Working-register address only
IR Indirect-register or indirect working-register Flags. Control Register R252 contains the following six
address flags:
Ir Indirect working-register address only C Carry flag
RR Register pair or working register pair address Z Zero flag
Symbols. The following symbols are used in describing the S Sign flag
instruction set. V Overflow flag
o Decimal-adjust flag
dst Destination location or contents H Half-carry flag
src Source location or contents
cc Condition code (see list) Affected flags are indicated by:
@ Indirect address prefix o Cleared to zero
SP Stack pointer (control registers 254-255) 1 Set to one
PC Program counter * Set or cleared according to operation
FLAGS Flag register (control register 252) Unaffected
RP Register pointer (control register 253) X Undefined
IMR Interrupt mask register (control register 251)
CONDITION CODES
968
INSTRUCTION FORMATS ope CCF, 01, EI. IRET, NOP,
RCF. RET. SCF
One-Byte Instruction
OPC
1----''::.dS-'" '----1
I OR 11 1 • 0 Ids.
JP. CALL (Indirecl)
Ace, ADD, AND, CPt
1--_=_---1 OR It 1 1 0 I dst
LO, OR. SBC, SUB,
TCM. TM. XOR
OPC SRP
VALUE
MODE OPC LD
OR
Ace, ADD. AND.
CPt OR, SBC, SUB, ds. OR
reM, TM. XOR
MODE OPC LD
LD. LDE. LDE ••
LOC. LOCI dst/src
ADDRESS
dstfsrc ope LO
OPC JP
src/dst OR 11 1 1 01 src
DAu
DAL
dst I OPC LD
VALUE
OPC CALL
DAu
INSTRUCTION SUMMARY
969
INSTRUCTION SUMMARY (Continued)
Addr Mode Opcode Flags Affected Addr Mode Opcode Flags Affected
Instruction Byte Instruction Byte
and Operation dst src (Hex) C Z S V 0 H and Operation dst src (Hex) C Z S V 0 H
IRET BF * * * * * * RLC dst L@:ciJ IRR 10 ****--
FLAGS - @SP; SP - SP + 1 C 7 0
11
PC - @SP; SP - SP + 2; IMR (7) - 1
JP cc.dst OA cD
RR dst l0 LciJ IRR
C 7 0
EO * * * *
El
If cc IS true c = 0 - F
PC -dst IRR 30 RRC dst LIri=ri"J IRR
C 7 0
CO * * * *
Cl
JR cc.dst RA cB
cc IS true.
If c =0 - F SBC dst,src (Note 1) 3D
PC - PC + dst dst -dst - src-C
Range: + 127. -128 SCF OF 1-----
LO dst,src 1m rC C-l
dst - src
R
R r8
r9
SRA dst l0 @J R DO ***0--
IR 01
r = 0 - F
r X C7 SRPsrc 1m 31
X r 07 RP -src
r Ir E3
SUBdst,src (Note 1) 20
Ir F3
dst - dst - src
R R E4
R
R
IR
1M
E5
E6
SWAP dst 17 S 01 R
IR
FO
Fl
X ** X
IR 1M E7
TCMdst,src (Note 1) 60
IR R F5
(NOT dst) AND src
LOC dst,src r Irr C2
TM dst,src (Note 1) 7D
dst -src Irr 02 dstANOsrc
LOCI dst,src Ir Irr C3
XORdst,src (Note 1) BO
dst - src Irr Ir 03
dst - dst XOR src
r - r + 1; rr - rr + 1
LOE dst,src r Irr 82 NOTE These Instructions have an Identical set of addressing modes.
which are encoded for brevity. The frrst opcode nibble IS found In
dst-src Irr 92
the instruction set table above. The second nibble IS expressed
LOEI dst,src Ir Irr 83 symbolically by a [~in this table, and ItS value IS found In the
following table to the left of the applicable addressing mode parr.
dst-src Irr Ir 93
r-r + l;rr-rr + 1 For example. the opcode of an ADC Instruction uSing the
addressing modes r (destination) and Ir (source) IS 13.
NOP FF
PUSH src R 70 R R
SP - SP - 1; @SP - src IR 71
R IR
RCF CF 0-----
R 1M
C-O
IR 1M
RET AF
PC-@SP;SP--SP + 2
RLdst 90
91
970
REGISTERS R240SJO R244 TO
SeriaJIIO Register Counter/Timer 0 Register
(FOH, Read/Write) (F4H: Read/Write)
NOT T,",
USEDMODES
= 00
~~ g~~ ~ ~&
INTERNAL CLOCK OUT = 11
T MODES
j
~ ~~o 1 = NO FUNCTION
LOAD To
0 = OISABLE To COUNT
1 = ENABLE To COUNT
0 = NO FUNCTION
~L
COUNTMODE
0= To SINGLE·PASS
1 = To MODUlO·N
RESERVED (MUST BE 0)
EXTERNAL CLOCK INP'ar = 00 1 = LOAD T,
GATE INPUT = 01 0 = DISABLE T, COUNT
PRESCALER MODULO
(NON'R~~~~g~~~~~~~) :: 10 1 = ENABLE T 1 COUNT (RANGE: 1·64 DECIMAL
TRIGGER INPUT = 11 01·00 HEX)
(RETRIGGERABLE)
E~
COUNTMODE O1 PORT2
~L
PULL UPS OPEN DRAIN
1 = T 1 MODUlO·N PORT 2 PULL UPS ACTIVE
o = T1 SINGlE·PASS
RESERVED (MUST BE 0)
CLOCK SOURCE
1 T, INTERNAL
o P32 INPUT P35 OUTPUT
1 P32 DAVO/ROYO P3s ROYOIDAVO
o T 1 EXTERNAL
TIMING INPUT 00 P33 INPUT P34 OUTPUT
~ ~ ! P3J
(T'N) MODE
- INPUT P34 OM
PRESCALER MODULO 11 RESERVED
(RANGE: 1-64 DECIMAL
01-00 HEX)
I-------~ ~~~ ~ 6N:vt;j~61~1 ~~: : ~~~~~~~20UT}
1-_ _ _ _ _ _ _ ~ ~~~ ~ ~N~~~l IN :;~ =~~~iAULTQUT
L________ ~ ~~=:i~ g~F
971
REGISTERS R248 P01M R252 FLAGS
(Continued) Port 0 Mode Register Flag Register
(F8H; Write Only) (FCH; Read/Write)
~~ 1
ll!~~
LUSERFLAG ..
PD._PO, MODE:]
OUTPUT;;: 00
INPUT = 01
L PD.-PO, MODE
00;; OUTPUT
01 ;; INPUT L USER FLAG F2
A'2-AlS :::: 1X IX :::: Aa-A" HALF CARRY FLAG
EXTERNAL STACK SELECTION , DECIMAL ADJUST FLAG
MEMORY TIMING 0 '" EXTERNAL
NORMAL:: 0 1 :::: INTERNAL OVERFLOW FLAG
-EXTENDED'" 1 SIGN FLAG
ZERO FLAG
. RESERVED (MUST BE D)
CARRY FLAG
R2491PR R253RP
Interrupt Priority Register Register Pointer
(F9H; Write Only) (FDH; Read/Write)
I~I~I~I~I~I~I~I~I
"",~.:J
IRC3, IROS PRIORITY (GROUP A~
o " IROS > tRQ3
1 " IRQ3 :> IROS
I I III '".""."~"....."
RESERVED ""
C :> A :> 8 '"
A > B :> C =
A :> C > B ::
000
001
010
011
REGISTER
POINTER
R2511MR R255SPL
Interrupt Mask Register Stack Pointer
(FBH; Read/Write) (FFH; Read/Write)
I~I~I~I~I~I~I~I~I I~I~I~I~I~I~I~I~I
II c= t ENABLES IRaO-IRas
(Do::: IRQO)
' - - - - - - - RESERVED (MUST BE 0)
L I_ _ _ _ ~~~~~S~~~~~~R LOWER
972
OPCODEMAP
Lower Nibble (Hex)
6 7 A B C o E F
---------- - - - - -10,5
- --------
-=~
65 65 6,5 6,5 10,5 10,5 10,5 6,5 6,5 12/10,5 12/10,0 6,5 12110,0 65
DEC DEC ADD ADD ADD ADD ADD ADD LD LD DJNZ JR LD JP INC
R, IR, rl·'2 r, Ir2 R2,R, IR2,R, R,,1M IR,,1M r"R2 r2· R , f,.RA cc.RA fl,IM cc.oA r'
6.5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
RLC RLC ADC ADC ADC ADC ADC ADC
R, IR, r,.f2 f,.lr2 R2,R, IR2,R, R"IM IR"IM
- f----- --
6,5 6,5 6,5 6,5 '10,5 10,5 10,5 10,5
INC INC SUB SUB SUB SUB SUB SUB
R, IR, r,.r2 r" lr2 R2,R, IR2,R, R,,1M IR"IM
-
8,0 6,1 6,5 6,5 10,5 10,5 10,5 10,5
JP SRP SBC SBC SBC SBC SBC SBC
IRR, 1M r'/2 (1, lr2 R2,R, IR2,R, R"IM IR"IM
--
8,5 8,5 6,5 6,5 10,5 10,5 10,5 10,5
4 DA DA OR OR OR OR OR OR
R, IR, T'/2 ",lr2 R2,R, IR2,R, R"IM IR"IM
-
10,5 10,5 6,5 6,5 10,5 10,5 10,5 10,5
POP POP AND AND AND AND AND AND
R, IR, r"T2 f,. lr2 R2,R, IR2,R, R"IM IR"IM
-
6,5 6,5 6,5 6,5 10,5 10,5 10,5 10,5
.
e"
6
7
COM
R,
10112,1
PUSH
COM
IR,
12/14,1
PUSH
TCM
r"T2
6,5
TM
TCM
r" lr2
6,5
TM
TCM
R2,R,
10,5
TM
TCM
iR2,R,
10,5
TM
TCM
R"IM
10,5
TM
TCM
IR,.IM
10,5
TM
-
"
:is
a
R2 IR2 r'/2 T,. lr 2 R2,R, IR2,R, R"IM IR"IM
z 10,5 10,5 '2,0 18,0 ~
:;; DECW DECW LDE LDEI 01
c. 8
c. RR, IR, Tl, lrr2 Ir" lrr2
::> -
6,5 6,5 12,0 18,0 6,1
RL RL LDE LDEI EI
R, IR, (2· lr;, Ir2,ITTl
Sequence:
Opcode. First Operand Second Operand
FIRST SECOND
OPERAND OPERAND NOTE The blank areas are not defined
973
ABSOLUTE MAXIMUM RATINGS
Voltages on all pins except RESET Stresses greater than those listed under Absolute Maximum Ratings may
with respect to GN D ............... - 0.3V to + 7.0V cause permanent damage to the device. This is a stress rating only;
operation of the device at any condition above those indicated in the
Operating Ambient operational sections of these specifications is not implied. Exposure to
Temperature ............... See Ordering Information absolute maximum rating conditions for extended periods may affect
Storage Temperature .............. -65·C to + 150·C device reliability.
DC CHARACTERISTICS
VCH Clock Input High Voltage 3.8 Vee V Driven by External Clock Generator
VCl Clock Input low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.0 Vee V
Vil Input low Voltage -0.3 0.8 V
VRH Reset Input High Voltage 3.8 VCC V
VRl Reset Input low Voltage -0.3 0.8 V
974
R/W ) X
-®- --®--I
PORT 0, - -) )(
OM
•
16
0 •
PORT 1 ) Ao-A7
~ 00-07 IN
J <
~ -0-
• 0 •
-- ~1\ 01-
1--0-- ~I. 0
os
(READ)
---®---l' 'y
-®-
-----.
PORT 1
- Ao-A7
X 00-07 OUT }(
I-®----I -®-I
as
(WRITE) 'f CD --y
Figure 15. External I/O or Memory Read/Write Timing
AC CHARACTERISTICS
External 110 or Memory Read and Write Timing
8MHz 12MHz
Number Symbol Parameter Min Max Min Max Notes'tO
TdA(AS) Address Valid to AS t Delay 50 35 2,3
2 TdAS(A) AS t to Address Float Delay 70 45 2,3
3 TdAS(DR) AS t to Read Data Required Valid 360 220 1,2,3
4 TwAS AS Low Width 80 55 2,3
5 TdAz(DS) Address Float to DS ~ 0 0
6 TwDSR DS (Read) Low Width 250 185 1,2,3
975
CLOCK
TIN
IRON
AC CHARACTERISTICS
Additional Timing Table
8MHz 12MHz
Number Symbol Parameter Min Max Min Max Notes·
976
DATA IN
CD
x DATA IN VALID
DAV -----:---1J----(i)---I~--------
~~ ~ ~
ROY
(OUTPUT) , ' - -_ _ _ _ _----'f
DAV
(OUTPUT)
RDY------------------------~~----_lk~--~+f
(INPUT)
AC CHARACTERISTICS
Handshake Timing
977
CLOCK CYCLETIME·DEPENDENT
CHARACTERISTICS
8MHz 12MHz
Number Symbol Equation Equation
1 TdA(AS) TpC-75 TpC-50
2 TdAS(A) TpC-55 TpC-40
3 TdAS(DR) 4TpG-140* 4TpG-110*
4 TwAS TpC-45 TpG-30
6 TwDSR 3TpC-125* 3TpC-65*
978
~ ZiIm Product Specification
FEATURES
• Improved Z81!) instruction set includes multiply and • Up to 32 bit-programmable and B byte-programmable I/O
divide instructions, Boolean and BCD operations. lines, with 2 handshake channels.
• Additional instructions support threaded-code • Interrupt structure supports:
languages, such as "Forth." o 27 interrupt sources
o 16 interrupt vectors (2 reserved for future versions)
• 325 byte registers, including 272 general-purpose
o B interrupt levels
registers, and 53 mode and control registers.
o Servicing in 600 nsec. (1 level only)
• Addressing of up to 12BK bytes of,memory.
• Full-duplex UART with special features.
• Two register pointers allow use of short and fast
instructions to access register groups within 600 nsec. • On-Chip oscillator.
• 20 MHz clock.
• Direct Memory Access controller (DMA).
• 8K byte ROM for ZBB20
• Two 16-bit counter/timers.
GENERAL DESCRIPTION
The Zilog SuperB single-chip MCU can be used for The SuperB features a full-duplex universal asynchronous
development and production. It can be used as 1/0- or ' receiver /transmitter (UARn with on-chip baud rate
memory-intensive computers, or configured to address generator, two programmable counter /timers, a direct
external memory while still supporting many I/O lines. memory access (DMA) controller, and an on-chip oscillator.
The SuperB is also available as a 4B-pin and 6B-pin ROM less
9 a 7 6 5 4 3 2 1 ~ ~ " 65 ~ 63 ~ 61
microcomputer with four byte-wide I/O ports plus a
Ne
" •• Ne byte-wide address/data bus. Additional address bits can be
Vee 11 5. Ne configured, up to a total of 16.
ROMIe" 12 58 Vee
P1a 13 57 Po,
... ,.
P1, 14
15
5•
55
Po,
P",
P2s
Vee 17
54
53
P3,
AS
PI. o vee
OND 18 SUPERB 52 OS P17 POe
Vee
XTAL2
XTAL1
"
"
21
..
51
49
P40
p..
GND
P24
P2S
P07
P34
.... 22 48 GND
vee Z8801 P3S
AS
P" 23 47 Po, GND
P40 24 48 P40 XTA12 os
P" 25 45 R/W GND
XTALI
Ne 2. 44 Ne
P47
~~~~~~~~~~~~~~~/~ P22~~rD~~~~n-~~~
Figure 18_ Pin Assignments - 68-pln PLCC
979
Pl. PO.
Pl, PO,
Pl. PO.
Pl, PO,
Pl. PO.
Pl. PO.
Pl. PO.
Ph P07
P2. pa.
P2. pa.
+5V AS
XTAL2 Os
XTALl po. SUPERB
po. po,
po. GND
po. po.
P07 po,
P2. R/W
pa. RESET
pa, pa.
P2, pa7
P2. P27
P2, P2.
pa, pa.
+5 +5 Au_
A,. +5
A7 A13
A. A.
A. A. DATA
A. An
A, liE PROTOPACK
A. AlO EPROM ADDRESS
SOCKET
A, CE
Au D7
D. D.
D, D.
D. D.
GND D,
Figure 3. Pin Assignments-28-Pin Piggyback Socket Figure 4. Pin Functions-28-Pin Piggyback Socket
Protopack
This part functions as an emulator for the basic development. When a final program is developed, it can be
microcomputer. It uses the same package and pin·out as mask·programmed into the production microcomputer
the basic microcomputer but also has a 28-pin "piggy back" device, directly replacing the emulator. The protopack part
socket on the top into which a ROM or EPROM can be is also useful in situations where the cost of mask-
installed. The socket is designed to accept a type 2764 programming is prohibitive or where program flexibility is
EPROM. desired. .
This package permits the protopack to be used in prototype
and final PC boards while still permitting user program
980
110
(BIT PROGRAMMABLE)
UUUU
PORT4 I
UART I
ADDRESS
I PORT 3
ARCHITECTURE
The SuperB architecture includes 325 byte·wide internal The UART is a full·function mUltipurpose asynchronous
registers. 272 of these are available for general purpose serial channel with many premium features.
use; the remaining 53 provide control and mode functions.
The 16·bit counters can operate independently or be
The instruction set is specially designed to deal with this cascaded to perform 32·bit counting and timing operations.
large register set. It includes a full complement of 8·bit The DMA controller handles transfers to and from the
arithmetic and logical operations, including multiply and register file or memory. DMA can use the UART or one of two
divide instructions and provisions for BCD operations. ports with handshake capability.
Addresses and counters can be incremented and
The architecture appears in the block diagram (Figure 5).
decremented as 16·bit quantities. Rotate, shift, and bit
manipulation instructions are provided. Three new
instructions support threaded·code languages.
PIN DESCRIPTIONS
The SuperB connects to external devices via the following POo·P07. P10·P17. P20·P27. P30·P37. P40·P47. Port /10
TIL·compatible pins: Lines (input/output). These 40 lines are divided into five B·bit
I/O ports that can be configured under program control for
AS. Address Strobe (output, active Low). AS is pulsed
110 or external memory interface.
Low once at the beginning of each machine cycle. The
rising edge indicates that addresses R/W and OM, when. In the ROMless devices, Port 1 is dedicated as a
used, are valid. multiplexed address/data port, and Port 0 pins can be
assigned as additional address lines; Port 0 non·address
OS. Data Strobe (output, active Low). OS provides timing
pins may be assigned as 110. In the ROM and protopack,
for data movement between the address/data bus and
Port 1 can be assigned as input or output, and Port 0 can be
external memory. During write cycles, data output is valid at
assigned as input or output on a bit by bit basis.
the leading edge of OS. During read cycles, data input
must be valid prior to the trailing edge of OS.
981
Ports 2 and 3 can be assigned on a bit-far-bit basis as it is deactivated, the Super8 begins processing at address
general I/O or interrupt lines. They can also be used as 0020H·
special-purpose I/O lines to support the UART,
counter/timers, or handshake channels. ROM less. (input, active High). This input controls the
operation mode of a 68-pin SuperB. When connected to Vee,
Port 4 is used for general I/O. the part will function as a ROM less ZBBOO. When connected
During reset, all port pins are configured as inputs (high to GND, the part will function as a ZBB20 ROM part.
impedance) except for Port 1 and Port 0 in the ROMless R/W. ReadlWrite (output). R(W determines the direction of
devices. In these, Port 1 is configured as a multiplexed data transfer for external memory transactions. It is Low
address/data bus, and Port 0 pins POO-P04 are configured when writing to program memory or data memory, and High
as address out, while pins P05-PO? are configured as inputs. for everything else.
RESET_ Reset (input, active Low). Reset initializes and starts XTAL 1, XTAL2. (Crystal oscillator input.) These pins
the Super8. When it is activated, it halts all processing; when connect a parallel resonant crystal or an external clock
source to the on-board clock oscillator and buffer.
REGISTERS
The Super8 contains a 256-byte internal register space. The uppermost 32 register direct registers (EO to FF) are
However, by using the upper 64 bytes of the register space further divided into two banks (0 and 1), selected by the
more than once, a total of 325 registers are available. Bank Select bit in the Flag register. When a Register Direct
command accesses a register between EO and FF, it looks at
Registers from 00 to BF are used only once. They can be
the Bank Select bit in the Flag register to select one of the
accessed by any register command. Register addresses CO
banks.
to FF contain two separate sets of 64 registers. One set,
called control registers, can only be accessed by register The register space is shown in Figure 6.
direct commands. The other set can only be addressed by
register indirect, indexed, stack, and DMA commands.
SET ONE
I SET TWO
FFH . - - - - - - - - . ,
41- BANK1
CONT~g~!:~I~TERS •
1-1- BANKO
(REGISTER ADDRESSING ONLY)
I- DATA REGISTERS
(INDIRECT REGISTER,INDEXED,
STACKORDMA
SYSTEM REGISTERS: ACCESS ONLY)
STACK, FLAGS, PORTS, ETC.
(REGISTER ADDRESSING ONLY)
WORKING REGISTERS
(WORKING REGISTER
ADDRESSING ONLY)
COH~ _______ ~
256
BFH . - - - - - - - - - , BYTES
OOH~ _______ ~
982
Working Register Window
Control registers R214 and R215 are the register pointers, The net effect is to concatenate the five bits from the register
RPO and RP1. They each define a moveable, 8-register pointer to the three bits from the address to form an 8-bit
section of the register space. The registers within these address. As long as the address in the register pointer
spaces are called working registers. remains unchanged, the three bits from the address will
always point to an address within the same eight registers.
Working registers can be accessed using short 4-bit
addresses. The process, shown in section a of Figure 4, The register pointers can be moved by changing the five
works as follows: high bits in control registers R214 for RPO and R215 for RP1.
• The high-order bit of the 4-bit address selects one of the The working registers can also be accessed by using full
two register pointers (0 selects RPO; 1 selects RP1). 8-bit addressing. When an 8-bit logical address in the range
192 to 207 (CO to CF) is specified, the lower nibble is used
• The five high-order bits in the register pointer select an
similarly to the 4-bit addressing described above. This is
8-register (contiguous) slice of the register space.
shown in section b of Figure 7.
• The th ree low-order bits of the 4-bit address select ol1e of
the eight registers in the slice.
I RPO (R2")
I
IIIIIIII
SELECTS
RP' (R2'S)
IIIIIIII
RPO (R2")
RP' (R2'S)
RPDOR RP1
SELECTS
ADDRESS DPCODE RPOORRP, ADDRESS
~~
~
I 1 1 1 1 1 1 1 I '-_'.....1_'.....1_0....1_0.....1--'1'--'-1---1...1.....1 ~as~TCAL ADDRESS
1
L----_~~~~~
4·81T ADDRESS PROVIDES 3 LOW-ORDER BITS
1 I 1 I, 1 1
'----___..v v
TOGETHER THEY CREATE a·BIT PHYSICAL ADDRESS
S·BIT REGISTER ADDRESS
983
Since any direct access to logical addresses 192 to 207 Register List
involves the register pointers, the physical registers 192 to
Table 1 lists the SuperS registers. For more details, see
207 can be accessed only when selected by a register
FigureS.
pointer. After a reset, RPO points to R192 and RP1 points to
R200.
Address
Decimal Hexadecimal Mnemonic Function
General-Purpose Registers
000-192 OO-BF General purpose (all address modes)
192-207 CO-CF Working register (direct only)
192-255 CO-FF General purpose (indirect only)
9S4
Table 1. Super-B Registers (Continued)
Address
Decimal Hexadecimal Mnemonic Function
I~I~I~I~I~I~I~I~I
CARRYFLAGg)j~
~
I L BANK ADDRESS
I'--____ HIGH BYTE (IP8.IP15)
-.J
ZERO FLAG L FAST INTERRUPT STATUS
I~I~I~I~I~I~I~I~I
R215 (07) RPl
~I
REGISTER POINTER 1
LEVEL 7 J ; m I
6~ L LLEVELO
LEVEL LEVEL 1
LEVEL 4 LEVEL 3
I~I~I~I~I~I~I~I~I
~I
' - - - - - - H I G H BYTE (SP8-SP15)
I
LEVEL7;mJ
LEVEL6:=..J L .LLEVELO
LEVEL 1
985
MODE AND CONTROL REGISTERS (Continued)
I~I~I~I~I~I~I~I~I
---r ~L 1 = GLOBAL INTERRUPT ENABLE
NOTUSED~ 1= FASTINTER~UPTENABLE
FAST INTERRUPT SELECT
000 LEVEL 0
001 LEVEL 1
010 LEVEL 2
011 LEVEL3
100 LEYEL4
101 LEVELS
110 LEVEL6
111 LEVEL7
'
R224. BANK 0 (EO) COCT
COUNTER 0 CONTROL
SINGLECYCLE~~
o1== CONTINUOUS
o = COUNT DOWN
1 = COUNT UP
1 = LOAD COUNTER
1 = SOFTWARE TRIGGER
llli L
L
1 = ENABLE COUNTER
READ 1
WRITE 1
1
= END OF COUNT
=RESET END OF COUNT
= ZERO COUNT INTERRUPT ENABLE
1 = SOFTWARE CAPTURE
I L!i:~=".",
INPUT PIN ASSIGNMENTS:
P2,
00001/0 1/0 , EDGE OF P2,
o 0 0 1 I{O TRIGGER
10 =
BI·VAWE MODe
0010GATE 1/0
11 = CAPTURE ON BOTH
0011GATE TRIGGER
EDGESOFP2,
o 1 0 0 110 CO INPUT
o 1 0 1 TRIGGER CO INPUT
0= EXTERNAL
01l0GATE CO INPUT
0111GATEJ UPIDOWN CONTROL P2,
TRIGGER CD INPUT 1 = PROGRAMMED
CO OUTPUT I/O UPIDOWN CONTROL
CD OUTPUT TRIGGER
1 = ENABLE RETRIGGER
CO OUTPUT GATE
CO OUTPUT GATEITRIGGER
CO OUTPUT CO INPUT
- - UNDEFINED--
- - UNDEFINED--
- CASCADE COUNTERS -
'
R225 BANKO (E11 C1CT
COUNTER 1 CONTROL
1
SINGLECYCLE~~
o1== CONTINUOUS
o = COUNT DOWN,
1 = COUNT UP
= LOAD COUNTER
1 = SOFTWARE TRIGGER
llli LL 1
1
= ENABLE COUNTER
READ 1 = END OF COUNT
WRITE 1 = RESET END OF COUNT
= ZERO COUNT INTERRUPT ENABLE
=SOFTWARE CAPTURE .
986
MODE AND CONTROL REGISTERS (Continued)
R22SBANK 1 (E1)C1M
COUNTER 1 MODE
CO INPUT
L L
CAPTURE MODE:
00 = NO CAPTURE
01 = CAPTURE ON RISING
EDGEOFP3,
10 = BI-VAWE MODE
11 = CAPTURE ON BOTH
EDGESOFP37
0= EXTERNAL
UPIDOWN CONTROL P3,
1 = PROGRAMMED
UPIDOWN CONTROL
CO OUTPUT 1/0
CO OUTPUT TRIGGER
CO OUTPUT GATE 1 = ENABLE RETRIGGER
CO OUTPUT GATEITRIGGER
CO OUTPUT CO INPUT
- - UNDEFINED--
- - UNOEFINEO--
- - , UNDEFINED--
1~1~1~1~1~1~1~I~l
IL._ _ _ _ _ HIGH BYTE (COC.-COC",) ' - - - - - - LOW BYTE (C1CD-C1C,)
I~I~I~I~I~I~I~I~I
' - - - - - - HIGH BVTE (COTCa-COTC1S) IL-_ _ _ _ _ LOW BYTE (C1 TCD-C1 TC,)
~
TRANSMIT DATA SELECT::Jj
o = OUTPUT P31 DATA
J I L 1 = TRANSMIT DMA ENABLE
I~I~I~I~I~I~I~I~I
1 = 2 STOP BITS
1
...._ _ _ _ _ _ LOW BYTE (COTCD-COTC,)
987
MODE AND CONTROL REGISTERS (Continued)
R237 BANK 0 (ED) UIE
UART INTERRUPT ENABLE
1 = CONTROL CHARACTER
INTERRUPT ENABLE
JJ
1 = WAKE-UP INTERRUPT E N A B LI E g u
I~I~I~I~I~I~I~I~I
~
' - - - - - - DATA (Do = LSB) DESKEW COUNTER =-:=J I L 1 = ,HANDSHAKE ENABLE
(RANGE 1-16)
L PORT SELECT:
1 = PORT1;0 = PORT 4
DMAENABLE:
1 = ENABLED
R240 BANK 0 (FO) POM 0= OISABLED
PORTO MODE
1~1~1~1~1~1~1~1~1
MODE:
1 = FULLY INTERLOCKED
0= STROBED
PO'MODEgu~
~
P06 MODE
~I
LL -
POD MODE
P01 MODE
R245 BANK o(F5) H1C
HANDSHAKE 1 CONTROL (WRITE ONLY)
I~I~I~I~I~I~I~I~I
I
pOs MODE P02 MODE
P04 MODE
o = 1/0; 1 = ADDRESS
P03 MODE
DESKEW COUNTER
(RANGE 1-16)
~ I L.. ~,~~~_
NOT USED
, MODE:
1 = FULLY INTERLOCKED
R240 BANK 1 (FO) DCH 0= STROBED
DMACOUNT
I~I~I~I~I~I~I~I~I
NOTUSEDT
~ T llli~ PORTO DIRECTION
O=OUTPUT
LI------~~:~~~:;~L~;R,A~N OPEN-DRAIN
E
0= DISABLE
1 = ENABLE
R241 BANK 1 (F1) DCL
DMACOUNT P3, MODE:=J I P2oMODE
00 INPUT
LI_ _ _ _ _ _ LOW BYTE (DCo-DC,) IU INPUT, INTERRUPT ENABLED
10 OUTPUT, PUSH-PULL
11 OUTPUT, OPEN-DRAIN
988
MODE AND CONTROL REGISTE.RS (Continued)
00 INPUT
01 INPUT, INTERRUPT ENABLED
R249 BANK 0 (F9) P2BM 10 OUTPUT, PUSH·PULL
PORT 2/3 B MODE (WRITE ONLY) 11 OUTPUT, OPEN·DRAIN
00
01
10
11
INPUT
INPUT, INTERRUPT ENABLED
OUTPUT, PUSH-PULL
OUTPUT, OPEN·DRAIN
1 = EVEN PARITY
1 = PARITY ENABLE
I~I~I~I~I~I~I~I~I
BITS PER CHARACTER
05 0 4
00 = 5 BITS
00 INPUT
01 INPUT, INTERRUPT ENABLED
10 OUTPUT, PUSH·PULL
11 OUTPUT, OPEN·DRAIN
07 0 6
o
o
1
1
0
1
0
1
CLOCK OUTPUT SELECT
= P21 DATA
= SYSTEM CLOCK (XTAL/2)
= BAUD·RATE GENERATOR
OUTPUT
= TRANSMIT DATA CLOCK
1 = AUTO· ECHO
~
E I L
L
1 = LOOPBACK·ENABLE
a = P20 (EXTERNAL)
1 = INTERNAL (XTAL/4)
'
1 = BAUD.RATEGENERATORENABLE
989
MODE AND CONTROL REGISTERS (Continued)
I~I~I~I~I~I~I~I~I I~I~I~I~I~I~I~I~I
LI_ _ _ _ _ _ THIS BYTE, MINUS MASKED BITS,
IS USED FOR WAKE-UP MATCH
:~~:
1 0 0 =C>A>B
1 0 1 =C>B>A SUBGROUPB
1 1 0 =A>C>B o = IRQ3 > IRQ4
1 1 1 ::: UNDEFINED 1 = IRQ4 > IRQ3
GROUPC
o = IRQ5 > (IRQG,IRQ7)
1 = (IRQG,IRQ7» IRQ5
p
R254 BANKO (FE) EMT
EXTERNAL MEMORY TIMING REGISTER
I~ I~ l~l':J ~ I~ :':".::-~"'"
1 = DATA MEMORX
STACK SELECT:
o = REGISTER FILE
1 = DATA MEMORY .
R255 BANK 1 (FF) WUMSK
WAKE-UP MASK REGISTER
990
I/O PORTS Port 1
In the ROMless device, Port 1 is configured as a byte-wide
The Super8 has 40 110 lines arranged into five 8-bit ports.
address/data port It provides a byte-wide multiplexed
These lines are all TTL-compatible, and can be configured
address/data path. Additional address lines can be added
as inputs or outputs. Some can also be configured as
by configuring Port O.
address/data lines.
The ROM and Protopack Port 1 can be configured as above
Each port has an input register, an output register, and a
or as an I/O port; it can be a byte-wide input, open-drain
register address. Data coming into the port is stored in the
output, or push-pull output. It can be placed under
input register, and data to be written to a port is stored in the
handshake control or handshake channel O.
output register. Reading a port's register address returns the
value in the input register; writing a port's register address
loads the value in the output register. If the port is configured Ports2and 3
for an output, this value will appear on the external pins. Ports 2 and 3 provide external control inputs and outputs for
When the CPU reads the bits configured as outputs, the the UART, handshake channels, and counter/timers. The
data on the external pins is returned. Under normal output pin assignments appear in Table 3.
loading, this has the same effect as reading the output Bits not used for control I/O can be configured as
register, unless the bits are configured as open-drain general-purpose I/O lines and/or external interrupt inputs.
outputs.
Those bits configured for general 110 can be configured
The ports can be configured as shown in Table 2. individually for input or output. Those configured for output
can' be individually configured for open-drain or push-pull
Table 2. Port Configuration output.
All Port 2 and 3 input pins are Schmitt-triggered.
Port Configuration Choices
The port address for Port 2 is R21 0, and for Port 3 is R211.
a Address outputs and/or general I/O
Multiplexed address/data(or I/O, only for ROM Table 3. Pin Assignments for Ports 2 and 3
and Protopack)
2and3 Control I/O for UART, handshake channels, and Port 2 Port 3
counter/timers; also general I/O and external Bit Function Bit Function
interrupts
4 General I/O a UART receive clock a UART receive data
UART transmit clock UART transmit data
2 Reserved 2 Reserved
'Port 0 Reserved
3 Reserved 3
Port 0 can be configured as an I/O port or an output for 4 HandShake a input 4 Handshake 1 input/WAIT
addressing external memory, or it can be divided and used as 5 Handshake a output 5 Handshake 1 output/OM
both. The bits configured as I/O can be either all outputs or all 6 Counter a input 6 Counter 1 input
inputs; they cannot be mixed. If configured for outputs, they 7 Counter a I/O 7 Counter 1 I/O
can be push-pull or open-drain type.
Any bits configured for I/O can be accessed via R208. To write
Port 4
to the port, specify R208 as the destination (dst) of an
instruction; to read the port, specify R208 as the source (src). Port 4 can be configured as I/O only. Each bit can be
configured individually as input or output, with either
Port 0 bits configured as I/O can be placed under handshake push-pull or open-drain outputs. All Port 4 inputs are
control of handshake channel 1. Schmitt-triggered.
Port 0 bits configured as address outputs cannot be accessed Port 4 can be placed under handshake control of
via the register. handshake channel O. Its register address is R212.
In ROMless devices, initially the four lower bits are configured
as address eight through twelve.
991
UART Receiver
The UART is a full-duplex asynchronous channel. It The UART begins receive operation when Receive Enable
transmits and receives independently with 5 to 8 bits per (URC, bit 0) is set High. After this, a Low on the receive input
character, has options for even or odd bit parity, and a pin for longer than half a bit time is interpreted as a start bit.
wake-up feature. The UART samples the data on the input pin in the middle of
each clock cycle until a complete byte is assembled. This is
Data can be read into or out of the UART via R239, Bank O.
placed in the Receive Data register. .
This single address is able to serve a full-duplex channel
because it contains two complete 8-bit registers-one for lithe 1Xclock mode is selected, external bit synch ronization
the transmitter and the other for the receiver. must be provided, and the input data is sampled on the
rising edge of the clock.
Pins
For character lengths of less than eight bits, the UART
The UART uses the following Port 2 and 3 pins: inserts ones into the unused bits, and, if parity is enabled,
th~ parity bit is not stripped. The data bits, extra ones, and
Port/Pin UART Function the parity bit are placed in the UART Data register (UIO).
2/0 Receive Clock While the UART is assembling a byte in its input shift register,'
3/0 Receive Data the CPU has time to service an interrupt and manipulate the
2/1 Transmit Clock data character in UIO.
3/1 Transmit Data
Once a complete character is assembled, the UART checks
it and performs the following:
Transmitter
• If it is an·ASCIl control character, the UART sets the
When the UART's register address is specified as the
Control Character status bit.
destination (dst) of an operation, the data is output on the
UART, which automatically adds the start bit, the • It checks the wake-up settings and completes any
programmed parity bit, and the programmed number of indicated action.
stop bits. It can also add a wake-up bit if that option is
• If parity is enabled, the UART checks to see if the
selected. calculated parity matches the programmed parity bit.. If
lithe UART is programmed for a 5-,6-, or 7-bit character, the they do not match, it sets the Parity Error bit in URC
extra bits in R239 are ignored. (R236 Bank 0), which remains set until reset by software.
Serial data is transmitted at a rate equal to 1, 1/16, 1/32 or • It sets the Framing Error bit (URC, bit 4) if the character is
1/64 of the transmitter clock rate, depending on the assembled without any stop bits. This bit remains set until
programmed data rate. All data is sent out on the falling cleared by software.
edge of the clock input.
Overrun errors occur when characters are received. faster
When the UART has no data to send, it holds the output than they are read. That is, when the UART has assembled a
marking (High). It may be programmed with the Send Break complete character before the CPU has read the current
command to hold the output Low (Spacing), which it character, the UART sets the Overrun Error bit (URC, bit 3),
continues until the command is cleared. and the character currently in the receive buffer is lost.
The overrun bit remains set until cleared by software.
992
ADDRESS SPACE
The SuperS can access 64K bytes of program memory and ROM and Protopack
64K bytes of data memory. These spaces can be either
Port 1 is configured as multiplexed address/data or as I/O.
com bined or separate. If separate, they are controlled by the
When Port 1 is configured as address/data, Port 0 lines can
DM line (Port P3s), which selects data memory when Low
be used as additional address lines, up to address 15.
and program memory when High.
External program memory is mapped above internal
Figure 9 shows the system memory space. program memory; that is, external program memory can
occupy any space beginning at the top of the internal ROM
CPU Program Memory space up to the 64K (16-bit address) limit.
Program memory occupies addresses 0 to 64K. External
CPU Data Memory
program memory, if present, is accessed by configuring
Ports 0 and 1 as a memory interface. The external CPU data memory space, if separated from
The address/data lines are controlled by AS, DS and Rlii program memory by the DM optional output, can be
mapped anywhere from 0 to 64K (full 16-bit address space).
The first 32 program memory bytes are reserved for Data memory uses the same address/data bus (Port 1) and
interrupt vectors; the lowest address available for user additional addresses (chosen from Port 0) as program
programs is 32 (decimal). This value is automatically loaded memory. Data memory is distinguished from program
into the program counter after a hardware reset. memory by the DM pin (P3s), and by the fact that data
memory can begin at address OOOOH. This feature differs
ROM less from theZS. .
EXTERNAL
PROGRAM
MEMORY EXTERNAL
DATA
MEMORY
THIS BOUNDARY )
MAY BE AT 0, OR
8192 DEPEN:~~GS~z~ 1---------1 ) ON.CHIP
ROM OR
32 r--------1 ~~~6c:ACK
INTERRUPT VECTORS
993
INSTRUCTION SET
The SuperB instruction set is designed to handle its large The following paragraphs describe each flag bit:
register set. The instruction set provides a full complement
Bank Address. This bit is used to select one of the register
of B-bit arithmetic and logical operations, including mUltiply
banks (0 or 1) between (decimal) addresses 224 and 255. It
and divide. It supports BCD operations using a decimal is cleared by the SBO instruction and set by the SB1
adjustment of binary values, and it supports incrementing
instruction.
and decrementing 16-bit quantities for addresses and
counters. Fast Interrupt Status. This bit is set during a fast interrupt
cycle and reset during the IRETfoliowing interrupt servicing.
It provides extensive bit manipulation, and rotate and shift
When set, this bit inhibits all interrupts and causes the fast
operations, and it requires no special 1/0 instructions-the
interrupt return to be executed when the IRET instruction is
1/0 ports are mapped into the register file.
fetched.
Instruction Pointer Half-Carry. This bit is set to 1 whenever an addition
A special register called the Instruction Pointer (IP) provides generates a carry out of bit 3, or when a subtraction borrows
hardware support for threaded-code languages. It consists out of bit 4. This bit is used by the Decimal Adjust (DA)
of register-pair R218 and R219, and it contains memory instruction to convert the binary result of a previous addition
addresses. The MSB is R218. or subtraction into the correct decimal (BCD) result. This
flag, and the Decimal Adjust flag, are not usually accessed
Threaded-code languages deal with an imaginary by users.
higher-level machine within the existing hardware machine.
The IP acts like the PC for that machine. The command Decimal Adjust. This bit is used to specify what type of
NEXT passes control to or from the hardware machine to the .instruction wa~ executed last during BCD operations, so a
imaginary machine, and the commands ENTER and EXIT subsequent Decimal Adjust operation can function
are imaginary machine equivalents of (real machine) CALLS correctly. This bit is not usually accessible to programmers,
and RETURNS. and cannot be used as a test condition.
If the commands NEXT, ENTER, and EXIT are not used, the Overflow Flag. This flag is set to 1 when the result of a
IP can be used by the fast interrupt processing, as twos-complement operation was greater than 127 or less
described in the Interrupts section. than -128. It is also cleared to 0 during logical operations.
Sign Flag. Following arithmetic, logical, rotate, or shift
Flag Register
operations, this bit identifies the state of the MSB of the
The Flag register (FLAGS) contains eight bits that describe result. A 0 indicates a positive number and a 1 indicates a
the current status of the SuperB. Four of these can be tested negative number.
and used with conditional jump instructions; two others are Zero Flag. For arithmetic and logical operations, this flag is
used for BCD· arithmetic. FLAGS also contains the Bank set to 1 if the result of the operation is zero.
Address bit and the Fast Interrupt Status bit.
For operations that test bits in a register, the zero bit is set to 1
The flag bits can be set and reset by instructions. if the result is zero.
For rotate and shift operations, this bit is set to 1 if the result is
zero.
Carry Flag. This flag is setto 1 ifthe result from an arithmetic
CAUTION operation generates a carry out of, or a borrow into, bit 7.
Do not specify FLAGS as the destination of an After rotate and shift operations, it contains the last value
instruction that normally affects the flag bits or the shifted out of the specified register.
result will be unspecified.
It can be set, cleared, or complemented by instructions.
994
Condition Codes Addressing Modes
The flags C, Z, S, and V are used to control the operation of All operands except for immediate data and condition
conditional jump instructions. codes are expressed as register addresses, program
memory addresses, or data memory addresses. The
The opcode of a conditional jump contains a 4-bit field
addressing modes and their designations are:
called the condition code (cc). This specifies under which
conditions it is to execute the jump. For example, a Register (R)
conditional jump with the condition code for "equal" after a Indirect Register (IR)
compare operation only jumps'if the two operands are Indexed (X)
equal. Direct (DA)
Relative (RA)
The condition codes and their meanings are given in
Immediate (1M)
Table 4.
Indirect (IA)
995
Registers can be addressed by an 8-bit address in the range Notation and Encoding
of 0 to 255. Working registers can also be addressed using
The instruction set notations are described in Table 5.
4-bit addresses, where five bits contained in a register
pointer (R218 or R219) are concatenated with three bits
Functional Summary of Commands
from the 4-bit address to form an 8-bit address.
Figure 10 shows the formats followed by a quick reference
Registers can be used in pairs to generate 16-bit program or
guide to the commands.
data memory addresses.
'l'w'o-Byte Instructions
cc loPC ds. JR
996
Three-Byte I structions
,---:-,,---, AoC, ADD, AND, CP, Lo, OR, PUSHUo,
OPC d,' '----"'''-----' PUSHUI, SBC, SUB, TCM, TM, XOR
OPC
Four-Byte In tructions
INSTRUCTION SUMMARY
997
INSTRUCTION SUMMARY (Continued)
998
INSTRUCTION SUMMARY (Continued)
------
RP1 ~IM + 8
PUSHUI dst, src IR R 83
IR~IR + 1 SRPO 1M 31 ------
dst ~ src RPO-IM
RLdst R 90 ****--
C ~dst(7) IR 91
dst (0) ~ dst (7)
dst (N + 1) ~ dst (N)
N = Ot06
999
INSTRUCTION SUMMARY (Continued)
1000
SUPER-8 OPCODE MAP
legend: *Examples:
r 4·blt address
= BOR rO·R2
NOTE A NOTEB NOTEC
R = B·blt address IS BOR r1 ,b,R2
b = bit number or BOR r2,b,R,
Rl or (, = dst address LOC f1,lrr2
R2 or (2 = src address IS LDC r1 ,lrr2 :;;:; program
or LDE (1,lrr2 ;;; data
NOTED NOTEE
Sequence:
Opcode, first, second, third operands
1001
INSTRUCTIONS
Table 7. Super81nstructions
1002
INTERRUPTS
The SuperB interrupt structure contains B levels of interrupt, The vector number is used to generate the address of a
16 vectors, and 27 sources. particular interrupt servicing routine; therefore all interrupts
using the same vector must use the same interrupt handling
Interrupt priority is assigned by level, controlled by the
routine.
Interrupt Priority register (IPR). Each level is masked (or
enabled) according to the bits in the Interrupt Mask register
Levels
(IMR), and the entire interrupt structure can be disabled by
clearing a bit in the System Mode register (R222). Levels provide the top level of priority assignment. While the
sources and vectors are hardwired within each level, the
The three major components of the interrupt structure are
priorities of the levels can be changed by using the Interrupt
sources, vectors, and levels. These are shown in Figure 10
Priority register (see Figure B for bit details).
and discussed in the following paragraphs.
If more than one interrupt source is active, the source from
Sources the highest priority level will be serviced first. If both sources
are from the same level, the source with the lowest vector will
A source is anything that generates an interrupt. This can be
have priority. For example, if the UART Receive Data bit and
internal or external to the SuperB MCU. Internal sources are
UART Parity Error bit are both active, the UART Parity Error
hardwired to a particular vector and level, while external
bit will be serviced first because it is vector 16, and UART
sources can be assigned to various external events.
receive data is vector 20.
External interrupts are falling-edge triggered.
The levels are shown in Figure 12.
Vectors
The 16 vectors are divided unequally among the eight
levels. For example, vector 12 belongs to level 2, while level
3 contains vectors 0, 2, 4, and 6.
INTERRUPT SOURCES
PorNG --,-
VECTORS ~
COUNTER 0 ZERO COUNT
EXTERNAL INTERRUPT (P2,)
! 12 IR02
I
EXTERNAL INTERRUPT (P27) I
COUNTER 1 ZERO COUNT
I
1,.
I
IROS
EXTERNAL INTERRUPT (P3,)
EXTERNAL INTERRUPT (P37) I
I
I
I
I
~;~~:~:t,~~~~~~~~ ~P24) I 1 28
IRQ4
RESERVED
I '0
I
12
RESERVED IR03
I
14
EXTERNAL INTERRUPT (P3,)
I •
EXTERNAL INTERRUPT (P22)
I
I
18
EXTERNAL INTERRUPT (P2,)
1003
Enables Two hardware registers support fast interrupts. The
Instruction Pointer (IP) holds the starting address of the
Interrupts can be enabled or disabled as follows:
service routine, and saves the PC value when a fast interrupt
• Interrupt enable/disable. The entire interrupt structure occurs. A dedicated register, FLAG', saves the contents of
can be enabled or disabled by setting bit 0 in the System the FLAGS register when a fast interrupt occurs.
Mode register (R222).
. To use this feature, load the. address oi the service routine in
• Level enable. Each level can be enabled or disabled by the Instruction Pointer, load the level number into the Fast
setting the appropriate bit in the Interrupt Mask register Interrupt Select field, and turn on the Fast Interrupt Enable
(R221). bit in the System Mode register.
• Level priority. The priority of each level can be controlled When an interrupt occurs in the level selected for fast
by the values in the Interrupt Priority register (R255, Bank interrupt processing, the following occurs:
0).
• The contents of the Instruction Pointer and Program
• Source enable/disable. Each interrupt source can be Counter are swapped.
enabled or disabled in the sources' Mode and Control
• The contents of the Flag register are copied into FLAG:
register.
• The Fast Interrupt Status Bit in FLAGS is set.
Service Routines
• The interrupt is serviced.
Before an interrupt request can be granted, a) interrupts
• When IRET is issued after the interrupt service outline is
must be enabled, b) the level must be enabled, c) it must be
completed, the Instruction Pointer and Program Counter
the highest priority interrupting level, d) it must be enabled at
are swapped again.
the interrupting source, and e) it must have the highest
priority within the level. • The contents of FLAG' are copied back into the Flag
register.
If all this occurs, an interrupt request is granted.
• The Fast Interrupt Status bit in FLAGS is cleared.
The SuperB then enters an interrupt machine cycle that
completes the following sequence: The interrupt servicing routine selected for fast processing
should be written so that the location after the IRET
• It resets the Interrupt Enable bit to disable all subsequent
instruction is the entry point the next time the (same) routine
interrupts.
is used.
• It saves the Program Counter and status flags on the
stack. Level or Edge Triggered
• It branches to the address contained within the vector Because internal interrupt requests are levels and interrupt
location for the interrupt. requests from the outside are (usually) edges, the hardware
for external interrupts uses edge-triggered flip-flops to
• It passes control to the interrupt servicing routine.
convert the edges to levels.
When the interrupt servicing routine has serviced the
The level-activated system requires that interrupt-serving
interrupt, it should issue an interrupt return (IRET)
software perform some action to remove the interrupting
instruction. This restores the Program Counter and status
source. The action iilVolved in serving the interrupt may
flags and sets the Interrupt Enable bit in the System Mode
remove the source, or the software may have to actually
register.
reset the flip-flops by writing to the corresponding Interrupt
Pending register.
Fast Interrupt Processing
The SuperB provides a feature· called fast interrupt
processing, which completes the interrupt servicing in 6
clock periods instead of the usual 22.
1004
STACK OPERATION
The SuperB architecture supports stack operations in the be used as a general-purpose register, but its contents will
register file or in data memory. Bit 1 in the external Memory be changed if an overflow or underflow occurs as the result
Timing register (R254 bank 0) selects between the two. of incrementing or decrementing the stack address during
normal stack operations.
Register pair 216-217 forms the Stack Pointer used for all
stack operations. R216 is the MSB and R217 is the LSB.
User-Defined Stacks
The Stack Pointer always points to data stored on the top of
The SuperB provides for user-defined stacks in both the
the stack. The address is decremented prior to a PUSH and
register file and program or data memory. These can be
incremented after a POP.
made to increment or decrement on a push by the choice of
The stack is also used as a return stack for CALLs and opcodes. For example, to implement a stack that grows
interrupts. During a CALL, the contents of the PC are saved from low addresses to high addresses in the register file, use
on the stack, to be restored later. Interrupts cause the PUSHUI and POPUD. For a stack that grows from high
contents of the PC and FLAGS to be saved on the stack, for addresses to low addresses in data memory, use LDEI for
recovery by IRET when the interrupt is finished. pop and LDEPD for push.
When the SuperB is configured for an internal stack (using
the register file), R217 contains the Stack Pointer. R216 may
COUNTER/TIMERS
The SuperB has two identical independently programmable The counterltimers can also be programmed to capture the
16-bit counterltimers that can be cascaded to produce a count value at an external event or generate an interrupt
single 32-bit counter. They can be used to count external whenever the count reaches zero. They can be turned on
events, or they can obtain their input internally. The internal and off in response to external events by using a gate and/or
input is obtained by dividing the crystal frequency by four. a trigger option. The gate option enables counts only when
the gate line is Low; the trigger option turns on the counter
The counter/timers can be set to count up or down, by
after a transient High. The gate and trigger options used
software or external events. They can be set for single or
togethe(cause the counterltimer to work in gate mode after
continuous cycle counting, and they can be set with a
initially being triggered.
bi-value option, where two preset time constants alternate in
loading the counter each time it reaches zero. This can be The control and status register bits for the counterltimers are
used to produce an output pulse train with a variable duty shown in Figure 5.
cycle.
DMA
The SuperB features an on-chip Direct Memory Access data memory. A 16-bit count register determines the
(DMA) channel to provide high bandwidth data number of transactions to be performed; an interrupt can be
transmission capabilities. The DMA channel can be used by generated when the count is exhausted. DMA transfers to or
the UART receiver, UART transmitter, or handshake channel from the register file require six CPU clock cycles; DMA
O. Data can be transferred between the peripheral and transfers to or from external memory take ten CPU clock
contiguous locations in either the register file or external cycles, excluding wait states.
1005
ABSOWTE MAXIMUM RATINGS
Voltage on all pins with respect Stresses greater than these may cause permanent damage to the device.
to ground ....................... - 0.3V to + 7.0V This IS a stress rating only; operation of the device under conditions more
severe than those listed for operating conditions may cause permanent
Ambient Operating
damage to the device. Exposure to absolute maximum ratings for
Temperature .............. See Ordering Information extended periods may also cause permanent damage.
Storage Temperature ............. '.- 65°C to + 150°C
DC CHARACTERISTICS
VCH Clock Input High Voltage 3.8 Vcc V Driven by External Clock Generator
VCl Clock Input Low Voltage -0.3 0.8 V Driven by External Clock Generator
VIH Input High Voltage 2.2 Vcc V
Vil Input Low Voltage -0.3 0,8 V
VRH Reset Input High Voltage 3.8 Vcc V
VRl Reset Input Low Voltage -0.3 0.8 V
VOH Output High Voltage 2.4 V IOH = -400,..A
VOL Output Low Voltage 0.4 V IOl = +4.0mA
III Input Leakage -10 10 ,..A
IOl Output Leakage -10 10 ,..A
IIR Reset Input Current -50 ,..A
Icc VCC Supply Current . 320 mA
1006
INPUT HANDSHAKE TIMING
1007
OUTPUT HANDSHAKE TIMING
~:::::I----j-I~--'--6-----
DATA OUT ~__________________________
1008
AC CHARACTERISTICS (20 MHz)
Read/Write
RIW
PORTO
DM
PORT 1
~------------~12~----------~~-----::I
External MemDry Read and Write Timing
1009
ADDRESS OUT ~ ~O'A13 x\._____
----'11-0-.~------
1 -""(0-';:======-=-:"~~11--..J
- -- -- -- -
1010
PERIPHERAL PRODUCTS
1011
AOVANCE INFORMATION SPECIFICATION
Z86128
CLOSED-CAPTIONED CONTROLLER
FEATURES
• Complete stand-alone Line 21 Closed-Caption • On-board character font ROM - 6x9 cllaracter in
Controller 8x13 cell
-Conforms to FCC Line 21 Closed-Caption - Character rounding - 12x18 actual character cell
Specifications
- Visual Attributes
• Simple system interface Color
Underline
• Requires only two inputs to operate Italic
Blink
- Composite video
- H flyback • Smooth scrolling
• On-board Analog Sync and Data Slicer • Automatic screen blanking after 1.5 sec with no input.
• CMOS VLSI design for low power and low cost III Automatic erase after 16 sec with no input
GENERAL DESCRIPTION
The Z86128 Line 21 Closed-Caption Controller is a single The Line 21 Closed Captioning System
IC, designed to provide the functional performance of a
Line 21 Closed-Caption depicted in the Figure 1 Decoder The Line 21 Closed-Caption system provides for the trans-
module. This Super Integration™ VLSI device is com- mission of CAPTION information and otller "lEX"I material
pletely self contained, requiring only composite video, H as an encoded composite data signal tllis is during tile
Flyback inputs and an external keyer* to produce cap- unblanked portion of Line 21. field 1 of the standard NTSC
tioned video. The Z86128 uses a wired logic approach to video signal. In addition, a framing code is transmitted
perform the functions selected through its input control during the first half of Line 21, field 2. The encoded
signals. It is fabricated using standard CMOS technology composite video signal for Line 21, field 1 and 2 is sllown
and designed to achieve the lowest possible cost. in Figure 2. The video signal conforms to the Standard
Synchronizing Waveform for Color Transmission given in
The Z86128 is intended for use in a set-top decoder or in Sub-part E, Part 73 of the FCC Rules and Regulations.
any television receiver conforming to the NTSC standard.
It is capable of processing all standard Line 21
closed-caption format transmissions. If and when PAL
and SECAM TV standards define a protocol using the Line
21 format, this design will be readily convertible to that
standard.
1013
Scan Line 21·
Scan Line 22
Scan Line 96
TextfCaption Row
TextfCaption Row
TextlCaplion Row i} Captions or
Text
00
Text Row
Text Row
J}
Text Row Active
Text Row Text Only Video
Text Row
0
Text Row
Text Row 11
Scan Line 187 T extfCaption Row
TextfCaption Row 13
12} Captions or
Text/Caption Row 14 Text
Scan Line 238 TextfCaption Row 15
·Scan Line 21 is the last scan Line of the vertical retrace blank interval
50
25
20
o Odd Field
-40 Program
IRE*
Units Hsync ~~~~
Even Field
Iv PP = 140 IRE
Fifteen additional displayable characters are sent by transmitting a two-byte code. The byte pair has a non-printing
1014
PIN DESCRIPTION (Actual pinout to be defined)
Pin 5 Vss
IC ground. Connect to system ground
1015
FUNCTIONAL DESCRIPTION
The composite data signal contained within the active to that data channel until a unique command code is
portion of Line 21 consists of a seven cycle sine-wave received for another data channel. The Alarm On and
clock run-in burst. a start bit and 16 bits of data. These 16 Alarm Off codes are an exception to this rule. Alarm codes
bits consist of two 8-bit alphanumeric characters formu- are ignored by everything except the Alarm output control
lated according to the USA Standard Code for Information circuits.
Interchange (USASCII; x 3.4-1967) with odd parity. The
clock rate is 0.5035 MHz which is 32fH. The clock burst The 7-bit ASCII table defines two types of information,
and data packet are 50 IRE units peak-to-peak and are printing and non-printing. Printable data are data bytes
filtered to a "2T" response. Data is sent with the least having values between, x0100000 (20H) and x111111
significant bit(bitD1 ) being sentfirst and the most significant (7FH), where x represents the parity bit. Data bytes having
bit (bit 08, the parity bit) sent last. values between xOOOOOOO (OOH) and xOO11111 (1 FH) are
called non-printing characters since they have no
Multiplexed Data Channels displayable font character in the standard ASCII table.
The Line 21 closed-captioned system defines four differ-
ent data channels which can be time multiplexed within the Displayable Character Set
Line 21 data stream. They are Captions - LANGUAGE I The specifications' define a modified ASCII table charac-
(C1), Captions - LANGUAGE II (C2), Text - LANGUAGE I ter set where eight of the alphanumeric characters have
(T1) and Text - LANGUAGE II (T2). Both languages can be been changed to provide some foreign characters.
English in either case.
In addition, 15 additional characters are defined by spe-
TEXT is defined as non-video related information therefore cial character commands. The changes from the standard
its display can fill the screen. TEXT mode displays a black ASCII table characters are shown in Table 1.
box 15 rows high by 34 columns wide. Text appears
starting at the top with a maxim,um of 32 characters per row • - The PBS 1979 specifications are slightly different than
(the first and last character locations are always blank and the NCI 1985 specifications. The information presented
used for asserting visual attributes). When all 15 rows have . here essentially conforms to the NCI specifications with the
been usea, the display scrolls up as additional information exception of the response to "space" characters.
is received.
. Table 1. Different ASCII Characters
Captions are video related information so they are not
Hex ASCII Une21
permitted to overwrite the entire screen. Captions may only
be displayed in the top four rows and/or the bottom four Code Value Value
rows, in any combination. Eight rows may be displayed at 2A a
one time. All the rows in each caption appear at once in 5C \ e
Pop-on Captions mode. 5E A
Data Format
1016
Fifteen additional displayable characters are sent by trans- Data Channel Commands. All the data channel command
mitting a two-byte code. The byte pair has a non-printing codes use the non-printing character 14H for LANGUAGE
character followed by a printing character, where the non- I and 1CH for LANGUAGE II. The printing character
printing character is 11 H for LANGUAGE I and 19H for determines the particular command function. The com-
LANGUAGE II. The printing character determines the mands are shown in Table 3. The printing character's value
special font character that will be displayed according to is given in Hex.
Table 2.
Table 3. Data Channel Commands
Table 2. Print Character Font Determination (Command = 14H + Hex code below)
Print Character Data Channel = Captions (C1 or C2) Hex
30 1/4 Print Function
31 #
32 1/2 20 Resume Caption Loading (off screen)
33 G 25 Resume 2 Line Roll-up
34 3/4 26 Resume 3 Line Roll-up
35 ¢ 27 Resume 4 Line Roll-up
1017
FUNCTIONAL DESCRIPTION (Continued)
Data Location and Attribute Codes. Additional codes are The Precodes identify the display row and character
used for positioning the data on the screen and for control- attributes for the caption data that follows it. These at-
ling the character attributes. There are two location at- tributes hold for the entire line unless changed by a
tributes, row and column (indent) position and three Midcode or Indent code. All the non-printing characters,
character attributes, color, italics and underline. All 11 H-14H for LANGUAGE I and 19H - 1CH for LANGUAGE
attribute information is contained in the Preamble Codes II are used. The code pair assignments for the location and
(Precodes) and Midrow Codes (Midcodes). character attributes are given in Table 4. The grid repre-
sents LANGUAGE I only. To use the grid for
LANGUAGE II simply replace the non-printcodes
(IIH-14H) with 19H-ICH.
1018
Table 4. Code Pair Assignments for Location and Character Attributes
Non-print 1-11H-1 1-12H-1 1-13H-1 1-14H-1
Caption Row 2 3 4 12 13 14 15
ATTRIBUTE
Monochrome 40 60 40 60 40 60 40 60
Mono Underline 41 61 41 61 41 61 41 61
Green 42 62 42 62 42 62 42 62
Green Underline 43 63 43 63 43 63 43 63
Blue 44 64 44 64 44 64 44 64
Blue Underline 45 65 45 65 45 65 45 65
Cyan 46 66 46 66 46 66 46 66
Cyan Underline 47 67 47 67 47 67 47 67
Red 48 68 48 68 48 68 48 68
Red Underline 49 69 49 69 49 69 49 69
Yellow 4A 6A 4A 6A 4A 6A 4A 6A
Yellow Underline 4B 6B 4B 6B 4B 6B 4B 6B
Magenta 4C 6C 4C 6C 4C 6C 4C 6C
Magenta Underline 40 60 40 60 40 60 40 60
Italics (mono) 4E 6E 4E 6E 4E 6E 4E 6E
Italics Underline 4F 6F 4F 6F 4F 6F 4F 6F
Indent 0 (mono) 50 70 50 70 50 70 50 70
Indent 0 Underline 51 71 51 71 51 71 51 71
Indent 4 52 72 52 72 52 72 52 72
Indent 4 Underline 53 73 53 73 53 73 53 73
Indent8 54 74 54 74 54 74 54 74
Indent 8 Underline 55 75 55 75 55 75 55 75
Indent 12 56 76 56 76 56 76 56 76
Indent 12 Underline 57 77 57 77 57 77 57 77
Indent 16 58 78 58 78 58 78 58 78
Indent 16 Underline 59 79 59 79 59 79 59 79
Indent 20 5A 7A 5A 7A 5A 7A 5A 7A
Indent 20 Underline 5B 7B 5B 7B 5B 7B 56 7B
Indent 24 5C 7C 5C 7C 5C 7C 5C 7C
Indent 24 Underline 50 70 50 70 50 70 50 70
Indent 28 5E 7E 5E 7E 5E 7E 5E 7E
Indent 28 Underline 5F 7F 5F 7F 5F 7F 5F 7F
The Midcodes are used to change the character attributes assigned by the Midcode. These hold until the end of the
in the middle of a caption row. The Midcode occupies a row unless changed by another Midcode. The Indent
space in the display and causes a black box to appear just codes listed above in the Precode table actually perform
as if the space character 20H had been sent. The charac- in the same manner as a Midcode. Indent commands
ters following the Midcode are displayed with the attributes move the pointer in increments of 4 across the screen.
1019
The Midcodes use the non-printing characters 11 Hand A display row contains a maximum of 32 characters plus
19H, respectively, for the two Languages. The printing a leading and trailing blank box, each a character cell in
character of the two byte pair contains the character width, making the overall width of a display row 34 x 8 =272
attributes as shown in Table 5. dots. Successive display rows are butted together so that
the total display occupies 195 dots high. The black box is
Table 5. Print Character Attributes 34 character cells wide by 195 dots high resulting in a box
size of 45.018 usec in width by 195tv scan lines in height.
Print Character Attribute When centered in the video display, this box will start 13
20 Monochrome usec after the leading edge of H in-scan line 43 and
21 Monochrome Underline extend-to-scan line 237. This places the display within the
22 Green safe title area for NTSC receivers. Character width is 42.37
23 Green Underlined usec also centered on the screen, resulting in a leading
and trailing 1.32 usec black border. '
24 Blue
25 Blue Underlined
26 Cyan Text Mode Display
When TEXT mode, in either language, has been selected
27 Cyan Underlined (and valid Line 21 code has been detected in the incoming
28 Red video) the 15 row by 34 character black box appears,
29 Red Underlined Received TEXT cllaracters are displayed as they are
2A Yellow received starting in tile top row, Successive carriage
2B Yellow Underlined returns (new line command) moves the display row/col-
2C Magenta umn pOinter down successive rows until all 15 display rows
2D Magenta Underlined have been used, Thereafter, the text scrolls up as new
2E Italics characters are added to the bottom row,
2F Italics Underlined
If the data for the selected channel is interrupted by a
command for another channel, data processing stops but
DECODER OPERATION the display remains, When a Resume Text command is
received, data processing will resume and the new char-
The Z86128 provides full function Line 21 performance. acters are added starting at the position that the display
Switch selection inputs are included to enable the decoder row/column pointer was prior to the interruption of data
to process and display any of the four data channels (C1, processing, If a Start Text command is received, the
C2, T1 or T2) transmitted in Line 21 of the incoming video. display is cleared and new characters are displayed
An additional input, Decoder ON/OFF, controls the dis- starting in row 1 (top) column 1 (left side)
play. When switched to the decoder off (TV) state, incoming
data in the selected channel is still processed but not When scrolling, the display will shift one scan line per
displayed. An internal pad is also provided to select field frame until a complete row has been scrolled, If a carriage
1 or field 2 operation which is present for field 1 operation return is received before scrolling is complete, the display
at this time. immediately completes the "scroll" by jumping up the
remaining scan lines and starts displaying the new text.
Display Format
There will never be any transparent boxes in the TEXT
Characters are displayed as white or colored; dot matrix display.
character on a black background. The characters are
described by 6 X 9 dot patterns within a character cell Caption Mode Display
which is 8 dots wide by 13 dots high. This leaves a one dot When Caption mode, in either language, has been se-
border of black around each character and provision for lected, the screen is transparent (display box disappears).
one scanline for underline, offset by one scanline of black, Caption data only appears in the top four rows: rows 1-4,
between the character and the bottom edge of the cell. and/or in the bottom four rows, rows 12-15, in any combi-
Character luminance is 90 IRE units and the black box nation. The form of the caption display depends on the
surround, 10 IRE units. caption mode indicated by the transmitted caption com-
mand, Pop-on, Paint-on or Roll-up.
The character ROM consists of 12 X 18 dot matrix pattern
per character. Alternate rows and columns are read out of
each field to produce an interleaved and rounded charater.
1020
Pop-on captions work with two caption memories. One of Three other events can also cause the display to be
them is always being displayed while the other is being erased. First, changing the data channel for processing by
used to accumulate new caption data. A new caption is switclling between CAPTIONs and TEXT, or between
popped-on by swapping the two memories (the show LANGUAGEs I and II, clears the memory and hence the
caption command). When the on-screen memory is erased, display. Secondly, if the autoblanking circuit is activated
the screen is blank (transparent) and the memory defaults
to the row/column pointer at row 1, column 1 and mono- by the loss of valid code, then the display is turned off and
chrome non-underlined. the memory cleared. Lastly, in the Caption mode, if novalid
caption command in the selected language is received for
When caption mode is selected, the decoder processes a 16 second period, the on-screen memory is erased.
any data following the Resume Caption Loading (RCL)
command (or the Show Caption command). Normally, this The autoblanking circuit maintains the status of tile pres-
command is followed by a Precode to indicate the row, ence of valid data. The decoder is held in tile Decoder off
column and character attributes to be used with the (TV) state until data is continuously detected for a period
following data. If no Precode is received the data is added of 0.5 seconds. Once the valid data decision has been
to the location last indicated by the row/column pOinter made, and assuming that the user has selected the Decoder
prior to the receipt of the RCL command and with the on state, the normal display for the data channel selected
character attributes previously assigned. is presented.
Paint-on caption mode is essentially equivalent to the The autoblanking circuit will not be activated again unlil
Pop-on mode except that the data received after the valid data has been lost for 1.5 seconds. Any valid data
Resume Direct Loading (RDL) command is written to the received during the 1.5 second period resets the counter
on-screen memory rather than the off-screen memory. All so that the autoblanking will only be activated on continu-
the rules for Precodes, Midcodes, etc., are otherwise the ous loss of data for 1.5 seconds.
same.
Roll-up caption mode presents a "text" like display that is BLOCK DIAGRAM DESCRIPTION
limited to the bottom 2, 3 or 4 rows depending on the
Resume Roll-up (RRn) command used. In this case, a The Z86128 is designed to provide the functional perfor-
black box does not appear until characters are being mance of a Line 21 Closed-Caption decoder with only two
displayed and the box is only wide enough to provide a input signals being required, Composite Video and H
leading and trailing box in each line. The new data Flyback. The Decoder performs two basic functions, namely
appears in the bottom row and as each carriage return is extracting the Line 21 code from the incoming video and
received, the row scrolls up and the new data added to the converting the recovered code, for the channel selected,
bottom. When the number of rows indicated by the Resume inlo displayable information. Figure 3 shows Ihe Z86128's
command has been reached, the data in the top row block diagram.
scrolls off as new data is added to the bottom.
The Z86128 generates its own H and V sync signals so thaI
In all the caption display modes "black box" is dropped all internal processing is performed with noise immune
whenever there are three or more consecutive spaces. signals. The decoder design has been formulaled to
The number of boxes dropped are two less than the total achieve the best performance at the lowest possible cost.
number of consecutive spaces so that the two characters
that are separated by the transparent space will both have
adjoining boxes.
1021
...
~
+5V
f--------------------------------------'1 -------------------- - - - I
Test2
_ _, 15
COMPVldeo
l'
'I
Clamp Test 1 ~ 14
,
"T1 2, SUce Level
SYNC Slicer
is:
c
;a
~
§l...
r COMPSYNC
.'"6 fl
g>
~
...J
!!:
<II
~
LL
10
9
L.cop
Riter
,---------
--------------i --,
6 7 8
PFD Vss
L ____ _
3
H Ayback
Input Signals Timing and Synchronizing Circuits
The Composite Video input should be a signal which is All internal tirning and synchronizing signals are derived
nominally 1 V p-p with sync tips negative and band limited from the ori-board 12 MHz VCO. Its output is the Dot Clk
to 600 KHz. The Z86128 operates with in an input level signal used to drive the Horizontal and Vertical counter
variation of 0.5 to 2.0 v p-p. chains and for display timing. No external cornponents are
required to bring it within the pull-in range of the Phase!
H Flyback is a TTL level input signal which provides Frequency detector.
horizontal sync information for the Phase/Frequency de-
tector. It maintains a coarse lock of the VCO whether The Horizontal Counter is a divide by 768 circuit with
composite video is present of not. This signal can also be intermediate outputs needed to generate tile timing logic
used in future applications to provide horizontal timing signals used in data recovery and data output (display). It
information in the absence of video. It can be positive or produces pulse signals at 1H, 2H, 32H and 48H rates as
negative polarity. well as the horizontal square wave, Q768, that is used to
phase lock the VCO.
Video Input Signal Processing
The Vertical Counter and Control circuits produce a noise
The Camp Video input is AC coupled to the IC and the sync free vertical pulse by dividing the horizontal signal in a 525
tip is internally clamped to a fixed reference voltage. counter. The internal synchronizing signals are phased up
Initially, the signal is clamped using a simple clamp, but with the incoming video by comparing the internally gen-
improved impulse noise performance is achieved once erated vertical pulse to an input vertical pulse derived from
the internal sync circuits lock to the incoming signal. Noise the Camp Sync signal provided by the Sync Slicer. When
rejection is obtained by making the clamp operative only proper phasing has been established, this circuit outputs
during the sync tip. The clamped composite video signal the LOCK signal which is used to provide additional noise
is fed to both the Data Slicer and Sync Slicer blocks. immunity to the slicing circuits.
The Data Slicer generates a clean TTL level data signal by The LOCKed state is established only after several suc-
slicing the signal at its midpoint. The slice level is estab- cessive fields have occurred in which these two vertical
lished on an adaptive basis during Line 21 of the odd field. pulses remain in sync. Once LOCKed, the internal timing
The resultant value is stored until the next odd field Line 21 will flywheel until such time as the two vertical pulses lose
begins. A high level of noise immunity is achieved by using coincidence for a number of consecutive fields. Until
this process. LOCK is established, the decoder operates on a pulse for
pulse basis.
The Data Clock Recovery circuit produces a 32H clock
signal (DCLK) that is locked in phase to the sliced clock Data Recovery
run-in burst obtained from the Data Slicer. The Dot Clock
is locked in phase with H sync but the DCLK phase is not The Data Recovery circuits perform the initial processing
determined until occurrence of Line 21 data. When Line 21 of the data in Line 21. The sliced data is relocked using
code appears, DCLK phase lock is achieved during the DCLK and the relocked data stream is checked for the
clock run-in burst and used to reclock the sliced data. presence of valid data. When data is present the two bytes
Once phase lock is established it is maintained until a are clocked into the Serial/Parallel register and output in
change in video signal occurs. parallel form.
. The Sync Slicer processes the clamped Comp Video This block checks the bytes for valid (odd) parity. It also
Signal to extract Camp Sync, which is then used to lock the deterrnines whether the recovered byte pair is a repeat of
internally generated sync to the incoming video. Sync the previously received byte pair. That information is used
slicing is performed in two steps. Initially, the sync is sliced with the redundancy flag in the Command Processor to
at a fixed offset level from the sync tip. When the internal determine whether the command should be executed or
vertical counter locks, the slice level reference switches not.
from a fixed to an adaptive basis. An external capacitor
stores the slice level.
1023
Command Processor
The Command Processor circuits control the manipulation During the display lime (line 43-237), the Command Pro-
of the data for storage and display. ,It decodes the control cessor controls the operations of the Display RAM, Char-
inputs (Decoder ON/OFF, Captions/Text, LANGUAGE 1/11) acter ROM and output Logic circuits.
to determine the display status desired and the data
channel selected. This information is then used to perform Memory and Display Circuits
its most important function, the control of the loading,
addressing and clearing of the Display RAM. These circuits operate together to generate the output
color signals R, G, B and the monochrome signals Lumi-
During data recovery lime (TV lines 21-42), the Command nance and Box. The character ROM contains the dot
Processor transfers only the data received for the data pattern for all the characters but not the underline char-
channel selected, to the RAM for storage and display. In acteristic. Theoutputlogic provides the hardware underline
those cases such as special characters, mid codes, parity control circuits and the Italics slant generator. The smooth
errors etc., where the data stored or action to be taken is scroll display control is also performed in the output logic
different than the specific bytes received, the Command block.
. Processor converts the input data to the appropriate form.
1024
~ Zilm Product Specification
Z765AFDC
Floppy Disk Controller
October 1988
FEATURES
Address Mark detection circuitry internal to the FDC • Drives up to 4 floppy-disk drives (FDD)
simplifies the phase locked loop and read electronics. The
• Data transfers in DMA or non-DMA mode
track stepping rate, head load time, and head unload time
are user-programmable. • Parallel seek operations on up to four drives
Z765A features are: • Compatible with most general-purpose microprocessors
• IBM-compatible format, Single and Double Density • Single phase a MHz clock
.. Multisector and multitrack transfer capability • +5VOnly
• Data scan capability-scans a single sector or an entire • 40-Pin Dual-In-Une (DIP) package. 44-Pin plastic
cylinder comparing byte-for-byte host memory and disk Chip carrier (PLCC) package.
data
GENERAL DESCRIPTION
The Z765A is an LSI Floppy Disk Controller (FOG) chip • READ DATA
which contains the circuitry and control functions for
interfacing a processor to four floppy-disk drives. It supports • WRITE DATA
IBM System 3740 Single Density format (FM) and IBM • WRITE DELETED DATA
System 34 Double Density format (MFM) including
double-sided recording. The Z765A provides control • READ DELETED DATA
signals which simplify the design of an external phase • READ TRACK
locked loop and write precompensation circuitry. The FDC
simplifies and handles most of the burdens associated with • READID
implementing a floppy-disk interface. (Figure 1). • FORMAT TRACK
Handshaking signals make DMA operation easily • SCAN EQUAL
incorporated with the aid of an external DMA Controller
chip, such as the zao DMA. The FDC operates in either the • SCAN HIGH OR EQUAL
DMA or non-DMA mode. In the non-DMA mode the FDC • SCAN LOW OR EQUAL
generates interrupts to the processor every time a data byte
is to be transferred. In the DMA mode, the processor need • SEEK
only load the command into the FDC and all data transfers • RECALIBRATE
occur under control of the FDC and DMA controllers.
• SENSE INTERRUPT STATUS
The Z765A executes 15 commands; each command
requires multiple a-bit bytes to fully specify the operation • SPECIFY
which the processor wishes the FDC to perform. The • SENSE DRIVE STATUS
commands are:
1025
DATA
BUS ¢:! ¢:! REGISTERS
oooO'¢:!
BUFFER
L-_--I
.....- WACLOCK
WRDATA
WRENABLE
SERIAL PRESHIFTO
TERMINAL INTERFACE
~
COURT CONTROllER PRESHIFT 1
INT READ
WRITE
OMA . - READY
CONTROL
LOGIC ¢:!
IJ- INPUT . . . - WRITEPROTECT/TWOSIDE
DIS --.-
RESET - - .
IY- PORT ........ INDEX
....... FAULTITRACK 0
CS t DRIVE
INTERFACE
UNIT SELECT 0
------ 0,
0,
WCK
WOA
WE
.- RESET
Rii
iVA
+5V
RwISEEK
lCTIOIR
SYSTEM
DATA
------ 0,
0,
03
PS,
PSo
RDO
SERIAL
INTERFACE
CONTROL
cs
DIS
Do
FR/STP
HOl
ROY
----
BUS
RDW D, WP/TS
0,
D, FLT/TRo
D, VCO/SYNC
Do D3 PSo
RDY .- D, PS,
----.
-
.-
DACK Z765A D5 WDA
WP/TS } DRIVE
INTERFACE USo
BUS { DRO IDX INPUTS 0,
CONTROL
TC FLTITRo .- 0, US,
ORO HD
DACK MFM
~~'I
D/S USo
Rii US, TC WE
lCT/OIR
FAlSTP
Figure 3a.Pin Assignments
t
ClK GND +5V
2357-001,002.003
1026
:.:
w
Iii w
(/) ~f!:
i==:(/)...J
I~I~ 1~1li! ~ > >I§: oii:o
~~a: .... lL:!:
6 5 4 3 2
Do 39 ROY
0, 38 WPfTS
O2 37 FLTfTRo
OJ 36 PSo
D. 35 PS,
05 Z765A 34 WOA
Os 33 USo
07 32 US,
ORO 31 HO
DACR 30 MFM
TC 29 WE
1027
PIN DESCRIPTIONS (Figures 2 and 3)
ClK. Clock (input). Single phase 8MHz square wave clock. RO. Read (input). When 0, control signal for transfer of data
from FDC to Data Bus. Disabled when Cs = 1.
CS. Chip Select (input). IC selected when 0 (Low), allowing
AD and WR to be enabled. ROO. Read Data (input). Read data from FDD, containing
clock and data bits.
00.07' Data Bus. Bidirectional 8-bit Data Bus. Disabled
when CS = 1. ROW. Read Data Window (input). Generated by PLL, and
used to sample data from FDD.
OACK. DMA Acknowledge (input). DMA cycle is active
when 0, and controller is performing DMA transfer. ROY. Ready (input). Indicates FDD is ready to send or
receive data.
ORQ. Data DMA Request (output). DMA Request is being
made by FDC when DRQ = 1. RESET. Reset (input). Places FOC in idle state. Resets
output lines to FDD to O. Does not affect SRT, HUT or HLT in
O/S. Data/Status Register Select (input). Selects Data
Specify command. If RDY pin is held High during Reset,
Register (DIS = 1) or Status Register (DIS = 0) contents of
FDC generates an interrupt within 1.024 msec. To clear this
the FDC to be sent to Data Bus. Disabled when CS = 1.
interrupt use Sense Interrupt Status command.
FRISTP. Fault Reset/Step (output). Resets fault FF in FDD in
RW/SEEK. Read Write/Seek (output). When 1 (High) Seek
ReadlWrite mode, contains step pulses to move head to mode selected; when 0 (Lovy) ReadlWrite mode selected.
another cylinder in Seek mode.
TC. Terminal Count (input). Indicates the termination of a
FlT/TRo. Fault!7i'ack 0 (input). Senses FDD fault condition
DMA transfer when 1 (High). It terminates data transfer
in ReadlWrite mode and Track 0 condition in Seek mode.
during ReadlWrite/Scan command in DMA or Interrupt
HO. Head Select (output). Head 1 selected when 1 (High); mode.
Head 0 selected when 0 (Low).
US 1, USo. Unit Select (output). FDD Unit selected.
HOl. Head Load (output). Command which causes
VCO/SYNC. (output). Inhibits VCO in PLL when 0 (Low);
readlwrite head in FOD to contact diskette.
enables VCO when 1.
lOX. Index (input). Indicates the beginning of a disk track.
WCK. Write Clock (input). Write data rate to FDD. FM = 500
INT. Interrupt (output). Interrupt Request generated by KHz, MFM = 1 MHz with a pulse width of 250 ns for both
FDC. FM and MFM.
lCT/OIR. Low Current/Direction (output). Lowers Write WOA. Write Data (output). Serial clock and data bits to FDD.
current on inner tracks in ReadlWrite mode; determines
WE. Write Enable (output). Enables write data into FDD.
direction head will step in Seek mode. A fault reset pulse is
issued at th'e beginning of each Read or Write command WP/TS. Write ProtectlTwo Side (input). Senses Write Protect
prior to the occurrence of the Head Load signal. status in ReadlWrite mode and Two-Side Media in Seek
mode.
MFM. MFM Mode (output). MFM mode when 1; FM mode
whenO. WR. Write (input). When 0, control signal for transfer of data
to FDC via Data Bus. Disabled when CS = 1.
PSh PSo. Precompensation (preshift) (output). Write
precompensation status during MFM mode. Determines
early, late, and normal times.
1028
Table 1. Internal Registers
Bit
Do FDDOBusy DoB FDD number a is in the Seek mode. If any bit is set, FDC will not accept read
or write command.
D1 FDD 1 Busy D1B FDD number 1 is in the Seek mode. If any bit is set. FDC will not accept read
or write command.
D2 FD02Busy 02B FOO number 2 is in the Seek mode. If any bit is set, FDC will not accept read
or write command.
03 F003 Busy 03B FOO number 3 is in the Seek mode. If any bit is set, FOC will not accept read
or write command.
D4 FOC Busy CB A read or write command is in process. FOC will not accept any other
command.
Ds Execution Mode EXM This bit is set only during execution phase in non-DMA mode. When Os
goes low, execution phase has ended and result phase has started. It
operates only during non-DMA mode of operation.
06 Data Input/Output 010 Indicates direction of data transfer between FOC and Data Register. If 010 =
1, then transfer is from Data Register to the processor. If 010 = 0, transfer is
from the processor to Data Register.
07 Request for Master RQM Indicates Data Register is ready to send or receive data to or from the
processor. Both bits 010 and RQM should be used to perform the
handshaking functions of "ready" and "direction" to the processor.
INTERNAL REGISTERS
The.Z765A contains two registers which may be accessed phase and the set or reset 010 and ROM is 12",s; every time
by the main system processor: a Status register and a Data the Main Status register is read the CPU should wait 12",s.
register. The a-bit Main Status register (Table 1) contains the The maximum time from the trailing edge of the last RD in
FDC status information and may be accessed at any time. the result phase to when 04 (FDC busy) goes Low is 12",s.
The a-bit Data register is several registers in a stack; one
register at a time is presented to the data bus. The Data Table 2. Relationships Between Status/Data Registers
register stores data, commands, parameters, and FDD and RD, WR, and DIS
status information. Data bytes are read out of, or written into,
the Data register in order to program or obtain the results DIS RD WR Function
after a particular command. Only the Status register may be
read and used to facilitate the transfer of data between the a a Read Main Status Register
processor and Z765A.
a a Illegal
The relationship between the Status/Data registers and the
signals RD, WR, and Dis is shown in Table 2.
a a a Illegal
a a Illegal
The Data Input/Output (010) and Request for Master (ROM)
bits in the Status register indicate when data is ready and the a Read from Data Register
direction transfer on the data bus (Figure 4). The maximum
time between the last RD or WR during a command or result
a Write into Data Register
1029
STATUS REGISTER IDENTIFICATION
Bit
Status Register 0
D7 = OandD6 = 0
Normal Termination of command, (NT). Command was completed and
properly executed.
D7 = OandD6 = 1
Abnormal Termination of command, (AT). Execution of command was started
Interrupt Code IC but was not successfully completed.
D6 D7=1andD6=O
Invalid Command issue, (IC). Command which was issued was never started.
D7=1andD6=1
Abnormal Termination because during command execution the ready signal
from FDD changed state.
D5 Seek End SE When the FDC completes the SEEK command, this flag is set to 1 (High).
D4 Equipment Check EC If a fault signal is received from the FDD, or if the Track 0 signal fails to occur
after 77 step pulses (Recalibrate Command) then this flag is set.
D3 Not Ready NR When the FDD is in the not-ready state and a read or write command is issued,
this flag is set. If a read or write command is issued to Side 1 of a single-sided
drive, then this flag is set.
D2 Head Address HO This flag is used to indicate the state of the head at Interrupt.
D1 Unit Select 1 US1 This flag is used to indicate a Drive Unit Number at Interrupt.
Do Unit Select 0 USo This flag is used to indicate a Drive Unit Number at Interrupt.
Status Register 1
End of Cylinder EN When the FDC tries to access a sector beyond the final sector of a cylinder,
this flag is set.
D5 Data Error DE When the FOC detects a Cyclic Redundancy Check (CRG) error in either the
ID field or the data field, this flag is set.
Overrun OR If the FOC is not serviced by the host system during data transfers within a
certain time interval, this flag is set. ,
No Data ND During execution of the READ ID command, if the FOC cannot read the 10
field without an error, then this flag is set.
1030
STATUS REGISTER IDENTIFICATION (Continued)
Bit
01 Not Writeable NW During execution of WRITE DATA, WRITE DELETED DATA or Format A
cylinder command, if the FDC detects a write protect signal from the FDD,
then this flag is set.
If the FDC cannot detect the 10 Address Mark after encountering the index
hole twice, then this flag is set.
Do Missing Address Mark MA If the FDC cannot detect the Data Address Mark or Deleted Data Address
Mark, this flag is set. Also at the same time, the MD (Missing Address Mark in
data field) of Status register 2 is sei.
Status Register 2
06 Control Mark CM During execution of the READ DATA or SCAN command, if the FDC
encounters a sector which contains a Deleted Data Address Mark, this flag is
set.
Os Data Error in Data Field DO If the FDC detects a CRC error in the data field then this flag is set.
04 Wrong Cylinder WC This bit is related to the NO bit, and when the contents of Cylinder (C) on the
medium is different from that stored in lOR, this flag is set.
03 Scan Equal Hit SH During execution of the SCAN command, if the condition of "equal" is
satisfied, this flag is set.
02 Scan Not Satisfied SN During execution of the SCAN command, if the FDC cannot find a sector on
'the cylinder which meets the condition, then this flag is set.
01 Bad Cylinder BC This bit is related to the NO bit, and when the contents of C on the medium is
different from that stored in the lOR and the contents of C is FFH, then this flag
is set.
Do Missing Address Mark in MD When data is read from the medium, if the FDC cannot find a Data Address
Data Field Mark or Deleted Data Address Mark, then this flag is set.
Status. Register 3
07 Fault FT This bit is used to indicate the status of the Fault signal from the FDD.
06 Write Protected WP This bit is used to indicate the status of the Write Protected signal from the
FDD.
Os Ready RY This bit is used to indicate the status of the Ready signal from the FDD.
04 Track 0 TO This bit is used to indicate the status of the Track 0 signal from the FDD.
03 Two Side TS This bit is used to indicate the status of the Two Side signal from the FDD.
02 Head Address HD This bit is used to indicate the status of the Side Select signal to the FDD.
01 Unit Select 1 US1 This bit is used to indicate the status of the Unt Select 1 signal to the FDD.
Do . Unit Select 0 USa This bit is used to indicate the status of the Unit Select 0 signal to the FDD.
1031
I
OUT Foe AND INTO PROCESSOR
DATA IN/OUT
(DID) OUT PROCESSOR AND INTO FOC .
L
1 1
REQUEST FOR MASTER
(RQM)
NOT
, READY
WR------------~U~--------------------
I
iii) ------I---1-----1------...,
1 1 1
COMMAND SEQUENCE
The Z765A is capable of performing 15 different Result Phase. After completion of the operation, status and
commands. Each command is initiated by a multibyte other housekeeping information are made available to the
transfer from the processor; the result after execution of the processor.
command may also be a multi byte transfer back to the
processor. Because of this multi byte interchange of The Instruction set shows the required preset parameters
information between the Z765A and the processor, each and results for each command. Most commands require 9
command consists of three phases: command bytes and return 7 bytes during the result phase.
TheW to the left of each byte indicates a command phase
Command Phase. The FDC receives all information byte to be written; an R indicates a result byte.
required to perform a particular operation form the
processor.
Execution Phase. The FDC performs the operation it was
instructed to do.
PROCESSOR INTERFACE
,
During Command or Result phases the Main Status register If the Z765A is in the non-DMA mode and reading data from
must be read by the processor before each byte of FDD, then the receipt of each data byte is indicated by an
information is written into, or read from, the Data register. interrupt signal on pin 18(INT = 1). The generation of a Read
Then the CPU should wait for 12/As before reading the Main signal (RD = 0) or Write signal (WR = 0) will clear the
Status register. Bits D6 and D7 in the Main Status register interrupt and output the data onto the data bus. If the
must be in a 0 and 1 state, respectively, before each byte of processor cannot handle interrupts fast enough (every 13/As
the command word may be written into the Z765A. Many of for the M FM mode and 27/As for the FM mode), then it may
the commands require multiple bytes and, as a result, the poll the Main Status register and bit D7 (ROM) functions as
Main Status register must be read prior to each byte transfer the interrupt signal. If a Write command is in process, the
to the Z765A. During the Result phase, D6 and D7 in the WR signal negates the reset to the interrupt signal.
Main Status register must both be 1's before reading each
In the non-DMA mode it is necessary to examine the Main
byte from the Data Register. Reading the Main Status
Status register to determine the cause of the interrupt, since
register before each byte transfer to the Z765A is required
it could be a data interrupt or a command termination
only in the Command and Result phases, not during the
interrupt, either normal or abnormal. If the Z765A is in the
Execution phase.
1032
COMMAND SYMBOL DESCRIPTION
DIS Data/Status Select DIS controls selection of Main Status register (DIS = 0) or Data register (DIS = 1)
C Cylinder Number C stands for the currenUselected cylinder (track) numbers 0 through 76 of the medium.
0 Data o stands for the data pattern which is going to be written into a sector.
Dy-Do Data Bus 8-bit Data Bus, where 07 stands for a most significant bit, and Do stands for a least
significant bit.
DTL Data Length When N is defined as 00, DTL stands for the data length which users are going to read
out or write into the sector.
EOT End ofTrack EOT stands for the final sector number on a cylinder. During Read or Write operations,
FDC will stop data transfer after a sector number equal to EOT.
GPL Gap Length GPL stands for the length of Gap 3. During ReadlWrite commands this value
determines the number of bytes that VCO/SYNC will stay low after two CRC bytes.
During Format command it determines the size of Gap 3.
H Head Address H stands for head number 0 or 1, as specified in 10 field.
HD Head HD stands for a selected head number 0 or 1 and controls the polarity of pin 27. (H =
HD in all command words.)
HLT Head Load Time HLT stands for the head load time in the FDD (2 to 254 ms in 2 ms increments).
HUT Head Unload Time HUT stands for the head unload time after a Read or Write operation has occurred (16
to 240 ms in 16 ms increments).
MF FM or MFM Mode If MF is Low, FM mode is selected, and if it is High. MFM mode is selected.
MT Multitrack If MT is high, a Multitrack operation is performed. If MT = 1 after finishing ReadlWrite
operation on side 0, FOC automatically starts searching for sector 1 on side 1.
N Number N stands for the Number of data bytes written in a sector.
NCN New Cylinder Number NCN stands for a New Cylinder Number or desired position of head which is going to
be reached as a result of the Seek operation.
NO Non-DMA Mode NO stands for operation in the Non-DMA mode.
PCN Present Cylinder Number PCN stands for the cylinder number or present position of Head at the completion of
Sense Interrupt Status command.
R Record R stands for the sector number which will be read or written.
RIW ReadlWrite RIW stands for either Read (R) or Write (W) signal.
SC Sector SC indicates the number of Sectors per Cylinder.
SK Skip SK stands for Skip Deleted Data Address mark.
SRT Step Rate Time SRT stands for the Stepping Rate for the FDD (1 to 16 ms in 1 ms increments). Stepping
Rate applies to all drives (F(16) = 1 ms, E(16) = 2 ms, 0(16) = 3 ms, ...).
STO Status 0 STO-3 stands for one of four registers which store the status information after a
ST1 Status 1 command has been executed. This information is available during the result phase after
ST2 Status 2 command execution. These registers should not be confused with the main status
ST3 Status 3 register (selected by DIS = 0). STO-3 may be read only after a command has been
executed and contains information relevant to that particular command.
STP Step During a Scan operation. if STP = 1. the data in contiguous sectors is compared byte
by byte with data sent from the processor (or DMA); if STP = 2, then alternate sectors
are read and compared.
USa, US1 Unit Select Used to select between drives 0-3.
1033
INSTRUCTION SET1, 2
Data Bus
Read Data
1034
INSTRUCTION SET1, 2 (Continued)
Data Bus
Write Data
1035
INSTRUCTION SET1, 2 (Continued)
Data Bus
Read A Track
1036
INSTRUCTION SET1, 2 (Continued)
Data Bus
Format A Track
Scan Equal
1037
INSTRUCTION SET1, 2 (Continued)
Oata Bus
NOTES: ,. Symbols used in this table are described at the end of this section.
2. DIS should equal binary' for all operations.
3. X = Don't care, usually made to equal binary a.
1038
INSTRUCTION SET1, 2 (Continued)
Oata Bus
Specify
Seek
Invalid
1039
DMA mode, no interrupts are generated during the has seven bytes of data in the Result phase; all seven bytes
Execution phase. The Z765A generates DROs (DMA must be read to successfully complete the Read Data
Requests) when each byte of data is available. The DMA command and allow the Z765A to accept a new command.
Controller responds to this request with both a DACK (DMA
The Z765A contains five Status registers. The Main Status
Acknowledge) = 0 and an RD (Read signal) = O. When the
register can be read at any time by the processor. The other
DMA Acknowledge signal goes Low (DACK = 0), then the,
four Status registers (STO, ST1, ST2, and ST3) are available
DMA request is cleared (ORO = 0). If a Write command has
only during the Result phase and can be read only after
been issued, a WR signal appears instead of RD. After the
completing a command. The particular command that has
Execution phase has been completed [Terminal Count (TC)
been executed determines how many of the Status registers
has occurred] or the last sector on the cylinder (EOT)
are read.
read/written, then an interrupt occurs (INT = 1) which
signifies the beginning of the Result phase. When the first The bytes of data which are sent to the Z765A to form the
byte of data is read during the Result phase, the interrupt is Command phase and are read out of the Z765A in the
automatically cleared (INT = 0). Result phase must occur in the order shown in the
Command Table. That is, the Command Code must be sent
The RD or WR signals should be asserted while DACK is
first and the other bytes sent in the prescribed sequence. No
true. The CS signal is used in conjunction with RD and WR
foreshortening olthe Command or Result phases is allowed.
as a gating function during programmed I/O operations. CS
After the last byte of data in the Command phase is sent to
has no effect during DMA operations. If the non-DMA mode
the Z765A, the Execution phase automatically starts. In a
is chosen, the DACK signal should be pulled up to Vee.
similar fashion, when the last byte of data is read out in the
During the Result phase all bytes shown in the Command Result phase, the command is automatically ended and the
Table must be read. For example, the Read Data command Z765A is ready for a new command.
After Reset is sent to the Z765A, the Unit Select lines USa issued), Not Ready (NR) is indicated. The polling of the
and US1 automatically go into a polling mode (Figure 5). Ready line by the Z765A occurs continuously between
Between commands (and between step pulses in the Seek commands, thus notifying the processor which drives are
command) the Z765A polls all four FDDs looking for a on or off line., Each drive is polled every 1.024 ms except
change in the Ready line from any of the drives. If the Ready during the Read/Write commands. When used with a 4 MHz
line changes state (usually due to a door opening or clock for interfacing to minifloppies, the polling rate is 2.048
closing), then the Z765A generates an interrupt. When ms.
Status register 0 (STO) is read (after Sense Interrupt Status is
1....I - - - - - - - - - - A P P R D X . 1 . 0 m s - - - - - - - - - . ; · · 1
USO
1040
COMMANDS
Read'Data data from the next sector is read and output on the data bus.
This continuous read function is called a Multi-Sector Read
A set of nine (9) byte words are required to place the FOC
Operation. The Read Data command can be terminated by
into the Read Data Mode. After the Read Data command is
the receipt of a TC signal which should be issued when the
issued, the FOC loads the head (if it is in the unloaded state),
OACK for the last byte of data is sent. Upon receipt of this
waits the specified head settling time (defined in the Specify
signal, the FOC stops outputting data to the processor, but
command), and begins reading 10 Address Marks and 10
continues to read data from the current sector, checks
fields. When the current sector number (R) stored in the 10
Cyclic Redundancy Count (CRC), and at the end of the
Register (lOR) compares with the sector number read off the
sector, terminates the Read Data command. The amount of
diskette, then the FOC, via the data bus, outputs data
data which can be handled with a single command to the
byte-to-byte from the data field to the main system.
FOC depends upon multitrack (MT), MFM/FM (MF), and
After completion of the read operation from the current Number of Bytes/Sector (N). Table 3 shows the Transfer
sector, the Sector Number is incremented by one, and the Capacity.
MT allows the FOC to read data from both sides of the If the FOC twice detects the index hole without finding the
diskette. For a particular cylinder, data is transferred starting right sector (R), then the FOC sets Status register 1's No Data
°
at Sector 1, Side and completing at the last sector, Sector
L, Side 1. This function pertains to only one cylinder (the
(NO) flag to 1, and terminates the Read Data command.
(Status register ° also has bits 7 and 6 set to °and 1
same track) on each side of the diskette. respectively.)
When N = 0, then OTL defines the data length which the After reading the 10 and Data fields in each sector, the FOC
FOC must treat as a sector. If OTL is smaller than the actual checks the CRC bytes. If a read error is detected indicating
data length in a Sector, the data beyond OTL in the Sector is incorrect CRC in the 10 field, the FOC sets Status register 1's
not sent to the Data Bus. The FOC' internally reads the Data Error (DE) flag to 1, and if a CRC error occurs in the
complete sector performing the CRC check and, Data Field, the FOC also sets Status register 2's Data Error in
depending upon the manner of command termination, may Data Field (~O) flag to 1, and terminates the Read Data
perform a Multi-Sector Read Operation. When N is command. (Status register 0, bit 7 = 0, bit 6 = 1.)
non-zero, then OTL has no meaning and should be set to
If the FOC reads a Deleted Data Address Mark off the
FFH· diskette, and the SK bit 0 in the first Command Word = 0,
At the completion of the Read Data Command the head is then the FOC sets Status register 2's Control Mark (CM) flag
unloaded, after the Head Unload Time Interval specified in to 1, and after reading all the data in the sector, terminates
the Specify Command has elapsed. If the processor issues the Read Data command. If SK = 1, the FOC skips the
another command before the head unloads, there is no sector with the Deleted Data Address Mark and reads the
head settling time between subsequent reads. This time next sector. When SK = 1, the CRC bits in the deleted data
saved is particularly valuable when a diskette is copied. field are not checked.
1041
During disk data transfers between the FDC and the If the processor terminates a read or write operation in the
processor, via the data bus, the FDC must be serviced by FDC, then the ID information in the Result Phase is
the processor every 271ls in the FM Mode, and every 131ls in dependent upon the state of the MT bit and EOT byte: Table
the MFM Mode, or the FDC sets Status register 1's Overrun 4 shows the values for C, H, R, and N when the processor
(OR) flag to 1, ·and terminates the Read Data command. terminates the command.
o EqualtoEOT C+1 NC R = 01 NC
o
Less t!ian EOT NC NC R+ 1 NC
EqualtoEOT C+1 NC R = 01 NC
o EqualtoEOT NC LSB R = 01 NC
NOTES: NC (No Change): The same value as the one at the beginning of command execution.
LSB (Least Significant Bit): The least significant bit of H is complemented.
Write Data
A set of nine (9) bytes is required to set the FDC in the Write • ID information when the proce~sor terminates command
Data mode. After the Write Data command is issued, the
FDC loads the head, waits the specified head setting time,
• Definition of DTL when N = °and when N *°
and begins reading ID fields. When all four bytes (C, H, R, Refer to the Read Data command for details.
and N) loaded during the command match the four bytes of
In the Write Data mode. data transfers between the
the ID field from the diskette, the FDC takes data from the
processor and FDC via the data bus, must occur every 271ls
processor byte-by-byte via the data bus and outputs it to the
inthe FM mode and every 131lsinthe MFM mode.lfthetime
FDD.
interval between data transfers is longer, then the FDC sets
After writing data into the current sector, the sector number Status register 1's Overrun (OR) flag to 1, and terminates the
stored in the R register is incremented by one, and new data Write Data command. (Status register 0, bit7 = 0, bit6 = 1.)
is written into the next data field. The FDC continues this
Multisector Write Operation until a Terminal Count signal is Write Deleted Data
issued. If a Terminal Count signal is sent to the FDC, it
This command is the same as the Write Data command
continues writing into the current sector to complete the data
except a Deleted Data Address mark, instead of the normal
field. If the Terminal Count signal is received while a data
Data Address mark, is written at the beginning of the data
field is being written, the remainder of the data field is filled
field.
with zeros.
The FDC reads the ID field of each sector and checks the Read Deleted Data·
CRC bytes. If the FDC detects a read error (CRC error) in
This command is the same as the Read Data command
one of the IDfields, it sets Status register 1's DE flag to 1, and
except that when the FDC detects a Data Address mark at
terminates the Write Data command. (Status register 0, bit
the beginning of a data field and SK = 0, the FDC reads all
7 = 0, bit 6 = 1.)
the data in the sector and sets Status register 2's CM flag to
The Write command operates in the same manner as the 1, and terminates the command. If SK = 1, then the FDC
Read command for the following items: skips the sector with the Data Address mark and reads the
next,sector.
• Transfer capacity
• End of cylinder (EN) flag Read Track
• No data (ND) flag This command is similar to the Read Data command except
that this is a continuous Read operation where the entire
• Head unload time interval data field from each of the sectors is read. Immediately after
1042
sensing the index hole, the FOC starts reading all data fields and terminates the command after setting Status register 0,
on the track as continuous blocks of data. lithe FOC finds an
error in the 10 or Data CRC check bytes, it continues to read
°
bit 7 to and bit 6 to 1. Also the loss of a Ready signal at the
beginning of a command execution phase causes Status
data from the track. The FOC compares the 10 information
read from each sector with the value stored in the lOR and, if
°
register 0, bit 7 and 6 to be set to and 1 respectively.
Table 5 shows the sector size relationship between N, SC,
there is no comparison, sets Status register 1's NO flag to 1.
and GPL.
Multitrack or skip operations are not allowed with this
command.
Table 5. Functional Description of Commands
This command terminates when the number of sectors read
is equal to EOT. If the FOC does not find an 10 Address mark Format Sector Size N SC GPLl GPL2,3
on the diskette after it senses the index hole for the second
8" Standard Floppy
time, it sets Status register 1's Missing Address mark (MA)
flag to 1 and terminates the command. (Status Register 0, bit 128 bytes sector 00 1A 07 IS
7=0,bit6=1.)
256 01 OF OE 2A
Read 10 512 02 08 IS 3A
FM Mode
The Read 10 command gives the present position of the 1024 03 04 47 8A
recording head. The FOC stores the values from the first 10
field it can read. If no proper 10 Address mark is found on the 2048 04 02 C8 FF
diskette before the index hole is encountered for the second
4096 05 01 C8 FF
time, Status register 1's MA flag is set to 1; if no data is found,
Status register 1's No Data (NO) flag is set to 1. The
command is then terminated with STO bit 7 =
6 = 1. During this command, data transfer between FOC
° and bit
256
512
01
02
lA
OF
OE
IS
36
54
and the CPU occurs only during the result phase. 1024 03 08 35 74
MFM
Mode4 2048 04 04 99 FF
Format Track
1043
Scan Commands
The Scan commands allow comparison of data read from (MT) is programmed, the last sector on the track must be
the diskette and data supplied from the main system. The read. For example, if STP = 02, MT = 0, the sectors are
FDC compares the data on a byte-by-byte basis and looks numbered sequentially 1 through 26 and the Scan
for a sector of data which meets the conditions of DFDO = command is started at sector 21, the following happens.
Dprocessor, DFDO .;;; Dprocessoro or DFDO ~ .OProcessor. The Sectors 21, 23, and 25 are read, then the next sector, 26, is
hexadecimal byte of FF from memory or from FDD can be skipped and the index hole is encountered before the EOT
used as a mask byte because it always meets the condition value of 26 can be read resulting in an abnormal termination
of the comparison. One's complement arithmetic is used for of the command. If the EOT had been set at 25 or the
comparison (FF = largest number, 00 = smallest number). scanning started at sector 20, then the Scan command
After a whole sector of data is compared, if the conditions would be completed in a normal manner.
are not met, the sector number is incremented (R + STP-'
During the Scan command, data is supplied by either the
R) and the scan operation continues until one of the
processor or DMA Controller for comparison against the
following conditions occur: the conditions for scan are met
data read from the diskette. In order to avoid having Sta~us
(equal, low, or high), the last sector on the track is reached
register 1's Overrun (OR) flag set, it is necessary to have the
(EOT), or the terminal count (TC) signal is received.
data available in less than 27/-1s (FM mode) or 13/-1s (MFM
If the conditions for scan are met, the FDC sets the Status mode). If an Overrun occurs, the FDC ends the command
register 2's Scan Hit (SH) flag to 1 and terminates the Scan with Status register 0, bit 7 cleared to 0 and bit 6 set to 1.
command. If the conditions for scan are not met between
the starting sector number (R) and the last sector on the Seek
cylinder (EOT), then the FDC sets Status register 2's Scan
The Read/Write head within the FDD is moved from cylinder
Not Satisfied (SN) flag to 1, and terminates the Scan
to cylinder under control of the Seek command. The FDC
command. During the scan operation, the receipt of a signal
has four independent Present Cylinder registers for each
from the processor or DMA controller causes the FDC to
drive which are cleared only after the Recalibrate command.
complete the comparison of the particular byte in process
The FDC compares the Present Cylinder Number (PCN)
and then to terminate the command. Table 6 shows the
which is the current head position with the New Cylinder
status of bits SH and SN under various conditions of Scan.
Number (NCN), and if there is a difference, performs the
following operations:
Table 6.
PCN < NCN: Direction signal to FDD set to 1, and Step
Status Register 2 Pulses are issued. (Step In)
Command Bit 2 = SN Blt3 = SH Comments PCN > NCN: Direction signal to FDD cleared to 0, and Step
Pulses are issued. (Step Out)
0 DFOO = DProcessor
Scan Equal The rate at which Step pulses are issued is controlled by
0 DFOO *Dprocessor Stepping Rate Time (SRT) in the Specify command. After
0 each Step pulse is issued NCN is compared against PCN,
DFOO = DProcessor
Scan Low and when NCN = PCN, Status register O's Seek End (SE)
or Equal 0 0 DFOO < Dprocessor flag is set to 1, and the command is terminated. At this point
FDC interrupt goes High. Bits 00-03 in the Main Status
0 DFDO > Dprocessor register are set during the Seek operation and are cleared
0 DFOO = DProcessor by the Sense Interrupt Status command.
Scan High
or Equal 0 0 DFOO > Dprocessor During the command phase of the Seek operation the FDC
is in the FOC Busy state, but during the execution phase it is
0 DFOO < Dprocessor in the Nonbusy state. While the FDC is in the Nonbusy state,
another Seek command may be issued, and in this manner
parallel Seek operations may be done on up to four drives at
If the FDC encounters a Deleted Data Address mark on one once. No other command can be issued for as long as the
of the sectors and SK = 0, then it regards the sector as the FDC is in the process of sending step pulses to any drive.
last sector on the cylinder, sets Status register 2's Control
Mark (CM) flag to 1 and terminates the command. If SK = 1, If an FDO is in a Not Ready state at the beginning of the
the FDC skips the sector with the Deleted Address mark, command execution phase or during the Seek operation,
reads the next sector, and sets Status register 2's Control then Status register O's Not Ready (NR) flag is set to 1, and
Mark (CM) flag to 1 to show that a Deleted sector has been the command is terminated after bit 7 is setto 1 and bit 6 to O.
encountered. If writing three bytes of Seek command exceeds 150/-ls, the
When either the Step (STP) (contiguous sectors = 01 or timing between the first two step pulses may be 1ms shorter
alternate sectors = 02) sectors are read or the Multitrack than that set in the Specify command.
1044
Recalibrate
The function of this command is to retract the Read/Write The Sense Interrupt Status command is used in conjunction
head within the FDD to the Track a position. The FDC clears with the Seek and Recalibrate commands which have no
the contents oflhe PCN counter and checks the status of the result phase. When the disk has reached the desired head
Track a signal from the FDD. As long as the Track a signal is position, the Z765A sets the interrupt line true. The host CPU
Low, the Direction signal remains a and step pulses are must then issue a Sense Interrupt Status command to
issued. When the Track a signal goes High, the Status determine the actual cause of the interrupt, which could be
register a's SE flag is set to 1 and the command is Seek End or a change in ready status from one of the drives.
terminated. If the Track a signal is still Low after 77 step Figure 6 is a graphic example.
pulses have been issued, the FDC sets Status register a's SE
and Equipment Check (EC) flags to 1s and terminates the Specify
command after Status register 0, bit 7 is cleared to a and bit
The Specify command sets the initial values for each of the
6 is set to 1.
three internal timers. The Head Unload Time (HUT) defines
The ability to do overlap Recalibrate commands to multiple the time from the end of the execution phase of one of the
FDDs and the loss of the Ready signal, as described in the Read/Write commands to the head unload state. This timer
Seek command, also applies to the Recalibrate command. is programmable from 16 to 240ms in increments of 16ms
If the Diskette has more than 77 tracks, the Recalibrate (01 = 16ms, 02 = 32ms ... OF 16 = 240ms). The Step Rate
command should be issued twice, in order to position the Time (SRT) defines the time interval between adjacent step
Read/Write head to Track O. pulses. This timer is programmable' from 1 to 16ms in
increments of 1ms (F = 1ms, E = 2ms, and 0 = 3ms). The
Sense Interrupt Status Head Load Time (HLT) defines the time between the Head
Load signal's going High and the start of the Read/Write
An interrupt signal is generated by the FDC for one of the
operation. This timer is programmable from 2 to 254ms in
following reasons:
incrementsof2ms(01 = 2ms, 02 = 4ms, 03 = 6ms ... 7F =
1. Upon entering the Result phase of command: 254ms).
D ReadData D Read Track
The time intervals mentioned are a direct function of the
D Write Data D Read 10
8M Hz clock; if the clock were reduced to 4MHz (minifloppy
D Write Deleted Data D Format Track
application), all time intervals would be increased by a factor
D Read Deleted Data D Scan
of2.
2. Ready Line of FDD changes state
The choice of a DMA or non-DMA operation is made by the
3. End of Seek or Recalibrate command Non-DMA (NO) bit. When this bit is High (NO = 1), the
Non-DMA mode is selected; when NO = 0, the DMA mode
4. During Execution phase in the non-DMA mode
is selected.
Interrupts caused by reasons 1 and 4 occur during normal
command operations and are easily discernible by the Sense Drive Status
processor. During an execution phase in non-DMA mode,
The processor uses this command to obtain the status of the
05 in the Main Status Register is High. Upon entering the
FDDs. Status register 3 contains the Drive Status information
Result phase this bit is cleared. Reasons 1 and 4 do not
stored internally in FDC registers.
require Sense Interrupt Status commands. The interrupt is
cleared by Reading/Writing data to the FDC. Interrupts
Invalid
caused by reasons 2 and 3 may be uniquely identified with
the aid of the Sense Interrupt Status command which resets If an Invalid command (not defined above) is sent to the
the Interrupt signal and, via bits 5,6, and 7 of Status register FDC, then the FDC terminates the command after Status
0, identifies the cause of the interrupt (Table 7). Register a bit 7 is set to 1 and bit 6 to O. No interrupt is
generated by the Z765A during this condition. Bits 6 and 7
Table 7. Interrupt Identification (010 and ROM) in the Main Status register are both High,
indicating to the processor that the Z765A is in the Result
Interrupt Code phase and the contents of Status register a (STO) must be
Seek End
read. When the processor reads Status register 0, it finds an
Bit5 Bit6 Bit7 Cause
80H indicating the receipt of an Invalid command.
o Ready Line changed state, A Sense Interrupt Status command must be sent after a
either polarity Seek or Recalibrate Interrupt, otherwise the FDC considers
o o Normal Termination of Seek the next command as an Invalid command.
or Recalibrate command This command may be used as a No-Op command to place
the FDC in a standby or No Operation state.
o Abnormal Termination of
Seek or Recalibrate
command
1045
INT _ _
COMMANOPHASE
SEEK (OR RECALIBRATE) COMMAND
~~_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _~I
'I-EXECUTIONPHASE _
________________~I
.1_
~COMMANOPHASE
~I
_14---
SENSE INTERRUPT STATUS COMMAND
________ __________ ~
RESULTPHASE~
•
~__
1 Ir - - - - - - - - - - - - , .....-------.1
D/siFn un Lf rIt
RD~ ~~~I----------------~U~--------~~
u r1 ~ It urp-
I
tnr
u u u u
DJO~ ~ u ][ ][
ROM ---I1----:-y"--...,..-------......InL-.....,..--~nL-_..,..__~nL-.....,.t-
OPCODEFOR HD/DRIVE NOT NCNWRITTEN OPCODEFOR STATUS ACN
INSTRUCTION WRITTEN INTOZ765A INSTRUCTION REGISTER STO REAOBV
WRITTEN INTOZ765A WRITTEN READ BY PROCESSOR
INTOZ765A INTOZ76SA PROCESSOR
I..·..------------REPEATNTIMES-----------·~I
INDEXJ"-
II-.o------------REPEATNTIMES-----------""'·~I
INDEX~
IDX J\---------------------------------------------------1f~
FORMAT L-_ _ GA_P_4_._~_ _I_AM_ _~_ _M_P_'_~_ _'_O_~_ _G_A_P2_ _~_ _O_A_~_ _~_M_P_3_~_____'o__~,l~1_<~I____GA_p_4_b__~
YeO/SYNC _~
__..li...__________________ ...J1
WE
I
r-------, \ f
NOTE; Read - - - - -
Wnte---
1046
AC CHARACTERISTICS
TA = -1 aoc to + 7aoC; Vee = + 5V ± 5% unless otherwise specified.
Number Symbol Parameter Min ~pl Max Unit Test Condition
1047
AC CHARACTERISTICS (Continued)
TA= -1 DOC to + 7DoC; Vee = + 5V ± 5% unless otherwise specified.
Number Symbol Parameter Min Typl Max Unit Test Condition
.... "~.~
-°1- -@-
RD 1--0---)
DATA -----~
-{!)-
-- 0)
~---
l
.... "-~
-@I- -®-
--®-
-K
WR
--I
®
--®--
DATA )l
--®--
1048
DMA Operation
DRQ
-----®------
·@}-----I
WRORiiii
----®---
----®---
WRITE CLOCK
WRITE ENABLE
PRESHIFT 0 OR 1
WRITE DATA
Preshift 0 Preshift 1
Normal o o
Late o
Early o
Seek Operation
USO,1
~ STABLE
K
RW/SEEK
- -- ® -- ®
DIRECTION
.- ®
- - -@
-@
-- ... -
~
'4J
"'-
--®-
--
STEP
®
• ® •
1049
FLT Reset
FAULT RESET =
FILE UNSAFE RESET
-0-
~
INDEX
RESET~
~I@I"'=--
1050
ABSOWTE MAXIMUM RATINGS
TA = 25°C
Operating Temperature ................ O°C to + 70°C Stresses greater than those listed under Absolute Maximum Ratings may
Storage Tem peratu re .............. - 65°C to + 150°C cause permanent damage to the device. This is a stress rating only;
operation of the device at any condition above these indicated in the
All Output Voltages .................... - .5V to + 7V operational sections of these specifications is not implied. Exposure to
All Input Voltages ...................... - .3V to + 7V absolute maximum rating conditions for extended periods may affect
Supply Voltage Vee .................... - .5V to + 7V device reliability.
DC CHARACTERISTICS
TA= O°C to + 70°C; Vee = + 5V ± 5% unless otherwise specified.
Symbol Parameter Min Typ' Max Unit Test Condition
CAPACITANCE
TA = 25°C; fc = 1 MHz; Vee = OV
Symbol Parameter Min Max Unit Test Condition
1051
PRODUCT SPECIFICATION
~ZiIm
Z5380
SCSI SMALL COMPUTER
SYSTEM INTERFACE
FEATURES
_ Compatible 5380 pinout - Arbitration support
_ Asynchronous interface, supports 1.5 MB/s - Supports Normal or Block Mode DMA
_ Direct SCSI Bus interface with on-board 48 mA drivers - Memory or I/O Mapped CPU interface
GENERAL DESCRIPTION
The Z5380 SCSI (Small Computer System Interface) con- The Z5380 increases the system performance by minimiz-
troller is a 40-pin DIP or 44-pin PLCC CMOS device ing the CPU intervention in DMA operations Wllich the SCSI
(Figure 1). It is designed to implement the SCSI protocol as controls. The CPU is interrupted by the SCSI wilen it
defined by the ANSI X3.131-1986 standard, and is fully detects a bus condition that requires attention. It also
compatible with the industry standard 5380. It is capable supports arbitration and reselection. The Z5380 has the
of operating both as a Target and as an Initiator. Special proper hand-sllake signals to support normal and block
high-current open-drain outputs enable it to directly mode DMA operations with most DMA controllers
interface to, and drive, the SCSI bus. The Z5380 has the available (Figure 2).
necessary interface hook-ups so the system CPU can
communicate with it like with any other peripheral device. Note: All Signals with a preceding front slash, "r, are active
The CPU can read from, or write to, the SCSI registers Low, e.g.: BIIW (WORD is active Low); IBIW (BYTE is
which are addressed as standard or memory- active Low, only); INIIS (NORMAL and SYSTEM are both
mapped I/Os. active Low).
1053
IOB7-/OBO.
10BP
CPU BUS
Interface .,,---,-.------.,...----.-----7'1<"'"----------,....---'
07-00 IOB7-0BO./OBP
A2.-AO lACK
liaR IATN
IIOW IBSY
ICS IMSG
IRESEr 11/0
Z5380
10ACK CI/O
lEap /REO
ORO IRST
REAOY ISEL
IRO
GNO VOO
1054
DO 01
... U)
m m m m
CD ..
!;! !;! !;! !;! c0 ~ C CII
c c'" C!i c
U)
IOB7 02
IOB6 03
IOB5 04 IOB3 • 39 06
1DB4 05 IOB2 38 07
10B3 06 10Bl 37 A2
IOB2 07 lOBO 36 Al
10BP GNO 33 AO
VOO
ISEL 32 IIOW
GNO AO
IBSY 31 IRESET
ISEL IIOW
lACK 30 IEOP
IBSY IRESET
IATN 29 10ACK
lACK IEOP
22 23 24 25 26 27 28
IATN 10ACK
IRST READY I- 0
rn
C (!J 0 o rn o a: >-
w Z Q 0a: a: 0 c
~ rn !!:
1110 IIOR !!: '" ~ c - a: "
CliO IRO
IMSG pRO
IREO ICS
PIN DESCRIPTION
Microprocessor Bus
Figure 3 shows the pins and their respective functions for 07-00. Data Lines(Bidirectional. three-state. Active High).
both, the DIP and PLCC. ' Bidirectional microprocessor data bus lines. DO is tile
Least Significant Bit of the bus. Data bus lines carry data
A2-AO. Address Lines(lnput). Address lines are used with and commands to and from the SCSI.
fCS.fIOR. or flOW to address all internal registers.
IEOP. End of Process (Input, Active Low)./EOP is used to
ICS. Chip Select (Input, Active Low). This signal. in con- terminate a DMA transfer. If asserted during a DMA cycle,
junction with IIOR or IIOW, enables the internal register the current byte will be transferred. but no additional bytes
selected by A2-AO. to be read from or written to. will be requested.
10ACK. DMA Acknowledge (Input. Active Low). IDACK IIOR. I/O Read (Input, Active Low). IIOR is used in con-
resets DRO and selects the data register for input or output junction with ICS and A2-AO to read an internal register.
data transfers. IDACK is used by DMA controller instead It also selects the Input Data Register when used
oI/CS, with IDACK.
ORO. DMA Request(Output, Active High). DRO indicatEls IIOW. I/O Write (Input. Active Low). IIOW is used in con-
that the data register is ready to be read or written. DRO is junction with ICS and A2-AO to write an internal register.
asserted only ifDMA mode is set in the Command Register. It also selects the Output Data Register when used
DRO is cleared by IDACK. with IDACK.
1055
PIN DESCRIPTION (Continued)
IRO. Interrupt Request (Output, Active High). IRO alerts IOB7-/OBO, 10BP. Data Bus Bits, Data Bus Parity Bit
a microprocessor of an error condition or an event (Bidirectional, Open-drain), These eight data bits
completion. (lDB7-/DBO), plus a parity bit (lDBP) form the data bus.
IDB7 is the most significant bit (MSB) and has the highest
READY. Ready (Output, Active High). Ready is used to priority during the Arbitration phase, Data parity is odd.
control the speed of Block. Mode DMA transfers. This Parity is always generated and optionally checked. Parity
signal goes active to indicate the chip is ready to sendl is not valid during Arbitration.
receive data and remains Low after a transfer until the last
byte is sent or until the DMA Mode bit is reset. 1110. Input/Output (Bidirectional, Open-drain). 1/0 is a sig-
nal driven by a Target which controls the direction 01 data
IRESET. Reset(lnput, Active Low)./RESET clears all reg- movement on the SCSI bus. True indicates input to the
isters. It has no effect upon the SCSIIRST signal. Initiator. This signal is also used to distinguish between
Selection and Reselection phases.
SCSI Bus
IMSG. Message (Bidirectional, Open-drai.n, Active Low).
The following signals are all bidirectional, active Low, This signal is driven by the Target during the Message
open-drain, with 48 mA sink capability. All pins interface phase. This signal is received by the Initiator.
directly with the SCSI bus. '
IREO. Request (Bidirectional, Open-drain, Active Low).
lACK. Acknowledge (Bidirectional, Open-drain, Active Driven by the Target and received by the Initiator, this
Low). Driven by an Initiator, lACK indicates an signal indicates a request for a IREOIIACK data-transfer
acknowledgement for a IREOIIACK data-transfer hand- handshake.
shake. In the Target role, lACK is received as a response
to the IREO signal. IRST. SCSI Bus Reset (Bidirectional, Open-drain, Active'
Low). This Signal indicates a SCSI bus Reset condition.
IATN. Attention (Bidirectional, Open-drain, Active Low) .•
Driven by an Initiator, received by the Target./ATN indicates ISEL. Select(Bidirectional, Open-drain, Active Low). This
an Attention condition. ' signal is used by an Initiator to select a Target, or by a
Target to reselect an Initiator.
IBSY. Busy (Bidirectional, Open-drain, Active Low). This
signal indicates that the SCSI bus is being used and can Power Signals:
be driven by both the Initiator and the Target device.
GND. Ground (OV)
CliO. Control/Data (Bidirectional, Open-drain). Driven by
the Target and received by the Initiator, CliO indicates VDD. VDD Supply (+5V)
whether Control or Data information is on the Data Bus.
True indicates Control.
FUNCTIONAL DESCRIPTION
The Z5380 Small Computer System Interface (SCSI) has a implement all or anyofthe SCSI protocol in software. These
set of eight registers that are controlled by the CPU. By registers are read (written) by activating ICS with an
reading and writing the appropriate registers, the CPU address on A2-AO and then issuing an IIOR (II OW) pulse.
may initiate any SCSI Bus activity or may sample and This section describes the operation of the internal regis-
assert any Signal on the SCSI Bus. This allows the user to ters (Table 1).
1056
Table 1. Register Summary Address: 0 (Read Only)
Address Imlool~I~lool~I~lool
A2 A1 AO R!W Register Name
~
lOBO
0 0 0 R Current SCSI Data
0 0 0 W Output Data IOB1
0 0 1 RfW Initiator Command IOB2
0 1 0 RfW Mode
IOB3
0 1 1 RfW Target Command 10B4
1 0 0 R Current SCSI Bus Status IOB5
1 0 0 W Select Enable
1 1 IOB6
0 R Bus and Status
IOB7
0 1 W Start DMA Send
1 0 R Input Data
1 0 W Start DMA Target Receive Figure 4. Current SCSI Data Register
1 1 R Reset Parity/Interrupt
1 1 W Start DMA Initiator Receive
Address: 0 (Write Only)
Current SCSI Data Register. Address 0 (Read Only). The ' - - - - - - - - - - - IOB6
L -_ _ _ _ _ _ _ _ _ IOB7
Current SCSI Data Register (Figure 4) is a read-only
register which allows the microprocessor to read the active
SCSI Data Bus. This is accomplished by activating /CS
with an address on A2-AO of 000 and issuing an /IOR pulse. Figure 5. Output Data Register
If parity checking is enabled, the SCSI Bus parity is
checked at the beginning of the read cycle. This register
is used during a programmed I/O data read or during Initiator Command Register. Address 1 (ReadfWrite). The
Arbitration to check for higher priority arbitrating devices. Initiator Command Register (Figures 6 and 7) are read and
Parity is not guaranteed valid during Arbitration. write registers which assert certain SCSI Bus signals,
monitors those signals, and monitors the progress of bus
Output Data Register. Address O(Write Only). The Output arbitration. Many of these bits are significant only wilen
Data Register (Figure 5) is a write-only register that is used being used as an Initiator: however, most can be used
to send data to the SCSI Bus. This is accomplished by during Target role operation.
either using a normal CPU write, or under DMA control, by
using /IOW and /DACK. This register also asserts the
proper 10 bits on the SCSI Bus during the Arbitration and
Selection phases.
1057
FUNCTIONAL DESCRIPTION (Continued) Bit 1. Assert /A TN./ATN may be asserted on the SCSI Bus
by setting this bit to a one (1) if the Target Mode bit (Mode
Address: 1 .(Read Only) Register, bit 6) is False./ATN is normally asserted by the
initiator to request a Message Out bus phase. Note that
Iwl~I~I~loolwlmlool since Assert ISEL and Assert/ATN are in the same register,
~
a select with IATN may be implemented with one CPU
Assert Oata Bus write./ATN may be deasserted by resetting this bit to zero.
Assert/ATN A read of this register simply reflects the status of this bit.
Assert/SEL
Bit 2. Assert /SEL. Writing a one (1) into this bit position
Assert/BSY asserts ISEL onto the SCSI Bus. /SEL is normally asserted
Assert/ACK after Arbitration has been successfully completed. /SEl.
. may be disabled by resetting bit 2 to a zero. A read 01 this
Lost Arb~ration
register reflects the status of this bit.
Arbitration In Progress
Assert/RST Bit 3. Assert /BSY. Writing a one (1) into this bit position
asserts /BSY onto the SCSI Bus. Conversely, a zero resets
the /BSY signal. Asserting /BSY indicates a successful
Figure 6. Initiator Command Register selection or reselection. Resetting this bit creates a Bus-
Disconnect condition. Reading this register reflects
bit status.
Address: 1 (Wr~e Only)
Bit 4. Assert /ACK. Bit 4 is used by the bus initiator to asserf
1071061051041031021011001 /ACK on the SCSI Bus. In order to assert lACK, tile Target
Mode bit (Mode Register, bit 6) must be False. Writing a
Assert Oata Bus zero to this bit deasserts /ACK. Reading'this register
Assert/ATN
reflects bit status.
Assert/SEL
Bit 5. "0" (Write Bit). Bit 5 should be written with a zero for
Assert/BSY proper operation.
Assert/ACK
Bit 5. LA (Lost Arbitration - Read Bit). Bit 5, when active,
·0·
indicates that the SCSI detected a Bus-Free condition,
L..-_ _ _ _ _ _ _ _ Test Mode
arbitrated for use of the bus by asserting /BSY and its 10 on
Assert/RST the Data Bus, and lost Arbitration due to /SEl. being
asserted by another bus device. This bit is active only
when the Arbitrate bit (Mode Register, bit 0) is active.
Figure 7. Initiator Command Register
Bit 6. Test Mode (Write Bit). Bit 6 is written during a test
environment to disable all output drivers, effectively re-
The following describes the operation of all bits in the moving the Z5380 from the circuit. Resetting this bit returns
Initiator Command Register: the part to normal operation.
Bit O. Assert Data Bus. This bit, when set, allows the con- Bit 6. AlP (Arbitration in Process - Read Bit). Bit 6 is used
tents of the Output Data Register to be enabled as chip to determine if Arbitration is in progress. For this bit to be
outputs on the signals IDB7-DBO. Parity is also generated active, the Arbitrate bit (Mode Register, bit 0) must have
and asserted on IDBP. been set previously. It indicates that a Bus-Free condition
has been detected and that the chip has asserted /BSY
When connected as' an Initiator, the outputs are only and put the contents of the Output Data Register onto tile
enabled if the Target Mode bit (Mode Register, bit 6) is 0, SCSI Bus. AlP will remain active until the Arbitrate bit
the received Signal 1110 is False, and the phase Signals is reset.
(CliO, 1110, and {MSG) match the contents of the Assert
C{{D, Assert I{{O, and Assert/MSG in the Target Command Bit 7. Assert /RST. Whenever a one is written to bit? of the
Register. Initiator Command Register, the IRST signal is asserted on
the SCSI Bus. The /RST signal will remain asserted until tllis
This bit should also be set during DMA send operations. bit is reset or until an external/RESET occurs. After this bit
1058
is set (1), IRO goes active and all internal logic and control Register. The control bit Assert Data Bus (Initiator Com-
registers are reset (except for the interrupt latch and the mand Register, bit 0) must be True (1) for all DMA send
Assert IRST bit). Writing a zero to bit 7 of the Initiator operations. In the DMA 'mode, IREO and lACK are auto-
Command Register de asserts the IRST signal. The status matically controlled.
of this bit is monitored by reading the Initiator Command
Register. The DMA Mode bit is not reset upon the receipt of an IEOP
signal. Any DMA transfer is stopped by writing a zero into
Mode Register. Address 2(Read/Write). The Mode Regis- this bit location; however, care must be taken not to cause
ter controls the operation of the chip. This register deter- ICS and IDACK to be active simultaneously.
mines whether the Z5380 operates as an Initiator or a
Target, whether DMA transfers are being used, whether Bit 2. Monitor Busy. The Monitor Busy bit, when True (1),
parity is checked, and whether interrupts are generated on causes an interrupt to be generated for an unexpected
various external conditions. This register is read to check loss of IBSY. When the interrupt is generated due to loss of
the value of these internal control bits (Figure 8). IBSY, the lower six bits of the Initiator Command Register
are reset (0) and all signals are removed from tile
Address: 2 (ReadlWrite) SCSI Bus.
Iwlool~I~lool~lrnlool Bit 3. Enable IEOP interrupt. Tile enable IEOP interrupt bit,
when set (1), causes an interrupt to occur wilen the IEOP
Arbitrate (End Of Process) signal is received from the DMA con-
DMAMode troller logic.
Monitor IBSY
Bit 4. Enable Parity Interrupt. The Enable Parity Interrupt
Enable IEOP Interrupt bit, when set (1), will cause an interrupt (IRO) to occur if a
Enable Parity Interrupt parity error is detected. A parity interrupt will only be
generated if the Enable Parity Checking bit (bit 5) is also
Enable Parity Checking
enabled (1).
Target Mode
Block Mode DMA Bit 5. Enable Parity Checking. The Enable Parity Checking
bit determines whether parity errors are ignored or saved
in the parity error latch. If this bit is reset (0), parity is
Figure 8. Mode Register ignored. Conversely, if this bit is set (1), parity errors
are saved.
The following describes the operation of all bits in the Bit 6. Target Mode. The Target Mode bit allows the Z5380
Initiator Command Register: to operate as a SCSI Bus Initiator or Target. With this bit
reset (0), the Z5380 operates as a SCSI Bus Initiator.
Bit O. Arbitrate. The Arbitrate bit is set (1) to start the Setting Target Mode bit to 1 programs the Z5380 to ope
Arbitration process. Prior to setting this bit, the Output Data ate as a SCSI Bus Target device. If the signals
Register should contain the proper SCSI device 10 value. IATN and lACK are to be asserted on the SCSI Bus, tile
Only one data bit should be active for SCSI Bus Arbitration. Target Mode bit must be reset (0). If the signals CliO, 11/0.
The Z5380 waits for a Bus-Free condition before entering IMSG, and IREO are to be asserted on the SCSI Bus, the
the Arbitration phase. The results of the Arbitration phase Target Mode bit must be set (1).
is determined by reading the status bits LA and AlP
(Initiator Command Register, bits 5 and 6, respectively). Bit 7. Block Mode OMA. The Block Mode DMA bit controls
the characteristics of the DMA DRO-/DACK handsllake.
Bit 1. DMA Mode. The DMA Mode bit is normally used to When this bit is reset (0) and Ihe DMA Mode bit is active (1),
enable a DMA transfer and must be set (1) prior to writing the DMA handshake uses Ihe normal interlocked hand-
Start DMA Send Register, Start DMA Target Register, and shake, and the rising edge of IDACK indicates the end of
Start DMA Initiator Receiver Register. These three regis- each byte being transferred. In Block Mode operation,
ters are used to start DMA transfers. The Target Mode bit when the Block Mode DMA bit is set (1) and DMA Mode bit
(Mode Register, bit 6) must be consistent with writes to is active (1). the end of IIOR or IIOW signifies the end of
Start DMA Target Receive and Start DMA Initiator Receive each byte transferred and IDACK is allowed to remain-
Registers; i.e., set (1) for a write to Start DMA Target active throughout the DMA operation. Ready can then be
Receive Register and set (0) for Start DMA Initiator Receive used to request the next transfer.'
1059
FUNCTIONAL DESCRIPTION (Continued)
Target Command Register. Address 3 (Read/Write). When device can use this register to determine the current bus
connected as a target device, the Target Command Reg- phase and to poll/REO for pending data transfers. This
ister (Figure 9) allows the CPU to control the SCSI Bus register may also be used to determine why a particular
Information Transfer phase and/or to assert /REO by writ- interrupt occurred. Figure 10 describes the Current SCSI
ing this register. The Target Mode bit (Mode Register, bit Bus Status Register.
6) must be True (1) for bus assertion to occur. The SCSI
Bus phases are described in Table 2. Address: 4 (Read Only)
I~::
1071061051041031021011001
~ ~CIIO
Assert VIO
Assert CliO
AssertlMSG IMSG
AssertlREO IREO
"X" IBSY
1..-_ _ _ _ _ _ _ _ _ IRST
Bus Phase Assert Assert Assert Select Enable Register. Address 4(Write Only). The Select
11/0 CI/D IMSG Enable Register (Figure 11) is a write-only register which is
used as a mask to monitor a signal ID during a selection
Data Out 0 0 0 attempt. The simultaneous occurrence of the correct ID bit,
Unspecified 0 0 1 /BSY False, and /SEL True causes an interrupt. This inter-
Command 0 1 0 rupt can be disabled by resetting all bits in this register. If
Message Out 0 1 1 the Enable Parity Checking bit (Mode Register, bit 5) is
active (1), parity is checked during selection.
Data In 0 0
UnspeCified 0 1 Address: 4 (Wrtte Only)
Status 1 0
Message In 1 1 1071061051041031021011001
~
lOBO
When connected as an Initiator with DMA Mode bit True, if
the phase lines (1110, CIID, and /MSG) do not match the
10Bl
phase bits in the Target Command Register, a phase IOB2
mismatch interrupt is generated when /REO goes active. IOB3
To send data as an Initiator, the Assert 1110, Assert CIID, 1..-_ _ _ _ _ _ 10B4
and Assert /MSG bits must match the corresponding bits
in the Current SCSI Bus Status Register. The Assert /REO IOB5
bit (bit 3) has no meaning when operating as an Initiator. IOB6
IOB7
Bits 4, 5, 6, and 7 are not used.
Current SCSI Bus Status Register. Address 4 (Read Only). Figure 11. Select Enable Register
The Current SCSI Bus Register is a read-only register
which is used to monitor seven SCSI Bus control signals,
plus the Data Bus parity bit. For example, an Initiator
1060
Bus and Status Register. Address 5 (Read Only). The Bus Bit 5. Parity Error. Bit 5 is set if a parity error occurs during
and Status Register (Figure 12) is a read-only register a data receive or a device selection. The Parity Error bit can
which can be used to monitor the remaining SCSI control only be set (1) if the Enable Parity Check bit (Mode
signals not found in the Current SCSI Bus Status Registers Register, bit 5) is active (1). This bit may be cleared by
(lATN and lACK), as well as six other status bits. The reading the Reset Parity/lnterrupt Register.
following describes each bitofthe Bus and Status Register
individually. Bit 6. OMA Request. Tile DMA Request bit allows the CPU
to sample the output pin DRO. DRO can be cleared by
Address: 5 (Read Only)
asserting IDACK or by resetting the DMA Mode bit (bit 1)
in the Mode Register. The DRO signal does not reset wilen
Imlool~I~lool~I~lool a phase-mismatch interrupt occurs.
lACK Bit 7. End of OMA Transfer. The End of DMA Transfer bit is
IATN
set if lEap, IDACK, and either liaR or flOW are simulta-
neously active for at least 1DOns. Since the fEOP signal can
Busy Error
occur during the last byte sent to the Output Data Register,
Phase Match the IREO and lACK signals should be monitored to ensure
Interrupt Request Active that the last byte has been transferred. This bit is reset
when the DMA Mode bit is reset (0) in the Mode Register.
Parity Error
OMA Request Input Data Register. Address 6 (Read Only). 1 he input
End of OMA Data Register (Figure 13) is a read-only register li1at is
used to read latched data from the SCSI Bus. Data is
latched either during a DMA Target receive operation
Figure 12. Bus and Status Register when lACK goes active or during a DMA Initiator receive
when IREO goes active. The DMA Mode bit (bit 1) must be
set before data can be latched in the Input Data Register.
Bit O. lACK. Bit 0 reflects the condition of the SCSI Bus This register is read under DMA control using liaR and
control signal lACK. This signal is normally monitored by IDACK. Parity is optionally checked when the Input Data
the Target device. Register is loaded.
Bit 1. /ATN. Bit 1 reflects the condition of the SCSI Bus Address: 6 (Read Only)
control signal/ATN. This signal is normally monitored by
the Target device. Imlool~I~lool~I~lool
~
Bit 2. Busy Error. The Busy Error bit is active if an unex- lOBO
pected loss of the IBSY signal has occurred. This latch is 10Bl
set whenever the Monitor Busy bit (Mode Register, bit 2) is
IOB2
True and IBSY is False. An unexpected loss of IBSY
disables any SCSI outputs and resets the DMA Mode bit IOB3
L..-_ _ _ _ _ _ 10B4
(Mode Register, bit 1).
IOB5
Bit 3. Phase Match. The SCSI signals IMSG, CIID, and
11/0, represent the current information Transfer phase. The IOB6
Phase Match bit indicates whether the current SCSI Bus IOB7
phase matches the lower 3 bits of the Target Command
Register. Phase Match is continuously updated and is only
significant when operating as a Bus Initiator. A phase Figure 13. Input Data Reqister
match is required for data transfers to occur on the
SCSI Bus.
1061
FUNCTIONAL DESCRIPTION (Continued)
DMA Registers
Three write-only registers are used to initiate all DMA active. Once arbitration has begun (lBSY asserted), an
activity. They are: Start DMA Send, Start DMA Target arbitration delay of 2.2us must elapse before the Data Bus
Receive, and Start DMA Initiator Receive. Performing a can be examined to determine if Arbitration is enabled.
write operation into one of these registers starts the de- This delay is implemented in the controlling soft-
sired type of DMA transfer. Data presented to the Z53800n ware driver.
signals 07-00 during the register write is meaningless and
has no effect on the operation. Prior to writing these The Z5380 is a clockwise device. Delays such as bus-free
registers, the Block Mode DMA bit (bit 7), the DMA Mode delay, bus-set delay, and bus-settle delay are imple-
bit (bit 1), and the Target Mode bit (bit 6) ,in the Mode mented using gate delays. These delays may differ be-
Register must be appropriately set. The individual regis- tween devices because of inherent process variations, but
ters are briefly described as follows: are well within the proposed ANSI X3.131 - 1986 specifi-
cation.
Start DMA Send. Address 5 (Write Only). This register is
written to initiate a DMA send, from the DMA to the SCSI Interrupts
Bus, for either Initiator or Target role operations. The DMA
Mode bit (Mode Register, bit 1) is set prior to writing this The Z5380 provides an interrupt output (IRQ) to indicate a
register. task completion or an abnormal bus occurrence. The use
of interrupts is optional and may be disabled by resetting
Start DMA Target Receive. Address 6 (Write Only). This the appropriate bits in the Mode Register or the Select
register is written to initiate a DMA receive - from the SCSI Enable Register.
Bus to the DMA, for Target operation only. The DMA Mode
bit (bit 1) and the Target Mode bit (bit 6) in the Mode When an interrupt occurs, tile Bus and Status Register and
Register must both be set (1) prior to writing this register. the Current SCSI Bus Status Register (Figures 12 and 10)
must be read to determine which condition created the
Start DMA Initiator Receive. Address 7 (Write Only). This interrupt. IRQ can be reset simply by reading the Reset
register is written to initiate a DMA receive - from the SCSI Parity/Interrupt Register or by an external chip reset
Bus to the DMA, for Initiator operation only. The DMA Mode /RESET active for 200ns.
bit (bit 6) must be False (0) in the Mode Register prior to
writing this register. Assuming the Z5380 has been properly initialized, an
interrupt is generated if the chip is selected or reselected;
Reset Parity/Interrupt. Address 7 (Read Only). Reading if an /EOP signal occurs during a DMA transfer; if a SCSI
this register resets the Parity Error bit (bit 5), the Interrupt Bus reset occurs; if a parity error occurs during a data
Request bit (bit 4), and the Busy Error bit (bit 2) in the Bus transfer; if a bus phase mismatcil occurs; or if a SCSI Bus
and Status Register. disconnection occurs.
1062
The proposed SCSI specification also requires that no interrupt is disabled by resetting the Enable EOP Inter-
more than two device ID's be active during the selection rupt bit.
process. To ensure this, the Current SCSI Data Reg-
ister is read. The proper values for the Bus and Status Register and tile
Current SCSI Bus Status Register for this interrupt are
The proper values for the Bus and Status Register and the shown in Figures 16 and 17.
Current SCSI Bus Status Register are displayed in Figures
14 and 15, respectively.
lACK
IATN
lACK
Busy Error
IATN
Phase Match
Busy Error
Interrupt Request Active
Phase Match
Parity Error.
Interrupt Request Active
OMA Request
Parity Error
End of OMA
OMARequest
End of OMA
Figure 16. Bus and Status Register
I~=
~C"O IMSG
IREO
~------ IMSG IBSY
IREO IRST
' - - - - - - - - - - IBSY
L -_ _ _ _ _ _ _ _ _ _ IRST
Figure 17. Current SCSI Bus Status Register
1063
FUNCTIONAL DESCRIPTION (Continued)
For send operations, the End of DMA bit is set when the 07 00
DMA finishes its transfers, but the SCSI transfer may still be Ixlxlxlxlxlxlxlxl
in progress. If connected as a Target, IREO and lACK
should be sampled until both are False. If connected as an
Initiator, a phase change interrupt is used to signal the
completion of the previous phase. It is possible for the
Target to request additional data for the same phase. In
this case, a phase change will not occur and both IREO
and lACK are sampled to determine when the last byte was 1 -_ _ _ _ _ _ IMSG
transferred.
1-------- IREO
SCSI Bus Reset Interrupt ~-------- IB~
The Z5380 generates an interrupt when the IRST signal IRST
transitions to True. The device releases all bus signals
within a bus-clear delay ofthis transition. This interrupt also
occurs after setting the Assert/RST bit (Initiator Command Figure 19. Current SCSI Bus Status Register
Register, bit 7). This interrupt cannot be disabled. (Note:
IRST is not latched in bit 7 of the Current SCSI Bus Status
Register and is not active when this port is read. For this Parity Error Interrupt
case, the Bus Reset interrupt is determined by default.) An Interrupt is generated for a received parity error if the
Enable Parity Check (bit 5) and the Enable Parity Interrupt
The proper values for the Bus and Status Register and the (bit 4) bits are set (1) in the Mode Register. Parity is
Current SCSI Bus Status Register are displayed in Figures checked during a read of the Current SCSI Data Register
18 and 19, respectively. and during a DMA receive operation. A parity error can be
detected without generating an interrupt by disabling the
07 00 Enable Parity Interrupt bit and checking the Parity Error
10lxlol11xlolxlxl flag (Bus and Status Register, bit 5).
I~:~,
The proper values for the Bus and Status Register and the
Current SCSI Bus Status Register are displayed in Figures
20 and 21, respectively.
~ Phase Match
Phase Match
Figure 18. Bus and Status Register Interrupt Request Active
Parity Error
OMA Request
End 01 OMA
1064
lACK
IATN
Busy Error
Phase Match
IMSG Interrupt Request Active
IREO Parity Error
IBSY OMA Request
IRST End of OMA
Figure 21. Current SCSI Bus Status Register Figure 22. Bus and Status Register
I~=
corresponding bits in the Target Command Register:
Assert II/a (bit 0), Assert CI/O (bit 1), and Assert IMSG
(bit 2). The comparison occurs continually and is reflected
in the Phase Match bit (bit 3) of the Bus and Status
Register. If the OMA Mode bit (Mode Register, bit 1) is
active and a phase mismatch occurs when IREO transitions
~~/O IMSG
from False to True, an interrupt (IRO) is generated.
fREO
A phase mismatch prevents the recognition of IREO and IBSY
removes the chip from the bus during an Initiator send
IRST
operation (lOB7-/OBO and 10BP will not be driven even
through the Assert Data Bus bit (Initiator Command Reg-
ister, bitO) is active). This may be disabled by resetting the Figure 23. Current SCSI Bus Status Register
OMA Mode bit (Note: It is possible for this interrupt to occur
when connected as a Target if another device is driving the
phase lines to a different state). Loss of BSY Interrupt
If the Monitor Busy bit (bit 2) in the Mode Register is active,
The proper values for the Bus and Status Register and the an interrupt is generated if the BSY signal goes False for at
Current SCSI Bus Status Register are displayed in Figures least a bus-settle delay. This interrupt is disabled by
22 and 23, respectively. resetting the Monitor Busy bit. Register values are dis-
played in Figures 24 and 25.
1065
FUNCTIONAL DESCRIPTION (Continued)
~
lACK SCSI Bus Reset (/RST) Issued
IATN If the CPU sets the Assert IRST bit (bit 7) in the Initiator
Busy Error Command Register, the IRST signal goes active on the
SCSI Bus and an internal reset is performed. Again, all
Phase Match
internal logic and registers are cleared except for tile IRO
Interrupt Request Active interrupt latch and the Assert IRST bit (bit 7) in the Initiator
Parity Error Command Register. The IRST signal will continue to be
active until the Assert IRST bit is reset or Until a hardware
OMARequest
reset occurs.
End 01 OMA
Data Transfers
Data is transferred between SCSI Bus devices in one of
Figure 24. ,Bus and Status Register four modes (Reference Figures 26-41):
07 DO 1. Programmed 1/0
2. Normal DMA
lolololxlxlxlolol 3. Block Mode DMA
4. Pseudo DMA
I~=
~~/O
The following sections describe these modes in detail
(Note: For all data transfer operations, IDACK and ICS
should never be active simultaneously).
1066
ORO signal to generate /DACK and an /IOR or an /IOW Halting a DMA Operation
pulse to the Z5380. ORO goes inactive wilen /OACK is The lEap signal is not the only way to halt a OMA transfer.
asserted and /OACK goes inactive some time after the A bus phase mismatch or a reset of the OMA Mode bit
minimum read or write pulse width. This process is re- (Mode Register, bit 1) can also terminate a DMA cycle for
peated for every byte. For this mode, IOACK should not be the current bus phase.
allowed to cycle unless a transfer is taking place.
Using the IEOP Signal
Block Mode DMA If lEap is used, it should be asserted for at least 100ns
Some popular OMA Controllers, such as the 9517A, pro- while IOACK and liaR or IIOW are simultaneously active.
vide a Block Mode OMA transfer. This type of transfer Note, however, that if liaR or II OW is not active, an interrupt
allows the OMA controller to transfer blocl,s of data without is generated, but the OMA activity continues. The lEap
relinquishing the use of the Data Bus to the CPU after each signal does not reset the DMA Mode bit. Si[lcC the IEOP
byte is transferred; thus, faster transfer rates are achieved signal can occur during the last byte sent to the Output
by eliminating the repetitive access and release of the CPU Data Register, the IREO and lACK signals are monitored to
Bus. " the Block Mode OMA bit (Mode Register, bit 7) is ensure that the last byte has transferred.
active, the Z5380 begins the transfer by asserting ORO.
The OMA controller then asserts IOACK for the remainder Bus Phase Mismatch Interrupt
of the block transfer. ORO goes inactive for the duration of A bus phase mismatch interrupt is used to halt the transfer
the transfer. The Ready output is used to control the if operating as an Initiator. Using this method frees the host
transfer rate. Non-Block Mode OMA transfers end when from maintaining a data length counter and frees the DMA
IOACK goes False, whereas Block Mode OMA transfers logic from providing the lEap signal. If performing an
end when liaR or IIOW becomes inactive. Since this is the Initiator send operation, the Z5380 requires IOACK to
case, OMA transfers may be started sooner in a Block cycle before lACK goes inactive. Since phase changes
Mode transfer. To obtain optimum performance in Block cannot occur if lACK is active, either IOI\CK must be
Mode operation, the OMA logic optionally uses the normal cycled after the last byte is sent or the OMA Mode bit must
OMA mode interlocking handshake. Ready is still available be reset in order to receive the phase mismatch interrupt.
to throttle the'OMA transfer, but ORO is 30 to 40 ns faster
than Ready and is used to start the cycle sooner. The Resetting the DMA Mode Bit
methods described under "Halting a OMA Operation" A OMA operation may be halted at any time simply by
apply for all OMA operations. resetting the OMA Mode bit. It is recommended that the
OMA Mode bit be reset after receiving an lEap or bus
Pseudo DMA Mode phase-mismatch interrupt. Tile OMA Mode bit must then
To avoid the tedium of monitoring and asserting the re- be set before writing any of the start OMA registers for
quest/acknowledgement handshake signals for pro- subsequent bus phases.
grammed 1/0 transfers, the system can be designed to
implement a pseudo OMA mode. This mode is imple- If resetting the OMA Mode bit is used instead of lEap for
mented by programming the Z5380 to operate in the OMA Target role operation, then care must be taken to reset this
mode, but using the CPU to emulate the OMA handshake. bit at the proper time. If receiving data as a Target device,
ORO may be detected by polling the OMA Request bit (bit the OMA Mode bit must be reset once the last ORO is
6) in the Bus and Status,Register, by sampling the Signal received and before IOACK is asserted to prevent an
through an external porI. or by using it to generate a CPU additionallREO from occurring. Resetting this bit causes
interrupt. Once ORO is detected, the CPU can perform a ORO to go inactive. However, the last byte received
read or write data transfer. This CPU read/write is exter- remains in the Input Data Register and may be obtained
nally decoded to generate the appropriate IOACK and either by performing a normal CPU read or by cycling
liaR or IIOW signals. IOACK and liaR. In most cases, lEap is easier to use when
operating as a Target device.
Often, external decoding logic is necessary to generate
the Z5380 ICS signal. This same logic may be used to
generate /OACK at no extra cost and provide an increased
performance in programmed 1/0 transfers.
1067
READR EGISTERS
Address: 0
I Address: 3
I
~:
1071061051041 (Read Only) 1 07 1osl 05 104 10 (Read Only)
" • • 3.021011001
~
~AssertVIO
~ AssertC//O
. Assert/MSG
1DB3 Assert/REO
10B4 "0"
IOB5
IOB6 Figure 29. Target Command Reglster
.
IOB7
Address: 4
1 07 1osl 05 1 I (Read Only)
~~::
Figure 26. Current SCSI Dat a Register
.
Address: 1
I
OO~j"~_,....
1071061051041 (Read Only)
CliO
~ Assert/ATN IMSG
Assert/sEL fREO
AssertlBSY IBSY
AssertfACK IRST
Lost Arbitration
Arbitration in Progress Figure 30. Current SCSI Bus Status Reglster
.
AssertfRST
I~:,~,
Address: 2
Phase Match
Par~yError
Enable IEOP Interrupt
OMA !'lequest
_ ." Interrupt
Enable P~"'"
End of OMA
Enable Parity Check"Ing
Target Mode
Figure 31. Bus and Status Reglster
.
Block Mode OMA
1068
Address: 6 (Read Only)
Address: 7 (Read Only)
1071061051041031021011001 ImlooloolO4lool~lrnlool
~
lOBO 1 "X"
10Bl X ~ Don't Care
IOB2
10B3 Figure 33, Reset Parity/Interrupt
10B4
lOBS
IOB6
IOB7
WRITE REGISTERS
1071061051041031021011001 ImlooloolO4lool~lrnlool
~
IDBO Arbitrate
10Bl OMAMode
L-___________ 10B3
1DB4
Enable IEOP Interrupt
L-_____________ lOBS
Enable Parity Interrupt
L-________________ IDBS
Enable Parity Checking
Target Mode
~ ~
Assert Data Bus Assert VlO
Assert/ATN AssertCiID
Assert/SEL Assert/MSG
Assert/BSY Assert/REO
Assert/ACK "X"
"0"
1069
WRITE REGISTERS (Continued)
·X·
, Figure 38. Select Enable Register
1071061051041031021011001
11-_ _ _ _ .X.
Voltages on all pins Stresses greater than those listed under Absolute Maxi-
with respect to GND """"""""" .. """";",,,-O.3V to +7,OV mum Ratings may cause permanent damage to the de-
Operating Ambient Temperature ................................... t vice. This is a stress rating only; operation of the device at
Storage Temperature ............................. -65°C~0 + 150°C any condition above those indicated in the operational
sections of these specifications is notimplied, Exposure to
Note: absolute maximum rating conditions for extended periods
t See Ordering Information may affect device reliability.
1070
STANDARD TEST CONDITIONS
0.4 =X>~~~:s<::X=
O.B O.B
DC CHARACTERISTICS
Z5380
1071
AC CHARACTERISTICS
CPU Write Cycle Timing Diagram
A2-fJJJ
ICS
IIOW
D7-oo
AC CHARACTERISTICS
CPU Write Cycle Timing Table
Note:
[1) Write Enabte is the occurrence of flOW and /CS
1072
AC CHARACTERISTICS
CPU Read Cycle Timing Diagram
A2-AO
ICS
/lOR
07-00
AC CHARACTERISTICS
CPU Read Cycle Timing Table
Nole:
[1 J Read Enable is the occurrence of liaR and leS.
1073
AC CHARACTERISTICS .
DMA Write (Non-Block Mode) Target Send Cycle Timing Diagram
ORQ
10ACK
IIOW
07-00 .
lEap
IREQ
lACK
IOB7-/OBO,
10BP
1074
AC CHARACTERISTICS
DMA Write (Non-Block Mode) Target Send Cycle Table
Notes:
[1] Write Enable is the occurrence of IIOW and IDACK.
[2] IEOP,/IOW, and /DACK must be concurrently Low for at least T7 for proper recognition of the lEap pulse.
1075
AC CHARACTERISTICS
DMA Write (Non-Block Mode) Initiator Send Cycle Timing Diagram
ORO
10ACK
IIOW
07-00
/EOP
IREO
lACK
1087-/080,
108P
1076
AC CHARACTERISTICS
DMA Write (Non-Block Mode) Initiator Send Cycle Table
NOles:
[1] Write Enable is the occurrence of /lOW and IDACK.
[2] lEap, IIOW, and /DACK must be concurrenUy Low for at least T7 for proper recognition of the lEap pulse.
1077
AC CHARACTERISTICS
DMA Read (Non-Block Mode) Target Receive Cycle Timing Diagram
ORO
10ACK
/lOR
07-00
IEOP
IREO
lACK
IOB7-/OBO,
10BP
1078
AC CHARACTERISTICS
DMA Read (Non-Block Mode) Target Receive Cycle Table
Noles:
[1] Read Enable is the occurrence of IIOR and /DACK.
[2] /EOP, IIOR, and /DACK must be concurrently Low for at least T6 for proper recognition of the /EOP pulse.
1079
AC CHARACTERISTICS
DMA Read (Non-Block Mode) Initiator Receive Cycle Timing Diagram
ORO
10ACK
/lOR
07-00
IEOP
/REO
lACK
IOB7-/OBO,
IOBP
1080
AC CHARACTERISTICS
DMA Read (Non-Block Mode) Initiator Receive Cycle Table
Notes:
[1) Read Enable is the occurrence of /lOR and /DACK.
[2) IEOP./IOR. and /DACK must be concurrently Low for at least T6 for proper recognition of the IEOP pulse.
1081
AC CHARACTERISTICS
DMA Write (Block Mode) Target Send Cycle Timing Diagram
ORO
fOACK
flOW
07-00
1E0P
fREO
fACK
~--~~----~1IV1----~~--~12~--~
REAOY
~------~131r-------~
fOB7-mBO,
fOBP
1082
AC CHARACTERISTICS
DMA Write (Block Mode) Target Send Cycle Table
Noles:
[1] Write Enable is the occurrence of /lOW and /DACK.
[2] IEOP,flOW, and IDACK must be concurrently Low for at least T6 for proper recognition of the lEap pulse.
1083
AC CHARACTERISTICS
DMA Read (Block Mode) Target Receive Cycle Timing Diagram
ORO
IOACK
/lOR
07-00
IEOP
/REO
lACK
REAOY
IOB7-IOBO,
IOBP
1084
AC CHARACTERISTICS
DMA Read (Block Mode) Target Receive Cycle Table
Notes:
[1] Read Enable is the occurrence of liaR and /DACK.
[2] lEap, /lOR. and /DACK must be concurrently Low for at leaSt T5 for proper recognition of the lEap pulse.
1085
AC CHARACTERISTICS
Arbitration
IRST J
ISEL
IBSY
IOB7-0BO,
10BP
ARBITRATE _ _ _ _...J
/
\'-----
Figure 52. Arbitration
AC CHARACTERISTICS
Reset
!RESET
-----.~~
r-:>=1 ~----
1086
Z5380NOTES
1. Edge-triggered /RST Interrupt - If the SCSI Bus is not 6. Phase Mismatch Interrupt - A phase mismatch interrupt
terminated, the IRST interrupt is continually generated. is not guaranteed after a reselection for the following
reasons:
2. True End of DMA Interrupt - The Z5380 generates an
interrupt when it receives the last byte from the DMA, not DMA Mode bit must be set in order to receive a phase
when the last byte is transferred to the SCSI Bus. . mismatch interrupt.
3. Return to Ready after lEap Interrupt - When operating in DMA Mode bit can not be set unless IBSY is active.
Block Mode DMA, the Z5380 does not return the Ready
signal to a Ready condition. This locks up the bus and IBSY can not be asserted until after the reselection has
prevents the CPU from executing. occurred.' .
4. SCSI handshake after lEap occurs - If an EOP occurs Once IBSY is asserted, the Target may assert/REO in less
when receiving data, a subsequent request will cause than 500ns.
lACK to be asserted even though no ORO is issued.
The phase mismatch interrupt is generated on the active
5. Reselection Interrupt - During reselection, if the Target edge of IREO. If the DMA Mode bit is not set before the
Command Register does not reflect the current bus phase IREO goes active, the phase mismatch interrupt will not
(most likely Data Out), the reselection interrupt may get occur.
reset.
1087
ADVANCE INFORMATION SPECIFICATION
~ZiIm
Z53C80
SMALL COMPUTER SYSTEM INTERFACE
(SCSI)
FEATURES
• Asynchronous Interface. supports data transfers up • DMA or Programmed I/O Data Transfers
to 3 Mbytes/sec
• Supports Normal or Block Mode DMA
• Direct SCSI Bus Interface with On-Board 4BmA drivers
• Memory or I/O Mapped CPU Interface
GENERAL DESCRIPTION
The Z53CBO SCSI (Small Computer System Interface) condition that requires attention. It also supports arbitra-
controller is a 44-pin PLCC or 4B-pin 01 P CMOS device. It tion and reselection. The Z53CBO has the proper hand-
is designed to implement the SCSI protocol as defined by shake signals to support normal and block mode DMA
the ANSI X3.131-19B6 standard. and is fully compatible operations with most DMA controllers available.
with the industry standard 53CBO. It is capable of operat-
ing both as a Target and as an Initiator. Special high- Figure 1 is the functional block diagram ofthe Z53CBO. Tile
current open-drain outputs enable it to directly interface to pin functions of the Z53CBO are shown in Figure 2. The
the SCSI bus. The Z53CBO has the necessary interface device is housed in a 4B-pin DIP (Figure 3) and a 44-pin
hook-ups so the system CPU can communicate with it like PLCC package (Figure 4).*
with any other peripheral device. The CPU can read from.
or write to. the SCSI registers which are addressed as Note: All Signals with a preceding front slash, "I", are active
standard or memory-mapped I/Os. Low, e.g.: B/IW (WORD is active Low); IBIW (BYrE is
active Low, only).
The Z53CBO increases the system performance by mini- 'Note: Power connections follow
mizing the CPU intervention in DMA operations which the
SCSI controls. The CPU is interrupted when it detects a bus
1089
GENERAL DESCRIPTION (Continued)
/087-/DBO,
IDBP lACK IATN IBSY IMSG V/O ClIO !REO !RST ISEL
ICS
CPU BUS
Interface
!RESET
A2-AO
DMA Intenupl Control
07-00 Logic Logic Registers
l<: II..
~ ~
~
c ~a: ~
Z53C80
DRQ
READY
IRQ
VSS
1090
IDB7 IDB6
IRST 47 IDB5
Vss 46 Vss
IBSY 4 45 IDB4
Isa 5 44 IOB3',
IATN 43 IDB2 ,
N/C 42 N/C
IRESET 41 IDB1
1R2 40 IDBO
OR2 10 39 Vss
IEOP 11 38 IDBP
IDACK 12 Z53C80 37 IREO
Vss 13 36 lACK
READY 14 35 1//0
AD 15 34 Vss
A1 16 33 C/ID
A2 17 32 IMSG
N/C 18 31 N/C
ICS 19 30 DO
now 20 29 01
nOR 21 28 02,
07 22 27 03
06 23 26 04
05 24 25
VOO
z
!;i;
-'
w >-
en
!'Q !!! ~ IE
. ~
....
!;!
on
'" '"!;!'" !;!'"
..
>
a!i
!;!
C')
'"
!;!
/RESET 1D32
IRO 38 IDBl
DR2 37 IDBO
1E0P 36 Vss
IDACK 35 IDBP
Vss 34 /REO
READY 33 lACK
AO 32 1110
Al 31 Vss
A2 30 C/ID
ICS 29 IMSG
3i= 0:
0
::; 0'" on
0
0
0 Zi 8 ~ Ei C>
0
0 >
"" ""
Figure 4. 44-Pin PLCC Pin Assignments
1091
PIN DESCRIPTIONS
Microprocessor Bus
A2-AO. Address Lines (Input). Address lines are used with lACK. Acknowledge (Bidirectional, Open-drain, Active
ICS, IIOR, and II OW to address all internal registers. Low). Driven by an Initiator, lACK indicates an acknowl-
edgment for a IREOIIACK data-transfer handshake. In the
ICS. Chip Select (Input, Active Low). This signal, in Target role, lACK is received as a response to the IREO
conjuction with IIOR or IIOW, enables the internal registers Signal.
selected by A2-AO, to be read from or written to.
IATN. Attention (Bidirectional, Open-drain, Active Low).
10ACK. DMA Acknowledge (Input, Active Low). IDACK Driven by an Initiator, received by the Target, IATN indi-
resets ORO and selects the data register for input or output cates an Attention condition.
data transfers./DACK is used by DMA controller instead of
ICS. IBSY. Busy (Bidirectional, Open-drain, Active Low). This
signal indicates that the SCSI Bus is being used and can
ORO. DMA Request (Output, Active High). ORO indicates be driven by both the Initiator and tile Target device.
that the data request is ready to be read or written. ORO is
asserted only if DMA mode is set in the Command Regis- CliO. Control//Data. (Bidirectional, Open-drain). Driven by
ter. ORO is cleared by IDACK. the Target and received by the Initiator, CliO indicates
whether Control Of Data information is on the Data Bus.
07-00. Data Lines(Bidirectional, three~state, Active High). True indicates Control.
Bidirectional microprocessor data bus lines.
IOB7-/OBO, IDBP. Data Bus Bits, Data Bus Parity Bit
IEOP. End of Process (Input, Active Low)./EOP is used to (Bidirectional, Open-drain). These eight data bits (/DB7-1
terminate a DMA transfer. If asserted during a DMA cycle, DBO), plus a parity bit (lDBP) form the data bus./DB7 is the
the current byte will be transferred, but no additional bytes most Significant bit (MSB) and has the higilest priority
will be requested. during the Arbitration phase. Data parity is odd. Parity is
always generated and optionally checked. Parity is not
/lOR. I/O Read(lnput, Active Low)./IOR is used in conjunc- valid during Arbitration.
tion with ICS and A2-AO to read an internal register. It also
selects the Input Data Register when used with IDACK. 1//0. Input/IOutput (Bidirectional, Open-drain). 1/10 is a
signal driven by a Target which controls the direction of
I.IOW. I/O Write (Input, Active Low). II OW is used in con- data movement on the SCSI bus. True indicates inputto the
junction with ICS and A2-AO to write to an internal register. Initiator. This signal is also used to distinguish between
It also selects the Output Data Register when used with Selection .and Reselection phases.
/DACK.
IMSG. Message (Bidirectional, Open-drain, Active Low).
IRO. Interrupt Request (Output, Active High). IRO alerts a This signal is driven by the Target during the Message
microprocessor of an error condition or an event comple- phase. The signal is received by the Initiator.
tion.
IREO. Request (Bidirectional, Open-drain, Active I. ow).
READY. Ready (Output, Active High). READY is used to Driven by a Target and received by the Initiator, this signal
control the speed of Block Mode DMA transfers. This indicates a request for a IREOIIACK data-transfer hand-
signal goes active to indicate that the chip is ready to sendl shake.
receive data and remains Low after a transfer until the last
byte is sent or until the DMA Mode bit is reset. IRST. SCSI Bus Reset (Bidirectional, Open-drain, Active
Low). This signal indicates a SCSI Bus Reset condition.
IRESET. Reset (Input, Active Low). IRESET clears all
registers. It has no effect upon the SCSIIRST signal. ISEl. Select(Bidirectional, Open-drain, Active Low). This
signal is used by an Initiator to select a Target, or by a
SCSI Interface Signals Target to reselect an Initiator.
1092
APPLICATION NOTES
AND TECHNICAL ARTICLES
1093
~Zirm
ON-CHIP OSCILLATOR DESIGN
INTRODUCTION
This Application Note (App Note) is written for deSigners 2. To eliminate field failures and other complications result-
using Zilog Integrated Circuits with on-chip oscillators; ing from an unawareness of critical on-chip oscillator
circuits in which the amplifier portion of a feedback oscillator design constraints and requirements.
is contained on the IC. This App Note covers common
theory of oscillators, and requirements of the circuitry (both Problem Background
internal and external to the IC) which comes from the
theory for crystal and ceramic resonator based circuits. Inadequate understanding of the theory and practice of
oscillator circuit design, especially concerning oscillator
Purpose and Benefits startup, has resulted in an unreliable design and subse-
quent field problems (See on page 10 for reference mate-
The purposes and benefits of this App Note include: rials and acknowledgements).
The circuit under discussion is called the Pierce Oscillator the crystal, stability with respect to Vee and temperature,
(Figures 1, 2). The configuration used is in all Zilog on-chip and low impedances (not disturbed by stray effects). One
oscillators. Advantages of this circuit are low power con- drawback is the need for high· gain. in the amplifier to
sumption, low cost, large output signal, low power level in compensate for feedback path losses.
IC
Va
I
L ---------- -I
XTAL
B 0
C1
T T C2
~
--
Figure 1. BasiC Circuit and Loop Gain
1095
OSCILLATOR THEORY OF OPERATION (Continued)
Pierce Oscillator (Feedback Type) the loop gain at pOints around the frequency of oscillation
must be greater than one. This achieves an average loop
The basic circuit and loop gain is shown in Figure 1. The gain of one at the operating frequency.
concept is straightforward; gain of the amplifier is
A = VoNi. The gain of the passive feedback element is The amplifier portion of the oscillator provides gain> 1 plus
B = ViNo. Combining these equations gives the equality 180 degrees of phase shift. The feedback element provides
AB = 1. Therefore, the total gain around the loop is unity. the additional 180 degrees of phase shift without allenu-
Also, since the gain factors A and B are complex numbers, ating the loop gain to < 1. To do this the feedback element
they have phase characteristics. It is clear that the total is inductive, Le., it must have a positive reactance at the
phase shift around the loop is forced to zero (Le., 360 frequency of operation. The feedback elements discussed
degrees), since V1N must be in phase with itself. In this are quartz crystals and ceramic resonators.
circuit, the amplifier ideally provides 180degrees of phase
shift (since it is an inverter). Hence, the feedback element Quartz Crystals
is forced to provide the other 180 degrees of phase shift.
A quartz crystal is a piezoelectric device; one whicll
Additionally, these gain and phase characteristics of both transforms electrical energy to mechanical energy and
the amplifier and the feedback element vary with fre- vice versa. The transformation occurs at the resonant
quency. Thus, the above relationships must apply at the frequency of the crystal. This happens when the applied
frequency of interest. Also, in this circuit the amplifier is an AC electric field is sympathetic in frequency with the
active element and the feedback element is passive. Thus, mechanical resonance of the slice of quartz. Since this
by definition, the gain of the amplifier atfrequency must be characteristic can be made very accurate, quartz crystals
greater than unity, if the loop gain is to be unity. are normally used where frequency stabiiity is critical.
Typical frequency tolerance is .005 to 0.3%.
The described oscillator amplifies its own noise at startup
until it settles at the frequency which satisfies the gain! The advantage of a quartz crystal in this application is its
phase requirement AB = 1. This means loop gain equals wide range of positive reactance values (Le., it looks
one, and loop phase equals zero (360 degrees). Todothis, inductive) over a narrow range of frequencies (Figure 3).
Region of Parallel
Operation
INDUCTIVE
o 2Y\'
CAPACITIVE
1096
However, there are several ranges of frequencies where
Cs
the reactance is positive; these are the fundamental (de-
sired frequency of operation), and the third and fifth
mechanical overtones (approximately 3 and 5 times the
fundamental frequency). Since the desired frequency range
in this application is always the fundamental, the overtones R L C
must be suppressed. This is done by reducing the loop
gain at these frequencies. Usually, the amplifier's gain roll
off, in combination with the crystal parasitics and load
Quartz Equivalent Circuit
capacitors, is sufficient to reduce gain and prevent oscil-
lation at the overtone frequencies.
1097
OSCILLATOR THEORY OF OPERATION
Impedance 100000
(Ohm)
10000
~ooo
10
o ~--~----~--~----~--~~--~----~--~----~--~
2000 4000 6000 8000 10000
Frequency (KHz)
1098
Power
Supply
RTxCB(SCC) SYNCB(SCC)
EXTAL (Z180) XTAL (Z180)
~ I.C.
~22PI
470 pf Under Test
(All Unused
Probe (in) ____ ~
Frequency
Generator Probe
1V P-P/Sine (out)
Load Capacitors OPEN Loop GAIN VS. FREQUENCY OVER LOT, vee, PROCESSS
SPLIT, AND TEMP. Closed loop gain must be adequate to start
The effects/purposes of the load caps are: the oscillator and keep it running at the desired frequency.
This means that the amplifier open loop gain must be equal
Cap C2 combined with the amp output resistance pro- to one plus the gain required to overcome the losses in ttle
vides a small phase shift. It also provides some attenuation feedback path, across the frequency band and up to the
of overtones. frequencyof operation. This isover full process. lot. Vcc' and
temperature ranges. Therefore. measuring ttle open loop
Cap C1 combined with the 'crystal resistance provides gain is not sufficient; the losses in the feedback palll
additional phase shift. (crystal and load caps) must be factored in.
These two phase shifts place the crystal in the parallel Open Loop Phase VS. Frequency. Amplifier phase shift at
resonant region of Figure 3. and near the frequency of interest must be 180 degrees
plus some, minus zero. The parallel configuration allows
Crystal manufacturers specify a load capacitance num- for some phase delay in the amplifier. The crystal adjusts
ber. This number is the load seen by the crystal which is the to this by moving slightly down the reactance curve
series combination of C1 and C2, including all parasitics (Figure 3).
(PCB and holder). This load is specified for crystals meant
to be used in a parallel resonant configuration. The effect Internal Bias. Internal to the IC, there is a resistor placed
on startup time; if C1 and C2 increase, startup time from output to input of the amplifier. The purpose of tllis
increases to the point at which the oscillator will not start. feedback is to bias the amplifier in its linear region and to
Hence, for fast and reliable startup, over manufacture of provide the startup transition. Typical values are
large quantities, the load caps should be sized as low as 1M to 20M ohms.
possible without resulting in overtone operation.
Amplifier Characteristics
1099
PRACTICE: CIRCUIT ELEMENT AND LAY OUT CONSIDERATIONS
The discussion now applies prior theory to the practical Gain Measurement Circuit. The gain of the amplifier can be
application. measured using the Circuits of Figures 6 & 7. This may be
necessary to verify adequate gain at the frequency of
Amplifier and Feedback Resistor interest and in determining design margin.
The elements of the circuit, internal to the IC, include the Gain Requirement vs. Temperature, Frequency and Sup-
amplifier, feedback resistor, and output resistance. The ply Voltage. The gain to start and sustain oscillation
amplifier is modeled as a transconductance amplifier with (Figure 8) must comply with:
a gain specified as 1000NIN (amps per volt).
gm > 41t" f2 Rq CIN COUTt x M
Transconductance/Gain. The loop gain AB = gm x Z1, where: M is a quartz form factor = (1 + COUT/CIN+ COlR/CQUT)2
where gm is amplifier transconductance (gain) in amps/
volt and Z1 is the load seen by the output. AB must be Output Impedance. The output impedance limits power to
greater than unity at and about the frequency of operation the XTAL and provides small phase shift with load cap C2.
to sustain oscillation.
DGBias
,.----f DC Bias t--.---f
Vb
V in Vout
*
VIN "---I VOUT
Quartz
0
GIN ....- - - - !
I
Rq, f
I--
GOUT
)-.
* Inside chip, feedback resistor biases the amplifier in the high gm region.
** External components typically: GIN", GOUT", 30 to 50 pf (add 10 pf pin cap).
1100
Load Capacitors The external components have a negligible effect (0.5%)
on frequency. The external components (C1 ,C2) and lay-
In the selection of load caps it is understood that parasitics out are chosen primarily for good startup and reliability
are always included. reasons.
Upper Umits. If the Imid caps are too large, the oscillator Frequency Tolerance (initialtemperature and aging). Initial
will not start because the loop gain is too low at the tolerance is typically ±.01 %. Temperature tolerance is
operating frequency. This is due to the impedance of the typically±.005% overthe temp range (-30 to + 100degrees
load capacitors. Larger load caps produce a longer startup. C). Aging tolerance is also given, typically
±.OO5%.
Lower Umits. If the load caps are too small, either the
oscillator will not start (due to inadequate phase shift Holder. Typical holder part numbers are HC6, 18,
around the loop), or it will run at a 3rd, 5th, or 7th overtone 25,33,44.
frequency (due to inadequate suppression of higher
overtones). Shunt Capacitance. (Cs) typically <7 pf.
Capacitor Type and Tolerance. Ceramic caps of ±10% Mode. Typically the mode (fundamental, 3rd or 5th over-
tolerance should be adequate for most applications. tone) is specified as well as the loading configuration
(series vs. parallel). .
Ceramic vs. Quartz. Manufacturers of ceramic resonators
generally specify larger load cap values than quartz crys- The ceramic resonator equivalent circuit is the same as
tals. Quartz C is typically 15 to 30 pf and ceramic shown in Figure 4. The values differ from those specified in
typically 100pl. the theory section. Note that the ratio of UC is much lower
than with quartz crystals. This gives a lower Q which allows
Summary. For reliable and fast startup, capacitors should a faster startup and looser frequency tolerance (typically
be as small as possible without resulting in overtone ±0.9% over time and temperature) than quartz.
operation. The selection of these capacitors is critical and
all of the factors covered in this note should be considered. Layout
Feedback Element The following text explains trace layout as it affecls ltle
various stray capacitance parameters (Figure 9).
The following text describes the specific parameters of a
typical crystal: Traces and Placement. Traces connecting cryslal,caps,
and the IC oscillator pins should be as short and wide as
Drive Level. There is no problem at frequencies greater possible (this helps reduce parasitic inductance and re-
than 1 MHz and Vee = 5V since high frequency AT cut sistance). Therefore, the components (caps and cryslal)
crystals are designed for relatively high drive levels should be placed as close to the oscillator pins of the IC
(5-10 mw max). as possible.
A typical calculation for the approximate power dissipated Grounding/Guarding. The traces from the oscillator pins of
in a crystal is: the IC should be guarded from all other traces (clock, Vcc'
address/data lines) to reduce crosstalk. This is usually
P = 2R (nx fx_Cx Vee )2 accomplished by keeping other traces away from the
oscillator circuit and by placing a ground ring around the
Where. R = crystal resistance of 40 ohms, C = C1 + Co = traces/components (Figure 9).
20 pf. The calculation gives a power dissipation of 2 mW
at 16MHz.
Measurement and Observation
Series Resistance. Lower series resistance gives better
performance but costs more.· Higher R results in more Connection of a scope to either of the circuit nodes is likely
power dissipation and longer startup, but can be compen- to affect operation because the scope adds 3-30 pf of
sated by reduced C1 and C2. This value ranges from 200 capaciiance and 1M-l OM ohms of resistance to ttle circuit.
ohms at 1 MHz down to 15 ohms at 20 MHz.
1101
PRACTICE: CIRCUIT ELEMENT AND LAY OUT CONSIDERATIONS (continued)
Indications of an Unreliable Design Output Level. The signal at the amplifier output should
swing from ground to Vcc. This indicates ttlere is adequate
There are two major indicators which are used in working gain in the amplifier. As the oscillator starts up, the signal
designs to determine their reliability over full lot and tem- amplitude grows until clipping occurs, at which point, tile
perature variations. They are: loop gain is effectively reduced 10 unity and constant
oscillation is achieved. A signal of less than 2.5 Vp-p is all
Start Up Time. If start up time is excessive, or varies widely indication that low gain may be a problem. Eittler C1/C2
from unit to unit, there is probably a gain problem. C1/C2 should be made smaller or a low R crystal Sllould
needs to be reduced; the amplifier gain is not adequate at be used.
frequency, or crystal Rs is too large.
D Z80180
CL EXTAL
2
Clock Generator Circuit 3Q------'
Z80180
SignalsA B
, I I
I I
(Parallel Traces I I
Must Be Avoided) I I
Board Design Example
----,:r-::--t-
; I I
(Top View)
Signal C
I
• To prevent induced noice, the crystal and load
capacitors should be physically located as
close to the LSI as possible.
64
• Signal lines should not run parallel to the clock
oscillator inputs. In particullar, the clock input
Z80180 circuitry and the system clock output (pin 64)
should be separated as much as possible.
1102
SUMMARY
Understanding the Theory of Operation of oscillators, along with good layout practices, results in a cost effective,
combined with practical applications, should give design- trouble free design. Reference the following text for Zilog
ers enough information to design reliable oscillator cir- products with on-chip oscillators and their general/
cuits. Proper selection of crystals and load capacitors, specific requirements.
The following are some recommendations on values/pa- Z8000 Family (8581 only)
rameters of components for use with Zilog on-chip oscilla-
tors. These are only recommendations; no guarantees are General Requirements:
made by performance of components outside of Zilog ICs.
Finally, the values/parameters chosen depend on the Crystal cut: AT cut, parallel resonant, fundamental mode.
application. This App Note is meant as a guideline to Crystal Co: < 7 pf for all frequencies ..
making these decisions. Selection of optimal components Crystal Rs: < 150 ohms for all frequencies.
is always a function of desired cosVperformance tradeoffs. Load capacitance: 10 to 33 pI.
Note: All load capacitance specs include stray capacitance. Z80 Family
1103
ZILOG CHIP PARAMETERS (Continued)
Communications Family
Crystal cut: AT cut, parallel resonant, fundamental mode. 8530/85C30/SCC: f = 1 - 6MHz (10MHz SCC), 1- 8.5 Mllz
Crystal Co: < 7 pf for all frequencies. (8 MHz SCC).
Crystal Rs: < 150 ohms lor alilrequencies. 85130/ESCC (16/20 MHz), I = 1 - 16.384 MHz.
Load capacitance: 20 to 33 pf. 16C35/ISCC: f = 1 -10 MHz.
Frequency: cannot exceed PCLK.
Intel Corp., Application Note AP-155, "Oscillators lor Micro Zilog, Inc., Steve German; Figu'res 4 and 8.
Controllers", orderff230659-001, by Tom Williamson, Dec.
1986. Zilog, Inc., Application Note, "Design Considerations Us-
ing Quartz Crystals wittl Zilog Components" - Oct. 1988.
Motorola 68HC11 Reference Manual.
Data Sheets; CTS Corp. Knigllts Div., Crystal Oscillators.
National Semiconductor Corp., App Notes 326 and 400.
1104
Z8 Low Cost Thermal Printer
1105
Figure 1. Thermal Printer
Since the print head traverses the width of the paper on t=R*E/V2
the head feed screw, the electronic signals required to
operate the head are delivered via a flexible printed Where: R = Head Resistance (Ohms)
circuit (typically copper traces sandwiched between E = Applied Energy (mj)
mylar). Each dot has a closely controlled value of V = Voltage (Volts)
resistance. This resistance ranges between 14 and 18 t = Pulse Width (ms)
ohms in compact thermal printers. Heat is generated by
a given dot through 12R dissipation. Figure 4. Thermal Energy Equation
A dot has a maximum applied energy specification and The Thermal Energy Equation yields a required pulse
a recommended or rated specification. Printer manu- width of 1.34 ms to apply the rated energy of the head.
facturers describe this energy in Joules, or more closely, The value of E, the applied energy in the equation,
milli-joules (mj). One joule per second is one watt. needs to reflect the effects that ambient temperature
Energy is usually expressed with a time base. Under- fluctuations induce. The equation to compensate the
standing this concept is essential in thermal printer applied energy used in deriving pulse width is given by
design. The print circuit must not exceed the energy Figure 5.
rating of a dot. Simultaneously, it must control the
duration (dissipation) to ensure proper print quality and E = Eo (1 + T o -Tl100)
protection of the print head elements (dots).
Where: E = Applied Energy (mj)
For example, a dot has a resistance of 16 ohms, a rated Eo = Rated Energy (mj)
energy spec of 2.10 mj, and a maximum energy spec of To= 24°C
2.52 mj, at 5 Volts. The pulse width (time) required to T = Ambient Temperature (0C)
apply the rated energy in milliseconds is given by the
equation in Figure 4. Figure 5. Ambient Temp 'Compensation Equation
1106
Z01
01 02 03 04
(,63)
oo D--L°.35
E1
2.75
o *
00t80
o Units = mm·
1107
STEPS
PHASES 1 I 2 I 3 I 4 1 2 3 I 4
* 1
! I
I
I :
.1
1 o
1
! o 1 i
1
1 0 I
I
0 1 I
I
1
1
1
1 I I
I
I
I
1 roo--
I
1 1 o l 0 1 1 0 1
I
0
1 1 1
1 1 I
1
~3 o 1 I
1
1 o o 1 1
1
1 o 1
I
1 1
1 1 1 1
1 1 I 1
1 1
1
~4 o 1 o 111 010 111
1 1 ~
1
:
1
1
I1 1
I I
I
I1 I1 1
1
HEX C Isl3l91 cIs '3l91
1k DOT 1 --~+---.--.-~---t---J---J----!---
DOT 2 ---.-i----!----~-l---~---~----~--
DOT 3 ---l---J----.,I----L---_-J---J----L---
I . I I I
r----~---~----L---~---.-J---J----~---
DOT 4
I . I I
DM5r-_~-+---+---J--- ~----L---L---}---
I
I' I I 1 1
DOT S r----+---t---~--i---~----~---~ ___ ~ __ _
DOT7 ____ +___ JII_i ___ ~~--~----~---r---~---
DOTS ----JII-.-~-.-_-~---L---L---
* HEAD FEED MOTOR . ** THERMAL HEAD
Depending upon the application environment and oper- Another possible parallel interface is the Centronics.
ating conditions, the designer must consider to what With 32 potential 1/0 signals on the ZS, 17 of which are
degree he provides print head protection. Bad resets, used for the printer interface, only a subset of the
power fails, ESD jolts, and printing errors can produce Centronics interface can be adapted directly to the ZS.
potential conditions whereby the head is left on too long. The designer could adapt full interfaces if required by
Depending on the maximum energy rating, the heads the application, through addition allogic (Table 2).
can be permanently damaged after only seconds of
carrying current continuously. The designer should The ZS has two-wire handshake logic built-in, greatly
consider these different potentially dangerous scenar- simplifying data flow. The stars in Table 2 show the
ios and make arrangements to avoid/manage them. boundary between a simple parallel interface, and a
One helpful design is to install a MOSFET in the complex one.
ULN2S01 A to VCC path. Then, a Watchdog chip can be
used to switch off the MOSFET in the event that the
ZS6E21 has lost its way due to upset. This then
removes power from the print circuit.
1109
+5V
0
1.0 K
2.2 K
7.2V -f.
r-lr-/
HOME
I t- +5V
,- '"'- +5V_
7 I 5KPAK
1 18 ,151
6 "1 2 17
51 2 -HEAD
5 3 16
f/3
4 4 15
PORT 0- rj4
5 ULN2801A 14 ~
3
+~
2 6 13
'1 2 -PAPER
1 7 12
}33
0 8 11
- rj4
+5V rg '"1i)~
Z86E21
f
-I 5KPAK 1 -
7 J. 1 18 01
6 2 17 02
5 3 16 03
4 4 15 04
PORT 1_ I-- DOTS
ULN2801A
3 5 14 05
2 6 13 06
1 7 12 07
0 8 11 08
- -
.-J!- ~ +5V
~
-
GND
_1
- --
0.1 uf T C1
I
- -
~
1111
C RESET
--------~--------
::>
INITZ8,
SET PORTS 0, 1 =ZERO
NO
NO
CONTINUE
NO
YES
LOOK UP CHARACTER
IN ROM
YES
PRINT COLUMN
NO
BUSY P37
liNT RESET
of:: 50uf
IERR P34
ISLN P23
CONNECTOR +t Z8
~ I 5KPAK I
00 P20
01 P21
02 J. P22
03 P23
Parallel Oata - 04 P24
05 P25
06 P26
07 P27
'--
ISTB IDAV2 P31
BSY
~ P36·
lACK P35
1114
ISTB
r-
I
tSL--1
~~----------~
BSY I
I
I
~
I
lACK
t SL =0.5 us min =
t DH 0.5 us min t AH = 6 us typ
t SB = 2.8 us typ tAL = 10 us typ
t DS = 0 us min tAB = 4 us typ
1115
EXPAND THE 1/0 PORTS IN YOUR Z8 APPLICATIONS
fRO
---..
~ I"'\ 50ns ~
61ns ~ r
/'
Certain Z8 applications require extra 1/0 ports. Some
engineers use the 74LS374 for expanded output ports
and the 74LS244 for expanded input ports. The advan- Figure 1. Interrupt/Read Timing
tage of using these TTLs is low cost. The disadvantage
is inflexibility (for example: you have to configure the
port direction by hardware). This Application Note ex- SOFTWARE
plains the use of the Z80 PIO to expand the 1/0 ports in
your Z8 applications. ' The Z80 PIO ports can be programmed to operate in
four modes: Output (Mode 0), Input (Mode 1), Bidirec-
tional (Mode 2) and Bit Control (Mode 3). These four
HARDWARE
modes have different program sequencing (Page 85 of
the Z80 Family Data Book January, 1989 describe the
The Z8691 circuit diagram interface with the Z80 PIO
details). This document uses Mode 3 as an example.
is shown in Rgure 2. In this application, the Z80 PIO
Program 1 (Figure 3) shows the initialization of Mode 3.
interrupts and handshakes are not used. Also, because
the Z8 does not provide M1 signals to the PIO, PIO pin
37 is pulled high. The IRD (Read Cycle Status) and I DEVELOPMENT TOOL APPLICATIONS
10RO (Input/Output Request) signals are composed of
ICE and R/IW by using U5 (74LS04) and U6 (74LS32). The following text and illustrations show hardwarel
software parameter applications as a development tool
The address of the PIO in this application is %1000- for expandable ports.
%1 FFF (HEX). Ports A and B ofthe PIO are selected by
AO (Address line) = "0" and AO = 1, respectively. The Hardware Applications
Data Mode or Control Mode of the P 10 can be selected
by A1 ="0" or A1 ="1", respectively. Table 1 shows the Since the ICE (In Circuit Emulation) chip of the CCP
relationship between AO, A 1, NIB and CliO. family is not available, it is very difficult to emulate the
Z86C30/40 by using the Z86C90. Because the Z86C90
Table 1. AddresslPort Relationships is configured with Port 1 as an Address/Data Bus and
Port 0 as an Address Bus, the chip still needs two ports
A1 AO STATUS (Port 0 and Port 1) for Z86C40 emulation. Figure 6
illustrates the PIO application for the Z86C90 to emulate
o o Port A Data Mode the missing ports (Port A = Port 0 and Port B = Port 1).
1 o Port A Control Mode
o 1 Port B Data Mode Four methods are proposed to emulate the Z86C301
1 o Port B Control Mode C40 by using this PIO application:
2. Z86C1900ZEM method
1117
....
OCI
1
SOFTWARE
1119
2. Z86C1900ZEM method SOFTWARE APPLICATION
Build a Pia board like Figure 7. Disconnect the Actually, the user has to change his debug program
ICSRAM signal (Pin3 of U6 to Pin 20 of U3) of when using this application to emulate the Z86C40/30.
the Z86C1900ZEM board (contact Zilog Sales However, the final program is similar to the debug
Offices for details). Make the following signal program. First, the user has to put the Pia initial~z~~io~
connections: routine after the Z8 initialization routine. The Pia Inltlab-
zationroutine has to execute on each 1/0 Port direction
Pia Board toZ86C1900ZEM Board change. Figure 4 shows the Flow-Chart of the initializa-
tion routine.
ADO-AD7 ADO-AD7
AO AO
A1
A14
A1
A14 I START I
A15
IDS
XTAL2
RIIW
A15
IDS
XTAL2
RIIW
1
Z81NITIALIZATION
(PORT 1 = ADDRESSIDATA BUS)
Pin 10 of U3B (Pia board) connects to Pin 20 (PORT 0 = ADDRESS BUS) .
(ICE) of U3 (Z86C1900ZEM board). After this
modification, the address map is changed as
follows:
Build a Pia board like Figure 6. Connect PortA, Secondly, the 1/0 port changes to memory accessable
Port B, Port 2, Port 3 and all control signals of instead of register accessable. For example: with the
the Pia board to the target board (or group all real Z8 1/0 port, use the instruction "Id 1 ,#data" to load .
these 1/0 lines and control signals into a 40 line the data to Port 1. But, for this application, use the
emulation cable). Plug the emulator cable from instructions of "Id rn' ,#data" and "Idc @rm,rn'" (where
the ROM emulator to U3 socket of the Pia rrn will store the address of Pia Port 1).
board. Debug your application program by us-
ing the ROM emulator.• In the software application, the simple way to access the
Pia is using the "MACRO" in the program. Having
4. Z86C90 In Circuit Emulator Method finished the debugging program, change the definition of
the "MACRO". Figure 5 illustrates the "MACRO" appli-
Build a Pia board like Figure 8. Connect PortA, cation program.
Port B, Port 2, Port 3 and all control signals of
the Pia board to the target board. Plug the 40-
pin emulator cable from the emulator to the
Z86C90 socket (U1) ofthe Pia board. Now, the
application program can be downloaded into
the RAM (6264) of the Pia board for debug.
1120
;THIS APPLICATION USES REGISTER GROUP %00
;Define the registers
r4: reg hJlioa ;r4 for PIO A high-byte address
rS: reg IJlioa ;rS for PIO A low-byte address
rr4: reg pioa ;register pair
r6: reg pio_data ;r6 for PIO RIW data
r8: reg hJliob ;r8 for PIO B high-byte address
r9: reg IJliob ;r9 for PIO B low-byte address
rr8: reg piob ;register pair
ORG %0
.word irqO ;define the interrupt vectors
.word irq1
.word irq2
.word irq3
.word irq4
.word irqS
ORG %e
di ;disable interrupts
Id p01m,#%96 ;init. PO and P1
pio_init:
Id r1,#<pa_ctrl ;init PA
Idc @rrO,r2 ;Ioad Mode 3
Idc @rrO,r3 ;Ioad PA Register Control Word
Idc @rrO,rS ;Ioad Interrupt Vector Word
Id r1,#<pb_ctrl ;init PB
Ide @rrO,r2 ;Ioad Mode 3
Ide @rrO,r4 ;Ioad PB Register Control Word
Ide @rrO,r5 ;Ioad Interrupt Vector Word
Ide @rrO.r6 ;Ioad Interrupt Control Word
Ide @rrO,r7 ;Ioad Mask Control Word
Ide @rrO,rB ;Ioad Interrupt Disable Word
ret
;Main Program
nextjob:
, iniLadd ;use the MACRO to init PIO's address
Now, change the MACRO when you finish the debugging (Table 2)
1123
Table 2. Comparison of System Clocks (ClK).
APPLICATION LIMITATIONS
2. Driving capability.
1124
VCC OATA 8US
Z86C9008PSC i U~
~'r5"8/A'
lit Z84C2010PSC
2-1 roo
U3
8MHz 28 3 00 2 10 11 lS P
~
14 XTAL2 V PI0 29 4 01 QO AO 00 19 PAO
Q! S 9 Al 01 12 01 PAl 14
20pf
C
C
P!!
P12
32
33
7
8
02
03 Q2 6
9
8
7 A2 02 13
L.,:) 40 D2 PA2 13
12
0
Q3 A3 03 PA3
H~............., XTAL!
P!3
P14
8
9
13
14
04
OS Q4 12
15
6
S A4 04
L6
L7
39
8
03
04 PA4 10
9
R
Q5 AS 05 PAS
P!5 12 17 06 16 4 L8 3 05 T
"
<5'
c
~ 20pf P30
P37
~ i~ 13 18 07 Q6
Q7 19 3 A6
A7
A8
06
07 L9 2 g~ PA6
PA7
AROY
8
18
7
A
24 A9
iil INT
!» P3!
1"32
21 AI0
23 All
I " to
VCC
IEI
IEO
ASTB --16 P
N 1"33 A12
,----..,.;ld CE
Sl P34 RO 0
IORQ
C') P3S
R
l~~::~j:~tj ~;D
CD P36
o
S' P20
II "~,,.. B/A
T
P2!
<D 1"22 'XOOOO-XOFFF 25 CLK B
~
P23
P24
P2S_
1"26 XI000-X1FFF
0' P27
-I
::r
CD
C')
5:
o
en
N
0)
o
'0
(5
.-
~
J\)
01
IADO - AOp_------------------------.
p.
o
R
"T1 T
16' A
r:::
;;
=-' p
o
~
CD
Al
R
T
~m
AO
B
s:: A14
:i'
CD A1S X8Q90-X8F"F"F"
~
CD
/Os
r
x'
PIN 20 OF" U3
:E
~
i(')
XTAL2
s::
oUJ
6
~
'tI
6
8
vee DATA vee
P
0
R
P30 T
"T1 P37 A
cO'
e
iil PBO
PBl P
!XI PBZ
0
N PB3
PB4
ClO
0) PBS R
(') PBG
CD
0 G PB7 T
BRDY
(';
N
" RC:::TR B
m
0' X1OOO--X1FFF I •••
~
CD
(')
s:
0
en
N
~
'tI
6
t:l
LOW COST Z8 MCU EMULATOR
1129
access is shown in Figure 2. Note that the usage of Take care when programming the Port 3 Mode Register
program memory is always a read operation by the (R247 P3M). To properly emulate the Z86C09/19, bits
Z86C90 when emulating the Z86C09/19. 07:02 must be programmed as all zeros. This sets P31 ,
P32and P33 as inputs; P34, P35 and P36 as outputs.
Table 1. Emulator EEPROM Timing Parameters Bits 07:02 are reserved in the Z86C09/19, so setting
these bits to 0 will have no effect.
No. Parameter Min Max
The Port 0 and Port 1 Mode Register (R248 POi M) is
1 Address valid to lAS high delay 35 one register that must be programmed differently be-
2 Address float to IDS active delay 0 tween the devices. To properly emulate the Z86C09/19,
3 lAS inactive to IDS active 65 the POi M register olthe Z86C90 issetto 96h. However,
4 IDS active to EEPROM data valid delay 100 bit 04 of the Z86C09/19 register must be set to O. The
5 MCU address valid to EEPROM remaining bits of the POi M register in the Z86C09/19
address valid 44 are reserved, and should be programmed as all zeros.
6 EEPROM address valid to EEPROM It is important that these differences are remembered
. valid data 180 when converting the code from one processor to the
7 lAS inactive to Data input required 250 other.
8 IDS active to Data input required 130
9 Data input setup time to IDS inactive 75 The RAM protect option of the Z86C90 (R251 - IMR, Bit
10 Data input hold time to IDS inactive 0 06) should not be enabled. This bit should be pro- .
11 IDS inactive to EEPROM data float 0 50 grammed as a 0 for both types of devices.
12 IDS inactive to MCU address valid 65
AornnONALENHANCEMENTS
SPECIAL PROGRAMMING
Additional EEPROM (or other) memory is supported by
There are a few programming considerations when using the unused latched address lines, a 3:8 demulti-
using the Z86C90 to emulate the Z86C09/19. First, the plexer, and the ICE inputs of the EEPROMS. A full64K
Z86C90 has 236 General Purpose registers (R4-R239) of memory is accessed using the schematic shown in
while the Z86C09/19 is limited to 124 General Purpose Figure 3. Because additional circuitry is being added,
registers (R4-R127). there is an additional time delay in data availability. The
maximum specified value, from IDS going active to data
In addition to the number of general purpose registers required by the Z86C9012, is 130 ns. A faster EEPROM
available to the user, there are also some differences in (Xicor X2864B-12) may be required. This depends on
the control and status registers (R240-R255) between the clock speeds being used in the application.
the devices. The first of these differences occurs in the
Watchdog Timer Mode Register [WTMR - Extended By adding some RAM, and setting bit 02 of register 248
Register %(F)OF]. The differences occur if you program to a one, an external stack can be added. This is useful
bit 04 of this register to select the XTAL option as the for debugging applications that are interrupt intensive.
watchdog timer driving source (04=1). By using the on- Registers 254 and 255 are programmed to map into the
chip RC circuit (the default condition) there are no appropriate RAM space.
differences in the watchdog timer activation periods.
The differences in the watchdog timer activation periods Additional memory is not the only useful enhancement.
between the devices when the crystal option is selected Other useful features include single stepping, break-
is outlined in Table 2. pOints, real time traces, and adding a direct computer
link. Unfortunately the Z86C90 is not the perfect In
Table 2. WDTMR XTAL Differences Circuit Emulator (ICE) chip, and adding single stepping
and breakpoints is not done easily. This is where the
XTAL1 Timeout commercial emulators come in. However, adding real
01 DO Z86C09/19 Z86C90 time trace capability and an external computer link are
possible.
o 0 XTAL1/512 XTAL1/256
o 1 XTAL1/1024 XTAL1/512 A real time trace is achieved by storing the latched
1 0 XTAL1/2048 XTAL1/1024 address information and EEPROM data. These values
1 1 XTAL1/8192 XTAL1/4096 are stored at the rising edges of lAS and IDS. The user
1130
then designs circuitry control of the trace (turn on, turn and automotive applications. Emulating these devices
off, stop when full, overwrite, etc.). is simple and cost effective plus it provides keen insight
into their specific uses.
Adding a computer link is probably the most challenging
task, and for those who do not like removing the
EEPROM and placing it in a programmer device, it is a
useful enhancement. Also, it controls other enhance-
ments like the trace function and can report the content;;
of an external stack. A logical candidate for this applica- REFERENCES
tion is the Z86C91. The UART on this microcontroller
can be used to execute an RS-232 interface. The design The following Zilog publications contain specific infor-
rules for the Z86C91 are the same as those outlined for mation on the use and programming of the Z8 CCP
the Z86C90, so half of the design is already complete! microcontroller:
1131
9M l..~IUF 1..~IUF l..~IUF l..~IUF 1..~IUF 1~IUF
[
+5
Z86C90 ~- +5
....
Cl ~ -. ~ C2
15
XTALI VCC
14
XTAL2 Pl0
Pll
11
28
29
3
I
74HC373 ~
10
20
VCC 20
10
X2864B ~
+5
..
o
P12 32
33 8
30 10 2
9
AD VCC 28 19:::J
P13 40 20 5 Al
(Z86C09/19)
18 PIN SOCKET+.J
vec 5
+5 P14
N/C...l R//W P15 9
P16
8
12
13
15
17
50
60
7Q
3D 6
40 9
50 17
8
7
6
A2
A3
A4 1/00 11
w
E
:;:)
18 (.J
P20 15 35 P20 P17 13 sa 60 15 5 AS 1/01 I"
1/02 13
r
P21 16 36 P21 11 70 16 4 A6 ==
T1
C co
XTALI P22 17 37 P22 tOE 80 19 3 A7 1/03 15 N
XTAL2 P23 18 38 P23 lK GNO 25 AS 1/04 16
21 'lii
P24 1 ,)!:I P24 51 24 A9 1/05 17
P25 2 2 P25 1/06 18 8
d
1/~
P26 3 ,)
P26 1UFt +5 A10
All 1/07 III 3:
P27 4 4 P27 74HC373 ~ 2 A12 .9
P31 8
P32 9
16 P31 POO 26
1 P32 POI 7
3
5
10
2Q
vee 20
14 GND
!WE
+-
10E r-12 ...
10 ~
P33 10 II! P33 P02 30 7
P34 11 19 34 8
30 4 I!!
P34 P03 40 20 :::J
12 C)
P35 22 P35 P04 5 13 50 3D 6
GND P36 13 24 P36 P05 6 15 60 40 9 74HC04B u::
1 12
N/C~ P37 POS 7Q 50
P30 P07 10 18 8Q SOp.!: N/C
3
r
74HC04A 11
1
C 70 N/C
..ll GNO
/AS 120
1-(:>01- JOE
GNO
80r1L N/C
/os
~7
~
~N/C
~
~N/C
~
0 }> ............ ............ IJ IJ
0 0.. 0 }> 0...., 0
-,
r+-
0 ,
0..
(lJ
U> U1 r+- r+-
en 0
en
t
~
}>
0
""~
(JI
I
}>
-f--
i
t.H
---...J
1ft
"
~
N
'i
en
t
~
}>
'-J
~
OJ
I
00
}>
0
0
0 I
I }>
-"
0 ()l 0
---...J - 0
Z
0 CD I
c- j
~
0
---...J
""
-
z
~
1ft
~
~
t
N
~
0
~
VCC
74HCT138 ~
0
E
OK
8K
..
CI)
::lE
.S!
74HC373 .!!
::l
13 16K E
W
Y2
iii
12 24K s:::
60 A Y3 .2
:::
70 B
11 32K :g
80 Y4 c:(
10 40K M
Y5 I!!
::l
9 48K .2'
G1 Y6 u..
G2A 7 56K
G28 Y7
'7
IDS
~
Z8602 CONTROLS A 101/102 PC/KEYBOARD
The Z8602 Microcontroller is designed into a PC Keyboard Scanning and the Keyboard Buffer
keyboard to control all scan codes, line status modes,
scan timing and communications between the key- The keyboard contains 101/1 02 keypads. All keypads
board and PC. This Application Note depicts a typical are scanned every 4.17 milliseconds by the Z8602.
method of interfacing a standard keyboard to an XTIAT The microcontroller handles a maximum of six keys
PC. concurrently by means of the key bouncethe key
bounce process and case conditions. Quick multiple
The Keyboard includes: 101/102 keypads, three LED key pressing for the first six keys generate the Scan
indicators for lock status, a cable wire between PC and Codes. If more than six keys are pressed concurrently
Keyboard, a selection switch for PC/XT and PC/AT they are ignored.
Scan Codes, and a Z8602 microcontroller for the
control (Figure 1). Each keypad sends multiple data bytes to the PC under
the control of the Z86C02 . This is a scan code. There
are two kinds of Scan Codes called Make Code and
The three indicators are Num Lock, Caps Lock and Break Code. The Make Scan Code is sent to the PC
Scroll Lock. The lock status transfers back from the PC when the key is pressed. When the key releases, ils
soon after the Key Scan Code transmits. Break Scan Code is sent. Additionally; these keys are
Typematic which means when a key is pressed and
The keyboard has three Key Scan Code Sets. Scan held down, the keyboard sends the Make Code with a
Code Set 1 uses PC/XTs and Scan Code Set 2 uses particular delay and rate. The typematic delay and rate
are specified by the F3 (Hex) command sent by the PC.
1135
The Make/Break Scan Code generation module trans-
fers Make code and Break code into the FIFO buffer via
several ROM tables.
Keyboard Scanning
1136
Table 1. Scan Code Set Table
The following table shows three scan code sets used in the
keyboard. 64 E010 EO 90 E014 EO FO 14
90 45 C5 n Fon
91 47 C7 6C F06C
92 4B CB 6B F06B
Key Nurn- Scan Code Set 1 Scan Code Set 2 93 4F CF 69 F069
ber M a k aBraak M a k eBreak 96 48 C8 75 F075
Coda Code Code Code 97 4C CC 73 F073
1 29 AS OE FOOE 99 50 00 72 F072
2 02 82 16 F016 99 52 02 70 F070
3 03 63 IE FOIE 100 37 B7 7C F07C
4 04 84 26 F026 101 49 C9 70 F070
5 05 85 25 F025 102 40 CD 74 F074
6 06 86 2E F02E 103 51 01 7A F07A
7 07 87 36 F036 104 53 03 71 F071
8 08 88 3D F030 105 4A CA 7B F07B
9 09 89 3E F03E 106 4E CE 79 F079
10 OA SA 46 F04E 108 EOIC E09C EO SA EO F05A
11 OB 8B 45 F045 110 01 81 76 F076
12 OC 8C 4E F04E 112 3B BB 05 F005
13 00 80 SS FOSS 113 3C BC 06 F006
15 OE 8E 66 F066 114 3D BO 04 F004
16 OF 8F 00 FOOD 115 3E BE OC FOOC
17 10 90 15 F015 116 3F BF 03 F003
18 11 91 10 FOlO 117 40 CO OB FOOB
19 12 92 24 F024 118 41 Cl 63 F063
20 13 93 20 F020 119 42 C2 OA FOOA
21 14 94 2C F02C 120 43 C3 01' FOOl
22 15 95 35 F035 121 44 C4 09 FOO9
23 16 96 3C F03C 122 57 07 78 F078
24 17 97 43 F043 123 58 08 07 F007
25 18 99 44 F044 125 46 C6 7E F07E
26 19 99 40 F040
27 lA 9A 54 F054 Key Num· Scan Code Set 1
28 lB 9B 5B F05B ber BasH Case, Shift Case· Num Lock On
29 2B AB 50 F050 Shlft+Num Make/Break Make/Break
30 3A SA 58 F058 L a c k
31 IE 9E lC FOIC Make/Break
32 IF 9F lB FOIB 75 E052/E002 EO AA EO 52 E02AE052/EO
33 20 AO 23 F023 /E002E02A 02 EO AA
34 21 AI 2B F02B 76 E053/E003 EO AA EO 53 E02A E053/EO
35 22 A2 34 F034 lEO 03 E02A 03 EOAA
36
37
23
24
A3
A4
33
3B
F033
F03B
79 E04B/EOCB Ik': AA EO 4B EO 2A EO 4B
OCBE02A lEO CBEOAA
38 25 AS 42 F042 80 E047/EOC7 EO AA EO 47 E02AE0471E0
39 26 A6 4B F04B IEOC7E02A C7EOAA
40 27 A7 4C F04C 81 E04F / EO CF EO AA EO 4F EO 2A EO 4F
41 28 AS 52 F052 1E0CF E02A lEO CFEOAA
42 2B AB 50 F050 63 E048/EOC6 EO AA EO 48 E02AE048/EO
43 lC 9C SA F05A 1E0C8E02A C6EOAA
44 2A AA 12 F012 84 E050/EOOO EO AA EO 50 E02AE050/EO
45 58 06 61 F061 lEO DO E02A DO EOAA
46 2C AC lA FOIA 85 E049/EOC9 EO AA EO 49 E02AE049/EO
47 20 AD 22 F022 lEO C9 E02A C9EOAA
48 2E AE 21 F021 86 EO 51/EO 01 EO AA EO 51 E02AE051/EO
49 2F AF 2A F02A lEO 01 E02A 01 EOAA
50 30 BO 32 F032 89 E040/EOCO EO AA EO 40 EO 2A EO 40
51 31 Bl 31 F031 lEO CD E02A 1E0COEOAA
52 32 B2 3A F03A • ~ the Iell shift Kay Is held down, the AA/2A shift make and
53 33 B3 41 F041 break Is sent wnh the other scan codes. ~ the right Shift key
54 34 B4 49 F049 Is held down, B6/36ls sent. If both Shift keys are down, both
SS 35 B5 4A F04A sets of codes are sent wnh the other scan code,
57 36 B6 59 F059
58 10 90 14 FO 14
60 38 B8 11 FOIl
61 39 B9 29 F029
62 EO 38 EOB8 EOll EOFOll
1137
Table 1. Scan Code Set Table (Continued)
1138
Pl0 21 COLO
3 XTAU Pll 22 COU
P12 23 COL2
0 2 XTAL2 P13 24 CO~
20PFx2~ P14 25 COL4
~ P1S 26 COLS
P16 27 COL6
P17 28 COL7
POO 13 COLS
RESET POl 14 COL9
Z8602 P02 15 COUO
2K ROM P03 16 COUl
Scroll Lock 330 29 P04 17 COU2
P34 POS 18 COL13
NumLock 330 10 P06 19 COU4
P35
Caps Lock 330 P07 20 COL1S
+SV 40
P36 5 82Kx8
P30
+5V P3l 39
2.2K P22 33
CLOCK 32 P21
P33 30
DATA 31 P20 P24 35
GND 2.2K P25 36
ROMLESS
-.:L- NC
34 P23
P26
P27
37
38
82K
Clase = PCIXT made
Open = PC AT made
i
~
COLO COL1 C012 COl3 COL4 COLS eOL6 eOL7 eOLS eOL9 eOL11 eOL13 COL15
eOL10 eOL12 eOL14
1139
I I no key detection
~~'--..L.....
-{bouce=O~ State Diagram Explanation (Figure 6):
key detected once
The converted key matrix number and the initial
:t~~on rrb-ou-n-ceL=""2c..::..:.;] ,
bounce data store in one of the empty KEY_DATA and
~_L:d:;:.ec::cre::;;mented at ...ake detection
KEY_STATUS registers, respectively, just after de-
- { bounce = 1 J tecting the key. When the key is detected once (bounce
r;-_Lk=:ey;-:de::.;tected twice
l bounce =3 JMAKE KEY CODE GENERATION =2), it is decremented at Make Detection to establish
1data is sent to IBM one bounce detection (bounr.G=1). The loop continues
r-1 bounce = 6 until the key is detected twice. When detected twice,
decremenled 1key detected no key
the bounce bit is three (bounce = 3) until generation of
at break detection the Make code. Then the bounce bits change to six
deteClion
(bounce = 6) in the Make/Break code generation
L..{bounce=7 J module.
1key detected
(bounce 5 The key detection loop continues (loop from bounce=5,
_1
no key detection bounce=7, bounce=6) until two key release detections
lbounce = 4 J
BREAK KEY CODE GENERATION (from bounce=6 to bounce=5). The bounce bit is set to
L-_ _ ~r-----' four (bounce=4) when the key release is detected two
data is sent to IBM times. The number is stored until generation of tl;le
Break code. Then, it is reset to zero in the Make/Break
Figure 6. Make/Break Code Generation State module. The first six keys generate the Make Code and
Diagram Break Code when multiple keys are pressed. Concur-
rently, the rest of the keys are ignored.
nw~=
status cases are stored in three of the six KEY_STATUS
registers to keep the same pair of Make and Break
CTRL CASE codes for each key. The Make code is stored in the
ALT CASE
NUM LOCK2 FIFO keyboard buffer.
KEY_DATA 1 -
1765432101
Key number 1765432 l' 0 1
o 6 Key Bu",",,_,
TT c==-- Rate bfts
~------ Oelaybfts
L------O
lYPEMATIC
1765432101
KEY_DATA 6
1765432101
~KeyAttribute
'-----AIIO
1140
The current pointer of KEY_DATA stores in the TYPE- Make/Break Scan Code Generation
MATIC painter register to generate Make Scan Code
when typematic timeout occurs. When the Make Code The system has one macro command to expand one
is generated, two flag bits in the KEY_TYPE register byte of Make Code to multiple Scan Codes. The macro
are set to determine the key attributes: Make-type- is data-!}en. The macro structure appears in Figure 1O.
matic-break (00), Make-typematic (01), Make-break
(10) and Make only (11). Macro Description:
After getting one byte of Make code, this is expanded
Break Code Timing Control: to multiple scan codes by the data...Qen macro com-
Code is generated when the bounce bits of mand. The data.-gen macro contains a total number of
KEY_STATUS are settofour. This means the key is bytes generated (Io.."er four bits) minus the offset
released. The TYPEMATIC pointer register is reset value. This offset value addresses a byte that is
when the current typematic key releases. The case key XORed with a byte-make code and other generated
tests and the case flag is reset when released. Then, data bytes.
Break Code is stored in the FIFO keyboard buffer and
KEY_DATA plus KEY_STATUS reset to show an The previously kept "index address" indicates the
empty key. This procedure repeats for the six entry point of the data...Qen macro command when the
KEY_STATUS registers (Figure 7). data is generated for Break Code. If it is generated for
Make Code, then the index address is decremented by
one and the ROM data at the address is read to specify
~flerkey~ the entry pointer for the Make Code generation.
o 0 0 0 0 0 0 0 0 0 0 0
Figure 9. Flow Chart for Make/BreakITypematic Tim- 2 nd data byte for scan code
irg
c:B XORed
Typematic Code Timing Control:
To generate typematic code, the key attribute tests to lOne byte of Make Code
be sure the key is typematic. If the current TYPE-
MATIC pointer is not zero, the typematic process is
carried out. The delay timer decrements every 4.17
msec and when it reaches 0, there is Make Code
generation. Once the delay timer sets to 0, the rate
timer takes over the typematic code generation which
continues whenever the rate timer decrements to O.
The rate timer then reloads from the TYPEMATIC_RATE Figure 10. Macro Structure of Data_AUr and
register. Data_Gen
1141
Four steps for generating multiple scan codes are the Z8602 MICROCONTROLLER CONTROL
following:
ANOINTERFACE
3. Store all the bytes from the ROM table to the Z8602 Pin Descriptions and Assignments
FIFO buffer while incrementing the FIFO_SIZE and
the ROM address pointer. Figure 11 and Table 3 show the Z8602 pin assign-
ments and pin descriptions, respectively. Figure 12
shows the communications format between the PC
4. Subtract the offset address from the temporary
register containing the same value of FIFO_SIZE. and the keyboard.
Change the FIFO data by taking the XOR with the
byte-make code.
Communication Between the PC and Keyboard
Scan Code Organization:
Before the keyboard microcontroller (hereinafter re-
The multiple scan code generation starts from conver-
sion of a key matrix number which points at the Key ferred to as Z8602) drives the keyboard clock and data
Matrix Table. The Key Matrix Table has the index lines, it sets both lines to a high level to check the
current line status. The three line status modes be-
address offset of the Scan Code Table. The Scan Code
Set Table contains all Make Code keys. The Scan tween the PC and the keyboard are the following:
Code Table Map organization is shown in Table 2.
· Communication Inhibit by PC (PC forces clock line
Typematic AHribute: low).
The Scan Code Set 3 is similar to Scan Code Set 2. It
· Request to send a data packet from PC to-keyboard
is the scan_code set flag (1 = Scan. Code Set 1, 2 =
(PC forces data line low).
Scan Code Set 2, and 3 = Scan Code Set 3) which
specifies the Scan Code Table to use. If the
· Scan Code transmission by Keyboard (both-data
scan_code_set flag is 3 (Scan Code Set 3), its data
and clock lines are high).
checks for typematic 'attributes. The typematic attrib-
ute for scan codes (addresses 7 -83h) store in the The keyboard clock line is always driven by the key-
scratchpad RAM. The four typematic attributes in- board's Z8602, except when the PC inhibits the com-
clude; Typematic, Make/Break, Make, and Typematic/ munication. This happens by forcing the clock line to a
Make/Break. To select one of the attributes, two bits low level (inactive level). This keeps the keyboard from
decode to determine which one of the four attributes to sending any data packet·and from generating clock
use. pulses during this stage.
Phantom Keys: Once the clock line releases high (active level), the
If the key matrix number is none of the valid keys, it is keyboard has to check the data line. When the data line
the Phantom key. The Phantom key happens when is inactive, the PC requests to send the serial data to
multiple keypads depress concurrently. The Phantom the keyboard. The keyboard has to send serial clock
key is zero in the Keyboard Matrix (Figure 5). If the streams to receive the data packet from the PC. The
microcontroller sees a zero from the Key Matrix Table data output of the Z8602 is high at this stage. When
it sends any code to the PC (data conversion for Phan- both data and clock lines are active, the keyboard
tom key is ignored). sends the Scan Codes to the PC at any time.
1142
fetches at the leading edge of the clock. After the stop
bit detects high, the Z8602 forces the data line to a low +5V P36
level for one bit period. The start bit is always low and XTAl2 P31
XTAL1 P27
the stop bit is high. The 8-bit data transmits from the
P37 P26
LSB (the least significant bit). The odd parity bit means P30 P25
that the number of 1 's for the data bit and the parity bit RESET P24
must be odd all the time. RIW P23
os P22
Command Communication Between the AS P21
Keyboard and PC P35 P20
GND P33
This subsection shows how the following three kinds of ROMLESS P34
POO P17
data are handled between the keyboard and the PC:
POI P16
P02 P15
Command and Acknowledge P03 P14
P04 P13
Optional Data P05 P12
P06 P11
P07 Pl0
Key Scan Code from the Keyboard FIFO Buffer
SET 1 SET2AND3
P03 IS OUT,OO
P05 18 OUT,OD
P06 19 OUT,OD
P07 20 OUT,OD
65 Pl0 21 OU10D
SET 3 SET 2 Pll 22 OU10D
89 .. _- P12
P13
23
24
OU10D
OU10D
KEY, 62. 64. 108 P14 25 OU10D
PIS 26 OU10D
92 j- PIS 27 OUT,O~
KEV.95 P17 28 OUlOD
9 3- 1----- P20 31 IN/OUT,
00 lion
KEy,75· 89 P21 32 IN/OUT, CLOCK linafor IBM Communic8-
00 tion
103 -1---
KEVil 124
P22
P23
33
34
IN
IN
Row 2 In ut Scan line
pe/XT or AT =hl h Selection
104 -j- P24 35 IN Row 4 In ut Scan Une
KEY, 126 P25 36 IN RowS!n ut line
~~ .. -- P26 37 IN Line
P27 38 IN Un.
P30 5 IN Line
P31 39 IN
P33 30 IN
P34 29 OUT
P35 10 OUT Num Lock Indicator
P36 40 OUT Ca s Lock Indicator
P37 4 NC No Connection
1143
The keyboard clock line is always driven by the key- sends the Scan Codes to the PC at any time.
board's Z8602, except when the PC inhibits the com-
munication. This happens by forcing the clock line to a The serial data bit stream consists of 11 bits which
low level (inactive level). This keeps the keyboard from include a start bit, 8 data bits, an odd parity bit and a
sending any data packet and from genE:!rating clock stop bit. When the bit stream sends data to the PC, all
pulses during this stage. the data bits are guaranteed while the clock line is low.
The data changes during a high level of the clock line.
Once the clock line releases high (active level), the When the bit stream arrives from the PC, the data
keyboard has to check the data line. When the data line fetches at the leading edge of the clock. After the stop
is inactive, the PC requests to send the serial data to bit detects high, the Z8602 forces the data line to a low
the keyboard. The keyboard has to send serial clock level for one bit period. The start bit is always low and
streams to receive the data packet from the PC. The the stop bit is high. The 8-bit data transmits from the
data output of the Z8602 is high at this stage. When LSB (the least significant bit). The odd parity bit means
both data and clock lines are active! the keyboard that the number of 1's for the data bit and the parity bit
must be odd all the time.
DATA (Z8602j
Command Communication Between the The command reception has the highest priority of the
Keyboard and PC data communication. A new command always over-
rides to the old command even during communication.
This subsection shows how the following three kinds of The PC starts the command transfer by lowering the
data are handled between the keyboard and the PC: DATA line. Then, theZ8602 sends eleven clock pulses
to receive the serial data packetfrom the PC. When the
• Command and Acknowledge data arrives, the Z8602 sends an acknowledge (OFAh)
and accepts an echo command (OEEh). The optional
• Optional Data data arrives or departs after sending the acknowledge.
The key scan cOde only sends from the keyboard FIFO
• Key Scan Code from the Keyboard FIFO Buffer buffer when no data is coming from the PC.
1144
Table 4. Commands Between the Keyboard and
the PC
Table 4 shows the commands used in the PC'.
Name Hex values Function
STATUSJND ED.ACK,XX,ACK Set I Reset Lock Status in-
• Table 4 term definitions dicators
ECHO EE,EE ACKl Echo Command
ALT_SCAN FO,ACK,XX,ACK Select Alternate Scan
ACK = Acknowledge Data to PC (OFAh) TYPE RATE F3,ACK.XX,ACK
Codes
Set Typematic Rate/Delay
F7,ACK
Enable Kev Scannin~
Default Disable
Set Defualt Value
To do the command communication, use the macro not it is a new command. The command compares to
command com-gen . The com-gen macro contains the Command data defined in com-gen macro.
three parameters which ensures the number of bytes
handled after command reception, command data, If it is a new command, then it is stored in a Z8602
and Jump address at the end of the communication COMMAND register. The first parameter of com-gen
(Figure 14). saves to the COM_STATUS register (Figure 14). The
COM_STATUS shows how many bytes are handled in
Whenever DATA line goes low (from PC), the Z8602 the current command. The acknowledge data (OFAh)
receives the data by driving the CLOCK line eleven sets to COMMAND_BUFFER and departs in the next
times. The received data is always checked whether or Timer 0 interrupt.
1145
After that transmission, COM_STATUS decrements Table 5. Serial Data Transfer Working Registers
by one and tests for zero. If it is zero, the communica-
tion is over and the program executes by getting ajump
address from the comJlen macro table.
COM_STATUS = 2
,""T~.'~~ /
I COMMAND BUFFER m FAh
! set
Option Byte =Received Data I
1146
After receiving all 11 bits, the seriaLdata_hi and Receive Mode:
seriaLdata_lo shift right five times to set up 8 bits of In the receive mode, the 10th bit tests for high. If high,
data into seriaLdata_lo. Now, parity is in bit 0 of the PC sends a low level for the 11 th bit period to show
seriaLdata_hi and is checked by the subroutine of an acknowledge. This means successful data recep-
paritY....gen (Figure 15). tion from the PC. Otherwise, the PC sends multiple
CLOCK pulses until it receives the correct stop bit.
serial_dala_hi serial_dala_1e
D CF
The following subsections explain and illustrate the
KeyboardlZ8602 hardware details and program para-
'I-1-1-1-1-1-1-1-piI 'I-7-=6-5-4-3-2-1-0-1 0
meters. These involve multiple scan code working
I t ~'"
odd parity generation
stop bit
t , '* 1
start bit
registers, FIFO dynamics, a scratchpad RAM map,
and overall flow chart.
Transmitted This Way ~
Multiple Scan Codes:
The multiple scan codes are stored into a 16-byte Rrst-
( Serial Data Input) In-First-Out (FIFO) buffer until the PC is ready to
serial_dataJo receive them. A buffer-overrun condition occurs when
more than 16 bytes remain in the FIFO buffer. This
11 1 1 1 1 1 1 1111 1 1 1 1 1 1 1 I
FIFO uses 16 general purpose registers in the Z86C02.
Received This Way ~D FIFO Dynamics:
serial_data_hi ,sen_"aI-=-'--da--'ta-=-lo_ _-------,
The overrun code appears at the last position of the
IASP765431121011111
buffer. When the full 16 bytes of scan code are in the
FIFO buffer and a further scan code appears, the
serial_data_hl serial_dataJo •••
overrun code goes into the 17th byte of the last
IxxxxxAspl1765432101 occupied buffer register. This produces an audible
t
1
parHy check
1
D
1 l t l •
"beep" warning. The FIFO buffer pointer points to the
working register plus one. Therefore, If there are no
Used As A Serial Input Daia scan codes available in the buffer, the pOinter is the
same address as the top of the FIFO buffer. The
keyboard buffer only contains the scan codes and does
not include any commands from the PC or acknowl-
Figure 15. Register Manipulation of the Serial
edges any data.
Data Buffer
Scratchpad RAM Map
The period of one data bit is 80 microseconds; the data
Table 6 describes the Z8602 RAM map. The table
ml,lst change when the CLOCK pulse is high. In fact,
shows the function name, RAM address, bit position,
the switching is done 20 microseconds after the lead- bit name, and descriptions for all map functions.
ing edge of the CLOCK pulse.
1147
Table 6. Z8602 Scratchpad RAM Map
P3 3
5
6
7 Is detected
8
9 Is detected
Ah
Bh Is detected
Ch
Dh Is detected
Eh
Fh Is detected
WORK GRP
lYPEMATIC_RAlE
1Ch
1Dh
1Eh
StackAraa 6Oh-7Fh e
1148
(1) Main Program loop (2) Keyboa'd Scan and MakelBreak (3) Cornrrlmlcalion Between IBM
Code Generation and Keyboard
(execuled every 4.17 msec) (exeaJled every 250usec)
@.i!D @JM~IRaJ
yes ~~onmibil~
!11(J__
<RequesI~_I~
~- .. ~----",yes
_...
While Cornnu1ication >. -
F.!-"~_~ J0~-~f!>
no
no jSMioos;eOiFIFO
Key Buller
I
CRetu~J
r-::------ - - -
'!"-C~~~)
1-~f~da1aJ
Qtu"!J
[TmnsmlI JawAck
no _ ..L .. _.---- ~
End 01 Communication .
·.. _____ 1 yes --. _
IExecute eech~.l
~~-I
(- oPii~:a ?)Yes
rSMciRESER~1
CReturn )
I
Receive ec;;"=;~io~iaJ -
I
~~"')
1149
Main Program Loop: active COM_IRQ but a positive Communication Inhibit,
Upon reset, a Basic Assurance Test on the RAM, the flow retums to the main program. If there is an
Keyboard, and ROM is enabled. The Z8602 parame- active COM_IRQ and no Communication ·Inhibit and
ters start, and test data transfers between the Z8602's there is a request from the PC, the Receive Datal
. CPU and the RAM, Keyboard and ROM. If no error de- Command activates. Depending upon whether it is a
tection, RAM receives the default values and the ini- new command, optional data, or send Resend, the
tialization testing is complete. pertinent logic goes active and the flow returns to the
main program.
Keyboard Scan and Make/Break Code Generation:
This program executes every 4.17 milliseconds. If When there is no request from the PC, but there is
there is a current communication, the flow bypasses current communication, the flow jumps to the Resend
and returns to the main program. If there is no current Mode. Ifthe Resend mode is active, the last data is sent
communication and the Key Scan (KEY_IRQ) is en- and then flow returns to the main. program.· If the
abled, the main process for six key buffering bounce Resend mode is inactive, the flow jumps to Transmit
elimination in make or break setup, goes active. DataiAck. If there is no more communication, the flow
returns to the main program. If there is more commu-
Now, Lock Status indicators are monitored and then nication, the remaining commands execute and the
make/break cases examined. A decision determines flow returns to the main program.
which case is active. The active case tests for six keys.
If it is the make case and is Typematic, the Make Code When there is a COM_IRQ but no communication
Generation parameters execute. If it is a break case, inhibit or request from the PC, and not during commu-
the flow returns to the main program. nication, the FIFO Key Buffer is checked. If it is empty,
the flow returns to the main program. If not empty, one
PC/Keyboard Communication: byte is sent from the FIFO Key Buffer and one byte
Communication between the PC and the keyboard shifts. The flow then returns to the main program.
executes every 250 microseconds. When there is an
1150
Three Facets of a Many Faceted Microcontroller
1151
change state and produce an interrupt. By using the on- toggled to discharge the RC circuit. By storing the count
chip timer, time T1 can be quickly determined. T1 and resetting the timer, the converter is now ready
The RC circuit is immediately discharged over fixed to take another sample. The value of V., is mathernaticaDy
time T2 (Rgure 6), where T2 is determined by the time determined later and software algorithms are used to
constant Tc = RCn. Since the product of RC is only an determine corresponding pressure.
approximate indicator of discharge time, a value of n The display is driven from a simple multiplexer circuit.
should be multiplied to improve accuracy. A general The Z86C08 can sink large loc currents which reduces
guideline should equate n to 1.4. Then, T2 = 1.4 RC. or eliminates buffering.
The dual slope NO converter measures voltage by
converting voltage into time intervals. Or, Current Sensing
T2IT1 = VinpuWref, then, Vinput = Vref T2IT1 The dual comparator is used as a current sensing
device in many application areas, e.g., in automotive
By using an I/O port on the Z86C08 as the Vref input, relays, lights, monitors, etc. In the automotive arena,
interrupts generated by the comparators can alternately current sensing is used in a typical case as shown in
switch Vref ON or OFF to perform the conversions. Figure 9. If the functional block shorts, then current (I)
surges causing voltage (V) to fall. When V reaches
Example: Blood Pressure Tester 2.5V, the comparator triggers an interrupt which allows
A pressure transducer in a blood pressure tester is a software to enable an emergency shutoff.
good example of the dual slope NO conversion method.
A minimum system consists of display logic, Z86C08
circuitry and a transducer signal input (Figure 7). POO
outputs the appropriate signal to the RC ramp circuit of
the Vref input. The output from the pressure transducer
(Rgure 8) is a linear voltage response to the applied
pressure. This signal is input to An2, the non-inverting
terminal of the comparator.
In this configuration, the sampling cycle for the AID
conversion begins when a logical 1 is output on POO and
a timer is enabled. When the comparator transitions, an
interrupt is generated, the timer is stopped and POO is
R247 = P3M 01
1 1
P31 (AN1)
I IRQ2, Tin
I
I
,1>0-
I
I
~I
IRQ3
P32 (AN2)
IRQO
P33 (REF)
~
0
IRQ1
1152
Vout
110VAC
1153
Figure 5. AID Converter
Vinput *
(V )
;::=Ti-:==i~r==T2==;r--:
Start .........
~ T1 T2. - .......M * Interrupt
1154
P27 ••
P20
P21
P22
[:=:~;======JE~===f=:::.!:=t.- P24
P25
P23
P26
1 P24
2 P25 P22
• 3 P 6 Z86C~1
o
+5V
****
P02 POl-
Pressure
Transducer • Cap = 30pf •• Enables Diastolic/Systolic Segments
••• 7 segment enable lines
•••• ,Selects Diastolic/Systolic Segments
+5V
Figure 7. AlDBlood Pressure Test and Readout
3.5 /'
~
L~L ~
~
//V
V
OUTPUT
VOLTAGE
/'" ~' / SPAN
~
V
I
~
r
OUTPUT
0.5 #
~
~
1
OF SET '\
7
o 25 50 75 100
PReSSum: - PSt
Figure 8. Silicon Pressure Transducer Motorola C
1155
---> IN OUT
+
r------------,
R
I
V
I I
I I
I I
I
I
I
I
I
I I
I I Emergency. Shutoff
I I
I I
Ves; R1 2.5 V I I Pxx
O-=-v'\I\ .....--tt-----r. r------J
R2
L _ _ _ _ _ _ _ _ _ _ _ _ -.l
R is large compared to the equivalent impedance of the Functional Block input. R1 and R2 are user selectable
and are generally in a 10K to 100K range for power dissipation considerations. R1 and R2 are determined from
the following formula:
Vref
R2
R1 + R2
R2i
1156
The Z8 MeU in Telephone Answering Systems
The owner of an answering machine can access the This is the main section of an answering system (Figure
machine from another telephone to playback mes- 3). After the phone rings and the relay is closed, the
1157
,-------.j CIRCUIT
PLL #1 I
---
PLL 112 I
.--.J CIRCUIT
TO
PHONE [Lj I----' MCRO-
CONlROLLER
PHONE
UNE IN [lj I
RELAY
III ~ I KEYPAD
I
H RING DETECTOR I ~ I DISPLAY
I
H AUDIO
SIGNAL III ~ I SWITCHES]
1 DETECTION
,
~
MPU ~
'-----< lELEPHONE
CASSETTE
--J AUDIO
PHONE TAPE
Q
PLAYER
CIRCUIT
(RECORDING
SECTION)
MCROPHONE
CIRCUIT
I MIC
I
4
SPEAKER
.... OGM I OGM MUX ---+ DE-MJX SPEAKER
CIRCUIT I
BATIERY
BACK-UP I PHONE lELEPHONE
UNE
CASSETTE
PLAYER TAPE
(PLAYBACK
SECTION)
... ... I
..... ... I CASSETTE
PLAYER M:>TOR
CIRCUIT
1158
caller hears the Out Going Message. In other words, the The User Interface block
microcontroller selects the OGM line as the MUX input.
The MUX output is fed to the DE-MUX block. The micro- The user interface block 'diagram is comprised of the
controller selects the SPEAKER and PHONE lines as display, keypad, and mode selection switches (Figure
the outputs of the DE-MUX block. In effect, the caller 5). The keypad usually has 5 or 6 keys for functions
hears the OGM and it is also heard from the speaker of such as Playback, Rewind and Stop. The keypad Is
the answering machine. scanned periodically by the microcontroller. The dis-
When the OGM is over, the caller hears a tone. This play (usually of the 7 segment LED type) shows the
tone (usually 1 KHz) is generated by the microcon- number of calls received.
troller. At this pOint, the MPU line is selected as the MUX In most machines, the microcontroller updates a 7
input, while the DE-MUX outputs are the same as segment display driver/decoderllatch IC which drives
before. Following the tone, the PHONE is selected as the LED display.
the MUX input, and the caller can leave a message. The The selection switches are used to determine the
TAPE (which records the message) and SPEAKER number of rings before the answering machine re-
lines are now selected by the microcontroller as the out- sponds, the maximum length of the message and other
puts of the DE-MUX block. When the caller hangs up, features. These switches are scanned when the phone
the relay is opened and the outputs of the DE-MUX rings, and the microcontroller uses this data to execute
block are not connected to the input. the appropriate sections of code.
For message playback, the TAPE line is selected as the
MUX input and the SPEAKER line as the DE-MUX The Remote Control Mechanism.
output. A common feature of several answering ma-
chines is the Personal Memo function. The speaker The remote control mechanism allows control of the an-
speaks into the microphone and the machine acts as a swering machine from another telephone. The caller
cassette' recorder. The message is recorded on the dials the telephone number and when the answering
cassette. In this case, the input to the MUX is the MIC machine responds, the caller keys in a secret code and
line, and the output of the DE-MUX is the TAPE line. from that point on, the answering machine can be con-
Figure 4 shows the Audio Signal Detection block. This trolled by the keys on the caller's phone. The caller must
block is comprised of analog cirCUitry which detects the use a DTMF (TouchTone) phone. If a rotary dial (purse)
presence of an audio signal. When a caller is leaving a phone is used, a tone generator is required for remote
message on the answering machine, and pauses for a. control.
long period of time, the microcontroller automatically Most answering systems use tone decoder (ie. phase
stops recording and goes on-hook. locked loop) ICs for the remote control function. The
A typical analog signal is shown in Figure 4. This is the phone line acts as the inputs·to the PLLs (Figure 6). As
input to the audio signal detection circuitry. The output soon as the answering machine responds by going off-
of this circuit is a square wave. If it is continuously low hook, the PLL outputs are scanned periodically by the
for a preset leng1h oftime (4 seconds, for example), the microcontroller. Each PLL has a center frequency cor-
answering machine goes on-hook. responding to 1 of the 7 tones required for DTMF
signals. The 7 frequencies are 697, 770, 852, 941,
MICRO-
RELAY
CONTROLLER
1159
TO
PHONE
PHONE
UNE IN
TAPE C:::;~ I
(RECORDING I
SECTION)
OE-MUX
SPEAKER ~SP""EA=KE=-R-'
P~lELEPHONE
UNE
CASSETTE
PlAYER TAPE
(PlAYBACK
SECTION)
Miscellaneous Circuitry
1160
----
-.--- r------P-~
OBI
~~~--- DE-MUX
- P2.1
MOTOR
- OUTPUT 1------
DB3
-------
DB2
-- ----- - ---- CONTROL
~2_ _ _ _ SIGNALS
DRI\Bi 1---.- -----
..... .... r---~
KEYPAD r-iiBAvl- DB4
I----- - P2.3 MPU
.... L __. ~
MICRO-
~
LED r- DB6
GENERAlED
TONE
...~ro~111
CONTFlOLLER FLASHER
I_I ~EA~
~
8049 MCU
L?~~CUrr 40 PINS
. MUTE
ETECTOR SELECT
~ ~ OUTPUT
2K ROM -----
..... ... r;:,rrCHES
L__ I
----
~~
P2.S
POSfTlON
TAPE Tl • OGM
DB7
ENCODER MODULE
Figure 5. User Interface Block OUTPUT P2.7
OGM
MODULE ~. LED DRIVER
CONTROL
-
~
AUDIO+_~
ETECTOR
,------. SIGNALS
MICRO- P1.0
OUTPUT
CO~ROLLER
Pl.l
SCAN UNES
P12
TO
PHONE
I PLL#l
OUTPUT
I P1.7 Pl.3
FOR
KEYPAD
Pl.0 PO.O
Figure 6. Remote Control Block 1-'--=-=-------1 DE-MUX
Pl.l PO.l
MOTOR 1-'--=-'--_ _--1 CONTROL
Pl.2 PO.2
the 8049. The block diagrams for functionally identical OUTPUT f-'--"'=--------.j SIGNALS
Pl.3
DRIVER
systems using an S049 and a 4o-pin ZS microcontroller Pl.4
are shown in Figure 7. Pl.S
PO.3
1161
STOP VC
PO.7 P3.3
!u:;l IN/EOS
PO.6 P3.2
PLAY!RECORD MonON
PO.5 P3.l
SPK/M1JTE RU
PO.4 P3.D
TONE/OPTlOIiIS
PO.3
START/C
PO.2
B
PO. 1
A
PO.D
DTMFHI
P2.7
FFWD DTMFLO
Pl.6 P2.6
REW ROW SCAN 1
P1.5 P2.5
FWD ROW SCAN 2
P1.4 P2.4
SOL MB3
Pl.3 P2.3
SOLHOLD MB2
P1.2 P2.2
LED MBl
Pl.l P2.l
LS MOO
Pl.D P2.D
P1.7
FOR
P3.7 FUTURE
P3.6 EXPANSION
P3.5
P3.4
Z8 MICROCONTROLLER
1162
Software Implementation
FLAG, TAPE_FLAG, and REMOTE]LAG are shown
Refer to the listing of the Z8 applications software for a in Figure 10.
medium-end answering machine. The Z8 port functions The remaining illustrations are block flow diagrams
are shown in Figure 9 and the registers referred to as showing the various functional modes.
76543210
PORTO ,----I!-I!-I,----11---
11---11---1,----,1
PLAy~-111
SPK/tIDTE"
TON~~ ------------------------~
.
START~ ----------------------------~
B
A
7 6 5 4 3 2 o
.PORT1
1 1
F~ ___
SOLHOLD _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _--'
I II
~D ________________________________ ~
LS
7 6 5 4 3 2 o
PORT2 L--IL-.l...--L--IIL--...l.----J'----'----'
DTMFHI
Ra:~NL~___
I I. I
ROW SCAN 2 . .
M~--------------~
M~----------------------------~
MB1----------------------------------~
M~------------------------------------~
7 6 5 4 3 2 o
PORT 3
VC ___________________________
INlEOS - - - - - - - - - - - - - - - ---l
MOTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - '
RU------------------------------------~
Figure 9. Z8 Port Functions
1163
7 6 5 3 2 o
FLAG <---I~I'-------JI'-------J'-----'-----L.---J
KEY DEPRESSED - - - - - - - '
KEYRELEASED I I I
CHECK OPTIONS REQUEST - - - - - - - - - - - '
CALL ANSWER IN PROGRESS
ANNOUNCEMENT IN PROGRESS .
PH REC SPEAKER TOGGLE
- ON-HOOK REQUEST
KEYSCAN REQUEST
7 6 5 4 3 2 .0
REWIND DONE
STOP TAPE REQUEST
KEY LOCK
TONE IN PROGRESS
AUDIO/DIALTONE TIMEOUT
LED UPDATE REQUEST
ERROR
7 6 5 4 3 2 1 0
REMOTE ON
REMOTE KEY DEPRESSED
REMOTE TIMEOUT
1164
YES
NO
YES
NO
YES
YES
YES
MAIN
1165
Z8® Subroutine Library
~ZiIm
Application
Note
Control Register
~ Address Initial Value Meaning
1167
instruction is executed to enable interrupt
processing, and a jump instruction is executed to
• Conversion Algorithms: BCD to and from decimal
ASCII, binary to and from decimal ASCII, binary
transfer control to the user's program at location to and from hex ASCII.
OB12H: The interrupt vectors for IRQO through
IRQ5 are rerouted to locations OBOOH through
OBOFH' respectively, in three-byte increments,
• Bit Manipulations: Packs selected bits into
the low-order bits of a byte, and optionally
allowing enough room for a jump instruction to the uses the result as an index into a jump table.
appropriate interrupt service routine. That is,
IRQO is routed to location OBOOH' IRQ1 to • Serial I/O: Inputs bytes under vectored inter-
rupt control, outputs bytes under polled inte-
OB03H' IRQ2 to OB06H' IRQ3 to OB09H' IRQ4 to
OBOCH' and IRQ5 to OBOFH. Figure 1 illus- rrupt control. Options provided include:
trates the allocation of ZB memory as defined by odd or even parity
this application note. BREAK detection
echo
The subroutines availab Ie to the user are refer- input editing (backspace, delete)
enced by a jump table beginning at location auto line feed
001BH. Entry to a subroutine is made via the jump
table. The 32 subroutines provided in the library
are grouped into six functional classifications.
• Timer/Counter: Maintains a time-of-day clock
with a variable nunber of 'ticks per second,
These classifications are described below, each generates an interrupt after a specified delay,
with a brief overview of the functions provided by generates variable width, variable frequency
each category. Table 2 defines one set of entry pu lse output.
addresses for each subroutine in the library.
The listings in the "Canned Subroutine library"
• Binary Arithmetic: Multiplication and division
of unsigned B- and 16-bit quantities.
provide a specificstion block prior to each sub-
routine, explain the subroutine's purpose, lists
the input and output parameters, snd gives pertin-
• BCO Arithmetic: Addition and subtraction of
variable-precision floating-point BCD values.
ent notes concerning the subroutines. The follow-
ing notes provide additional information on data
formats and algorithms used by the subroutines.
UNIMPLEMENTED
so
7F
1.
78
7A
USER USER
2.
DEFINED DEFINED
BE
60
3.
6S
64
STACK
-----------
061 2 START
061 1
INTERRUPT VECTORS
USER (3 BYTE/IROx)
DEFINED DBDD
D7FF
INTERNAL
SUBROUTINES
~~----------------~
110 PORTS
DDL.._ _ _ _ _ _ _..1 DDDDL-________________..1
DDDD
REGISTERS USED BY SUBROUTINES:
1168
1. Although the user is free to modify the condi- Digits are packed two per byte with the most-
tions selected in the Port 3 Ibde register significant digit in the high-order nibble of
(P3M', F7H)' P3M is a write-only register. byte 1 and the least-significant digit in the
This subroutine library maintains an image of low-order nibble of byte n. Byte 0 is organ-
P3M in its register P3M __save (7F H). If ized as two fields:
software outside of the subroutine package is
to modify P3M, it should reference and modify Bit 7 represents sign:
P3M save prior to modification of P3M. For 1 negative;
example, to select P32/P35 for handshake, the o = positive.
following instruction sequence could be used:
Bits 0-6 represent post-decimal digit count.
OR P3M_save, fl04H
LD P3M, P3M_save For ex amp Ie:
• The location designation "in reg/ext/ser Table 3 illustrates how various input strings
memory" implies the same considerations as are interpreted by the conversion routines.
above with one enhancement: if both bytes
of the register pair are 0, the operand
exists in the serial channel. In this 5. The format of the decimal ASCII character
case, the register pair is not modified string output from the conversion routine
(updated). For example, rather than stor- "bcddasc" operating on an input BCD string of
ing a destination ASCII string in memory, 2n digits is
it might be desirable to output the string
to the serial line. sign of character ( ,+ 1 - )
2n-x pre-decimal digits
1 decimal point if x does not equal 0
3. The BCD format supported by the following x post-decimal digits
arithmetic and conversion routines allows rep-
resentation of signed variable-precision BCD
numbers. A BCD number of 2n digits is repre- 6. The format of the decimal ASCII character
sented in n+ 1 consecutive' bytes, where the string output from the conversion routine
byte at the lowest memory address (byte 0) "wrddassc" is
represents the sign and post-decimal digit
count, and the bytes in the n higher memory 1 sign character (determined by bit 15 of
locations (bytes 1 through n) represent the input word)
magnitude of the BCD number. The address of 6 pre-decimal digits
byte 0 and the value n are passed to the sub- no decimal point
routines in specified working registers. no post-decimal digits
1169
Table 2. Subroutine Entry Points
Address Description
Bm Aritt.etic Routines
Conversion Routines
Serial Routines
T~r/COunter Routines
1170
7. Procedure name: ser___input fhe register pair SERhtime, SER1time was
initialized during ser init to equal the
The conclusion of the algorithm for BREAK product of the prescaler and the counter
detection requires the Serial Receive Shift selected for the baud rate clock. That is,
register to be cleared of the character
currently being collected (if any). This SERhtime, SER1time = PREO x TO
requires a software wait loop of a
one-character duration. The following The instruction sequence
explains the algorithm used (code lines 464
through 472, Part II):. inlop: ld rSERtmpl, 1153 (6 cycles)
Result
Input String Sign PrtHlecu.sl Post-Decissl Tenli.nator
Digits Digits
+---+.789+ 789 +
1234 .. + 1234
4976- + 4976
NOTE: The terminator can be any ASCII character that is not a valid ASCII string
character.
1171
ROMLESS Z8 SUBROUTINE LIBRARY PART I
Z~ASM 3.02
LOC OBJ CODE STMT SOURCE STATEMENT
1
2
3 PART I MODULE
4
5
6 !'ROMLESS za' SUBROUTINE LIBRARY PART I
7
a Initialize: a) Port 0 & Port 1 set up to address
9 64K external memory;
10 b) internal stack below allocated
11 RAM for subroutines;
12 c) normal memory timing;
13 d) IMR, IRQ, TMR, RP cleared;
14 e) Port 2 inputs open-drain pull-ups;
15 f) Data Memory select enabled;
16 g) EI executed to 'unfreeze' IRQ;
17 h) Jump to ~Oa12.
18
19
20 Note: The user is free to modify the initial
21 conditions selected for a, b, and c above,
22 via direct modification of the Port 0 & 1
23 Mode register (P01M, ~F8).
24
25 The user is free to modify the conditions
26 selected in the Port 3 Mode register (P3M, ~F7).
27 However, please note that P3M is a write-only
28 register. This subroutine library maintains
29 an image of P3M in its register P3M save (~7F).
30 If software outside of the subroutine package
31 is to modify P3M, it should reference and modify
32 P3M save, prior to'modification of P3M. For
33 example, to select P32/P35 for handshake, use
34 an instruction sequence such as:
35
36 OR P3M save,#~04
37 LD P3~P3M~save
38
39 This is important if the serial and/or timer/
40 counter subroutines are to be used, since these
41 - routines may modify P3M.
42
1172
44 IAccess to GLOBAL subroutines in this library should
45 be made via a CALL to the corresponding entry in the
46 jump table which begins at address ~OOOF. The jump
47 table should be referenced rather than a CALL to the
48 actual entry point of the subroutine to avoid future
49 conflict in the event such entry points change in
50 potential future revisions.
51
52 Each GLOBAL subroutine in this listing is headed by a
53 comment block specifying its PURPOSE and calling
54 sequence (INPUT and OUTPUT parameters). For many of
55 the subroutines in this library, the location of the
56 operands (sources/destinations) is quite flexible
57 between register memory, external memory (code/data),
58 and the serial channel (if enabled). The description
59 of each parameter specifies what the location choices
60 are:
61
62 - The location designation 'in reg/ext memory'
63 implies that the subroutine allows that the operand
64 exist in either register or external data memory
65 The address of such an operand is contained
66 in the designated register pair. If the high byte of
67 that pair is zero, the operand is in register memory
68 at the address given by the low byte of the register
69 pair. OtherWise, the operand is in external data
70 memory (accessed via LDE).
71
72 - The location de;ignation
73 'in reg/ext/ser memory' implies the same
74 considerations as above with one enhancement: if both
75 bytes of the reg. pair are zero, the operand exists
76 in the serial channel. In this case, the register
77 pair is not modified (updated). For example, rather
78 than storing a destination ASCII string in memory, it
79 might be desirable to output such to the serial line.
80 !
1173
82 CONSTANT
83 !Register Usagel
811
85 RAM START := ~7F
86
87 P3M save
88 TEM15 3
· -
:=
RAM START
P3M- save-l
89 TEMP-2 := TEMlf 3-1
90 TEMP-l := TEMP-2-1
91 TEMP-II
92 - · - TEMP:l-l
93 IThe following registers are modified/referenced
911 py the Serial Routines ONLY. They are
95 available as general registers td the user
96 who does not intend to make use of the
97 Serial Routines!
98
99 SER char := TEMP 4-1
100 SER-tmp2 := SER char-l
101 SER-tmpl ._ SER-tmp2-1
102 SER-put ._ SER-tmpl-l
103 SER-len ._ SER-put-l
1011 SER-buf := SER-len-2
105 SER-imr ._ SER-buf-l
106 SER-cfg := SER-imr-l
107 !Serial Configuration Data
108 bit 7 =1 => odd parity on
109 bit 6 : =1 => even parity on
110 (bit 6,7 = 11 => undefined)
111 bit 5 undefined
112 bit II undefined
113 bit 3 =1 => input editting on
1111 bit 2 =1 => auto line feed enabled
115 bit 1 =1 => BREAK detection enabled
116 bit 0 =1 => input echo on
117 I
118 op := :S80
119 ep := ~40
120 ie
121 al
· -
:=
~08
~04
122 be
123 ec ··--
~02
~01
1211 SER get
125 SER-flg ··- -
SER cfg-l
SER:get-l
126 !Serial Status Flags
127 bit 7 =1 => serial I/O disabled
128 bit 6 undefined
129 bit 5 undefined
130 bit II =1 => parity error
131 bit 3 =1 => BREAK detected
132 bit 2 =1 => input buffer overflow
133 bit 1 =1 => input buffer not empty
134 bit 0 =1 => input buffer full
135 I
136 sd ~80
137 pe ~10
138'bd ~08
139 bo ~04
140 bne %02
1111 bf :SOl
142
143 RAM TMR
11111
145 SERl time SERJlg-l
1174
146 SERhtime := SERltime-1
147
148 !The following registers are modified/referenced
149 by the Timer/Counter Routines ONLY. They are
150 available as general registers to the user
151 who does not intend to make use of the
152 Timer/Counter Routinesl
153
154 TOO tic := RAM TMR-2
155 TOO-imr := TOO-tic-1
156 TOO-hr TOO-imr-1
157 TOO-min TOO-hr-1
158 TOO-sec := TOO-min-1
159 TOO-tt := TOO-sec-1
160 PLS-l TOO-tt-l
161 PLS-tmr := PLS-l-1
162 PLS-2 := PLS::::tmr-l
163
164 RAM END := PLS 2
165 STA!:K := RAM:ENO
166
167 IEquivalent working register equates
168 for above register layoutl
169
170 Iregister file J70 - J7FI
171 RAM STARTr := ~70 I for SRPI
172
173 rP3Msave := R15
174 rTEMP 3 R14
175 rTEMP-2 !: R13
176 rTEMP-1 R12
177 rrTEMP 1 := RR12
178 rTEMP 1h != R12
179 rTEMP-ll := R13
180 rTEMP-4 := Rl1
181 rSERchar := Rl0
182 rSERtmp2 R9
183 rSERtmpl := R8
184 rrSERtmp RR8
185 rSERtmpl := R9
186 rSERtmph := R8
187 rSERput != R7
188 rSERlen := R6
189 rrSERbuf RR4
190 rSERbufh R4
191 rSERbufl R5
192 rSERimr := R3
193 rSERc fg := R2
194 rSERget R1
195 rSERflg RO
196
197
198 !register file J60 - ~6FI
199 RAM TMRr := ~60 I for SRPI
200 rTOll"tic := R13
201 rTOOimr := R12
202 rTOOhr := Rll
203 rTODmin := Rl0
204 rTOOsec := R9
205 rTOOtt := R8
206 rPLS 1 := R7
207 rPLStmr := R6
208 rPLS_2 := R5
1175
210 EXTERNAL
211 ser inlt PROCEDURE
212 ser:input PROCEDURE
.213 ser rlln PROCEDURE
2111 ser-rabs PROCEDURE
215 ser-break PROCEDURE
216 ser-nush PROCEDURE
217 ser-wlln PROCEDURE
218 ser-wabs PROCEDURE
219 ser-wbyt PROCEDURE
220 ser-dlsable PROCEDURE
221 ser-get PROCEDURE
222 ser-output PROCEDURE
223 tod-i PROCEDURE
224 tod- PROCEDURE
225 delay PROCEDURE
226 pulse_i PROCEDURE
227 pulse PROCEDURE
228
229
230 $SECTION PROGRAM
231 GLOBAL
232
233
2311 IInterrupt vectors!
P 0000 0800 235 IRQ 0 ARRAY [ 1 word] a0800]
P 0002 0803 236 IRQ-1 ARRAY [ 1 word] = [~0803]
P 0004 0806 237 IRQ-2 ARRAY [ 1 word] = [~0806]
p 0006 0809 238 IRQ-3 ARRAY [ 1 word] [~0809]
p 0008 080C IRQ-4
=
239 ARRAY [ 1 word] = [S080C]
p OOOA 080F 240 IRQ:5 ARRAY [ 1 word] [~080F]
241
242
1176
244 GLOBAL
245
246 !Jump Table!
P OOOC 247 ENTER PROCEDURE
248 ENTRY
P OOOC 80 007B' 249 JP IN IT
P OOOF 250 END ENTER
251
252
P
P
OOOF
0012
28
31
43 29 253 copyright ARRAY [. BYTE] .- '(C)1980ZILOG'
39 38
P 0015 30 5A 49
P 0018 4C 4F 47
254
255 !Subroutine Entry Points!
P 001B 256 JUMP PROCEDURE
257 ENTRY
258
259 !Binary Arithmetic Routines!
260
P 001B 80 0099' 261 JP divide !16/8 unsigned binary
262 division!
P DOlE 80 00B7' 263 JP div 16 !16/16 unsigned binary
264 - division!
P 0021 80 00E2' 265 JP multiply !8x8 unsigned binary
266 multipl ication!
P 0024 80 00F6' 267 JP mult - 16 !16x16 unsigned binary
268 mul tipl ication!
269
270 ! BCD Arithmetic Routines!
271
P 0027 80 011A' 272 JP bcdadd ! BCD addition!
273
P 002A 80 0117 ' 274 JP bcdsub !BCD subtraction!
275
276 !Conversion Routines!
277
P 0020 80 0205' 278 JP bcddasc !BCD to decimal ASCII!
279
P 0030 80 0363' 280 JP dascbcd ! Dec imal ASCII to BCD!
281
P 0033 80 0284' 282 JP bcdwrd ! BCD to binary word!
283
P 0036 80 02CD' 284 JP wrdbcd !binary word to BCD!
285
P 0039 80 025C' 286 JP bythasc ! Bin. byte to Hex ASCII!
287
P 003C 80 0257' 288 JP wrdhasc ! Bin. word to hex ASCII!
289
P 003F 80 0319' 290 JP hascwrd ! Hex ASCII to bin word!
291
P 0042 80 03BE' 292 JP wrddasc !Bin. word to dec ASCII !
293
P 0045 80 0340' 294 JP dascwrd !dec ASCII to bin word!
295
296 !Bit Manipulation Routines!
297
P 0048 80 04A l' 298 JP clb !collect bits in a byte!
299
P 004B 80 04B9' 300 JP tjm !Table Jump Under Mask!
301
302 !Serial Routines!
303
P 004E 80 0000· 304 JP ser init ! initialize serial I/O!
1177
305
P 0051 80 0000· 306 JP ser_input IIRQ3 (receive) servicel
307
P 0054 80 0000· 308 JP ser_rlin Iread liner
309
P 0057 80 0000· 310 JP ser rabs Iread absolutel
311
P 005A 80 0000· 312 JP ser break I transmit BREAK I
313
P 0050 80 0000· 314 ' JP se,r _flush I flush (clear)
315 input bufferl
P 0060 80 0000· 316 JP ser wlin Iwrite linel
317
P 0063 80 0000· 318 JP ser_wabs Iwrite absolutel
319
P 0066 PO 0000· 320 JP ser_wbyt !write by tel
321
P 0069 SO 0000· 322 JP ser_disable Idisable serial 1/01
323
324 I Timer I Counter Routinesl
325
P 006C 80 0000· 326 JP tod i linit for time of dayl
327
P 006F ~O 0000· 328 JP tod !tod IRQ servicel
329
P 0072 80 0000· 330 JP delay !ini1:- for delay interval
331
P 0075 80 0000· 332 JP pulse linit for pulse outputl
333 -
P 0078 8D 0000· 334 JP pulse Ipulse IRQ service!
335
P 007B 336 END JUMP
338 !Initializationl
? 007B 339 INIT PROCEDURE
340 ENTRY
341
P 007B E6 F8 07 342 LO P01M,HS(2)11010111
343 linternal stack;
344 ADO-A15;
345 normal memory
346 timing !
P 007E E6 7F 10 347 LO P3M save,nS(2)00010000
348 - !P3M is write-only,
349 so keep a copy in
350 RAM for later
351 reference!
P 0081 E4 7F F7 352 LO P3M,P3M save ! set up Port 3
P 0084 E6 FF 65 353 LO SPL,IISTICK !stack pointer
P 0087 BO F1 354 CLR TMR !reset timers!
P 0089 E6 F6 FF 355 LD P2M,UFF tall inputs!
P 008C BO FA 356 CLR IRQ !reset into requests!
P 008E BO FB 357 CLR IMR !disable interrupts !
P 0090 BO FO 358 CLR RP !register pointer I
P 0092 E6 70 80 359 LO SER_flg,/lS80 !serial disabled I
P 0095 9F 360 EI !globally enable
361 interrupts I
P' 0096 80 0812 362 JP S0812
363
P 0099 364 END INIT
1178
Binary Arithmetic Rout~nes
397 CONSTANT
398 div LEN = Rl0
399 DIVISOR = Rll
400 dividend HI R12
401 dividend-LO R13
402 GLOBAL
P 0099 403 divide PROCEDURE
404
405 I·····················································
Purpose To perform a 16-bit by 8-bit unsigned
406 binary division.
407
408 Input = Rll = 8-bit divisor
409 RR12 16-bit dividend
410
411 Output = R13 = 8-bit quotient
412 R12 = 8-bit remainder
413 Carry flag = 1 if overflow
414 = 0 if no overflow
415 R11 unmodified
416 ..................................................... /
417 ENTRY
P 0099 A9 7C 418 ld TEMP 1,div LEN !save caller's Rl01 .
P 009B AC 08 419 ld div_LEN,U8- !LOOP COUNTERI
420
421 ICHECK IF RESULT WILL FIT IN 8 BITSI
P 009D A2 BC 422 cp DIVISOR,dividend HI
P 009F BB 02 423 jr UGT,LOOP TCARRY o (FOR RLC)!
424 !overflow!
P OOAl DF 425 SCF !CARRY 1!
P 00A2 AF 426 ret
427
P 00A3 10 ED 428 LOOP: RLC dividend LO !DIVIDEND • 21
P OOA5 10 EC 429 RLC dividend-HI
P 00A7 7B 04 430 jr c,subt
P 00A9 A2 BC 431 cp DIVISOR,dividend HI
P OOAB BB 03 432 jr UGT,next TCARRY = 01
P OOAD 22 CB 433 subt: SUB dividend HI,DIVISOR
P OOAF DF 434 SCF - !TO BE SHIFTED INTO RESULT!
P OOBO AA Fl 435 next: djnz div_LEN,LOOP !no flags affectedl
436
437 !ALL DONEI
P 00B2 10 ED 438 RLC dividend LO
439 !CARRY = 0: no overflow!
P 00B4 A8 7C 440 ld Irestore caller's Rl0!
P 00B6 AF 441 ret
P 00B7. 442 END divide
1179
444 CONSTANT
445 d16 LEN = R7
446 dvsr hi = R8
447 dvsr-lo R9
448 rem hi = Rl0
449 rem-lo Rll
450 quo~ hi R12
451 quot-lo R13
452 GLOBAl:
P 00B7 453 div 16 PROCEDURE
454 I··T••••••••••••••••••••••••••••••••••••••••••••••••••
455 Purpose To perform a 16-bit by 16-bit unsigned
456 binary division.
457
458 Input = RR8 = 16-bit divisor
459 RR12 = 16-bit dividend
460
461 Output = RR12 = 16-bit quotient
462 RR10 16-bit remainder
463 RR8 unmodified
464 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
465 ENTRY
P 00B7 79 7C 466 ld TEMP 1,d16 LEN Isave caller's Rl0!
P 00B9 7C 10 467 ld d16_1:EN,1110 ILOOP COUNTER I
P OOBB CF 468 rcf Icarry = 01
P OOBC BO EA 469 clr rem hi
P OOBE BO EB 470 clr rem-lo
P OOCO 10 ED 471 dlp_16: rIc quo~ 10
P 00C2 10 EC 472 rIc quot-hi
P 00C4 10 EB 473 rIc rem To
P 00C6 10 EA 474 rIc rem-hi
P OOCS 7B OA 475 jr c ,siibt 16
P OOCA A2 8A 476 cp dvsr hI,rem hi
P OOCC BB OB 477 jr ugt,skp 16-
P OOCE 7B 04 478 jr ult,subt 16
P OODO A2 9B 479 cp dvsr lo,rem 10
P 00D2 BB 05 480 jr ugt,skp 16-
P 00D4 22 B9 481 subt 16: sub rem lo,avsr 10
P 00D6 32 A8 482 sbc rem=hi,dvsr=hi
P 00D8 DF 483 scf
P 0009 7A E5 484 skp_16: djnz d16 LEN,dlp 16 Ino flags affectedl
P OODB 10 ED 485 rIc quo~ 10 -
P OODD 10 EC 486 rIc quot-hi
P OODF 78 7C 487 ld d16_rEN,TEMP_l
P OOEl AF 488 ret
P 00E2 489 END div_16
491 CONSTANT
492 MULTIPLIER := Rll
493 PRODUCT LO := R13
494 PRODUCT-HI := R12
495 mul LEN := Rl0
496 GLOBlrL
P 00E2 497 multiply PROCEDURE
498
499 I·····················································
Purpose = To perform an 8-bit by 8-bit unsigned
500 binary multiplication.
501
502 Input = Rll = multiplier
503 R13 = multiplicand
504
505 Output = RR12 = product
506 Rll unmodified
507 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
508 ENTRY
P 00E2 A9 7C 509 ld TEMP 1,mul LEN Isave caller's Rl01
P 00E4 AC 09 510 ld mul rEN,1I9- 18 BITS!
P 00E6 BO EC 511 clr PRODUCT HI IINIT HIGH RESULT BYTEI
P 00E8 CF 512 . RCF ICARRY = 01
P 00E9 co EC 513 LOOP1: RRC PRODUCT HI
P OOEB CO ED 514 RRC PRODUCT-LO
P OOED FB 02 515 jr NC,NEXT-
P OOEF 02 CB 516 ADD PRODUCT HI,MULTIPLIER
P OOFl AA F6 517 NEXT: djnz mul LEN-;LOOPl
P 00F3 A8 7C 518 ld mul=LEN,TEMP_l Irestore caller's Rl01
P 00F5 AF 519 ret
P 00F6 520 END multiply
1180
522 CONSTANT
523 m16 LEN R7
524 plier hi R8
525 plier-lo R9
526 prod hi Rl0
527 prod-lo Rll
528 mult-hi R12
529 mult-lo R13
530 GLOBAL
P 00F6 531 mult 16 PROCEDURE
532 ! •• IT •••••••••••••••••••• , ••• , ••••••••••• , ••••••••••••
533 Purpose To perform an 16-bit by 16-bit unsigned
534 binary multiplication.
535
536 Input = RR8 = multiplier
537 RR12 = multiplicand
538
539 Output = RQ10 = product (Rl0, Rl1, R12, R13)
540 RR8 unmodified
541 Zero FLAG = 0 if result> 16 bits
542 = 1 if result fits in 16
543 (unsigned) bits (RR12 = result)
544 •••••••••••••••••••••••••• ** ••••••••••••••••• ** •••••• !
545 ENTRY
P 0()F6 79 7C 546 Id TEMP 1,m16 LEN !save caller's R7!
P 00F8 7C 11 5~7 Id m16 t:EN,1117 !16BITS!
P OOFA BO EA 5~8 clr prod hi
P OOFC BO EB 549 clr prod:lo !init product!
P OOFE CF 550 rcf !CARRY = O!
P DOFF CO EA 551 100p16: rrc prod hi
P 0101 CO EB 552 rrc prod-lo !bit 0 to carry!
P 0103 CO EC 553 rrc mUltoi !multiplicand / 2!
P 0105 CO ED 554 rrc mult 10
P 0107 FB 04 555 jr nc,next16
P 0109 02 B9 556 add prod 10, pI ier 10
POl DB 12 A8 557 adc prod-hi,plieroi
P 010D 7A FO 558 next16: djnz m16 LEN,100p16 next bit!
P 010F 78 7C 559 Id m16-LEN,TEMP 1 restore caller's R7!
P 0111 A9 7C 560 Id TEMP 1, prod hi test product ..• !
P 0113 ~~ EB 7C 561 or TEMP:l ,prod:lo ... bits 31 - 16!
P 0116 AF 562 ret
P 0117 563 END mul t 16
1181
BCD Arithmetic Routines
593 IThe BCD format supported by the following arithmetic
594 and conversion routines allows representation
595 of signed magnitude variable precision BCD
596 numbers. A BCD number of 2n digits is
597 represented in n+l consecutive bytes where
598 the byte at the lowest memory address
599 ('byte 0') represents the sign and post-
600 decimal digit count, and the bytes in the
601 next n higher memory locations ('byte l'
602 through 'byte n') represent the magnitude
603 of the BCD number. The address of 'byte 0'
604 and the value n are passed to the subroutines
605 in specified working registers. Digits are
606 packed two per byte with the most
607' significant digit in the high order nibble
608 of 'byte l' and the least significant digit
609 in the low order nibble of 'byte n'. 'Byte 0'
610 is organized as two fields:
611 bit 7 represents sign:
612 = 1 => negative
613 = 0 => positive
614 bit 6-0 represent post-decimal digit
615 count
616 ,For example:
617 'byte 0'= ~05 => positive, with 5 post-decimal digits
61e ~80 => negative, with no post-decimal digits
619 = ~90 => negative, with 16 post-decimal digits
620
622 CONSTANT
623 bcd LEN := R12
624 bcd-SRC ._ R14
625 bcd-DST ._ R15
626 GLOB'lL
P 0117 627 bcdsub PROCEDURE
628
I·····················································
629 Purpose = To subtract two packed BCD strings of
630 equal length.
631 dst <-- dst - src
632
633 Input R15 address of destination BCD
634 string (in register memory).
635 R14 address of source BCD
636 string (in register memory).
637 R12 BCD digit count I 2
638
639 Output = Destination BCD string contains the
640 difference.
641 Source BCD string may be modified.
642 R12, R14, R15 unmodified if no error
643 R13 modified.
61111 Carry FLAG = 1 if underflow or format
645 error.
646
·····················································1
647 ENTRY
P 0117 B7 EE 80 648 xor Icomplement sign of
649 subtrahend!
650 !fall into bcdaddl
P 011A 651 END bcdsub
1182
653 GLOBAL
P 011A 654 bcdadd PROCEDURE
655 !* ••• **.****** ••••••••••••••••••••••• **.** •••••••• ** ••
656 Purpose = To add two packed BCD strings of
657 equal length.
658 dst <-- dst + src
659
660 Input R15 address of destination BCD
661 string (in register memory).
662 R14 address of source BCD
663 string (in register memory).
664 R12 BCD digit count / 2
665
666 Output Destination BCD string contains the sum.
667 Source BCD string may be modified.
668 R12, R14, R15 unmodified if no error
669 R13 modified.
670 Carry FLAG = 1 if overflow or format
671 error •
672 •••••••••••••••••••••••••••••••• ** ••••••••••••••••••• !
673 ENTRY
674 !delete all leading pre-decimal zeroesl
P 011A E6 7E 02 675 Id TEMP 3,112
P 011D D8 EE 676 Id R13,bcd SRC
P 011F C9 7B 677 Id TEMP 4,ocd LEN
P 0121 04 7B 7B 678 add TEMP-4,TEMP 4 !total digit count!
P 0124 E5 ED 7D 679 ld TEMP-2,@R13- !get Sign/post dec #1
P 0127 56 7D 7F 680 and TEMP-2,#%7F !isolate post dec #!
P 012A 24 7D 7B 681 sub TEMP-4,TEMP 2 !pre-dec digit cnt!
P 012D 7D 0203' 682 jp ult,oa err - ! format error I
P 0130 6B lA 683 jr z,ba 1- Ino pre-dec. digitsl
P 0132 70 EC 684 ba 2: push R12 - ! savel
P 0134 C7 CD 01 685 Id R12,1 (R13) !leading byte!
P 0137 76 EC FO 686 tm R12,II%FO !test leading digitI
P 013A 50 EC 687 pop R12 !restorel
P 013C EB OE 688 jr nz,ba 1 !no more leading O's!
P 013E BO 7C 689 clr TEMP T
P 0140 D6 0463' 690 call rdl !rotate left!
P 0143 21 ED 691 inc @R13 !update post dec #1
P 0145 4D 0203' 692 jp ov,ba err loops!
P 0148 00 7B 693 dec TEMP 11 !dec pre-dec II!
P 014A EB E6 694 jr nz,ba 2 Iloopl
P 014C D8 EF 695 Id R13,bcd DST
P 014E 00 7E 696 dec TEMP 3 - !SRC and DST done?!
P 0150 EB CD 697 jr nz,ba_3 !do DSTI
698 !leading zero deletion complete!
699 !insure DST is > or = SRC; exchange if necessary!
P 0152 E3 DF 700 Id R13,@bcd DST
P 0154 56 ED 7F 701 and R13,#%7F- !isolate post dec #1
P 0157 E5 EE 7D 702 ld TEMP 2,@bcd SRC I
P 015A 56 7D 7F 703 and TEMP-2,#%7F- !isolate post dec #1
P 015D A4 7D ED 704 cp R13,TEMP 2
P 6160 70 ED 705 push R13 - I savel
P 0162 7B 39 706 jr ult,ba 4 !DST > SRCI
P 0164 BB 18 707 jr ugt,ba-5 !DST < SRCI
708 Idecimal points in same position.
709 must compare magnitude!
P 0166 D/I EC 710 Id R13,bcd LEN
P 0168 E9 7C 711 Id TEMP 1, ocd SRC
P 016A F9 7B 712 ld TEMP-4,bcd-DST
P 016C 20 7C 713 ba 6: inc TEMP-l -
P 016E 20 7B 714 inc TEMP-4
P 0170 E5 7C 7E 715 Id TEMP-3,@TEMP 1 !get SRC byte!
P 0173 A5 7B 7E 716 cp TEMP=3,@TEMP=4 Icompare DST by tel
1183
P 0176 88 06 717 jr ugt,ba 5 'SRC > DST'
P 0178 78 23 718 jr ult,ba-4 'SRC < DST'
P 017A DA FO 719 djnz R13,ba:6 !loop'
P 017C 88 IF 720 jr ba 4 !DST > or = SRC'
721 'swap source and destination operands'
p 017E D8 EC 722 ba_5: ld R13,bcd_LEN
P 0180 DE 723 inc R13 'include flag/size byte'
P 0181 02 ED 724 add bcd SRC,R13
P 0183 02 FD 725 add bcd:DST,R13
P 0185 00 EE 726 ba_7: dec bcd SRC
P 0187 00 EF 727 dec bcd-DST
P 0189 E5 EE 7C 728 ld TEMP 1,@bcd SRC
P 018C E5 EF 78 729 ld TEMP-4,@bcd-DST
P 018F F5 78 EE 730 ld @bcd-SRC,TEMP 4
P 0192 F5 7C EF 731 ld @bcd-DST,TEMP-1 lone byte swapped'
P 0195 DA EE 732 djnz R13,oa 7 -
P 0197 D8 7D 733. ld R13,TEFlP_2
P 0199 50 7D 734 pop TEMP 2
P 0198 70 ED 735 push R13 -
736 !exchange complete'
P 019D 50 ED 737 ba 4: pop' R13 !restore'
738 'R13 = DST post decimal digit count
739 TEMP 2 = SRC post decimal digit count
740 R13 ';'< TEMP 2
P 019F 24 ED 7D 741 sub - TEMP_2, R1 3
P 01A2 CO 7D 742 rrc TEMP 2 'alignment offsetl
P 01A4 F8 09 743 jr nc,ba 8 !digits word aligned I
744 !rotate out least significant SRC post decimal digiti
P 01A6 08 EE 745 ld R13,bcd_SRC
P 01A8 01 ED 746 dec @R13 !dec post dec digit II I
P 01AA 80 7C 747 clr TEMP_1
P 01AC D6 0485' 748 call rdr
749 !determine if addition or subtraction!
P 01AF E5 EE 78 750 ba_8: ld TEMP 4,@bcd SRC 'sign of SRCI
P 0182 85 EF 78 751 ' xor TEMP-4,@bcd-DST ! sign of OSTI
752 ! get starting addresses! -
P 0185 D8 EC 753 ld R13,bcd LEN
P 0187 24 70 EO 754 sub R13,TEM1f 2
P 018A 68 45 755 jr z,ba 14 - !done already I
P 018C 02 EO 756 add bcd SRC,R13
P 018E 02 FC 757 add bcd:DST, bcd_LEN
758 !ready!'!
P 01 CO CF 759 rcf Icarry = O!
P 01C1 E5 EF 7C 760 ba 11: ld TEMP_1,@bcd_DST
P 01C4 76 78 80 761 tm TEMP 4,IIJ80 !add or sub?!
P 01C7 68 05 762 jr z, ba-9 !addl
P 01C9 35 EE 7C 763 sbc TEMP-1,@bcd SRC
P 01CC ~8 03 764 jr ba 1'0 -
P 01CE 15 EE 7C 765 ba 9: adc TEMP 1,@bcd SRC
P 01D1 40 7C 766 ba-l0: da TEMP-1 -
P 01D3 F5 7C EF 767 ld @bcd-DST,TEMP 1
P 0106 00 EF 768 dec bcd 'UST -
P 01D8 00 EE 769 dec bcd-SRC
P 010A OA E5 770 djnz R13-;ba 11
771 Ipropagate carry thru lEMP 2 bytes of DST!
P 01DC D8 70 772 ld R13,TEMP_2-
P 01DE DE 773 inc R13 !may be zerol
P 010F DA 02 774 djnz R13,ba 12
p 01E1 88 09 775 jr ba 13 -
P 01E3 17 EF 00 776 ba 12: adc @bcd DST,IIO
P 01E6 41 EF 777 da @bcd-DST
P 01E8 00 EF 778 dec bcd 'UST
P OlEA DA F7 779 djnz R13-:-ba_12
1184
780 !carry propagate completel
P 01EC FB 13 781 ba 13: jr nc,ba lq Idonel
782 IRotate out least significant post decimal OST
783 digit to make room for carry at high endl
P 01EE E5 EF 7C 78q ld TEMP_l,@bcd_OST
P 01Fl 56 7C 7F 785 and TEMP 1, 111>7F
P 01Fq 60 0203' 786 jp z,ba-err !no post dec digits!
P 01F7 E6 7C 10 787 ld TEMP-l, liS 10
P 01FA 08 EF 788 ld R13,ocd_OST
P 01FC 06 OQ85' 789 call rdr
P 01FF 01 EF 790 dec @bcd_OST !dec digit cntl
P 0201 CF 791 ba 1Q: rcf
P 0202 AF 792 ret
793
P 0203 OF 79Q ba err: scf
P 020Q AF 795 ret
P 0205 796 ENO bcdadd
1185
Conversion Routines
821 CONSTANT
822 bca LEN := R12
823
824
bca-SRC
GLOBAL
.- R13
P 0205 825 bcddasc PROCEDURE
826 ! ••••••••••••••••••• ~ •••••••••••••••••••••••••••••••••
827 Purpose To convert a variable length BCD
828 string to decimal ASCII.
829
830 Input = RR14 = addressof destination ASCII
831 string (in reg/ext/ser memory).
832 R13 address of source BCD
833 string (in register memory).
834 R12 BCD digit count / 2
835
836 Output ASCII string in designated
837 destination buffer.
838 Carry FLAG = 1 if input format error
839 or serial disabled,
8liO = 0 if no error.
8lil R12, R13, R14, R15 modifie~.
8li2 Input BCD string ummodified.
8li3
844 ··**···················**··························**1
ENTRY
P 0205 E6 7C 2D 845 ld TEMP 1,11'-' !minus sign!
P 0208 77 ED 80 846 tm @bca-SRC,1I%80 Isrc negative?1
P 020B EB 03 8117 jr nz,bcd dl !yes!
P 0200 E6 7C 2B 8li8 ld TEMP 1";"11'+' I positive signl
P 0210 E5 ED 7E 849 bcd dl: ld TEMP-3,@bca SRC
P 0213 56 7E 7F 850 and TEMP-3, 111. 7r lisolate post dec cntl
P 0215 02 CC 851 add bca LEN,bca LEN Itotal digit count!
P 0218 70 EC 852 push bca-LEN -
P 021A 24 7E EC 853 sub bca-LEN,TEMP 3 !pre-dec digit cntl
P 0210 50 7E 8511 pop TEM'!' 3 - Itotal digit count I
P 021F 7B 35 855 ,jr ult,bcd d2 ! format error I
P 0221 06 03F4' 856 call put dest !sign to dest.!
P 022li 7B 30 857 jr c,bcd d2 !serial errorl
P 0226 A6 EC 00 858 cp bca LE'N,IIO !any pre-dec digits?!
P 0229 6B 22 859 jr z,bcd d6 Ino. start with '.'!
P 022B 76 7E 01 860 bcd dli: tm TEMP 3,111 Ineed next byte?1
P 022E EB Oli 861 ' jr nz,bcd d3 !not yet.1
P 0230 OE 862 inc bca SR'l:' lupdate pointer!
P 0231 E5 ED' 70 863 ld TEMP 2,@bca SRC Iget next byte!
P 0234 FO 7D 864 bcd_d3: swap TEMP-2 -
P 0236 Eli 7D 7C 865 ld TEMP-l, TEMP 2
P 0239 56 7C OF 866 and TEMP-l ,1I1.0r lisolate ,digit!
P 023C A6 7C 09 867 cp TEMP-l,1I9 !verify bcd!
P 023F BB lli 868 jr ugt,bcd d5 !no good!
P 02lil 06 7C 30 869 add TEMP 1,#1.30 !convert to ASCIII
P 0211li D6 03Fli' 870 call put cest Ito destination I
P 0247 00 7E 871 dec TEMP 3 Idigit count!
P 02li9 6B OB 872 jr z,bcd_d2 lall donel
P 024B CA DE 873 djnz bca LEN,bcd d4 Inext digiti
P 0240 E6 7C 2E 874 bcd d6: ld TEMP 1,1/'. ,- I time for dec. pt. I
P 0250 D6 03F4' 875 call put dest Ito destination!
P 0253 8B D6 876 jr bcd-dli !continuel
P 0255 OF 877 bcd d5: scf Iset error return I
P 0256 AF 878 bcd-d2: ret
P 0257 879 END- bcddasc
881 GLOBAL
P 0257 882 wrdhasc PROCEDURE
883
88li I·····················································
Purpose To convert a word to Hex ASCII.
~inary
885
886 Input = RR12 = source binary word.
887 RR14 = address of destination ASCII
888 string (in reg/ext/ser memory).
889
890 Note = All other details same as for,bythasc.
891
892 ·····················································1
ENTRY
P 0257 06 025C' 893 call bythasc !convert R121
P 025A C8 ED 89li ld R12;R13
895 ! fall into bythascl
P 025C 896 ENO wrdhasc
1186
898 CONSTANT
899
900
bna SRC
GLOBAL
-. R12
P 025C 901 bythasc PROCEDURE
902 ! •••••••••••••••••••••••••••••••••••••••••••••••••••••
903 Purpose To convert a binary byte to Hex ASCII.
904
9P5 Input = RR14 = address of destination ASCII
906 string (in reg/ext/ser memory).
907 R12 = Source binary byte.
908
909 Output ASCII string in designated
910 destination buffer.
911 Carry = 1 if error (serial only).
912 R14, R15 modified.
913
914 ***·***····················**·············**·········1
ENTRY
P 025C BO 7E 915 clr MODE !flag => binary to ASCIII
P 025E E6 70 02 916 bca go: ld TEMP_2,112
P 0261 FO EC 917 bca:go 1: SWAP bna SRC !look at next nibble!
P 0263 C9 7C 918 ld TEMV_1,bna_SRC
P 0265 56 7C OF 919 and TEMP', nOF ! isolate low nibble!
P 0268 06 7C 30 920 ADD TEMP-' ,11$30 !convert to ASCII!
P 026B A6 7C 3A 921 cp TEMP-l,U3A !>9?!
P 026E 7B 09 922 jr ult,skip !nol
P 0270 OF 923 SCF lin case error!
P 0271 76 7E 01 924 TM MODE,n, !input is BCD?!
P 0274 EB 00 925 JR NZ,bca ex !yes. error. !
P 0276 06 7C 07 926 ADD TEMP '-;U07 linput hex. adjust!
P 0279 06 03F4' 927 skip: call put dest !put byte in dest!
P 027C 7B 05 928 jr c,bca ex terror!
P 027E 00 70 929 dec TEMP "2
P 0280 EB OF 930 jr nz,bca_g01 ! loop till done!
P 0282 CF 931 RCF !carry = 0: no error!
P 0283 AF 932 bca ex: ret !done!
P 0284 933 END- bythasc
1187
935 CONSTANT
936 bcd adr := R14
937 bcd-cnt := R15
938 GLOBAL
P 0284 939 b'cdwrd PROCEDURE
91i0
941 I·····················································
Purpose = To convert a variable length BCD
942 string to a signed binary word. Only
943 pre-decimal digits are converted.
944
945 Input R14 address of source BCD
946 string (in register memory).
91i7 R15 = BCD digit count / 2
948
949 Output RR12 = binary word
950 Carry FLAG = 1 if input format error
951 or dest overflow,
952 = 0 if no error.
953 R14,R15 modified.
951i
955 ·····················································1
ENTRY
P 0281i BO EC 956 clr R12 !init destinationl
P 0286 BO ED 957 clr R13
P 0288 E5 EE 7B 958 ld TEMP 4,@bed adr Iget sign/post lengthl
P 028B 56 7B 7F 959 and TEMP-4, /J'1.7F- lisolate post Tengthl
P 028E 02 FF 960 add bcd ent,bcd cnt 111 bcd digits!
P 0290 24 7B EF 961 sub bcd-cnt,TEHF 4 1# pre-dec digits!
P 0293 7B 37 962 jr ult";'bcd w2 - !format error!
P 0295 E5 EE 7B 963 ld TEMP 4,Fbcd adr !remember signl
P 0298 E6 7E 02 964 bcd_w3: ld TEMP-3,1I2 - !digits per by tel
P 029B EE 965 inc bcd idr !src addressl
P 029C E5 EE 70 966 ld TEMl' 2,@bcd adr Iget next src byte!
P 029F A6 EF 00 967 bcd w1: cp bcd ent,IIO - !digit count = O?I
P 02A2 6B 12 968 jr z,bcd w4 !conversion complete I
P 02A4 FO 70 969 swap TEMP ~ Inext digit!
P 02A6 Eli 7D 7C 970 ld TEMP-1, TEMP 2
P 02A9 06 042C' 971 call bcd liin - laccumulate in binaryl
P 02AC 7B 1E 972 jr c,bed w2 loverflow or format err!
P 02AE 00 EF 973 dec bcd cnt !update digit countl
P 02BO 00 7E 974 dec TEMl' 3 !next byte?1
P 02B2 EB EB 975 jr nz,bed w1 !no. same.!
P 02B4 8B E2 976 jr bcd_w3- Inext by tel
P 02B6 OF 977 bcd wli: scf lin casel
P 02B7 76 EC 80 978 tm R12,/J'1.80 !result > 15 bits?1
P 02BA EB 10 979 jr nz,bcd w2 loverflowl
P 02BC 76 7B 80 980 bcd_w5: tm TEMP 4";'11$80 Isource negative?1
P 02BF 6B OA 981 jr z,bcd w6 Ino. done. I
P 02C 1 60 EC 982 com R12 -
P 02C3 60 ED 983 com R13
P 02C5 06 ED 01 984 add R13,1I1
P 02C8 16 EC 00 985 adc R12,1I0 IRR12 two's complement I
P 02CB CF 986 bed w6: rcf Icarry = 01
P 02CC AF 987 bcd-w2: ret
P 02CD 988 END- bcdwrd
1188
990 GLOBAL
P 02CD 991 wrdbcd PROCEDURE
992
993 I·····················································
Purpose To convert a signed binary word
994 to a variable length BCD string.
995
996 Input R14 = address of destination BCD
997 string (in register memory)
998 RR12 = source binary word
999 R15 = BCD digit count / 2
1000
1001 Output BCD string in destination buffer
1002 Carry FLAG = 1 if dest overflow
1003 = 0 if no error.
1004 R12,R13,R14,R15 modified.
1005
1006 ·····················································1
ENTRY
P 02CD Bl EE 1007 clr @bcd adr !init sign/post dec cntl
P 02CF 76 EC 80 1008 tm R12,'lT%80 lis input word nega~ive?
P 02D2 6B OD 1009 jr z,wrd bO
P 02D4 47 EE 80 1010 or @bcd adr,#~80 !set result negative!
P 02D7 60 ED 1011 com R13 -
P 02D9 60 EC 1012 com R12
P 02DB 06 ED 01 1013 add R13,#1
P 02DE 16 EC 00 1014 adc R12,II0 !RR12 two's complement I
P 02El 10 ED 1015 wrd bO: rlc R13
P 02E3 10 EC 1016 rlc R12 !bit 15 not magnitude!
P 02E5 EE 1017 inc bcd adr !update dest pointer!
P 02E6 E9 7C 1018 ld TEMF l,bcd adr
P 02E8 F9 7D 1019 ld TEMP-2,bcd-cnt Idest byte countl
P 02EA 04 EF 7C 1020 add TEMP-l ,bcd-cn t
P 02ED 00 7C 1021 dec TEMP-l - != bcd end addr!
P 02EF B1 EE 1022 wrd bl: clr @bcd-adr linitialize destl
P 02Fl EE 1023 inc bcd adr
P 02F2 FA FB 1024 djnz bcd-cnt,wrd bl
P 02F4 E6 7E OF 1025 ld TEMP 3,#15 - !source bit countl
P 02F7 70 7E 1026 wrd_b3: push TEMP-3
P 02F9 10 ED 1027 rlc R13 -
P 02FB 10 EC 1028 rlc R12 Ibit 15 to carry!
P 02FD E8 7C 1029 ld bcd adr,TEMP 1 !start at endl
P 02FF F8 7D 1030 ld bcd-cnt,TEMP-2 !dest byte count I
1031 I(dest bcd string) <-- (dest-bcd string • 2) + carry!
P 0301 E5 EE 7E 1032 wrd b2: ld TEMP 3,@bcd adr
P 0304 15 EE 7E 1033 adc TEMP-3,@bcd-adr !. 2 + carry!
P 0307 40 7E 1034 da TEMP-3 -
P 0309 F5 7E EE 1035 Id @bcd-adr,TEMP 3
P 030C 00 EE 1036 dec bcd adr - Inext two digits!
P 030E FA Fl 1037 djnz bcd-cnt,wrd b2 Iloop for all digitsl
P 0310 50 7E 1038 pop TEMP 3 - !restore src bit cntl
P 0312 7B 04 1039 jr c ,wrCi ex !dest. overflow I
P 0314 00 7E 1040 dec TEMP J
P 0316 EB DF 1041 jr nz,wrd_b3 !next bit!
P 0318 AF 1042 wrd ex: ret
P 0319 1043 END- wrdbcd
1189
1045 GLOBAL
P 0319 1046 hascwrd PROCEDURE
1047
1048 I·················································
.Purpose To convert a variable length Hex ....
1049 ASCII string to binary.
1050
1051 Input = RR14 address of source ASCII
1052 string (in reg/ext/ser memory).
1053
1054 Output = RR12 = binary word (any overflow
1055 high order digits are truncated
1056 without error).
1057 Carry FLAG = 1 if input error
1058 (serial only)
1059 (SER fIg indicates cause)
1060 =-0 if no error
1061 R14, R15 modified
1062
1063 Note = The ASCII input string processing is
1064 terminated with the occurrence of a
1065 non-hex ASCII character.
1066
1067 ·····················································1
ENTRY
P 0319 BO 7E 1068 clr TEMP_3
P 031B BO EC 1069 clr R12
P 031 D BO EO 1070 clr R13 Unit outputl
P 031F 06 030A' 1071 has cl: call get src Iget inputl
P 0322 7B 28 1072 jr c,has_exl !errorl
P 0324 06 0400' 1073 call ver asc Iverify hex ASCIII
P 0327 7B 22 1074 jr c,has_ex lend conversionl
P 0329 A6 7C 39 1075 cp TEMP 1,U39
P 032C 3B 03 1076 jr ule,nas_c2
P 032E 26 7C 37 1077 sub TEMP 1,1''''37
1078 I Shift "left one nibbTel
1079 I Insert new nibble in least significant nibble I
P 0331 FO EO 1080 has c2: swap R13
P 0333 09 70 1081 ld TEMP 2,R13
P 0335 56 EO FO 1082 and R13,nFO
P 0338 56 7C OF 1083 and TEMP 1,UOF
P 033B U4 7C EO 1084 or R13, "TEMP_l
P 033E FO EC 1085 swap R12
P 0340 56 EC FO 1086 and R12,UFO
P 0343 56 70 OF 1087 and TEMP 2,If"'OF
P 0346 44 70 EC 1088 or R12,'rEMP_2
P 0349 8B 04 1089 jr has cl !loopl
P 034B CF 1090 has ex: rcf Ino error!
P 034C AF 1091 has-exl :ret
P 0340 1092 ENO- hascwrd
1190
1094 GLOBAL
P 0340 1095 dascwrd PROCEDURE
1096 ! •••••••••••••••••••••••••••••••••••••••••••••••••••••
1097 Purpose To convert a variable length decimal
1098 ASCII string to signed binary.
1099
1100 Input = RR14 address of source ASCII
1101 string (in reg/ext/ser memory).
1102
1103 Output RR12 = binary word
1104 R8,R9,R10,R11 holds the packed BCD
1105 version of the result.
1106 Carry FLAG = 1 if input error
1107 (serial only)
1108 (SER fIg indicates cause)
1109 - or dest overflow
1110 = 0 if no error
1111 R14, R15 modified
1112
1113 Note The ASCII input string processing is
1114 terminated with the occurrence of a
1115 non-decimal ASCII character.
1116 Decimal ASCII string may be no more
1117 than 6 digits in length, else Carry
1118 will be returned.
1119 Post decimal digits are not included
1120 in the binary result.
1121 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
1122 ENTRY
P 0340 CC 03 1123 Id R12,113 !6 digitsl
P 034F DC 08 1124 Id R13,118 ! temp addr =I
P 0351 04 FD ED 1125 add R13,RP ! R8 thru R111
P 0354 06 0363' 1126 call dascbcd Iconvert to bcd!
P 0357 7B F3 1127 jr c,has ex1 lerrorl
P 0359 EC 08 1128 Id R14, #"8"
P 035B 04 FD EE 1129 add R14,RP
P 035E FC 03 1130 Id R15,1I3
P 0360 80 0284' 1131 jp bcdwrd Iconvert to binary I
P 0363 1132 END dascwrd
1191
11311 CONSTANT
1135 dab LEN := R12
1136 dab-DST :: R13
1137 GLOBAL
P 0363 1138 dascbcd PROCEDURE
1139 I··············.· ... ····.· ............................
11110 Purpose To convert a variable length decimal
11111 ASCII string to BCD.
1142
1143 Input = R13 = address of destination BCD
1144 string (in register memory).
1145 RR111 = address of source ASCII
1146 string (in reg/ext/ser memory).
1147 R12 = BCD digit count / 2
1148
1149 Output BCD string in designated destination
1150 buffer (any overflow high order
1151 digits are truncated without error).
1152 Carry FLAG = 1 if input error
1153 (serial only)
1154· (SER_flg indicates cause)
1155 or overflow
1156 Rll1, R15 modified.
1157
1158· Note = The ASCII input string processing is
1159 terminated with the occurrence of a
1160 non-decimal ASCII character.
1161
·····················································1
1162 ENTRY
P 0363 70 EC 1163 push dab LEN I savel
P 0365 70 ED 1164 push dab-DST
P 0367 Bl ED 1165 das_gl: clr @dab DST linit. destination!
P 0369 DE 1166 inc dab UST
P 036A CA FB 1167 djnz dab-LEN,das gl
P 036C Bl ED 1168 clr @dao DST - I in it • I
P 036E 50 ED 1169 pop dab OST Irestorel
P 0370 50 EC 1170 pop dab-LEN
P 0372 E6 7E 01 1171 Id TEMl' 3,111 I for ver asc I
P 0375 BO 7B 1172 clr TEMP:4 lbit o => digit seen;
1173 bit 1 => dec pt seen;
1174 bit· 7 => overflowl
P 0377 D6 03DA' 1175 das_g2: call get src 1get input by tel
.P 037A 7B 41 1176 jr c,dab exl Iserial error I
P 037C 56 7C 7F 1177 and TEMP ·1,U7F 17-bit ASCIII
P 037F 76 7B 03 1178 tm TEMP=II,U03 Icheck status I
P 0382 EB OF 1179 jr nz,das g5 ISign char not valid I
P 0384 A6 7C 2B 1180 cp TEMP 1-;11' +' !positive?1
P 0387 6B EE 1181 jr z,das_g2 Iyes. no affectl
P 0389 A6 7C 2D 1182 cp TEMP_ 1 ,1/ '-' lnegative?1
P 038C EB 07 1183 jr nz,das g4 Inot sign charI
P 038E B7 ED 80 11811 xor @dab_D"ST, 11~80 Icomplement signl
P 0391 8B Ell 1185 jr das g2 Iget next input!
P 0393 5B OA 1186 das g5: jr mi,aas g6 Idec pt has been seenl
P 0395 A6 7C 2E 1187 das=gll: cp TEMP 1-;11'.' lis char dec pt?!
P 0398 EB 05 1188 jr nz,das g6 !nope.1
P 039A 116 7B 03 1189 or TEMP II-;U03 Idec pt and digit seenl
P 039D 8B D8 1190 jr das_g2 Iget next input!
P 039F D6 OIlOD' 1191 das_g6: call ver asc ! is bcd digit?l
P 03A2 7B 16 1192 jr c,dab_ex lend conversion.!
P 03AII 116 7B 01 1193 or TEMP II, II~O 1 Idigit seen!
P 03A7 D6 01163' 11911 call rdl - Inew digit to destl
P 03AA EB 09 1195 jr nZ,das g7 ! overflowl
P 03AC 76 7B 02 1196 tm TEMP_ 11-; U02 Ipost dec digit?1
P 03AF 6B C6 1197 jr z,das_g2 lno. get next input!
1192
P 0361 21 ED 1198 inc @dab DST linc post dec cntl
P 0363 86 C2 1199 jr das 82 Iget next inputl
P 0365 46 76 80 1200 das_g7: or TEMP 4,1IS80 I set overflowl
P 0368 86 60 1201 jr das_82 Iget next inputl
1202
P 036A E4 7B FC 1203 dab ex: ld FLAGS,TEMP_4 Icarry = 0 or 11
P 03BD AF 1204 dab-ex1: ret
P 03BE 1205 END- dascbcd
1207 GLOBAL
P 03BE 1208 wrddasc PROCEDURE
1209
1210 I·····················································
Purpose To convert a signed binary word to
1211 decimal ASCII
1212
1213 Input = RR12 = source binary word.
1214 RR14 = address of dest (in reg/ext/ser
1215 memory) •
1216
1217 Output = Decimal ASCII in dest buffer.
1218 R8,R9,R10,Rll holds the packed BCD
1219 version of the result.
1220 R12, R13, R14, R15 modified.
1221
1222 ·····················································1
ENTRY
P 03BE 70 EE 1223 push R14
P 03CO 70 EF 1224 push R15 Isave dest addrl
P 03C2 EC 08 1225 ld R14,1I8
P 03C4 04 FD EE 1226 add R14,RP IR8,9,lO & 11 temp!
P 03C7 FC 03 1227 ld R15,I13 !temp byte length I
P 03C9 06 02CD' 1228 call wrdbcd !convert input word!
P 03CC 50 EF 1229 pop 815
P 03CE 50 EE 1230 pop R14 Irestore dest addr!
P 0300 CC 03 1231 ld R12,I13 Ilength of templ
P 0302 DC 08 1232 ld 813,118
P 0304 04 FD ED 1233 add R13,RP laddr of tempI
P 0307 80 0205' 1234 jp bcddasc Iconvert to ASCIIl
P 03DA 1235 END wrddasc
1193
1237 GLOBAL Ifor PART II onlyl
P 03DA 1238 get src PROCEDURE
1239 I··T •••••••••••••••••• ~ •••••••••••••••••••••••••••••••
1194
1291 CONSTANT
1292 MODE
1293 char
1294 INTERNAL
P 040D 1295 ver asc PROCEDURE
1296 I··T••••••••••••••••••••••••••••••••••••••••••••••••••
. 1297 Purpose To verify input character as valid
1298 hex or decimal ASCII.
1299
1300 Input = TEMP 1 8-bit input
1301 TEMP:3 = 0 => test for hex,
1302 1 => test for decimal
1303
1304 Output = Carry FLAG = 0 if no error
1305 1 if error.
1306 ••• ** •• ** •••••••••••••••••••••••••••••• ** •••••••••••• !
1307 ENTRY
P 040D 56 7C 7F 1308 and char,U~7F 17-bit ASCII!
P 0410 A6 7C 30 1309 cp char,U'O' !range start: 'O'!
P 0413 7B 16 1310 jr ult,ver err !no good!
P 0415 A6 7C 3A 1311 cp char,U'9'+1 !dec range end: '9'!
P 0418 7B 10 1312 jr ult,ver ok fall's well!
P 041A 76 7E 01 1313 tm MODE,U1- !dec or hex?!
P 041D EB OB 1314 jr nz,ver erc !no goodl
P 041F ').6 7C DF 1315 and char,ULNOT('a'-'A') !insure upper case!
P 0422 A6 7C 41 1316 .cp char,U'A' !check A-F range!
P 0425 7B 04 1317 jr ult,ver err !no good!
P 0427 A6 7C 47 1318 cp char,U'F'+1 lend hex range!
1319 ver ok:
P 042A EF 1320 ver-erc: ccf Icomplement carry!
P 042B AF 1321 ver-err: ret
P 042C 1322 END- ver asc
1324 INTERNAL
P 042C 1325 bcd bin PROCEDURE
1326 ! ••T ••••••••••••••••••••••••••••••••••••••••••••••••••
1327 Purpose To convert next bcd digit to binary.
1328
1329 Input =
1330
1331 Output = RR12 = RR12 • 10 + digit
1332
1333 ·····················································1
ENTRY
P 042C 56 7C OF 1334 and TEMP 1,U~OF !isolate digit!
P 042F A6 7C 09 1335 cp TEMP-1,/l9 ! verify valid!
P 0432 BB 2D 1336 jr ugt,bcd b1 !errorl
P 0434 02 DD 1337 add R13,R13-
P 0436 12 CC 1338 adc R12,R12 !2x!
P 0438 7B 27 1339 jr c,bcd b1 ! overflow!
P 043A 70 EC 1340 push R12 -
P 043C 70 ED 1341 push R13
P 043E 02 DD 1342 add R13,R13
P 0440 12 CC 1343 adc R12,R12 ! 4x!
P 0442 7B 19 1344 jr c,bcd b2 !overflow!
P 0444 02 DD 1345 add R13,RT3
P 0446 12 CC 1346 adc R12, R12 !8x!
P 0448 7B 13 1347 jr c,bcd b2 !overflowl
P 044A 04 7C ED 1348 add R13,TEMP
P 044D 16 EC 00 1349 adc R12,110 .- !8x + dl
P 0450 7B OB 1350 jr c,bcd b2 ! overflow!
P 0452 50 7C 1351 pop TEMP T
P 0454 04 7C ED 1352 add R13,TEMP 1
P 0457 50 7C 1353 pop TEMP 1 -
P 0459 14 7C EC 1354 adc R12,TEMP_1 110x + d!
P 045C AF 1355 ret
1356
P 045D 50 7C 1357 bcd b2: pop TEMP 1
P 045F 50 7C 1358 pop TEMP-1 !restore stack!
P 0461 DF 1359 bcd b1: scf terror!
P 0462 AF 1360 ret
P 0463 1361 END bcd bin
1195
1363 CONSTANT
1364 s len := R12
1365 s-adr
INTERNAL
.- R13
1366
P 0463 1367 rdl PROCEDURE
1368
1369 I·····················································
Rotate Digit Left
1370
1371 Input = R12 = BCD string length
1372 R13 = BCD string address
1373 TEMP_l bit 3-0 = new digit
1374
1375 Output BCD string rotated left one digit·
1376 new digit inserted in units position.
1377 TEMP 1 bit 3-0 = digit rotated out
1378 - of high order digit position
1379 bit 7-11 = 0
1380 Zero FLAG = 1 if TEMP_l <> 0
1381 R12, R13 unmodified
1382
1383 ·····················································1
ENTRY
P 0463 70 EC 1384 push s len
P 01165 02 DC 1385 add s-adr,s len laddress of units placel
P 0467 Fl ED 1386 rdl_Ol : swap @s adr -
P 0469 E5 ED 7D 1387 ld TEMP 2,@s adr
P 046C 57 ED FO 1388 and @s aar,H~rO li;!olate digit!
P 046F 56 7C OF 1389 and TEMP l,nOF I isolate new digitI
P 0472 45 ED 7C 1390 or TEMP:l,@s_adr
P 0475 F5 7C ED 1391 ld @s adr,TEMP 1 Isave new by tel
P 0478 E4 7D 7C 1392 ld TE'R'P_1, TEMP:2
P 047B 00 ED 1393 dec s adr Iback-up pointerl
p 047D CA E8 1394 djnz s-len,rdl 01 !loop till donel
p 01l7F 56 7C OF 1395 and 'fEMP l,nOF lold high order digitI
P 04f\2 50 EC 1396 pop s_len !restore R12!'
p 0484 AF 1397 ret
P 0485 1398 END rdl
11100 INTERNAL
p 0485 11101
1402 ,.....................................................
rdr PROCEDURE
1403 Rotate Digit Right
14011
1405 Input = R12 = BCD string length
1406 R13 = BCD string address
1407 TEMP_l bit 7-4 = new digit
1408
1409 Output = BCD string rotated right one digiti.
1410 new digit inserted in high order
11111 position.
1412 R12 unmodified
1413 R13 modified
11114
1415
....................
ENTRY
·································1
P 0485 70 EC 1416 push s len
P 0487 DE 1417 rdr _01: inc s-adr
P 0488 Fl ED 1418 swap @s adr
P 04(1A E5 ED 7E 1419 ld TEMP 3,@S adr
P 01l8D 57 ED OF 1420 and @s aar,nOF ! isolate digitI
P 0490 56 7C FO 1421 and TEMP l,nFO lisolate new digit!
P 0493 115 ED 7C 1422 or TEMP:l,@S_adr
P 0496 F5 7C ED 1423 ld @s adr,TEMP 1 Isave new byte!
P 0499 E4 7E 7C 1424 ld TE'R'P_1, TEMP:3
P 049C CA E9 1425 djnz s len, rdr 0.1 !loop till done!
P 049E 50 EC 1426 pop s-len - !restore R121
P OIiAO AF 1427 ret
P OIiAl 1428 END rdr
1196
B~t Manipulation Routines
1460 CONSTANT
1461 tjm bits R12
1462 tjm-mask R13
1463 GLOBAL
P 04A 1 1464 clb PROCEDURE
1465 ! •••••••••••••••••••••••••••••••••••••••••••••••••••••
11166 Purpose = To collect selected bits in a byte
1467 into adjacent bits in the low order
1468 end of the byte. Upper bits in byte
11169 are set to zero.
1470
1471 Input R12 input byte
1472 R13 = mask. Bit = 1 => corresponding
1473 input bit is selected.
1474
1475 Output R12 = collected bits
1476
1477 Note = For example:
1478 Input: R12 $(2)01110110
1479 R13 %(2)10000101
1480
1481 Output R12 = $(2)00000010
1482 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
1483 ENTRY
P 04A1 E6 7C 08 1484 ld TEMP 1,#8 !bit count!
P 04A4 80 7D 1485 clr TEMP-2 !bits collected here!
P 04A6 90 EC 1486 next1: rl tjm bits !bit 7 to bit O!
P 04A8 90 ED 1487 rl tjm-mask !bit 7 to carry!
P 04AA FB 06 1488 jr nc,rio select !don't use this bit!
P 04AC EO EC 1489 rr tjm bTts
P 04AE 90 EC 1490 rl tjm-bits !bit 7 to 0 and carry!
P 0480 10 7D 1491 rIc TEMl'"_2 Icollect source bit!
1492 no select:
P 0482 00 7C 1493 dec TEMP 1
P 04BII E8 FO 1494 jr nz,next1 !repeat!
P 0486 C8 7D 1495 ld R12,TEMP_2
P 04B8 AF 1496 ret
P 01189 1497 END clb
1197
1499 CONSTANT
1500 tjm tabh R14
1501 tjm:::tabl = R15
1502 tjm tab = RR14
1503 GLOBAL
P 04B9 1504 tjm PROCEDURE
1505
1506 I·····················································
Purpose = To take a jump to a routine address
1507 determined by the state of selected
1508 bits in a source byte. A bit
1509 is 'selected' by a one in the
1510 corresponding position of a mask.
1511 The 'selected' bits are packed into
1512 adjacent bits in the low order end of
1513 the byte. This value is then doubled,
1514 and used as an index into the jump
1515 table.
1516
1517 Input = RR14 = address of jump table in
1518 program memory.
1519 R12 :; input data
1520 R13 = mask
1521
1522 ·····················································1
ENTRY
P 04B9 D6 04A l' 1523 call clb Icollect selected bitsl
P 04BC 02 CC 1524 add tjm bits,tjm bits Icollected bits • 21
P OUBE 16 EE 00 1525 adc tjm-tabh,HO - lin case carryl
P 04C 1 02 FC 1526 add tjm-tabl,tjm bits
P 04C3 16 EE 00 1527 adc tjm-tabh,#O - Itjm tab points to ••• 1
P 04C6 C2 DE 1528 Idc tjm-mask,@tjm tab 1.7.table entryl
P 04C8 AO EE 1529 incw tjm-tab -.
P 04CA C2 FE 1530 Idc tjm-tabl,@tjm tab Iget table entry ..• 1
P 04CC E8 ED 1531 Id tjm:::tabh,tjm_mask I ••• into tjm_tabl'
1532
P 04CE 30 EE 1533 jp Ibyel
1534
P 04DO 1535 END tjm
1536 END PART I
o errors
Assembly complete
1198
ROMLESS ze SUBROUTINE LIBRARY PART II
Z8ASM 3.02
LOC OBJ CODE STMT SOURCE STATEMENT
1
2
3 PART II MODULE
4
5
6 !'ROMLESS Z8' SUBROUTINE LIBRARY PART II
7
9 CONSTANT
10 !Register Usage!
11
12 RAM START .- $7F
13
14 P3M save · - RAM START
··-
15 TEMP 3 P3M-save-1
16 TEMP-2 TE~ 3-1
17 TEMP-1 .-- TEMP-2-1
18
19
TEMP-4 · - TEMP-1-1
20 !The following registers are modified/referenced
21 by the Serial Routines ONLY. They are
22 available as general registers to the user
23 who does not intend to make use of the
24 Serial Routines!
25
26 SER char .- TEMP 4-1
27 SER-tmp2 ._ SER Char-1
28 SER-tmp1 ._ SER-tmp2-1
29 SER-put ._ SER-tmp1-1
30 SER-len ._ SER-put-1
31 SER-buf ._ SER-len-2
32 SER-imr ._ SER-buf~1
33 SER-c fg ._ SER-imr-1
34 ! Serial Configuration Data -
35 bit 7 =1 => odd parity on
36 bit 6 : =1 => even parity on
37 (bit 6,7 = 11 => undefined)
38 bit 5 undefined
39 bit 4 undefined
40 bit 3 =1 => input editting on
41 bit 2 =1 => auto line feed enabled
42 bit 1 =1 => BREAK detection enabled
43 bit 0 =1 => input echo on
44 !
45 op .- $80
46 ep .- ';40
47 ie .- $08
.- .
48 a1 S04
49 ,be - $02
50 ec .- $01
51 SER get · - SER cfg-1
52 SER-flg ·
53 ! Serial Status Flags
- SER- get-1
-
54 bit 7 =1 => serial I/O disabled
55 bit 6 undefined
56 bit 5 undefined
55 78 bit =1 => parity error
bit 43 =1 => BREAK detected
59 bit 2 =1 => input buffer overflow
60 bit 1 =1 => input buffer not empty
61 bit 0 =1 => input buffer full
62 !
63 sd :C80
64 pe :C10
65 bd ~08
66 bo ~04
67 bne ~02
68 bf ~01
69
1199
70 RAM TMR
71
72 SERltime SER flg-1
73 SERhtime := SERltime-1
74
75 IThe following registers are modified/referenced
76 by the Timer/Counter Routines ONLY. They are
77 available as general registers to the user
78 who does not intend to make use of the
79 Timer/Counter Routinesl
80
81 TOD tic RAM TMR-2
82 TOD-imr := TOD-tic-1
83 TOD-hr := TOD-imr-1
84 TOD-min TODnr-1
85 TOD-sec TOD-min-1
86 TOD-tt TOD-sec-1
87 PLS-1 TOO-tt-1
88 PLS-tmr PLS-1-1
89 PLS:2 := PLS=tmr-1
90
91 RAM END
92 STACK
93
94 IEquivalent working register equates
95 for above register layoutl
96
97 Iregister file ~70 - ~7FI
98 RAM STARTr .- ~70 I for SRPI
99
100 rP3Msave R15
101 rTEMP 3 R14
102 rTEMP-2 R13
103 rTEMP-1 R12
104 rrTEMP 1 RR12
105 rTEMP lh := R12
106 rTEMP-n := R13
107 rTEMP-4 R11
108 rSERcnar := R10
109 rSERtmp2 R9
110 rSERtmp1 R8
111 rrSERtmp := RR8
112 rSERtmpl := R9
113 rSERtmph R8
114 rSERput R7
115 rSERlen := R6
116 rrSERbuf := RR4
117 rSERbufh := R4
118 rSERbufl := R5
119 rSERimr R3
120 rSERcfg := R2
121 rSERget R1
122 rSERflg := RO
123
124
125 Iregister file ~60 - ~6FI
"1"26 RAM TMRr ~60 I for SRP!
127 rTO'Utic := R13
128 rTODimr R12
129 rTODhr R11
130 rTODmin R10
131 rTODsec R9
132 rTODtt R8
133 rPLS 1 R7
134 rPLStmr := R6
135 rPLS_2 R5
1200
Serial Routines
164 CONSTANT
165 si PTR RR14
166 si:::TMP1 R11
167 si TMP2 = R13
168 GLOB"AL
P 0000 169 ser in it PROCEDURE
170 ' ••T ••••••••••••••••••••••••••••••••••••••••••••••••••
171 serial initialize
172
173 Purpose = To initialize the serial channel and
174 RAM flags for serial I/O. Serial
175 input occurs under interrupt control.
176 Serial output occurs in a polled mode.
177
178 Input RR14 = address of parameter list in
179 program memory (if R14 = 0,
180 use defaults):
181 byte = Serial Configuration Data
182 (see definition of SER cfg)
183 byte = IMR mask for nestable
184 interrupts
185 word = address of circular input
186 buffer (in reg/ext memory)
187 byte Length of input buffer
188 byte Baud rate counter value
189 byte = Baud rate prescaler value
190 (unshifted)
191
192 Output = Serial I/O operations initialized.
193 R11, R12, R13, R14, R15 modified.
194
195 Note Defaults:
196 Input echo on
197 Input editting on
198 BREAK detection enabled
199 No parity
200 Auto line feed on
201 Input Buffer Address =' SER char
202 Input buffer length = 1 byte
203 Baud Rate = 9600 (assuming
204 XTAL = 7.3728 MHz)
205
206 The instruction at ~0809 must result
207 in a jump to the jump table entry for
208 ser _input.
209
210 If BREAK detection is disabled, and a
211 BREAK occurs, it will be received as a
212 continuous string of null characters.
213
214 The parameter list is not referenced
215 following initialization.
216 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
217 ENTRY
P 0000 EE 218 inc R14 fuse defaults?1
P 0001 EA 04 219 djnz R14,si 1 !no. given by caller.1
P 0003 EC 00· 220 Id R14,OHI ser def laddress of default ••• 1
P 0005 FC 51· 221 Id R15,OLO ser-def I ••• parameter list. I
P 0007 BC 72 222si_1: Id si TMP1,OSE"R cfg
P 0009 DC 05 223 Id sCTMP2,1I5 -
P OOOB C3 BE 224 si_2: ldci @sl TMP1,@Si PTR Iget initialization ••• 1
P 0000 DA FC 225 djnz si TMP2,si 2- I ••• parametersl
P OOOF 56 73 F7 226 and SER_imr,II~F7 linsure no self-nesting I
227
1201
228 !initialize Port 3 Mode Register for serial 1/01
P 0012 56 Fl FC 229 AND TMR,UFC !disable TOI
P 0015 B8 72 230 ld s1 TMP1,SER cfg Iconfiguration data!
P 0017 56 EB 80 231 AND si-TMP1,g~80 !odd par1ty selectl
P 001A 46 EB 40 232 OR sCTMPl ,1I~40 IP30/7 = Sin/Soutl
P 001D 56 7F 3F 233 AND P3'R save,U3F Imask off old settings!
P 0020 44 EB 7F 234 OR P3~save,si TMPl !new selectionl
P 0023 E4 7F F7 235 LD P3M~P3M_save Ito write-only register I
236
237 !initialize TO!
P 0026 BC F4 238 ld s1 TMP1,IITO
P 0028 C2 DE 239 ldc si-TMP2,@si PTR Isave counter!
P 002A C3 BE 240 ldci @sI TMP1,@sI PTR linit counter I
P 002C C2 BE 241 Idc si TMP1,@si ~TR !get prescalerl
P 002E D6 0000· 242 call multiply - ITO x PREOI
P 0031 C9 6E 243 ld SERhtime,R12 I save for BREAK ... I
P 0033 D9 6F 244 ld SERl time, R13 I ••• detection
P 0035 90 EB 245 rl si 'TMPl 1SHL 11
P 0037 DF 246 scf Icontinuous mode!
P 0038 10 EB 247 rlc s1 TMP1 !SHL 21
P 003A B9 F5 248 Id PR'lO,si TMP1
249 1initialize RAM flags and pointersl
P 003C 8F 250 D1 !disable interrupts!
P 003D BO 71 251 cIr SER get !input buffer •.• 1
P 003F BO 77 252 clr SER-put I ••• empty!
P 0041 BO 70 253 clr SER::::flg Ino ll!rrorsl
254
255 I initialize interrupts 1
P 0043 56 FA E7 256 AND 1RQ,IJU7 Iclear 1RQ3 & 4!
P ,0046 56 FB EF 257 and 1MR,II~E'F Idisable 1RQ4 (xmt)1
p 0049 46 FB 08 258 or 1MR, U08 lenable 1RQ3 (rcv)1
P 004C 9F 259 E1
260 !gol
p 004D 46 Fl 03 261 or TMR,U03 Iload/enable TOI
P 0050 AF 262 ret
p 0051 263 END Ber init
264 -
265
266
267 !Defaults for serial initialization!
268
p 0051 OF 00 269 ser def RECORD [cfg_, imr BYTE
P 0053 007A 01 -
p 0056 02 03
270 buf WORD
271 len ctr_, pre_ BYTE]
272 .- -'
273 [ec+al+ie+be, ~OO, SER_char, ~02, ~03]
"
1202
275 CONSTANT
276 rl i len R13
277 GLOBAL
P 0058 278 ser rlin PROCEDURE
279 ! ••T ••••••••••••••••••••••••••••••••••••••••••••••••••
280 read line
281
282 Purpose = To return input from serial channel
283 up to 'carriage return' character or
284 maximum length requested or BREAK.
285
286 Input RR14 = address of destination buffer
287 (in reg/ext memory)
288 R13 = maximum length
289
290 Output Input characters is destination buffer.
291 RR14 = unmodified
292 R13 = length returned
293 Carry Flag = 1 if any error,
294 = 0 if no error.
295 R12 indicates read status
296
297 Note 1. Return will be made to the calling
298 program only after the requisite
299 characters have been received from
300 the ser i al line.
301
302 2. If input editting is enabled, a
303 'backspace' character will cause
304 the previous character (if any) in the
305 the destination buffer to be deleted;
306 a 'delete' character will cause all
307 previous characters (if any) in the
308 destination buffer to be deleted.
309
310 3. If parity (odd or even) is enabled,
311 the parity error flag (R14) will be set
312 if any character returned had a parity
313 error. (Bit 7 of each character may
314 then be examined if it is qesirable to
315 know which character(s) had the error).
316
317 4. The status flags 'BREAK detected',
318 'parity error', and 'input buffer
319 overflow' will be returned
320 as part of R12, but will be cleared in
321 SER stat.
322
323 5. The staus flags: 'input buffer full'
324 and 'input buffer not empty' will be
325 updated in SER stat.
326 **** •• **** ••••••• ** ••••••••••• T ••••••• ** ••••••••••••• !
327 ENTRY
P 0058 BO 7E 328 clr TEMP_3 !flag => read line!
329 ser read:
P 005A 70 EE 330 push R14 !save original ... !
P 005C 70 EF 331 push R15 I •.. dest. pointer!
P 005E 70 ED 332 , push rli len ! •.. and length!
P 0060 D6 0170' 333 rli 4: call ser-get !get input character!
P 0063 7B 48 334 jr c,rli 3 terror!
P 0065 76 72 CO 335 tm SER cTg, flop LOR ep !parity enabled?!
P 0068 6B 08 336 jr z,rli 1 !no!
P o06A 76 7C 80 337 tm .TEMP ",11$80 !parity error?!
P 006D 6B 03 338 jr z,rlI 1 !no!
1203
P 006F 46 70 10 339 or SER flg, IIpe Iyes. set error flagl
P 0072 D6 0000· 340 rli t: call put-dest Istore in bufferl
P 0075 A6 7E 00 341 - cp TEMP 3,110 I read line? I
P 0078 EB 31 342 jr nz,rli 2 Inol
P 007A 56 7C 7F 343 and TEMP l-;n7F lignore parity bitl
P 0070 76 72 OB 344 tm SER efg ,lIie linput editting on?1
P 0080 6B 21 345 jr z,rTi 9 Ino.1
346 linput edittingl -
P 00B2 A6 7C 7F 347 cp TEMP l,n7F I char = delete? I
P 00B5 6B 3E 348 jr z,rlT 6 Iyesl
P 0087 A6 7C 08 349 cp TEMP1,n08 Ichar = backspace?1
P 008A EB 17 350 jr nz,rli 9 !no. continuel ,
P 008C 50 7C 351 pop TEMP 1- Iget original lengthl
P 008E 70 7C 352 push TEMP-l
P 0090 A4 ED 7C 353 cp TEMP-I, rli_len !any characters?!
P 0093 6B 30 354 jr eq,rli 6 !nonel
P 0095 DE 355 inc rli len !undo last decrement!
P 0096 26 EF 02 356 sub R15-;1I2 !backspace & previousl
P 0099 EE 357 inc R14 Ireg or ext mem?!
P 009A EA 02 358 djnz Rl4,rli 7 lextl
P 009C 8B C2 359 jr rl1 4 - Iregl
P 009E 36 EE 00 360 rl1_7: sbc R14-;1I0
P OOAt 8B BD 361 jr rl1 4
362
P 00A3 00 ED 363 rli_9: dec rl1 len !in case cr!
P 00A5 A6 7C OD 364 cp TEMP l,nOD !carriage return?!
P 00A8 6B 03 365 jr z,rlT 3 lend input!
P OOAA DE 366 inc rli fen Irestore!
P OOAB DA B3 367 rli 2: djnz rl1-len ,rl1_ 4 !loop for max lengthl
P OOAD 50 7C 368 rl(): pop TEMl'" 1 !original length!
P OOAF 24 ED 7C 369 sub TEMP-I, rl1 len III chars returnedl
P 00B2 08 7C 370 ld rli Ien,TERp 1 Itell caller!
P 00B4 C8 70 371 Id RI2-;SER flg - !return read status!
P 00B6 56 70 E3 372 and SER flg-;IILNOT (pe LOR bd LOR bo)
373 - ! reset for next time I
P 00B9 CF 374 rcf !good return code!
P OOBA 76 EC 9C 375 tm Rl2,lIpe LOR bd LOR bo LOR sd
P OOBD 6B 01 376 jr z,rli_5 Ina errorl
P OOBF OF 377. scf Iset error returnl
P OOCO 50 EF 378 rl1_5: pop R15
P 00C2 50 EE 379 pop R14 !original buffer addrl
P 00C4 AF 380 ret
381
P 00C5 50 ED 382 rli 6: pop rli len
P 00C7 50 EF 383 pop R15-
P 00C9 50 EE 384 pop R14
P OOCB 8B 80 385 jr ser read !start over!
P OOCD 386 END ser_rlin
jlltl ULUtlAL
P OOCD 389 ser rabs PROCEDURE
390 ! ••~ ••••••••••••••••••••••••••••••••••••••••••••••••••
391 read absolute
392
393 Purpose = To return input from serial channel
394 of maximum length requested. (Input
395 is not terminated with the receipt of
396 a 'carriage return'. BREAK will
397 terminate read.)
39B
399
400
1101
.................................................T···I
Note =
ENTRY
All other details are as for 'ser rlin'.
1204
406 GLOBAL
P 0002 407 ser input PROCEDURE
408 ! •••••••••••••••••••••••••••••••••••••••••••••••••••••
409 Interrupt service - Serial Input
410
41 I Purpose = To service IRQ3 by inputting current
412 character into next available position
413 in circular buffer.
414
415 Input = None.
416
417 Output New character inserted in buffer.
418 SER_stat , SER_put updated.
419
420 Note I. If even parity enabled, the software
421 replaces the eigth data bit with a
422 parity error flag.
423
424 2. If BREAK detection is enabled, and
425 the received character is null,
426 the serial input line is monitored to
427 detect a potential BREAK condition.
428 BREAK is defined as a zero start bit
429 followed by 8 zero data bits and a
430 zero stop bit.
43 1"
432 3. If 'buffer full' on entry, 'input
1133 buffer overflow' is flagged.
4311
1135 4. If input echo is on, the character is
1136 immediately sent to the output serial
1137 channel.
1138
1139 5. IMR is modified to allow selected
4110 nested interrupts (see ser init).
4111
·····················································1
11112 ENTRY
P 0002 E4 03 78 11113 ld SER tmpl,1.03 tread stop bit level!
P 0005 70 FB 111111 push imr- !save entry imr!
P 0007 54 73 FB 445 and imr ,SER_imr ! allow nesting!
P OODA 9F 446 ei
P OODB 70 FD 447 push rp !save user's!
P DODD 31 70 448 srp I/RAM STARTr
P OODF A8 FO 449 ld rSERchar,SIO !capture input!
P OOEI 76 E2 02 450 tm rSERcfg,l/be !break detect enabled?!
P 00E4 6B 2F 451 jr z,ser 30 !nope. !
P 00E6 BO E9 452 clr rSERtiiip2
P 00E8 76 E2 80 453 tm rSERcfg,lIop todd parity enabled?!
P OOEB 6B 02 454 jr z,ser 23 !no. !
P OOED 9C 80 455 ld rSERtiiip2,1/1.80
P OOEF A2 A9 456 ser_23: cp rSERchar,rSERtmp2 !8 received bits = O?!
P OOFI EB 22 457 jr ne,ser 30 !no~
P 00F3 76 E8 01 458 tm rSERtmpl,lIl Itest stop bit!
P 00F6" EB 10 459 jr nz,ser 30 !not BREAK!
460 lis BREAK. Wait for marking!
P 00F8 46 EO 08 461 or rSERflg,lIbd !set BREAK flag!
P OOFB 76 03 01 462 ser 24: tm %03,111 !marki~g yet?1
P OOFE 6B FB 463 jr z,ser 24 Inot yet!
464 Iwait I char time to 7lush receive shift register!
P 0100 70 6E 465 push SERhtime
P 0102 70 6F 1166 push SERltime !save PREO x TO!
P 0104 8C 35 467 in loop: ld rSERtmpl,II53
P 0106 8A FE 468 lpT: djnz rSERtmpl,lpl !delay 640 cycles!
P 0108 80 6E 469 decw SERhtime
1205
P 010A EB F8 470 jr nz ,in_loop !delay (128xl0xPREOxTO)1
471 I ----------------1
472 I 2 I
P 010C 50 6F 473 pop SERltime
P 010E 50 6E 474 pop SERhtime I restore PREO x TO!
P 0110 56 FA F7 475 and IRQ,OLNOT S08 Iclear int req!
P 0113 8B 49 476 jr ser_i5 Ibyel
477
P 0115 76 EO 01 4'78 ser_30: tm rSERflg,lIbf I buffer full? I
P 0118 EB 4A 479 jr nZ,ser il Iyes.overflowl
P 011A 76 E2 01 480 tm rSERcfg,lIec ! echo on?!
P 0110 6B OA 481 jr z,ser iO !nol
P 011F A9 FO 482 ld SIO, r"SERchar lechol
P 0121 66 FA 10 483 ser_i6: tcm IRQ,Ul0 I polll
P 0124 EB FB 484 jr nZ,ser i6 Iloopl
P 0126 56 FA EF 485 and IRQ,OL"NOT S10 !clear irq bitt
P 0129 76 E2 40 486 ser_iO: tm rSERcfg ,lIep leven parity?!
P 012C 6B 14 487 jr z,ser 22 !no parity I
488 !calculate parity error flagl
P 012E 8C 07 489 ld rSERtmpl,1I7
P 0130 BO E9 490 clr rSERtmp2 Icount l's herel
P 0132 CO EA 491 ser_20: rrc rSERchar !bit to carry I
P 0134 16 E9 00 .492 adc rSERtmp2,II0 lupdate l's countl
P 0137 8A F9 493 djnz rSERtmpl,ser_20 !loop till donel
P 0139 56 E9 01 494 and rSERtmp2,Dl 11 's count even or odd?!
P 013C B2 A9 495 xor rSERchar,rSERtmp2
P 013E CO EA 496 rrc rSERchar !parity error flag ••. 1
P 0140 CO EA 497 rrc rSERchar !. .. to bit 7!
P 0142 88 E4 498 ser 22: ld rSERtmph,rSERbufh
P 01114 98 E5 499 ld rSERtmpl,rSERbufl
P 0146 02 97 500 add rSERtmpl,rSERput Inext char address I
P 0148 8E 501 inc rSERtmph lin external memory?!
P 0149 8A lE 502 djnz rSERtmph,ser i2 !yes.!
P 014B F3 9A 503 ld @rSERtmpl,rS~Rchar Istore char in bufl
P 01110 46 EO 02 504 ser_i 3: or rSERflg,Dbne !buffer not emptyl
P 0150 7E 505 inc rSERput lupdate put ptr!
P 0151 A2 76 506 cp rSERput,rSERlen !wrap-around?1
P 0153 EB 02 507 jr ne,ser i4 !no!
p 0155 BO E7 508 clr rSERput !set to start!
P 0157 A2 71 509 ser i4: cp rSERput,rSERget lif equal, then full!
P 0159 EB 03 510 jr ne ,ser i5.
P 015B 116 EO 01 511 or rSERflg,Dbf
p 015E 50 FO 512 ser_i5: pop rp Irestore user's!
p 0160 8F 513 di
p 0161 50 FB 5111 pop imr I restore entry imrl
p 0163 BF 515 iret
516
p 0164 46 EO 011 517 ser i 1: or rSERflg ,llbo !buffer overflowl
p 0167 8B F5 518 jr ser_i5
519
p 0169 16 E8 00 520 ser i2: adc r SE Rtmph, 00
P 016C 92 A8 521 lde @rrSERtmp,rSERchar Istore in bufl
p 016E 8B DO 522 jr ser_i 3
p 0170 523 END ser_input
1206
525 GLOBAL Ifor PART II
P 0170 526 ser get PROCEDURE
527 I··T••••••••••••••••••••••••••••••••••••••••••••••••••
528 Purpose To return one serial input character.
529
530 Input = None.
531
532 Output = Carry FLAG if BREAK detected or
533 serial not enabled
534 or buffer overflow
535 = 0 otherwise
536 TEMP 1 = character
537
538 Note = This routine will not return control
539 until a character is available in the
540 input buffer or an error is detected.
541
542 ·····················································1
ENTRY
P 0170 70 FD 543 push rp Isave caller's rpl
P 0172 31 70 544 srp IIRAM_STARTr Ipoint to subr.· RAMI
P 0174 OF 545 scf lin case errorl
P 0175 76 EO 8C 546 ser_gl: tm rSERflg,/lsd LOR bd LOR bo
547 Iserial disabled or
548 BREAK detected or
549 buffer overflow?1
P 0178 EB 24 550 jr nz,ser_g6 ! yes. I
P 017A 76 EO 02 551 tm rSERflg ,lJbne Ibuffer not empty?1
P 017D 6B F6 552 jr z,ser gl lempty., wait!
P 017F 08 E5 553 ld rTEMP-l1,rSERbufl
P 0181 C8 E4 554 ld rTEMP:lh,rSERbufh
P 0183 8F 555 di Iprevent IRQ3 conflict!
P 0184 02 Dl 556 add rTEMP ll,rSERget !next char addressl
P 0186 CE 557 inc rTEMP-lh linput buffer in ••• 1
P 0187 CA 18 558 djnz rTEMP:lh,ser_g3 I ••• external memoryl
559 I ••• register memoryl
P 0189 E3 CD 560 ld rTEMP l,@rTEMP 11 Iget charI
P 018B 56 EO FE 561 ser g4: and rSERfTg,lJLNOT bf !buffer not fulll
P 018E lE 562 - inc rSERget lupdate get pointerl
P 018F A2 16 563 cp rSERget, rSERlen I wrap-around? 1
P 0191 EB 02 564 jr ne,ser_g2 Ino .1
P 0193 BO El. 565 clr rSERget Iyes. set to startl
P 0195 A2 17 566 ser_g2: cp rSERget ,rSERput !buffer empty if get ••• 1
P 0197 EB 03 567 jr ne,ser g5 I ••• and put =1
P 0199 56 EO FD 568 and rSERflg,lJLNOT bne !buffer empty nowl
P 019C CF 569 ser_g5: rcf Iset good returnl
P 019D 9F 570 ei Ire-enable interrupts I
P 019E 50 FD 571 ser _g6: pop rp Irestore caller's rpl
P 01AO AF 572 ret
573
P 01Al 16 EC 00 574 ser_g3: adc rTEMP lh,nO IrrTEMP 1 has char addr!
P 01A4 82 CC 575 lde rTEMP-l,@rrTEMP 1 !get CharI
P 01A6 8B E3 576 jr ser_gq -I clean upl
P 01A8 577 END ser _get
1207
579 GLOBAL
P 01A8 580 ser break PROCEDURE
581
582 I·····················································
br.eak transmission
583
584 Purpose = To transmit BREAK on the serial line.
585
586 Input = RR14 = break length
587
588 Output = None.
589
590 Note = BREAK is defined as:
591 serial out (P37) = 0 for
592 2 x 28 cycles/loop x RR14 loops
593
594 XTAL
595
596 RR14 should yield at least 1 bit time
597 so that the last 'clr SIO' will
598 have been preceded by at least 1 bit
599 time of spacing. Therefore, RR14 should
600 be greater than or equal to
601
602 4 x 16 x PREO x TO
603
604 28
605
606
... ··.····.· ... · .. ····· .. ···.························1
ENTRY .
607 ser_bl:
P OlAS BO FO 608 clr SIO
P 01AA 80 EE 609 decw RR14
P 01AC EB FA 610 jr nZ,ser bl
611 Iwait for last null tooe fully transmitted I
POlAE 8D 0238' 612 jp ser 01
P 01Bl 613 END ser break
615 GLOBAL
P 01Bl 616 ser flush PROCEDURE
617 I··T••••••••••••••••••••••••••••••••••••••••••••••••••
618 input flush
619
620 Purpose = To flush (clear) the serial input
621 buffer of characters.
622
623 Input = None
624
625 Output Empty input buffer.
626
627 Note = This routine might be useful to clear
628 all past input after a BREAK has been
629 detected on the line.
630
631 ·····················································1
ENTRY
P 01Bl 8F 632 di Idisable interrupts I
633 I(to avoid collision with
634 serial input)1
P 01B2 BO 71 635 clr SER_get Ibuffer start I
P 01B4 BO 77 636 clr SER put 1= buffer endl
P 01B6 56 70 80 637 and SER-flg,nS80 Iclear statusl
P 01B9 9F 638 ei - Ire-enable interrupts I
P 01BA AF 639 ret
P 01BB 640 END ser flush
1208
642 CONSTANT
643 wli len := R13
644 GLOBAL
P 01BB 645 ser wlin PROCEOURE
646
647 I··y··················································
write line
648
649 Purpose = To output a character string to serial
650 line, ending with either a 'carriage
651 return' character or the maximum length
652 specified.
653
654 Input RR14 = address of source buffer
655 (in reg/ext memory)
656 R13 = length
657
658 Output RR14 = updated
659 Carry Flag = 1 if serial not enabled,
660 = 0 if no error-.
661 R13 = # bytes output (not including
662 auto line feed)
663
664 Note If auto line feed is enabled, a
665 line feed character will be output
666 following each carriage return
667 (ser wlin only).
668 •••••••••••••••••••• T •••••••••••••••••••••••••••••••• ,
669 ENTRY .
P 01BB BO 7E 670 clr Iflag => write linel
671
P 01BO OF 672 write: scf lin case errorl
P 01BE 76 70 80 673 tm SER flg,lIsd !serial disabled?1
P 01Cl EB 30 674 jr nz,wli 1 ryes. errorl
P 01C3 70 EO 675 push wli len
P 01C5 06 0000· 676 wl1 4: call get-src
P 01C8 06 020B' 677 call ser-output Iwrite the character I
P 01CB 7B 1E 678 jr c,wii 2 Iserial disabled!
P 01CO A6 7E 00 679 cp TEMP -j,IIO Iwrite line?1
P 0100 EB 17 680 jr nz,wTi 5 Ino, absolute.1
P 0102 56 7C 7F 681 and TEMP 1-;-1I:l7F Imask off parityl
P 0105 A6 7C 00 682 cp TEMP-l,noo !line done? I
P 0108 EB OF 683 jr nz,wTi 5 Iyes. !
P 010A 00 EO 684 dec wli len
P 010C 76 72 04 685 tm SER-c fg ,llal lauto line feed?!
P 010F 6B OA 686 jr z,wTi 2 Idisabledl
P 01El E6 7C OA 687 ld TEMP l,nOA !output line feedl
P 01E4 06 020B' 688 ca11 ser output
P 01E7 8B 02 689 jr wl1-2
P 01E9 OA OA 690 djnz wll-len ,wli 4 Iloop!
P 01EB 50 7C 691 pop TEMP 1 - !original length!
P OlEO 24 EO 7C 692 sub TEMP-1,wli len
P 01FO 08 7C 693 ld wli_Ten,TERP_1 !return output count!
P 01F2 CF 694 rcf !no errorl
P 01F3 AF 695 wli 1: ret
P 01F4 696 ENO- ser wlin
1209
69B GLOBAL
P 01F4 699 ser wabs PROCEDURE
700 ! •• T••••••••••••••••••••••••••••••••••••••••••••••••••
701 write absolute
702
703 Purpose = To output a character string to serial
704 line for the length specified. (Output
705 is not terminated with the output of
706 a 'carriage return').
707
70B Note = All other details are as for 'ser wlin'.
709 •••••••••••••••••••••••••••••••••••••••••••••••••T ••• !
710 ENTRY
P 01F4 E6 7E 01 711 ld TEMP 3,#1
P 01F7 8B C4 712 jr write
P 01F9 713 END ser wabs
P 01F9 715
716
717
r··
ser wbyt PROCEDURE
T ••••••••••••••••••••••••••••••••••••••••••••••••••
write byte
718
719 Purpose = To output a given character to the
720 serial line. If the character is a
721 carriage return and auto line feed
722 is enabled, a line feed will be output
723 as well.
724
725 Input = R12 = character to output
726
727 Note = Equivalent to ser wlin with length = 1.
728 ••••••••••••••••••••••••••••••••• T ••••••••••••••••••• !
729 ENTRY
P 01F9 C9 7C 730 ld TEMP 1,R12
P 01FB D6 020B' 731 call ser output loutput it!
P 01FE 76 72 04 732 tm SER-cfg,Ual !auto line feed?!
P 0201 6B 3E 733 jr z,ser 05 !not enabled!
P 0203 A6 EC OD 734 cp R12,nToD Ichar = car. ret?!
P 0206 EB 39 735 jr nz,ser 05 !nope!
P 020B E6 7C OA 736 ld TEMP 1~nJOA !output line feed!
737 !fall into ser outpu~!
P 020B 7,38 END ser_wbyt
1210
740 GLOBAL 'for PART I!
P 020B 741 ser output PROCEDURE
742 ' •• T ••••••••••••••••••••••••••••••••••••••••••••••••••
743 Purpose To output one character to the serial
744 line.
745
746 Input = TEMP 1 = character
747
748 Output Carry FLAG = 1 if serial disabled
749 = 0 otherwise.
750
751 Note 1. If even parity is enabled, the eigth
752 data bit is modified prior to character
753 output to SIO.
754
755 2. IRQ4 is polled to wait for completion
756 of character transmission before control
757 returns to the calling program •
758 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
759 ENTRY
P 020B DF 760 scf 'in case error'
P 020C 76 70 80 761 tm SER flg,Usd !serial disabled?'
P 020F EB 30 762 jr nz,ser 05 'yes. errorl
P021176 72 40 763 tm SER cfg,Uep leven parity enabled?!
P 0214 6B 1F 764 jr z,ser_02 'no. just output!
765 !calculate parity'
P 0216 70 7E 766 push TEMP 3
P 021P E6 7E 07 767 ld TEMP-3,U7
P 021B BO 7D 768 clr TEMP-2
P 021D CO 7C 769 ser 04: rrc TEMP-1 !character bit to carry!
P 021F 16 7D 00 770 adc TEMP-2,HO !count 1 'sl
P 0222 00 7E 771 dec TEMP-3
P 0224 EB F7 772 jr nz,ser 04 !next bitl
P 0226 56 7D 01 773 and TEMP 2~#01 11's count odd/even!
P 0229 56 7C FE 774 and TEMP-1,H%FE
P 022C 44 7D 7C 775 or TEMP-1,TEMP 2 !parity bit in DO!
P 022F CO 7C 776 rrc TEMP-1 -
P 0231 CO 7C 777 rrc TEMP-1 !parity bit in D7!
P 0233 50 7E 778 pop TEMP-3
P 0235 E4 7C FO 779 ser 02: ld SIO,TEMP 1 !output character!
P 0238 66 FA 10 780 ser-01: tcm IRQ,#~10- !check IRQ4!
P 023B EB FB 781 jr nz,ser 01 ,wait for completel
P 023D 56 FA EF 782 and IRQ,H~~F !clear IRQ4!
P 0240 CF 783 rcf !all ok!
P 0241 AF 784 ser 05: ret
P 0242 785 END- ser_output
787 GLOBAL
P 0242 788 ser disable PROCEDURE
789 I·····················································
790 d.isable
791
792 Purpose To disable serial I/O ~perations.
793
794 Input = None.
795
796 Output = Serial 1/0 disabled •
797 ••••••••••••••••••••••••••••••••••••••••••••••••••••• !
798 ENTRY
P 0242 8F 799 di !avoid IRQ3 conflictl
P 0243 46 70 80 800 or SER flg,Usd
801 - Iset serial disabled'
P 0246 56 F1 FC 802 and TMR,nFC
803 Idisable TO!
P 0249 56 FB E7 804 and IMR,U~E7
805 Idisable IRQ3,4!
P 024C 56 7F BF 806 and P3M save,U~BF
807 - IP30/7 normal i/o pinsl
P 024F E4 7F F7 808 ld P3M,P3M save
P 0252 9F 809 ei -Ire-enable interrupts!
P 0253 AF 810 ret
P 0254 811 END ser disable
1211
Timer/Counter Routines
840 CONSTANT
841 TMP := R13
842 PTR RR111
843 PTRh := Rll1
844 GL08AL
P 0254 845 tod i PROCEDURE
846 I··T••••••••••••••••••••••••••••••••••••••••••••••••••
847 time of day initialize
848
849 Purpose To initialize TO or Tl to function as
850 a time of day clock.
851
852 Input = RR14 = address of parameter list in
853 program memory:
854 byte = IMR mask for nestable
855 interrupts
856 byte = # of clock ticks per second
857 byte = counter # : = ~F4 => TO
858 = ~F2 => Tl
859 byte = Counter value
860 byte Prescaler value (unshifted)
861
862 TOO hr, TOO min, TOO sec, TOO tt
863 inItialized to the starting time of
864 hours, minutes, seconds, and ticks
865 respectively.
866
867 Output Selected timer is loaded and
868 enabled; corresponding interrupt
869 is enabled.
870 R13, Rll1, R15 modified.
871
872 Note The cntr and prescaler values provided
873 are those values which will generate an
874 interrupt (tick) the designated # of
875 times per second.
876
877 For example:
878 for XTAL = 8 MHZ, cntr = 250 and
879 prescaler = 40 yield a .01 sec interval;
880 the 2nd byte of the parameter list
881 should = 100 •
882
883 For TO the instruction at ~080C or
884 for Tl the instruction at ~080F must
885 result in a jump to the jump table entry
886 for 'tod'.
887
888 The parameter list is not referenced
889 following initialization.
890 ·····················································1
891 ENTRY
P 0254 DC 6C 892 ld TMP,HTOD imr
P 0256 C3 DE 893 ldei @TMP,@PTlf limr maskl
P 0258 C3 DE 894 ldci @TMP,@PTR Iticks/secondl
P 025A E6 78 6C 895 ld TEMP 4, IITOD imr
P 0250 80 0282' 896 jp pre_ctr - Ictr & prescalerl
P 0260 897 END tod i
1212
899 GLOBAL
P 0260 900
901 ,.....................................................
tod PROCEDURE
902 Interrupt service - time of day
903
Purpose =
904
905
To update the time of day clock.
..................................................... ,
906 ENTRY
P 0260 10 FB· 901 push imr !save entry imrl
P 0262 54 6C FB 908 and imr,TOD_imr fallow nested interrupts
P 0265 9F 909 ei lenable interrupts!
P 0266 10 FD 910 push rp !save rp!
P 0268 31 60 911 srp DRAM TMRr !point to our setl
P 026A 8E 912 inc rTODtt Iticks/secondl
P 026B A2 8D 913 cp rTODtt,rTODtic !second complete?1
P 026D EB 13 914 jr ne,tod ex !nope .1
P 026F BO E8 915 clr rTODtt-
P 0211 9E 916 inc rTODsec !secondsl
P 0212 A6 E9 3C 911 cp rTODsec,D60 Iminute complete?!
P 0215 EB OB 918 jr ne,tod_ex Inope .1
P 0211 BO E9 919 clr rTODsec
p 0279 AE 920 inc rTODmin !minutesl
P 027 A A6 EA 3C 921' cp rTODmin,#60 ! hour complete?!
P 027D EB 03 922 jr ne,tod ex Inope.1
P 021F BO EA 923 clr rTODmin
P 0281 BE 924 inc rTODhr ! hours!
925
P 0282 50 FD 926 tod ex: pop rp !restore rp!
P 0284 8F 921 di !disable interrupts 1
P 0285 50 FB 928 pop imr !restore entry imrl
P 0281 BF 929 iret
p 0288 930 END tod
1213
932 GLOBAL
P 0288 933 pulse i PROCEDURE
934 ! ••••T ••••••••••••••••••••••••••••••••••••••••••••••••
935 .purpose = To initialize one of the timers
936 to generate a variable frequencyl
937 variable pulse width output.
938
939 Input RR14 = address of parameter list in
940 program memory:
941 byte cntr value for low interval
942 byte counter H : = ~F4 => TO
943 = ~F2 => T1
944 byte cntr value for high interval
945 byte prescaler (unshifted)
946
947 Output Selected timer is loaded and
948 enabled; corresponding interrupt
949 is enabled. P36 is enabled as Tout.
950 R13, R14, R15 modified.
951
952 Note The parameter list is not referenced
953 following initialization.
954
955 The value of Prescaler x Counter
956 must be > 26 (=%1A) for proper
957 operation.
958 •••••••••••••• ** •••••••••••••••••••••••••••••• ** ••••• !
959 ENTRY
P 0288 DC 65 960 LD TMP,IIPLS 2
P 028A C3 DE 961 ldci @TMP,@PTR Ilow interval cntrl
P 028C C3 DE 962 ldci @TMP,@PTR !timer addr!
P 028E C3 DE 963 ldci @TMP,@PTR ! high interval cntr!
P 0290 80 EE 964 decw PTR
P 0292 80 EE 965 decw PTR !back to flag!
P 0294 56 F1 3F 966 and TMR,II%3F twill be modifying TM~I
P 0297 56 7F DF 967 and P3M save ,II%DF !P36 = Tout!
P 029A E4 7F F7 968 ld P3W;-P3M save
P 029D E6 7B 01 969 ld TEMP_ 4, #% 1 ! flag for pre ctr!
P 02AO 8D 02B2' 970 jp pre_ctr !set up timerT
P 02A3 971 END pulse
972 -
973
974 GLOBAL
P 02A3 975 pulse PROCEDURE
976 ! •••••••••••• *** •••••••••••• ** •••• ** ••••••••••••••••••
977 Purpose = To modify the counter load value
978 to continue the pulse output generation.
979
980 •• ** ••••••••• ** •••••••••••••••••••••••••••••••••••••• !
981 ENTRY
982 !exchange valuesl
P 02A3 B4 65 67 983 xor PLS 1,PLS 2
P 02A6 BII 67 65 984 xor PLS-2, PLS-1
P 02A9 B4 65 67 985 xor PLS-1,PLS-2
986 !exchange complete 1- -
P 02AC F5 67 66 987 ld @PLS_tmr,PLS_ Iload new value 1
P 02AF BF 988 iret
P 02BO 989 END pulse
1214
991 GLOBAL
P 02BO 992 delay PROCEDURE
993 ! •• ** •••••••••••••••••••••••••••••••••••••••••• *••••••
994 Purpose To generate an interrupt after a
995 designated amount of time.
996
997 Input RR14 = address
of parameter list in
998 program memory:
999 byte counter # : = ~F4 => TO
1000 = ~F2 => Tl
1001 byte = Counter value
1002 byte = Prescaler value and count mode
1003 (to be loaded as is into
1004 PREO or PRE1).
1005
1006 Output Selected timer is loaded and
1007 enabled; corresponding interrupt
1008 is enabled.
1009 . R13, R14, R15 modified.
1010
1011 Note This routine will initialize the timer
1012 for single-pass or continuous mode
1013 as determined by bit 0 of byte 3 in
1014 the parameter list.
1015 The caller is responsible for provid-
1016 ing the interrupt service routine.
1017
1018 The parameter list is not referenced
1019 following initialization.
1020 *** ••••••••••• ** ••••• ** •••••••••••••••••••••••••••••• !
1021 ENTRY
P 02BO BO 7B 1022 clr TEMP 4
1023 !fall into pre ctr! -
P 02B2 1024 END delay -
1215
1026 INTERNAL
P 02B2 1027 pre ctr PROCEDURE
1028 I··T..................................................
1029 'Purpose = To get counter and prescaler values
1030 from parameter list and modify control
1031 registers appropriately.
1032
1033 Input = TEMP_ 4 = 0 => for 'delay'
1034 = 1 => for 'pulse'
1035 = TOD imr => for 'tod'
1036 .............................T·· .... ·················I
1037 ENTRY
P 02B2 C2 DE 1038 ldc TMP,@PTR I TO or T11
P 02114 AO EE 1039 incw PTR
P 02B6 E6 7D 8C 1040 ld T£MP 2,n8C I for TMR!
P 02B9 £6 7£ 20 1041 ld T£MP-3,/I~20 I for IMRI
P 02BC A6 £D F2 10112 cp TMP,}"T1
P 02BF 6B 06 1043 jr eq,pre 1 11.s for T11
P 02C1 £6 7D 43 1044 ld T£MP 2-;U43 I for TMRI
P 02C4 £6 7£ 10 1045 ld T£MP:3, /1110' ! for IMR!
P 02C7 C3 D£ 1046 pre_1 : ldci @TMP,@PTR linit counter I
P 02C9 C2 ££ 1047 ldc PTRh,@PTR Iprescalerl
P 02CB A6 7B 00 1048 cp T£MP_4,ilO Ishift prescaler?!
P 02CE 6B 12 1049 jr eq,pre_2 !nol
P 02DO DF 1050 scf linternal clockl
P 02D1 10 EE 1051 rlc PTRh
P 02D3 DF 1052 scf Icontinuous mode!
P 02D4 10 EE 1053 rlc PTRh
P 02D6 A6 7B 6C . 1054 cp TEMP_4, IITOD_ imr
P 02D9 £B OA 1055 jr ne,pre 3 ! for 'pulse'l
P 02DB 60 7E 1056 com TEMP 3-
P 02DD 54 7E 6C 1057 and TOD_Tmr,TEMP_3 linsure no self-nesting I
P 02EO 60 7£ 1058 com TEMP 3
P 02E2 56 7D OF 1059 pre 2: and TEMP-2,nOF Ino Tout mode modi
P 02E5 F3 DE 1060 pre:3: ld @TMP-;PTRh !init prescalerl
P 02£7 114 7D F1 1061 or TMR,T£MP_2 linit tmr model
P 02EA 8F 1062 di
P 02EB 44 7E FB 1063 or imr,T£MP_3 lenable interrupt!
P 02EE 9F 1064 ei
P 02EF AF 1065 ret
P 02FO ' 1066 END pre ctr
1067 END PART n-
O errors
Assembly complete
1216
A Comparison of
Microcomputer Units
General-Purpose
Registers 124 128 128
Special-function
Registers
Status/Control 16 16 17
I/O ports 4 4 4
I/O
Parsllel lines 32 32 29
Ports Four 8-bit Four 8-bit Three 8-bit,one 5-bit
Handshake Hardware on None Hardware on
three ports one port
Interrupts
Source 8 5 7
External source 4 2 2
Vector 6 5 7
Priority 48 Programmable 2 Programmable Nonprogrammable
orders orders
Maskable 6 5 6
External
Memory 120K bytes 124K bytes. 64K bytes
Stack
Stack pointer 16-8it 8-Bit 16-Bit
Internal stack Yes, uses Yes Yes
~-bits
External stack Yes No Yes
1217
Table 1. MCU COIIpari80n
(Continued)
Addressing
Modes
Register Yes Yes No
Indirect Register Yes Yes No
Indexed Yes Yes Yes
Direct Yes Yes Yes
Relative Yes Yes Yes
Immediate Yes Yes Yes
Implied Yes Yes Yes
Index
Registers 124, Any 1, Uses the 1, Uses
general- accumulator 16-bit index
purpose for 8-bi t register
register offset
Serial
Cmnnunication
Interface
full duplex
UART Yes Yes Yes
Interrupts
for transmit
and receive One for each One for both One for .bot h
Registers
Double buffer Receiver Receiver Transmi tter/Rece iver
Serial Data Rate 62.5K bls 187.5K bls 62.5K b/s
@8 MHz @12 MHz @4 MHz
93.5K b/s
@12 MHz
Speed
Ins truct ion
execution average 2.2 Usec 1.5 Usec 3.9 Usec
1.5 Usec @12 MHz
Longest
instruction 4.25 Usec 4 Usec 10 Usec
2.8 Usec @12 MHz
1218
Table 1. tl:U Campar ison
(Continued)
On-Chip ROM. All three chips have internal ROM The number of general-purpose registers on each
for program memory. The ZB611 and the B051 have chip is comparable. However, because of its
4K bytes of internal ROM, and the MC6801 has 2K flexible design, the ZB611 clearly has a more
bytes. In some cases, external memory may be powerful register architecture.
1219
The ZB611 haa 20 special function registers used The special function registers in the three chips
for status, control, and I/O. These registers seem comparable in number and function. However,
include: upon closer examination, the sFRs of the HC6801
prove less efficient than those of the Z8611. The
-. Two registers for a 16-bit Stack Pointer (sPH, MC6801 has five registers associated with the I/O
SPL) ports, whereas the Z8611 uses only three registers
• One register used as Register Pointer for for the same funct ions. The MC6801 uses four
working registers (RP) registers to perform the serisl communication
• One register for the status flags (FLAGS) function, whereas the Z8611 uses only one register
• One register for interrupt priority (IPR) and part of another.
• One register for interrupt mask (IMR)
• One register for interrupt request (IRQ) The 8051 uses two registers for the accumulators;
• Three mode registers for the four ports (P01M, the Z8611 is not limited by this restriction. The
P2M, P3M) 8051 also uses two registers for the serial com-
• Serial communicstions port used like s munication interface, whereas the Z8611 accom-
register (510) plishes the same job with one register. Another
• Two counter/timer registers (TO, T1) two registers in the 8051 are used for data
• One Timer Mode Register (TMR) pointers; these are not necesaary in the Z8611
• Two prescaler registers (PREO, PRE1) since any register can be used as an address
• Four I/O ports accessed as registers (PORTO, pointer.
PORT1, PORT2, PORT3)
The Z8611 uses registers more efficiently than
The B051 also has 20 special function registers either the MC6801 or the 8051. The registers saved
used for status, control, and I/O. They include: by this optimal design are used to perform the
functions needed for enhanced interrupt handling
• One register for the Stack Pointer (SP) and for register pointing with short addresses.
• Two accumulators (A,B) The Z8611 also supplies the extra register re-
• One register for the Program Status Word quired for the external stack. These features are
(PSW) . not available on the 8051 or the MC6801.
• Two registers for pointing to data memory
(DPH, DPL) External Me.ory. All three chips can access
• Four registers that serve as two 16-bit external memory. The Z8611 and the 8051 can gen-
counter/timers (THO, TH1, TlO, Tll) erate signals used for selecting either program or
• One mode register for the counter/timers data memory. The Data Memory atrobe (the signal
(TMOD) used for selecting data or program memory) gives
• One control register for the counter/timers the Z8611 access to 120K bytes of external memory
(TCON) (60K byt es in both program and data memory). The
• One register for interrupt enable (IEC) B051 can use 124K bytes of external memory (64K
• One register for interrupt priority (IPC) bytes of external data memory and 60K bytes of
• One register for serial communications buffer external program memory). The MC6801 can access
(sBUF) I only 62K bytes of external memory and does not
• One register for serial communications control distinguish between program and data memory. Thus,
(sCON) the Z8611 and the 8051 are clearly able to access
• Four registers used -as the four I/O ports (PO, more external memory than the MC6801.
Pl, P2, P3)
The MC6801 has 21 special function registers used On-Chip Peripheral Functions
for status, control, and I/O. These include:
In addition to the CPU and memory spaces, all
• One register for RAM/EROM control chips provide an interrupt system and extensive
• One serial' receive register I/O facilities including I/O pins, parallel I/O
• One serial, transmit register ports, a bidirectional address/ data bus, and a
• One register for serial control and status serial port for I/O expansion.
• One serial rate and mode register
• One register for status and control of port 3
• One register for status and control of the Interrupts. The Z8611 acknowledges interrupts
timer from eight sources, four are exter.nal from pins
• Two registers for the 16-bit timer IRQO-IRQ3' and four are internal from serial-in,
• Two registers for 16-bit input capture used serial-out, and the two counter/timers. All
with timer interrupts are maskable, and a wide variety of
• Two registers for 16-bit output compare used priorities are realized with the Interrupt Mask
with timer Register and the Interrupt Priority Registers (see
• Four data direction registers associated with Table 1). All Z8611 interrupts are vectored, with
the four I/O ports six vectors located in the on-chip ROM. The
• Four I/O ports vectors are fixed locations, two bytes long, that
contain the memory address of the service routine.
1220
The B051 acknowledges interrupts from five handshake. The ports provide all the signals
sources: two external sources (from INTO and needed to control input and output either serially
INT1) and three internal sources (one from each of. or in parallel, with or without multiplexed
the internal counters and one from t\le serial I/O address/data lines. They can be used to interface
port). All interrupts can be disabled individual- with external memory.
ly or globally. Each of the five sources can be
assigned one of two priorities: high or low. All The main differences in I/O facilities are the
B051 interrupts are vectored. There are five number of B-bit ports and the hardware handshake.
fixed locations in memory, each eight bytes long, The ZB611 and the B051 have four B-bit ports,
allocated to servicing the interrupt. whereas the MC6BOl has three B-bit ports and an
additional 5-bit port. The ZB611 has hardware
The MC6BOl has one external interrupt, one non- handshake on three ports, the MC6BOl has hardware
maskable interrupt, an internal interrupt request, handshake on only one port, and the B051 has no
and a software interrupt. The internal interrupts hardware handshake.
are caused by the serial I/O port, timer overflow,
timer output compare, and timer input capture.
The priority of each interrupt is preset and can- Counter/timers. The ZB611 has two B-bit counters
not be changed. The external interrupt can be and two 6-bit programmable prescalers. One pre-
masked in the Condition Code register. The MC6BOl scaler can be driven internally or externally; the
vectors the interrupts to seven fixed addresses in other pres caler is driven internally only. Both
ROM where the 16-bi t address of the service timers can interrupt the CPU when counting is
routine is located. completed. The counters can operate in one of two
modea: they can count down until interrupted, or
When an interrupt occurs in the B051, only the they can count down, reload the initial value, and
Program Counter is saved; the user must save the start counting down again (continuously). The
flags, accumulator, and any registers that the counters for the ZB611 can be used for measuring
interrupt service routine might affect. The time intervals and pulse widths, generating vari-
MC6BOl saves the Program Counter, acumulators, able pulse widths, counting events, or generating
Index register, and the PSW; the user must save periodic interrupts.
all registers that the interrupt service routine
might affect. The ZB611 saves the Program Counter The B051 has two 16-bit counter/timers for measur-
and the Flags register. To save the 16 working ing time intervals and pulse widths, generating
registers, only the Register Pointer register need pulse widths, counting events, and generating
be pushed onto the stack and another set of work- periodic interrupts. The counter/timers have
ing registers is used for the service routine. several modes of operation. They can be used as
For more detail on working registers and interrupt B-bit counters or timers with two 5-bit program-
context switching, see the ZB Technical Manual mable prescalers. They can also be used as 16-bit
(03-3047-02). counter/timers. Finally, they can be set as B-bit
modulo-n counters with the reload value held in
Wi th regard to interrupts, the ZB611 is clearly the high byte of the 16-bit register. An interrupt
superior. The ZB611 requires only. one command to is generated when the counter/timer has completed
save all the working registers, which greatly counting.
increases the efficiency of context switching.
The MC6BOl has one 16-bit counter which can be
used for pulse-width measurement and generation.
I/O Facilities. The ZB611 has 32 lines dedicated The counter/timer actually consists of three
to I/O functions. These lines are grouped into 16-bit registers and an B-bit control/status reg-
four ports with eight lines per port. The ports ister. The timer has an input capture register,
can be configured individually under software an output compare register, and a free-running
control to provide input, output, multiplexed counter. All three 16-bit registers can generate
address/data lines, timing, and status. Input and interrupts.
output can be serial or parallel, with or without
handshake. One port can be configured for serial
transmission and four ports can be configured for Serisl Communications Interface. The ZB611 has a
parallel transmission. With parallel transmis- programmable serial communication interface. The
sion, ports 0, 1, and 2 can transmit data with the chip contains a UART for full-duplex, asynchron-
handshake provided by port 3. ous, serial receiver/ transmitter operation. The
bit rate is controlled by counter/timer 0 and has
The B051 also has 32 I/O lines grouped together a maximum bit rate of 93.500 b/s. An interrupt is
into four ports of eight lines each. The ports can generated when an assembled character is transfer-
be configured under program control for parallel red to the receive buffer. The transmitted
or serial I/O. The ports can also be configured character generates a separate interrupt. The
for multiplexed address/data lines, timing, and receive register is double-buffered. A hardware
status. Handshake is provided by user software. parity generator and detector are optional.
The MC6BOl has 29 lines for I/O (three B-bit ports The B051 handles serial I/O using one of its
and one 5-bit port). One port has two lines for parallel ports. The B051 bit rate is controlled
1221
by counter/timer 1 and has a maximum bit rate of tions of addressing modes per instruction, because
lB7,500 b/s. The B051 generates one interrupt for any of its registers can be used as an accumula-
both transmission and receipt. The receive reg- tor. For example, the instructions to clear,
ister is double-buffered. complement, rotate, and swap nibbles are all
accumulator oriented in the B051 and operate on
The MC6BOl contains a full-duplex, asynchronous, the accumulator only. These same commands in the
serial communication interface. The bit rafe is ZB611 can use any register and access it either
controlled by a rate register and by the MCU's directly, with register addressing, or with in-
clock or an external clock. The maximum bit rate direct register addressing.
is 62,500 b/s. Both the transmit and the receive
registers are double-buffered. The MC6BOl gener-
ates only one interrupt for both transmit and Indexed Addressing. All three chips differ in
receive operations. No hardware parity generation their handling of indexing. The ZB611 can use any
or detection is available, although it does have register for indexing. The B051 can use only the
automatic detection of framing errors and overrun accumulator as an Index register in conjunction
condit ions. with the data pointer or the Program Counter. The
MC6BOl has one 16-bit Index register. The address
The B051 and the MC6BOl generate only one inter- located in the second byte of an instruction is
rupt for both transmit and recei ve, whereas the added to the lower byte of the Index register.
ZB611 has a separate interrupt for each. The The carry is added to the upper byte for the com-
ability to generate separate interrupts grestly plete address. The MC6801 requires the index
enhances the use of serial communications, since value to be an immediate value.
separate service routines are often required for
transmitting and receiving. The MC6BOl has only one 16-bit Index register and
an immediate B-bit value from the second byte of
Other differences between the ZB611, MC6B01, and the instruction. Hence, the Indexed,mode of the
the B051 occur in the hardware parity detector, MC6BOl is much more restrictive than that of the
the double-buffering of registers, framing error ZB611. The B051 must use the accumulator as its
detectors and overrun conditions. The B051 has a only Index register, loading the accumulator with
faster data rate than either the ZB611 or the the register address each time a reference is
MC6B01. The MC6BOl has the advantage of a hard- made. Then, using indexing, the data is moved
ware framing error detector and automatic detec- into the accumu,lator, eradicating the previous
tion of ove r run conditions. The MC6S01 also has index. This forces a stream of data' through the
both its transmit and receive registers accumulator snd requires a reload of the index
double-buffered. The ZB611 hss a hardware parity before access can be made agein. The ZB611 is
detector. For detection of framing errors and clearly superior to both the MC6BOl and the B051
overrun conditions, a simple, low-overhead soft- in the flexibility of its indexed addressing mode.
ware check is available that uses only two
ins tructions. See ZB600 Software Framing Error
Detection Application Brief (document #617-1BB1-
0004). Short and long Addressing. Short addressing helps
to optimize memory space and execution speed. In
sample applications of short register addressing,
INSTRUCTION ARCHITECTURE an eight percent decrease in the number of bytes
used was recorded.
The architecture of the ZB611 is designed specif-
ically for microcomputer applications. This fact All three chips have short addressing modes, but
is manifest in the instruction composition. The the ZB611 has short addressing for both external
arduous task of programming the MC6BOl and the memory and register memory. The B051 has short
B051 starkly contrasts that of programming the addressing for the lowest 32 registers only.
ZB611.
The ZB611 has two different modea for register
addressing. The full-byte address can be used to
Addressing Modes provide the address, or a 4-bit address can be
used with the Register Pointer. To use the work-
The ZB611 and the B051 both have six addressing ing registers, the Register Pointer is set for a
modes: Register, Indirect Register, Indexed, particular bank of 16 registers, and then one of
Direct, Relative, and Immediate. The MC6B01 has the 16 registers is addressed with four bits.
five addressing modes: Accumulator, Indexed, Another feature for addressing external memory is
Direct, Relative, and Immediate. A quick compar- the use of a 12-bit address in place of a full
ison of these addressing modes reveals the versa- 16-bit address. To use the 12-bit address, one
tility of the ZB611 and the B051. The addressing port supplies the eight multiplexed address/data
modes of the MC6BOl have several restrictions, as lines and another port supplies four bits for the
shown in Table 1. While the B051 has all the address. The remaining four bits of the second
addressing modes of the ZB611, its use of them is port can be used for I/O. This feature allows
restricted. The ZB611 allows many more combina- access to a maximum of 10K bytes of memory.,
1222
The 8051 uses short addresses by organ1z1ng its with its 8051 family. The 8031 has no internal
lowest 32 registers into four banks. The bank ROM and the 8751 has 4K of internal EPROM.
select is located in a 2-bit field in the PSW,
with three bits addressing the register in the Motorola offers the MC6801, MC6803, MC6803NR, and
bank. MC68701. These are all similar except the MC68701
hss 2K bytes of EPROM and the MC6801 has 2K bytes
The MC6801 uses extended addressing for addressing of ROM. The MC6803 has no internal ROM and the
external memory. With a special, nonmultiplexed MC6803NR has neither ROM nor RAM on board.
expansion mode, 256 bytes of external memory can
be accessed without the need for an external The Z8613 and the MC68701 are both available now,
address latch. The MC6801 uses one 8-bit port for but the 8751 is still unavailable (as of April
the address and another port for the data. 1981).
Stacks
Zilog offers an entire family of microcomputer All three microcomputers offer a Power Down mode.
chips for product development and final product. The Z8611 and the 8051 save all of their regis-
The Z8611 is a single-chip microcomputer with 4K ters with an auxilary power supply. The MC6801
bytes of.mask-programmed ROM. For development, two uses an auxiliary power supply to save only the
other chips are offered. The Z8612 is a 64-pin, first 64 bytes of its register file.
development version with full interface to ex-
ternal memory. The Z8613 is a prototype version The Z8611 uses one of the crystal input pins for
that uses a functional, piggy-back, EPROM proto- the external power supply to power the registers
pak. The Z8613 can use either a 4K EPROM (2732) in Power Down mode. Since the XTAL2 input must be
or a 2K EPROM (2716). Zilog also offers a ROMless used, an external clock generator is necessary and
version in a 40-pin package that has all the fea- is input via XTAL1. The 8051 and the MC6801 both
tures of the Z8611 except on-board ROM (Z8681). have an input reserved for this function. The
MC6801 uses the Vcc standby pin, and the 8051 uses
Intel offers a similar line of development chips the Vpd pin.
1223
family Compatibility Program Listings
1224
Character Search Through Block of 40 Bytes Shift 16-Bit Word to Right 5-Bits
HC6801 Machine
Cycles Bytes HC6801 Machine
LDAB 11$40 2 2 Cycles Bytes
LDAA IICHARAC 2 2 LDX 115 6 3
LDX IITA8LE 3 3 LDAD WORK 4 2
LOOP: CMPA $0, X 4 2 LOOP: LSRD 3
BEQ OUT 4 2 DEX 3
INX 3 BNE LOOP 4 2
DECB 2 STAD WORD 4 2
BNE . LOOP 4 2 N : 10X5+11 : 61 Cycles
OUT: - @4 MHz : 61.cca
Instructions : 6
Bytes: 11
N: 7+40X17 : 687 cycles
@4 MHz = 687 .... s
Instructions = 8 Z8611 Clock
Bytes: 15 Cycles Bytes
LD INDEX, 115 6 2
Z8611 Clock LOOP: CCF 6 1
Cycles Bytes RRC WORD + 1 6 2
LD INDEX, 1140 6 2 RRC WORD 6 2
LOOP: LD DATA, TABLE (INDEX) 10 3 DJNZ INDEX, LOOP 12 or 10 2
CP DATA, CHARAC 6 2 N = 6+4X3D+2B = 154 Cycles
JR Z, OUT 12 or 10 2 ®12 MHz = 26.1(s
DJNZ INDEX, LOOP 12 or lO 2 Instructions = 5
OUT: - Bytes = 9
1225
Computed GOTO Move 64-Byte Block
MC6801 Machine
LCALL ADORN 2 Cycles Bytes
N = 1+9X7+11 = 75 Cycles LDAB #lCOUNT 2 2
1I!l12 MHz = 75"'-8 LOOP: LOX ADDR1 4 3
Instructions = 12 LDAA 0, X 4 2
Bytes = 21 INX 3
STAA ADDR1 4 2
LOX ADOR2 4 3
11:6801 Machine STAA 0, X 4 2
Cycles Bytes INX 3 1
LOAB #2 2 2 STX ADDR2 4 2
LOX TABLE 3 3 DECB 2 1
LOOP: RORA 2 BNE LOOP 4 2
BCS OUT 4 2 N = 64X36+2 = 2306 Cycles
ABX 3 ®II MHz =2306 4s
JMP LOOP 3 2 Instructions = 11
OUT: LDX 0, X 5 3 Bytes = 21
JMP 0, X 4 3
N = 8X12+14 = 110 Cycles
®II MHz = 110A.s Z8611 Clock
Instructions = 8 Cycles Bytes
Bytes = 17 LD INDEX, #lCOUNT 6. 2
LOOP: LDEI ®ADDR2, ®ADDR1 18 2
DJNZ INDEX, LOOP 12 or 10 2
Z8611 Clock N = 6+63X30+2B = 1924 Cycles
Cycles Bytes ®12 MHz = 321_
CLR INDEX 6 2 Instructions = 3
LOOP: INC INDEX 6 1 Bytes = 6
RLC DATA 6 2
JR NC, LOOP 12 or 10 2
LD ADDR,TABLE 1, (INDEX) 10 3
LD ADDR+1,TABLE 2, (INDEX) 10 3
JP ®ADDR 12 2
N = 6+24X7+54 = 228 Cycles
®12 MHz = 38"-s
Instructions = 7
Bytes = 15
1226
Toggle a Port Bit Subroutine Call/Return Overhead
B051 Machine
B051 Machine Cycles Bytes
Cycles Bytes LCALL SUBR 2 3
XRL PO, IIYY 2 3
N = 2 Cycles
®12 MHz = 2.us SUBR: -
Instructions
Bytes = 3 REr 2
N 4 Cycles
®12 MHz = 4"'s
Instructions 2
HC6801 Machine Bytes = 4
Cycles Bytes
LDAA PORTO 3 2 MC6B01 Machine
EORA IIYY 2 2 Cycles Bytes
STAA PORTO 3 2 JSR SUBR 9 2
N = B Cycles
®4 MHz = 8 AS
Instructions 3 SUBR: -
Bytes = 6
RTS 5
N 14 Cycles
lB611 Clock ®4 MHz = 14M.s
Ins truct ions 2
Cycles Bytes Bytes = 3
XOR PORTO, IIYY 10 2
N = 10 Cycles lB611 Clock
®1 2 MHz = 1.7 "'"s Cycles Bytes
Instructions = 1 CALL ®SUBR 20 2
8yte = 2
SUBR: -
RET 14
N 34 Cycles
®12 MHz = 5.7.us
Instructions = 2
Bytes = 3
Results
1227
Table 2. Benchllark Program Results
Me6801 8051 Z8 Z8
Benchmark (4 MHz) (12 MHz) (8 ItIz) (12 ItIz) Relative Performance
Test cycles time cycles time cycles time cycles time MC6801 8051
CRC
Generation 367 367 139 139 546 137 546 91 4.03 1.53
Character
Search 687 687 280 280 1524 382 1524 254 2.70 1.10
Computed
GOTO 110 110 75 75 228 57 228 38 2.89 1.97
Shift Right
5 8its 61 61 46 46 154 38 154 26 2.35 1.78
Move
64-byte
block 2306 2306 577 577 1924 481 1924 321 7.18 1.80
Subroutine
Overhead 14 14 4 4 34 8.5 34 5.7 2.46 0.70
Toggle a
Port Bit 8 8 2 2 10 2.5 10 1.7 4.71 1.18
Overall
Performance 3.76 1.44
1228
SUMMARY
The hardware of the three chips compared is very the Z8611 are more flexible than those of either
similar. The Z8611, however, has several advan- the MC6801 or the 8051. The Z8611 can use byte-
tages, the most important of which is its inter- saving addressing with working registers, and it
rupt structure. It is more advanced than the has short external addresses for saving I/O lines.
interrupt structures of both the 8051 and the It can also provide for an external stack. The
MC6801. Other advantages of the Z8611 over either register architecture (as opposed to the accumu-
the MC6801 or the 8051 include I/O facilities with lator architecture) of the Z8611 saves execution
parity detection and hardware handshake and a time and enhances programming speed by reducing
larger amount of internal ROM (the MC6801 has only the byte count.
2K bytes).
The Z8611 microcomputer stands out as the most
Subs t ant i al di fferences are apparent with regard powerful chip of the three, and concurrently, it
to software architecture. The addressing modes of is the easiest to program and configure.
1229
Z86XX Interrupt
Request Register
The Interrupt Request Register (IRQ. R250) The designer must ensure that unexpected and
stores requests from the six possible Inter- undesirable 'Interrupt requests will not occur
rupt sources (I RQO_IRQ5) In the Z8600 series after the EI Is executed. One method of
microcomputer. In addition to other func- doing this Is to reset al I Interrupt enable
tions. a hardware reset to the Z8600 disables bits In the IMR for levels that are possible
the IRQ register and resets Its request bits. Interrupt sources; the EI Instruction may
Before the IRQ will register requests. It then be safely executed. Once EI' Is exe-
must first be enabled by executing an Enable cuted. the program may Immediately execute a
Interrupts (EI) Instruction. Setting the Disable Interrupts (01) Instruction. The
Enable Interrupt bit In the Interrupt Mask code necessary to perform these operations Is
Register (IMR. R251) Is not an equivalent as follows:
operation for this purpose; to enable the
IRQ. an EI Instruction Is required. The RESET: LO IMR. I%XX ISET INTERRUPT MASKI
function of this EI Instruction Is distinct EI !ENABLE GLOBAL INTER-
from Its task of globally enabling the Inter- RUPT. ENABLE IRQI
rupt system. Even In a pol led system where
IRQ bits are tested In software, It Is where XX has a g In each bit position cor-
necessary to execute the EI. responding to the Interrupt level to be
disabled. If al I IMR bits are to be reset. a
CLR IMR Instruction may be used.
EI INSTRUCTION
R Z8600
RESET ------------~
1231
18 Family Software
Framing Error Detection
The Zilog ZB600 UART mlcrocanputer Is a h Igh- Three possible error conditions can occur
performance, single-chip device that Incor- during reception of serial data: framing
porates on-ch Ip ROM, RIM, parallel I/O, error, parity error, and overrun error. A
serial I/O, and a baud rate generator. The framing error condition occurs when a stop
UART Is capable of ful I-duplex, asynchronous bit Is not received at, the proper time
serial communication at nine standard (Figure I). This can result from noise In
sOftware-selectable baud rates from 110 to the data channel, causing erroneous detection
19.2K baud; other nonstandard rates can also of the previous start bit or lack of detec-
be obta Ined under software control. Odd tion of a properly transmitted stop bit. The
parity generation and checking can also be ZB600 UART does not Incorporate hardware
selected. framing error detection but does facilitate a
simple, low-overhead software detection
method.
In the middle of the stop bit time, the ZB600 dltlon exists and the following code Is used
UART automatically posts a serial Input to test this:
Interrupt request on IRQ3. The serial Input
can a Iso be tested by read Ing Port 3 bl t 0 1M P3, #%01 I TEST FOR P30 = I I
(P30) as shown In Figure 2. Thus, within JR Z, FERR I ELSE FRAM I ~ ERROR I
the Interrupt service routine or pol ling
loop, It Is only necessary to test P30 In The execution time of this framing error test
order to Identify a framing error. If P30 Is Is only 5.5.l(.s at 8 MHz. In the worst case
Low when IRQ3 goes High, a framing error con- (19.2K baud), this would result In 1% over-
head. Only five program bytes are required.
SERIAL _
DATA IN P3 0
ZB600
1232
CONClI'~ Wh II e the Z8 600 UART does nat Incorporate maximum penalty of 1% at 19.2K baud using no
hardware framing error detection, this additional hardware and only five bytes of
feature can be Implemented In software with a program memory.
1233
A Programmer's Guide to
the Z8™ Microcomputer
Application
~ZiIm Note
Doll Freund
1235
2. Accessing 2.2 Register Pointer. Within the register The address calculation for the latter case
Register addressing modes provided by the Z8, a regis- is illustrated in Figure 1. Notice that 4-bit
Memory ter may be specified by its full 8-bit address working-register addressing offers code com-
(Continued) (0-%7F, %FO-%FF) or by a short 4-bit pactness and fast execution compared to its
address. In the latter case, the register is 8- bit counterpart.
viewed as one of 16 working registers with- To modify the contents of the Register
in a working regi~ter group. Such a group Pointer, the Z8 provides the instruction
must be aligned on a 16-byte boundary and is SRP #value
addressed by Register Pointer RP (%FD). As
an example, assume the Register Pointer con- Execution of this instruction will load the
tains %70, thus pointing to the working reg- upper four bits of the Register Pointer; the
ister group from %70 to %7F. The LD instruc- lower four bits are always set to zero. Although
tion may be used to initialize register %76 to a load instruction such as
an immediate value in one of two ways: . LD RP,#value
LD %76,#1 !8-bit register address is given could be used to perform the same function,
by instruction (3 byte instruc- SRP provides execution speed (six vs. ten
tion)! cycles) and code space (two vs. three bytes)
or advantages over the LD instruction. The
LD R6,#1 14-bit working register address instruction
is given by instruction; 4-bit SRP #%70
working register group
address is given by Register is used to set the Register Pointer for the above
Pointer (2 byte instruction)! example.
INSTRUCTION
(lO RB,1#1) 1····1···,1
2.3 Context Switching. A typical function assume such a register allocation scheme has
performed'during an interrupt service routine been implemented in which the interrupt ser-
is context switching. Context switching refers vice routine for IRQO may access only working
to the saving and subsequent restoring of the register Group 4 (registers %40-%4F). The
program counter, status, and registers of the service routine for IRQO should be headed by
interrupted task. During an interrupt machine the code sequence:
cycle, the Z8 automatically saves the Program PUSH RP !preserve Register Pointer of
Counter and status flags on the stack. It is the interrupted task!
responsibility of. the interrupt service routine to SRP #%40 !address working register
preserve the register space. The recommended group 41
means to this end is to allocate a specific por-
tion of the register file for use by the service Before exiting, the service routine should
routine. The service routine thus preserves the execute the instruction
register space of the interrupted task by avoid- POP RP
ing modification of registers not allocated as its to restore the Register Pointer to its entry
own. The most effiCient scheme with which to' value.
implement this function in the Z8 is to allocate It should be noted that the technique
a working register group {or portion thereof} to described above need not be restricted to
the interrupt service routine. In this way, the interrupt service routines. Such a technique
preservation of the interrupted task's registers might prove efficient for use by a subroutine
is solely a matter of saving the Register Pointer requiring intermediate registers to produce its
on entry to the service routine, setting the outputs. In this way, the calling task can
Register Pointer to its own working register assume that its environment is intact upon
group, and restoring th~ Register Pointer prior return from the subroutine.
to exiting the service routine. For example,
1236
2. Accessing 2.4 Addressing Mode. The ZS provides three LD R2,#%60
Register addressing modes for accessing the register !working register 2 is the buf-
Memory space: Direct Register, Indirect Register, and fer pointer register!
(Continued) Indexed. out_again:
2.4.1 Direct Register Addressing. This LD RO,@R2
addressing mode is used when the target regis- !load into working register 0
ter address is known at assembly time. Both the byte pointed to by working
long (S-bit) register addressing and short register 2!
(4-bit) working register addressing are sup- INC R2 !increment pOinter!
ported in this mode. Most instructions sup- CALL SERIAL_OUT
porting this mode provide access to single !output the byte!
S-bit registers. For example: DJNZ RI,out _again
!loop till done!
LD %FE,#HI STACK
!load register %FE (SPH) with Indirect addressing may also be used for
the upper S-bits of the label accessing a l6-bit register pair via the INCW
STACK! and DECW instructions. For example,
AND O,MASK_REG INCW @RO !increment the register pair
!AND register 0 with register whose address is contained in
named MASK_REG! working register O!
OR I,R5 lOR register I with working DECW @%7F
register 5! !decrement the register pair
Increment word (INCW) and decrement whose address is contained in
word (DECW) are the only two ZS instructions register %7F!
which access 16-bit operands. These instruc- The contents of registers RO and %7F should
tions are illustrated below for the direct reg- be even numbers for proper access; when
ister addressing mode. referencing a register pair, the least significant
!NCW RRO !increment working register address bit is forced to the appropriate value
pair RO, RI: by the ZS. However, the register used to point
RI +- RI + to the register pair need not be an even-
RO +- RO + carry! numbered register.
DECW %7E Since the indirect addressing mode permits
!decrement working register calculation of a target address prior to the
pair %7E, %7F: desired register access, this mode may be used
%7F +- %7F to simulate other, more complex addressing
%7E +- %7E - carry! modes. For example, the instruction
Note that the instruction SUB 4,BASE(R5)
INCW RR5 requires the indexed addressing mode which is
not directly supported by the ZS SUBtract
will be flagged as an error by the assembler instruction. This instruction cari be simulated
(RR5 not even-numbered). as follows:
2.4.2 Indirect Register Addressing. In this LD R6,#BASE
addressing mode, the operand is pOinted to by !working register 6 has the
the register whose S-bit register address or base address!
4-bit working register address is given by the ADD R6,R5 !calculate the target address!
instruction. This mode is used when the target SUB 4,@R6 !now use indirect addressing to
register address is not known at assembly time perform the actual subtract!
and must be calculated during program execu-
tion. For example, assume registers %60-%7F Any available register or working register
contain a buffer for output to the serial line via may be used in place of R6 in the
repetitive calls to procedure SERIAL_OUT. above example.
SERIAL_OUT expects working register 0 to 2.4.3 Indexed Addressing. The indexed
hold the output character. The follOWing addressing mode is supported by the load
instructions illustrate the use of the indirect instruction (LO) for the transference of bytes
addressing mode to accomplish this task: between a working register and another regis-
LD . RI,#%20 ter. The effective address of the latter register
!working register 1 is the byte is given by the instruction which is offset by
counter: output %20 bytes! the contents of a designated working (index)
1237
2. Accessing register. This addressing mode provides LD Rl,#BUF+LENGTH-l
Register efficient memory usage when addressing LD RO,#LENGTH
Memory . consecutive bytes in a block of register !starting at buffer end, look for
(Continued) memory, such as a table or a buffer. The 1st non-blank!
working register used as the index in loopl:
'the effective address calculation can CP @Rl,#' ,
serve the additional role of counter for JR ne,foundl
control of a loop's duration. !found non-blank! ,
For example, assume an ASCII character DEC Rl !dec pOinter!
buffer exists in register memory starting at DJNZ RO,loopl
address BUF for LENGTH bytes. In order !are we done?!
to determine the logical length of the char· alljlanksl: !length = O!
acter string, the buffer should be scanned foundl:
backward until the first nonoccurrence of a 6 instructions
blank character. The following code 13 bytes
sequence may be used to accomplish 3 itS overhead
this task: ' ~.5 JLS (average) per character tested
LD RO,#LENGTH The latter method requires one more byte of
!length of buffer! program memory than the former, but is faster
!starting at buffer end, look for by four execution cycles (l its) per character
1st non·blank! tested.
loop: As an alternate example, assume a buffer
LD RI,BUF-l(RO) exists as described above, but it is desired to'
CP Rl,#' , scan this buffer forward for the first occur-
JR ne,found rence of an ASCII carriage return. The follow-
!found non·blank! ing illustrates the code to do this:
DJNZ RO,loop LD RO,#-LENGTH
!look at next! !starting at buffer start, look for
aiL_blanks: !length = O! 1st carriage return (= %OD)!
found: next:
5 instructions LD r l,BUF + LENGTH(RO)
12 bytes CP Rl,#%OD
1.5 itS overhead JR eq,cr !found it!
10.5 itS (average) per character tested INC RO !update counter/index!
At labels "all_blanks" and "found," RO JR nZ,next
contains the length of the character !tryagain!
string. These labels may refer to the same cr:
location, but they are shown separately for ADD RO,#LENGTH
an application where special processing is IRO has length to CR!
required for a string of zero length. To per- 7 instructions
form this task without indexed address- 16 bytes
ing would require a code sequence 1.5 itS overhead
such as: 12 JLS (average) per character tested
SECTION Accessing Program and External Data LDE or the indirect working register address-
Memory ing mode in LDCI and LDEI. In addition to
3 In a single instruction, the Z8 can transfer a performing the designated byte transfer, LDCf
Ibyte between register-memory and eitherpr-o~ and LDEI automatically increment both the
gram or exlernaTOala rnemory~ Load Constant indirect registers specified by the instruction.
(LDC) and Load Constant and Increment These instructions are therefore efficient for
(LDCI) reference program memory; Load performing block moves between register and
External (LDE) and Load External and Incre- either program or external data memory. Since
ment (LDEl) reference external data memory. the indirect addreSSing mode is used to specify
These instructions require that a working the operand address within program or exter-
register pair contain the address of the byte in nal data memory, more complex addreSSing
either program or external data memory to be modes may be simulated as discussed earlier
accessed by the instruction (indirect working in Section 2.4.2. For example, the instruction
register pair addressing mode). The registe'r LDC R3,BASE(R2)
byte operand is speCified by using the direct
working, register addressing mode in LDC and requires the indexed addressing mode, where
1238
3. Accessing BASE is the base address of a table in program LD POIM,#%(2)0001001O
Program and memory and R2 contains the offset from table !bit 3-4: enable ADo-AD7;
External Data start to the desired table entry. The following bit 0-1: enable As-All!
Memory code sequence simulates this instruction with LD P3M,#%(2)00001000
(Continued) the use of two additional registers (RO and RI !bit 3-4: enable DM!
in this example). The two bytes follOWing the mode selection of
LD RO,#HI BASE ports 0 and I should not reference external
LD RI,#LO BASE memory due to pipelining of instructions within
!RRO has table start address! the ZS. Note that the load instruction to P3M
ADD RI,R2 satisfies this requirement (providing that it
ADC RO,#O resides within the internal 2K bytes of
!RRO has table entry address! memory).
LDC R3,@RRO 3.2 LDC and LDE. To illustrate the use of the
!R3 has the table entry! Load Constant (LDC) and Load External (LDE)
3.1 Configuring the Z8 for I/O Applications instructions, assume there exists a hardware
vs. Memory Intensive Applications. The ZS configuration with external memory and Data
offers a high degree of flexibility in memory Memory Select enabled. The follOWing module
and I/O intensive applications. Thirty-two port illustrates a program for tokenizing an ASCII
bits are provided of which 16, 12, eight, or input buffer. The program assumes there is a
zero may be configured as address bits to list of delimiters (space, comma, tab, etc.) in
external memory. This allows for addressing of program memory at address DELIM for
62K, 4K or 256 bytes of external memory, COUNT bytes (accessed via LDC) and that an
which can be expanded to 124K, SK, or 512 ASCII input buffer exists in external data
bytes if the Data Memory Select output (DM) is memory (accessed via LDE). The program
used to distinguish between program and data scans the input buffer from the current location
memory accesses. The following instructions and returns the start address of the next token
illustrate the code sequence required to con- (Le. the address of the first nondelimiter
figure the ZS with 12 external addressing lines found) and the length of that token (number of
and to enable the Data Memory Select output. characters from token start to next delimiter).
Z8ASM 2.0
LaC OBJ CODE STMT SOURCE STATEMENT
1 SCAN MODULE
2 CONSTANT
3 COUNT._ 6
4 GLOBAL
5 $SECTION PROGRAM
P 0000 20 3B 2C 6 OELIM ARRAY [COUNT BYTE]
P 0003 2E OA 00
7 [ I' , , , , ,
1.1 , .' , %OA , ~OD]
8
P 0006 9 scan PROCEDURE
10 1*****************************************************
11 Purpose To find the next token within an
12 ASCII buffer.
13
14 Input RRO = address of current location
15 within input buffer in external
16 memory.
17
18 Output RR4 address of start of next token
19 RRO address of new token's ending
20 delimi ter
21 R2 length of token
22 R3 ending delimiter
23 R6,R7,R8,R9 destroyed
24
25 *****************************************************!
26 ENTRY
P 0006 BO E2 27 clr R2 !init. length counter 1
28 DO
P 0008 82 30 29 LOE R3,@RRO !get byte from input buffer!
P 000 A AD EO 30 incw RRO !increment pointer 1
P OOOC 06 002E' 31 call check !look for non-delimiter'!
P OOOF FD 0015' 32 IF C THEN
P 0012 80 0018' 33 EXIT Ifound token startl
34 FI
P 0015 80 0008' 35 00
1239
36
P 0018 48 EO 37 ld R4, RO
P 001A 58 El 38 ld R5, Rl IRR4 = token starting addr!
39 DO
P 001C 2E 40 inc R2 ! inc. length counter!
P 0010 82 30 41 LOE R3,@RRO !get next input byte!
P 001F 06 002E' 42 call check !look for delimiter!
P 0022 70 0028' 43 IF NC THEN
P 0025 80 0020' 44 EXIT !found token endl
45 FI
P 0028 AO EO 46 incw RRO Ipoint to next byte!
P 002A 80 001C' 47 00
48
P 0020 AF 49 ret
P 002E 50 END scan
51
P 002E 52,check PROCEDURE
53 !*****************************************************
54 Purpose = compare current character with
55 delimiter table until table
56 end or match found
57
58 input DELIM = start address of table
59 COUNT = length of that table
60 R3 = byte to be scrutinized
61
62 output Carry flag = 1 => input byte
63 is not a delimiter (no match found)
64
65 Carry flag = 0 => input byte
66 is a delimiter (match found)
67 R6 , R7 , R8 , R9 destroyed
68
69 *****************************************************!
70 ENTRY
P 002E 6C 00* 71 ld R6,IIHI DELIM
P 0030 7C 00* 72 ld R7 , IILO DELIM !RR6 points to
73 delimiter listl
P 0032 8C 06 14 ld R8,IICOUNT !R8 = length of listl
75 here:
P 0034 C2 96 16 LDC R9,@RR6 !get table entryl
P 0036 AO, E6 11 incw RR6 Ipoint to next entry!
P 003&, A2 93 18 cp R9,R3 !R3 = delimiter?!
P 003A 6B 03 19 jr eq,bye !yes. carry = 01
P 003C 8A F6 80 djnz R8,here Inext entryl
P 003E DF 81 scf !table done. R3
82 not a delimiter 1
83 bye:
P 003F AF 84 ret
P 0040 85 END check
86 END SCAN
o ERRORS
ASSEMBLY COMPLETE
27 instructions
58 bytes
Execution time is a lunction 01 the number 01 leading delimiters
belore token slart (x) and the number 01 characters in the
token (y): 123/.1S overhead + 59x /.IS + 102y /.IS
(average) per token '
3.3 LDCI. A common function performed in Z8 register or two program bytes for a working
applications is the initialization of the register register). This approach is also the most effi-
space. The most obvious approach to this func- cient technique for initialiZing less than eight
tion is the coding of a sequence of "load consecutive registers or 14 consecutive work-
register with immediate value" instructions ing registers. For a larger registel." block, the
(each occupying three program bytes for a
1240
3. Accessing LDCI instruction provides an economical 3.4 LDEI. The LDEI instruction is useful for
Program and means of initializing consecutive registers from moving blocks of data between external and
External Data an initialization table in program memory. The register memory since auto-increment is per-
Memory following code excerpt illustrates this tech- formed on both indirect registers designated
(Continued) nique of initializing control registers %F2 by the instruction. The following code excerpt
through %FF from a 14-byte array (INIT_tab) illustrates a register buffer being saved at
in program memory: address %40 through %60 into external
SRP #%00 memory at address SAVE:
!RP not %FO! LD RIO,#HI SAVE
LD R6,#HI INIT_tab !external memory!
LD R7,#LO INIT_tab LD Rll.#LO SAVE
LD RS,#%F2 !address!
! 1st reg to be initialized! LD RS,#%40
LD R9,#14 !starting register!
!length of register block! LD R9,#%21
loop: !number of registers to save in
LDCI @RS,@RR6 external data memory!
!load a register from the loop:
init table! LDE~ @RRIO,@RS
DJNZ R9,Ioop !init a register!
Icontinue till done! DJNZ R9,Ioop
7 instructions !until done!
14 bytes 6 instructions
7.5 JJS overhead 12 bytes
7.5 JJS per register initialized 6 JJS overhead
7.5 JJs per register saved
1241
4. Bit AND operation; the overflow flag (V) is always As in Test under Mask, the FLAGS control
Manipu- reset. All other flags are unaffected. Table 2 register is the only register affected by this
lations illustrates the flag settings which result from operation. The zero flag (Z) is set if all selected
(Continued) the TM instruction on a variety of source and destination bits are I; it is reset otherwise. The
destination operand combinations. Note that a sign flag (S) is set or reset to reflect the result
given TM instruction will never result in both of the AND operation; the overflow flag (V) is
the Z and S flags being set. always reset. Table 3 illustrates the flag set-
4.2 Test Complement under Mask. The Test tings which result from the TCM instruction on
Complement under Mask instruction is used to a variety of source and destination operand
test selected bits for logic I. The logical opera- combinations. As with the TM instruction, a
tion performed is given TCM instruction will never result in both
the Z and S flags being set.
(NOT destination) AND source.
Destination Source Flags Destination - Source Flags
§
onto the stack!
LABEL 2: CALL @RR4
XSP_§
x-1
x-2
SP_ R1 R1
PC LOW
!indirect addressing: PC is
loaded with the contents of
working register pair R4, R5;
x-' $P- PCHIOH address LABEL 2 + 2 is pushed
x-. onto the stack!
INmAL FOLLOWING FOLLOWING
STATE PUSH R1 CALL
1242
5. Stack LABEL 3: CALL @%7E the stack and register memory, thus providing
Operations !indirect addressing: PC is program access to the stack for saving and
(Continued) loaded with the contents of restoring needed values and passing
register pair %7E, %7F; parameters to subroutines.
address'LABEL 3 + 2 is pushed Execution of a PUSH instruction causes the
onto the stack! stack pOinter to be decremented by 1; the
5.3 RET. The return (RET) instruction causes operand byte is then loaded into the location
the top two bytes to be popped from the stack pointed to by the decremented stack pointer.
and loaded into the Program Counter. Typi- Execution of a POP instruction causes the byte
cally, this is the last instruction of a subroutine addressed by the stack pointer to be loaded
and thus restores the PC to the address follow- into the operand byte; the stack pointer is then
ing the CALL to that subroutine. incremented by 1. In both cases, the operand
byte is designated by either a direct register
5.4 Interrupt Machine Cycle. During an inter-
rupt machine cycle, the PC followed by the address or an indirect register reference. For
example:
status flags is pushed onto the stack. (A more
detailed discussion of interrupt processing is PUSH R1 !direct address: push working
provided in Section 6.) register 1 onto the stack!
5.5IRET. The interrupt return (IRET) instruc- POP 5 !direct address: pop the top
tion causes the top byte to be popped from the stack byte into register 5!
stack and loaded into the status flag register, PUSH @R4 !indirect address: pop the top
FLAGS (%FC); the next two bytes are then stack byte into the byte
popped and loaded into the Program Counter. pointed to by working reg-
In this way, status is restored and program ister 4!
execution continues where it had left off when PUSH @17 !indirect address: push onto
the interrupt was recognized. the stack the byte pointed to
5.S PUSH and POP. The PUSH and POP by register 17!
instructions allow the transfer of bytes between
1-43 1243
6.2 Vectored Interrupt Processing. Enabled may be allowed service within the current
interrupt requests are processed in an interrupt service routine (nested) or may be
automatic vectored mode in which the inter- held until the current service routine is com-
rupt service routine address is retrieved from plete (non-nested).
within the first 12 bytes of program memory. To allow nested interrupt processing, inter-
When an enabled interrupt request is rupts must be selectively enabled upon entry
recognized by the Z8, the Program Counter is to an interrupt service routine. Typically, only
pushed onto the stack (low order 8 bits first, higher-priority interrupts would be allowed to
then high-order 8 bits) followed by the FLAGS nest within the current interrupt service. To do
register (#%FC). The corresponding interrupt this, an interrupt routine must "know" which
request bit is reset in IRQ, interrupts are interrupts have a higher priority than the cur-
globally disabled (bit 7 of IMR is reset), and rent interrupt request. Selection of such nest-
an indirect jump is taken on the word in loca- ing priorities is usually a reflection of the
tion 2x, 2x + I (x = interrupt request number, priorities established in the Interrupt Priority
0~x~5). For example, if the bytes at Register (IPR). Given this data, the first
addresses %0004 and %0005 contain %05 and '- instructions executed in the service routine
%78 respectively, the interrupt machine cycle should be to save the current Interrupt Mask
for IRQ2 will cause program execution to con- - Register, mask off all interrupts of lower and
tinue at address %0578. equal priority, and globally enable interrupts
When interrupts are sampled, more than one (EI). For example, assume that service of inter-
interrupt may be pending. The Interrupt Prior- rupt requests 4 and 5 are nested within the ser-
ity Register (IPR) controls the selection of the vice of interrupt request 3. The follOWing illus-
pending interrupt with highest priority. While trates the code required to enable IRQ4
this interrupt is being serviced, a higher- and IRQ5:
priority interrupt may occur. Such interrupts
CONSTANT
INT~ASL3 %(2) 00110000
GLOBAL
IRQ3-Bervice PROCEDURE ENTRY
!service routine for IRQ3!
PUSH IMR !save Interrupt Mask Register!
!interrupts were globally disabled during the interrupt
machine cycle - no DI is needed prior to modification of IMR!
AND IMR,#INT~ASL3 !disable all but IRQ4 & 5!
EI
!... ! !service interrupt!
!interrupts are globally enabled now - must disable them prior to
modification of IMRI
DI
-POP IMR !restore entry IMR!
IRET
END IRQ3_service
Note that IRQ4 and IRQ5 are enabled by the interrupts, the following code sequence could
above sequence only if their respective IMR be used:
bits = I on entry to IRQ3-Bervice. POP FLAGS
The service routine for an interrupt whose !FLAGS +- @SPI
processing is to be completed without interrup- RET !PC +- @SPI
tion should not allow interrupts to be nested
within it. Therefore, it need not modify the This accomplishes all the functions of IRET,
IMR, since interrupts are disabled automati- except that IMR is not affected.
cally during the interrupt machine cycle. 6.3 Polled Interrupt Processing Disabled
The service routine for an enabled interrupt interrupt requests may be processed in a
is typically concluded with an IRET instruc- polled mode, in which the corresponding bits
tion, which re~tores the FLAGS register and of the Interrupt Request Register (IRQ) are
Program Counter from the top of the stack and examined by the software. When an interrupt
globally enables interrupts. To return from an request bit is found to be a logic I, the inter-
interrupt service routine without re-enabling rupt should be processed by the appropriate
1244
service routine. During such processing, the lished priorities. For example, assume that
interrupt request bit in the IRQ must be IRQO, IRQ1, and IRQ4 are to be polled and
cleared by the software in order for subsequent that established priorities are, from high to
interrupts on that line to be distingUished from low, IRQ4, IRQO, IRQ!. An instruction
the current one. If more than one interrupt sequence like the following should be used to
request is to be processed in a polled mode, poll and service the interrupts:
polling should occur in the order of estab-
I. .. !
!poll interrupt inputs here!
TCM IRQ, #%(2)00010000 !IRQ4 need service?!
JR NZ, TESTO !no!
CALL IRQ4_service !yes!
TESTO: TCM IRQ, #%(2)00000001 !IRQO need service?!
JR NZ, TEST! !no!
CALL IRQO_ser.vice !yes!
TEST!: TCM IRQ, #%(2)00000010 !IRQI need service?!
JR NZ, DONE !no!
CALL IRQ I_service !yes!
DONE: I. .. !
1245
counters may simulate a readable prescaler. When Tour is driven by the internal clock,
This capability is a requirement for high that clock is directly output on P36.
resolution measurement of an event's duration. While programmed as Tour, P36 is disabled
The basic approach requires that one timer/ from being modified by a write to port register
counter be initialized with the desired counter %03; however, its current output may be
and prescaler values. The second timer/ examined by the Z8 software by a read to port
counter is initialized with a counter equal to register %03.
the prescaler of the first timer/counter and a 7.3 TIN Modes. Port 3, bit 1 (P31) may be con-
prescaler of 1. The second timer/counter must figured as an input (TIN) which is used in con-
be programmed for continuous mode. With junction with TI in one of four modes:
both timer/counters driven by the internal
clock ·and started and stopped simultaneously, • External clock input
they will run synchronous to one another; thus, • Gate input for internal clock
the value read from the second counter will • Nonretriggerrable input for internal clock
always be equivalent to the prescaler of
the Iirst. • Retriggerable input for internal clock
·7.1 Time/Count Interval Calculation To For the latter two modes, it should be noted
determine the time interval (i) until EOC, the that the existence of a synchronizing Circuit
equation within the 28 causes a delay of two to three
internal clock periods following an external
i=txpxv
trigger before clocking of the counter actually
characterizes the relation between the begins.
prescaler (p), counter (v), and clock input Each High-la-Low transition on TIN will
period (t); t is given by generate interrupt request IRQ2, regardless of
II(XTAU8) the selected TIN mode or the enabled/disabled
where XTAL is the 28 input clock frequency; state of T1. IRQ2 must therefore be masked or '
p is in the range 1 - 64; v is in the range enabled according to the needs of the
1 - 256. When programming the prescaler and application.
counter registers, the maximum load value is The "external clock input" TIN mode sup-
truncated to six and eight bits, respectively, ports the counting of external events, where an
and is therefore programmed as zero. For an event is seen as a High-to-Low transition on
input clock frequency of 8 MHz, the prescaler TIN. Interrupt request IRQ5 is generated on
and counter register values may be pro- the nth occurrence (single-pass mode) or on
grammed to time an interval in the range every nth occurrence (continuous mode) of
that event.
1 ps x 1 x 1 :S i :S 1 ps x 64 x 256 The "gate input for internal clock" TIN mode
1 ps :S i :S 16.384 ms provides for duration measurement of an exter-
To determine the count (c) until EOC for TI nal event. In this mode, the TI prescaler is
with external clock input, the equation driven by the 28 internal clock, gated by a
High level on TIN. In other words, TI will
c =p x v count while TIN is High and stop counting
characterizes the relation between the TI while TIN is Low. Interrupt request IRQ2 is
prescaler (p) and the TI counter (v). The generated on the High-to-Low transition on
divide-by-8 on the input frequency is bypassed TIN. Interrupt request IRQ5 is generated on TI
in this mode. The count range is EOC. This mode may be used when the width
xl:sc:s64x256 of a High-going pulse needs to be measured.
In this mode, IRQ2 is typically the interrupt
1 :S c :S 16,384 request of most importance, since it signals the
7.2 TOUT Modes. Port 3, bit 6 (P36) may be end of the pulse being measured. If IRQ5 is
configured as an output (Tour) which is generated prior to IRQ2 in this mode, the
dynamically controlled by one of the following: pulse width on TIN is too large for TI to
measure in a single pass.
• To The "nonretriggerable input" TIN mode pro-
• TI vides for automatic delay timing following an
• Internal clock external event. In this mode, TI is loaded and
When driven by To or TI, Tour is reset to a clocked by the 28 internal clock following the
logic I when the corresonding load bit is set in first High-to-Low transition on TIN after TI is
timer control register TMR (%Fl) and toggles enabled. TIN transitions that occur after this
on EOC from the corresponding counter. point do not affect TI. In single-pass mode, the
1246
7. Timer/ enable bit is reset on EOC; further TIN transi- ately; IHOS is generated at every EOC until
Counter tions will not cause TI to load and begin count- the software resets the enable bit. This TIN
Functions ing until the software sets the enable ,bit again. mode may provide such functions as watch-dog
(Continued) In continuous mode, EOC does not modify the timer (e.g.; interrupt if conveyor belt stopped
enable bit, but the counter is reloaded and or clock pulse missed), or keyboard time-out
counting continues immediately; IHOS is (e.g., interrupt if no input in x ms).
generated every EOC until software resets the 7.4 Examples. Several possible uses of the
enable bit. This TIN mode may be used, for timer/counters are given in the following four
example, to time the line feed delay following examples.
end of line detection on a printer or to delay
data sampling for some length of time follow- 7.4.1 Time of Day Clock. The follOWing
ing a sample strobe. module illustrates the use of TI for
The "retriggerable input" TIN mode wiil load maintenance of a time of day clock, which is
and clock TI with the 28 internal clock on kept in binary format in terms of hours,
every occurrence of a High-to-Low transition minutes, seconds, and hundredths of a second.
on TIN. TI will time-out and generate interrupt It is desired that the clock be updated once
request rHOS when the programmed time every hundredth of a second; therefore, TI is
interval (determined by TI prescaler and load programmed in continuous mode to interrupt
register values) has elapsed since the last 100 times a second. Although TI is used for
High-to-Low transition on TIN. In single-pass this example, To is equally suited for'the task.
mode, the enable bit is reset on EOC; further The procedure for initialiZing the timer
TIN transitions will not cause TI to load and (TOD~NIT), the interrupt service routine
begin counting until the software sets the (TOO) which updates the clock, and the inter-
enable bit again. In continuous mode, EOC rupt vector for TI end-of-count (IHO_S) are
does not modify the enable bit, but the counter illustrated below. XTAL = 7.3728 MHz is
is reloaded and counting continues immedi- assumed.
Z8ASM 2.0
LOC OBJ CODE STMT SOURCE STATEMENT
1 TIMER 1 MODULE
2 CONSTANT
3 HOUR .- R12
4 MINUTE .- R13
5 SECOND .- R14
6 HUND .- R15
$SECTION PROGRAM
7
8 GLOBAL
9 !IRQ5 interrupt vector I
10 $ABS 10
P 0000 OOOF' 11
1'2
IRQ_5 ARRAY [1 WORD] -- [TOD]
13 $REL
P OOOC 14 TOD_INIT PROCEDURE
15 ENTRY
P 0000 E6 F3 93 16 LD PRE1,#%(2)10010011,
17 Ibit 2-7: prescaler = 36;
18 bit 1: internal clock;
19 bit 0: continuous model
P 0003 E6 F2 00 20 LD Tl,110 !(256) time-out =
21 1/100 second I
P 0006 46 Fl OC 22 OR TMR,II'J,OC !load, enable Tl!
P 0009 8F 23 DI
P OOOA 46 FB 20 24 OR IMR,II'J,20 lenable Tl interruptI
P OOOD 9F 25 EI
P OOOE AF 26 RET
P OOOF 27 END TOD_INIT
28
P OOOF 29 TOD PROCEDURE
30 ENTRY
P OOOF 70 FD 31 PUSH RP
32 !Working register file %10 to %IF contains
33 the time of day clockl
P 0011 31 10 34 SRP 11%10
P 0013 FE 35 INC HUND 11 more • 01 sec!
P 0014 A6 EF 64 36 CP HUND,I1100 Ifull second yet?1
P 0017 EB 13 37 JR NE,TOD_EXIT I jump if no I
P 0019 BO EF 38 CLR HUND
P 001B EE 39 INC SECOND 11 more secondl
P 001C A6 EE 3C 40 CP SECOND,I160 !full minute yet?!
P 001F EB OB 41 JR NE,TOD_EXIT !jump if no!
1247
7. Timer/ p 0021 BO EE 42 CLR SECOND
Counter P 0023 DE 43 INC MINUTE !1 more minutel
p 0024 A6 ED 3C 44 CP MINUTE,1160 I full hour yet?!
Functions P 0027 EB 03 45 JR NE,TOD_EXIT ! jump i f no!
(Continued) P 0029 BO ED 46 CLR MINUTE
P 002B CE 47 INC HOUR
48 TOD_EXIT:
P 002C 50 FD 49 POP RP Irestore entry RPI
P 002E BF 50 IRET-
P 002F 51 END TOD
52 END TIMER1
o ERRORS
ASSEMBLY COMPLETE
TOD_INIT: TOD:
7 instructions 17 instruction
15 byles 32 byles
16 p.s 19.5 p.s (average) including interrupt response time
7.4.2 Variable Frequency, Variable Pulse initial loading of the T I counter register is
Width Output. The following module followed by setting the TI load bit of timer con-
illustrates one possible use of TOUT. Assume it trol register TMR (%Fl); this action causes
is necessary to generate a pulse train with a TOUT to be reset to a logic 1 output. Each
10% duty cycle, where the output is repetitive- subsequent modification of the TI counter
ly high for 1.6 ms and then low for 14.4 ms. To register does not affect the current TOUT level,
do this, TOUT is 'controlled by end-of-count since the T I load bit is NOT altered by the
from II, although To could alternately be software. The new value is loaded on EOC,
chosen. This example makes use of the Z8 and TOUT will toggle at that time. The TI inter-
feature that allows a timer's counter register .to rupt service routine should simply modify the
be modified without disturbing the count in TI counter register with the new value, alter-
progress. In 'continuous mode, the new value is nating between the long and short interval
loaded when TI reaches EOC. TI is first values.
loaded and enabled with values to generate In the example which follows, bit 0 of
the short interval. The counter register is then register %04 is used as a software !lag to indi-
immediately modified with the value to cate which value was loaded last. This module
generate the long interval; this value is loaded illustrates the procedure for TI/ToUT initializa-
into the counter automatically on TI EOC. The tion (PULSE_INIT), the T I interrupt service
pres caler selected value must be the same for routine (PULSE), and the interrupt vector for
both long and short intervals. Note that the TI EOC (IRQ_5). XTAL = 8 MHz is assumed.
Z8ASM 2.0
LOC OBJ CODE STMT SOURCE STATEMENT
1 TIMER2 MODULE
2 $SECTION PROGRAM
3 GLOBAL
4 IIRQ5 interrupt vectorl
5 $ABS 10
P 0000 0017' 6 IRQ_5
7
ARRAY [1 WORD] .- [PULSE]
8 $REL
P OOOC 9 PULSE_INIT PROCEDURE
10 ENTRY
'P 0000 E6 F3 03 11 LD PRE1,U%(2)00000011
12 Ibit 2-7: prescaler = 64;
13 bit 1: internal clock;
14 bit 0: continuous model
P 0003 E6 F7 00 15 LD P3M,1I00' Ibit 5: let P36 be Toutl
P 0006 E6 F2 19 16 LD T1,1125 Ifor short interval!
P 0009 8F 17 D1
P OOOA 46 FB 20 18 OR 1MR,#%(2)00100000 lenable T1 interruptI
P OOOD E6 F1 8C 19 LD TMR,II%(2)10001100
20 Ibit 6-7: Tout controlled
21 by T1;
22 bit 3: enable T1;
23 bit 2: load T1 I
24 ISet long interval counter, to be loaded on T1 EOCI
P 0010 E6 F2 E1 25 LD T1,1I225
26 IClear alternating flag for PULSEI
1248
7. Timer/ P 0013 BO Oil 27 CLR $011 1= 0 25 next;
Counter 28 1 225 next
Functions P 0015 9F 29 EI
P 0016 AF 30 RET
(Continued) P 0017 31 END PULSE_INIT
32
33
P 0017 311 PULSE PROCEDURE
35 ENTRY
P 0017 E6 F2 El 36 LD Tl,11225 !new load value!
P 001A B6 Oil 01 37 XOR ·$011,111 Iwhich value next?1
P 0010 6B 03 38 JR Z, PULSE_EXIT !should be 225!
P 001F E6 F2 19 39 LD Tl,1125 !should be 251
110 PULSE_EXIT :
P 0022 BF III IRET
P 0023 112 END PULSE
113 END TIMER2
o ERRORS
ASSEMBLY COMPLETE
PULSE_INIT: PULSE:
10 instructions S instructions
23 bytes 12 bytes
23 ps 25 ps (average) including interrupt response time
7.4.3 Cascaded Timer/Counters. For some TI to function as a single unit. TOUT. program-
applications it may be necess!'lry to measure a med to toggle on To end-of-count, should be
greater time interval than a single timer/ wired back to TIN, which is selected as the
counter can measure (16.384 ms). In this case, external clock input for TI. With To program-
TIN and TOUT may be used to cascade To and med for continuous mode, TOUT (and therefore
TIN) goes through a High-to-Low transition
XTAL
(causing TI to count) on every other To EOC.
Interrupt request IRQ5 is generated when the
programmed time interval has elapsed. Inter-
rupt requests IRQ2 (generated on every TIN
High-to-Low transition) and IRQ4 (generated
on To EOC) are of no importance in this
application and are therefore disabled.
To determine the time interval (i) until EOC,
the equation
i=t x pO x vO x (2 x pi x vi-I)
characterizes the relation between the To
prescaler (pO) and counter (vO), the TI
prescaler (pi) and counter (v I), and the clock
TO INTERRUPT LOGIC (IRQ,,)
input period (t); t is defined in Section 7.1.
Assuming XTAL = 8 MHz, the measurable
time interval range is
I !,-S x I x I x (2 x I - 1) SiS
I !,-S x 64 x 256 x (2 x 64 x 256 - I)
I !,-s s i s 536.854528 s
Figure 3 illustrates the interconnection
between To and T,. The following module
illustrates the procedure required to initialize
TO INTERRUPT LOGIC (IROS)
the timers for a 1.998 second delay interval:
1249
7. Timer/ Z8ASM 2.0
Counter LOC OBJ CODE STMT SOURCE STATEMENT
Functions 1 TIMER3 MODULE
(Continued) 2 GLOBAL
P 0000 3 TIMER_16 PROCEDURE
4 ENTRY
P 0000 E6 F3 28 5 LD PRE1,O%(2)00101000
6 Ibit 2-7: prescaler = 10;
7 bit 1: external clock;
8 bit 0: single-pass model
P 0003 E6 F7 00 9 LD P3M,1100 !bit 5: let P36 be Toutl
P 0006 E6 F2 64 10 LD Tl,Ul00 ITI counter register!
P 0009 E6 F5 29 11 LD PREO,U%(2)00101001
12 !bit 2-7: prescal er = 10;
13 bit 0: continuous mode!
P OOOC E6 F4 64 14 LD TO,11100 ITO counter register I
P OOOF 8F 15 DI
P 0010 56 FB 2B 16 AND IMR,U%(2)00101011 !disable IRQ2 (Tin);
17 and IRQ4 (TO) I
P 0013 46 FB 20 18 OR IMR,#$(2)OO100000 lenable IRQ5 (Tl)!
P 0016 9F 19 EI
P 0017 E6 Fl 4F 20 LD TMR,#$(2)01001111
21 Ibit 6-7: Tout controlled
22 by TO;
23 bit 4-5: Tin mode is ext.
24 clock input;
25 bit 3 : enable Tl;
26 bit 2 : load Tl;
27 bit 1: enable TO;
28 bit 0: load TO !
P 001A AF 29 RET
P 001B 30 END TIMER_16
31 END TIMER3
o ERRORS
ASSEMBLY COMPLETE
11 instructions
27 bytes
26.5p.s
7.4.4 Clock Monitor. TI and TIN may be used The following module illustrates the pro-
to monitor a clock line (in a diskette drive, for cedure for initializing T I and TIN
example) and generate an interrupt request (MONITOR_INIT) to monitor a clock with a
when a clock pulse is missed. To accomplish period of 2 p.s. XTAL = 8 MHz is assumed.
this, the clock line to be monitored is wired to Note that this example selects single-pass
P31 (TIN)' TIN should be programmed as a rather than continuous mode for TI. This is to
retriggerable input to TI, such that each fall- prevent a continuous stream of IRQ5 interrupt
ing edge on TIN will cause TI to reload and requests in the event that the monitored clock
continue counting. If TI is programmed to fails completely. Rather, the interrupt service
time-out after an interval of one-and-a-half routine (CLK_ERR) is left with the choice of
times the clock period being monitored, TI whether or not to re-enable the monitoring.
will time-out and generate interrupt request Also shown is the TI interrupt vector (IRQ_5).
IRQ5 only if a clock pulse is missed.
Z8ASM 2.0
LOC OBJ CODE STMT SOURCE STATEMENT
1 TIMER4 MODULE
2 $SECTION PROGRAM
3 GLOBAL
4 IIRQ5 interrupt vectorl
5 $ABS 10
P 0000 0015 ' 6
7
IRQ_5 ARRAY [1 WORD] .- [CLK_ERR]
8 $REL
P OOOC 9 MONITOR_ INIT PROCEDURE
10 ENTRY
P 0000 E6 F3 04 11 LD PRE1,U%(2)00000100
12 Ibit 2-7: prescaler = 1;
13 bit 1 external clock;
14 bit 0 single-pass model
P 0003 E6 F7 00 15 LD P3M,1100 Ibit 5 1 et P36 be Tout I
P 0006 E6 F2 03 16 LD T1,113 T1 load register,
17 1.5 *
2 usec I
1250
7. Timer/ P 0009 8F 18 01
Counter P OOOA 56 FB 3B 19 AND 1MR,#%(2l00111011 !disable 1RQ2 (Tinll
P 0000 46 FB 20 20 OR IMR,#%(2l00100000 lenable IRQ5 (Tl l I
Functions P 0010 9F 21 EI
(Continued) 22
P 0011 E6 Fl 38 23 LD TMR,#%(2l00111000
24 !bit 4-5: Tin mode is
25 retrig. input;
26 bit 3: enable Tl !
P 0014 AF 27 RET
P 0015 28 END MONITOR_ INIT
29
30
P 0015 31 CLK_ERR PROCEDURE
32 ENTRY
33 ! ... ! !handle the missed clock!
34
35 !if clock monitoring should continue ••• !
P 0015 46 Fl 08 36 OR TMR,#%(2l00001000
37 !bit 3: enable Tl
P 0018 BF 38 IRET
P 0019 39 END CLK_ERR
40 END TIMER4
a ERRORS
ASSEMBLY COMPLETE
MONITOR_lNIT: eLK_ERR:
9 instructions 2 + instructions
21 bytes 4 + bytes
21.Sp.s 18.5 + p.s including interrupt response lime
Counterl
TImer
r P3j
3Q
P3 2
P3:J
{ P3j
P36
IRQ3
IRQ2
!RQO
IRQ I
TIN
TOUT
replaced by the odd-parity bit when trans-
mitted and a parity-error flag (= I if error)
when received. Table 5 illustrates the state of
the parity bit/parity error flag during serial
I/O with parity enabled.
Although the 28 directly supports either odd
parity or no parity for serial I/O operation,
Data Memory
Select { P34 DKI even parity may also be prOVided with addi-
Status Out tional software support. To receive and
{ P30 SerIal In transmit with even parity, the 28 should be
SenalllO
P37 SenalOut configured for serial I/O with odd parity
Table 4. Port 3 Special Functions disabled. The 28 software must calculate parity
1251
8. I/O Character Loaded Transmitted To Received From Characler
'Functions InloSIO Serial Line Serial Line Transferred To SIO Nole"
(Continued) 11000011 01000011 01000011 01000011 no error
11000011 01000011 01000111 11000111 error
01111000 11111000 11111000 01111000 no error
01111000 11111000 01111000 11111000 error
and modify the eighth bit prior to the load of a satisfied by To counter = 2 and prescaler = 3.
character into SIO and then modify a parity The following code sequence will configure the
error flag following the load of a character To counter and To prescaler registers:
from SIO. All other processing required for LD To,#2 !To counter = 2!
serial I/O (e.g. buffer management, error LD PREO,#%(2)00001l01
handling, etc.) is the same as that for odd !bit 2-7: prescaler = 3; bit 0:
parity operations. continuous mode!
To configure the Z8 for Serial 1/0, it is
necessary to: Interrupt request 3 (IRQ3) is generated
whenever a character is transferred into the
• Enable P30 and P37 for serial I/O and select receive buffer; interrupt request 4' (IRQ4) is
parity, generated whenever a character is transferred
• Set up To for the desired bit rate, out of the transmit buffer. Before accepting
• ConfigureIRQ3 and IRQ4 for polled or such interrupt requests, the IIiterrupt Mask,
automatic interrupt mode, Request, and Priority Registers (IMR, IRQ, and
IPR) must be programmed to configure the
• Load and enable To. mode of interrupt response. The section on
To enable P30 and P37 for serial 1/0, bit 6 of Interrupt Processing provides a discussion of
P3M (R247) is set. To enable odd parity, bit 7 interrupt configurations.
of P3M is set; to disable it, the bit is reset. For To load arid enable To, set bits 0 and I of
example, the instruction the timer mode register (TMR) via an instruc-
LD P3M,#%40 tion such as
will enable serial 1/0, but disable parity. The OR TMR,#%03
instruction This will cause the To prescaler and counter
LD P3M,#%CO registers (PREO and To) to be transferred to the
To prescaler and counter. In addition, To is
will enable serial 1/0, and enable odd parity. enabled to count, and serial 1/0 operations
In the following discussions, bit rate refers to will commence.
all transmitted bits, including start, stop .. and Characters to be output to the serial line
parity (if enabled). The serial bit rate is given should be written to serial 1/0 register SIO
by the equation: ' (%FO). IRQ4 will be generated when all bits
mput clock frequency have been transferred out.
bit rate =
(2 X 4 X TO prescaler X TO counter X 16) Characters input from the serial line may be
The final divide-by-16 is incurred for serial read from 510. IRQ3 will be generated when a
communications, since in this mode To runs at full character has been transferred into 510.
16 times the bit rate in order to synchronize The following module illustrates the receipt
the data stream. To configure the Z8 for a of a character and its immediate echo back to
specific bit rate, appropriate values must first the serial line. It is assumed that the Z8 has
be selected for To prescaler and To counter by been configured for serial 1/0 as described
the above equation; these values are then pro- above, with IRQ3 (receive) enabled to interrupt,
grammed into registers To (%F4) and PREO and IRQ4 (transmit)' configured to be polled.
(%FS) respectively. Note that PREO also con- The received character is stored in a circular
trols the continuous vs. single-pass mode for buffer in register memory from address %42 to
To; continuous mode should be selected for %SF. Register %41 contains the address of
serial I/O. For example, given an input clock the next available buffer pOSition and should
frequency of 7.3728 MHz and a selected bit have been initialized by some earlier routine
rate of 9600 bits per second, the equation is to #%42.
1252
8. I/O Z8ASM 2.0
Functions LOC OBJ CODE STMT SOURCE STATEMENT
(Continued) 1 SERIAL_IO MODULE
2 CONSTANT
3 next_addr ·- %41
4 start ·- %42
5
6
length
$SECTION PROGRAM
·- %lE
7 GLOBAL
8 !IRQ3 vector I
9 $ABS 6
P 0006 0000' 10
11
IRQ_3 ARRAY [1 WORD] .- [GET_CHARACTER]
12 $REL a
P 0000 13 GET_CHARACTER PROCEDURE ENTRY
14
15 ISerial I/O receive interrupt service!
16 JEcho received character and wait for
17 echo completionl
P 0000 E4 FO Fa 18 ld SIO, SID lecho!
19
20 !save it in circular buffer!
P 0003 F5 Fa 41 21 ld @next_addr,SIO Isave in bufferl
P 0006 20 41 22 inc next_addr !point to next positionl
P 0008 A6 41 60 23 cp next_addr, Dstart+length
24 Iwrap-around yet?1
P OOOB EB 03 25 jr ne,echo_wait Ino.1
P OOOD E6 41 42 26 ld next_addr, Hstart Eyes. point to start!
27 !now, wait for echo complete I
28 echo_wait:
P 0010 66 FA 10 29 tcm IRQ,H%10 !transmitted yet?1
P 0013 EB FB 30 jr nZ,echo_wait Inot yeti
31
P 0015 56 FA EF 32 and IRQ,II%EF I clear IRQ41
P 0018 BF 33 IRET !return from interrupti
P 0019 34 END GET_CHARACTER
35 END SERIAL_IO
o ERRORS
ASSEMBLY COMPLETE
10 instructions
25 bytes
35.5 ps + 5.5 ps for each addjfjonal pass through the echo_wai/loop,
including interrupt response time
8.2 Automatic Bit Rate Detection. In a typical uishing between the bit rates shown in Table 6
system, where serial communication is and assumes an input clock frequency of
required (e.g. system with a terminal), the 7.3728 MHz, a To prescaler of 3, and serial IIO
desired bit rate is either user-selectable via a enabled with parity disabled. This example
switch bank or nonvariable and "hard-coded" requires that a character with its low order
in the software. As an alternate method of bit- bit = 1 (such as a carriage return) be sent to
rate detection, it is possible to automatically the serial channel. The start bit of this
determine the bit rate of serial data received character can be measured by counting the
by measuring the length of a start bit. The number of zero bits collected before the low
advantage of this method is that it places no order 1 bit. The number of zero bits actually
requirements on the hardware design for this collected into data bits by the serial channel is
function and provides a convenient (automatic) less than n (as given in the above equation),
operator interface. due to the detection of start and stop bits.
In the technique described here, the serial Figure 4 illustrates the collection (at 19,200
channel of the 28 is initialized to expect a bit
rate of 19,200 bits per second. The number of
bits (n) received through Port pin P30 for each
bit transmitted is expressed by
n = 19,200/b
1-<14>------1 BIT TIME AT 1.200 BITS PER SECOND----••I
where b = transmission bit rate. For example, ST .. START BIT SP = STOP BIT Dn ... DATA BIT n
if the transmission bit rate were 1200 bits per EACH INTERVAL SHOWN"" 1 BIT TIME
second, each incoming bit would appear to the AT 1.,200 BITS PER SECOND
1253
8.110 Number of Bits Received Number of 0 Bits Collected
Functions Bit Rate Per Bit TraDSmilled as Data Bits TO Counter
(Continued) dec binary dec. binary
19200 1 0 00000000 I 00000001
9600 2 1 00000001 2 00000010
4800 4 3 00000011 4 00000100
2400 8 7 00000111 8 00001000
1200 16 13 00001101 16 00010000
600 32 25 00011001 32 00100000
300 64 49 00110001 64 01000000
ISO 128 97 01100001 128 10000000
bits per second) of a zero bit transmitted to the character has been received, thus "flushing"
Z8 at 1,200 bits per second. Notice that only 13 the serial line. This can be accomplished
of the 16 zero bits received are collected as either via a software loop, or by programming
data bits. T1 to generate an interrupt request after
Once the number of zero hits in the start bit the appropriate amount of time has elapsed.
has been collected and counted, it remains to" Since a character is composed of eight bits
translate this count into the appropriate To plus a minimum of one stop bit following the
counter value and program that value into To start bit, the length of time to delay may be
(%F4). The patterns shown in the two binary expressed as
columns of Table 6 are utilized in the (9 X n)/b
algorithm for this translation.
As a final step, if incoming data is to com- where nand b are as defined above. The
mence immediately, it is advisable to wait until follOWing module illustrates a sample program
the remainder of the current "elongated" for automatic bit rate detection. .
Z8ASM 2.0
LOC OBJ CODE STMT SOURCE STATEMENT
1 bit_rate MODULE
2 EXTERNAL
3 DELAY PROCEDURE
4 GLOBAL
P 0000 5 main PROCEDURE
6 ENTRY
P 0000 8F 7 di !disable interrupts!
P 0001 56 FB 77 8 and IMR,I/%77 !IRQ3 polled mode!
P 0004 56 FA F7 9 and IRQ,I/%F7 !clear IRQ3!
P 0007 E6 F7 40 10 ld P3M,II%40 !enable serial I/O!
P OOOA E6 F4 01 11 ld TO,lll
P 0000 E6 F5 00 12 ld PREO, /I( 3 SHL 2)+1 !bit rate = 19,200;
13 continuous count mode!
P 0010 BO EO 14 clr RO !init. zero byte counter!
P 0012 E6 Fl 03 15 ld TMR,113 !load and enable TO!
16
17 !collect input bytes by counting the number of null
18 characters received. Stop when non-zero byte received!
19 collect:
P 0015 76 FA 08 20 TM IRQ,II%08 !character received?!
P 0018 6B FB 21 jr z,collect !not yet!
P 001A 18 FO 22 ld Rl,SlO !get the character!
P 001C 56 FA F7 23 and IRQ,II%F7 !clear interrupt request!
P 001F lE 24 inc R1 Icompare to 0 ••• 1
P 0020 1A 05 25 djnz R1, bitloop ! ••• (in 3 bytes of code)1
P 0022 06 EO 08 26 add RO,1I8 lupdate count of 0 bits!
P 0025 8B EE 27 jr collect
28 bitloop: !add in zero bits from low
29 end of 1st non-zero byte!
P 0027 EO E1 30 RR Rl
P 0029 7B 03 31 jr c, count_done
P 002B OE 32 inc RO
P 002C 8B F9 33 jr bi tloop
34
35 I RO has number of zero bits collected I
36 I translate RO to the appropriate TO counter value I
37 count_done: ! RO has count of zero bits!
P 002E 1C 07 38 ld Rl,117
P 0030 2C 80 39 ld R2,11%80 I R2 will have TO counter value I
P 0032 90 EO 40 RL RO
41
P 0034 90 EO 42 loop: RL RO
1254
8. I/O P 0036 7B 04 43 jr c,done
Functions P 0038 EO E2 44 RR R2
P 003A 1A F8 45 djnz r1,loop
(Continued) 46
P 003C 29 F4 47 done: ld TO,R2 Iload value for detected
48 bit ratel
49 IDelay long enough to clear serial line of bit stream!
P 003E D6 0000* 50 call DELAY
51 !clear receive interrupt request!
P 0041 56 FA F7 52 and IRQ,II'f,F7
53
P 0044 54 END main
55 END bi t_rate
o ERRORS
ASSEMBLY COMPLETE
30 instructions
68 bytes
Execution time is variable based on transmission bit rate.
8.3 Port Handshake. Each of Ports 0, I and 2 CLR P2M !Port 2 mode register: all Port
may be programmed to function under input or 2 bits are outputs!
output handshake control. Table 7 defines the OR %03,#%40
port bits used for the handshaking and the !set DAV2: data not available!
mode bit settings required to select handshak- LD P3M,#%20
ing, To input data under handshake control, !Port 3 mode register: enable
the Z8 should read the input port when the Port 2 handshake!
r5li.V input goes Low (signifying that data is LD %02,DATA
available from the attached device). To output !output first data byte; lJAV2
data under handshake control, the Z8 should will be cleared by the Z8 to
write the output port when the RDY input goes indicate data available to
Low (signifying that the previously output data the peripheral device!
has been accepted by the attached device). Note that following the initialization of the out-
Interrupt requests IRQO, IRQI, and IRQ2 are put sequence, the software outputs the first
generated by the falling edge of the handshake data byte without regard to the state of the
signal input to the Z8 for Port 0, Port I, and RDY2 input; the Z8 will automatically hold '
Port 2 respectively. Port handshake operations DAV2 High until the RDY2 input is High. The
may therefore be processed under interrupt peripheral device should force the Z8 RDY2
control. input line Low after it has latched the data in
Consider a system that requires communica- response to a Low on DAV2. The Low on RDY2
tion of eight parallel bits of data under hand- will cause the Z8 to automatically force DXV2
shake control from the Z8 to a peripheral High until the next byte is output. Subsequent
deyice and that Port 2 is selected as the output bytes should be output in response to interrupt
port. The following assembly code illustrates request IRQ2 (caused by the High-to-Low tran-
the proper sequence for initializing Port 2 for sition on RDY2) in either a polled or an
output handshake. enabled interrupt mode.
1255
SECTION ~ithmetic Routines cessed one nibble at a time from left to right,
This section gives examples of the arithmetic beginning with the high-order nibble of the
9 and rotate instructions for use in multiplica- lower memory address. %30 is added to each
tion, division, conversion, and BCD arithmetic nibble if it is in the range 0 to 9; otherwise
algorithms. %37 is added. In this way, %0 is converted to
9.1 Binary to Hex ASCII. The following %30, %1 to %31, ... %A to %41. ... %F to
module illustrates the use of the ADD and %46. Figure 5 illustrates the conversion of RRO
SWAP arithmetic instructions in the conversion (contents = %F2BE) to its hex ASCII
of a 16-bit binary number to its hexadecimal eqUivalent; the destination buffer is pointed to
ASCII representation. The 16-bit number is by RR4.
viewed as a string of four nibbles and is pro-
BIT 0, .3 Do Dr .3 Do
REGISTER
I I
R.
I I I
R.
I
R.. -
Dr
I
..I Do
I I
Dr .3
I
Do
I I
0, .I, Do
I I
Dr .,
I
Do
I
Figure 5. Conversion of (RRO) 10 Hex ASCU
15 instructions
34 bytes
120.5 ps (average)
1256
9. Arithmetic 9.2 BCD Addition. The following module illus- significant digit in bits 7-4. Bytes within a
Routines trates the use of the add with carry (ADC) and BCD string are arranged in memory with the
(Continued) decimal adjust (DA) instructions for the addi- most significant digits stored in the lowest
tion of two unsigned BCD strings of equal memory location. Figure 6 illustrates the
length_ Within a BCD string, each nibble representation of 5970 in a 6-digit BCD string,
represents a decimal digit (0-9). Two such starting in register %33.
digits are packed per byte with the most
BIT D,
I
•
I
3 Do
I I
Dr .3
I
D,
I I
D, ..I Do
I
REGISTER %33 %34 %35
Z8ASM 2.0
LOC OBJ CODE STMT SOURCE STATEMENT
1 ARITH MODULE
2 CONSTANT
3 BCD_SRC. _ R1
4 BCD_DST:= RO
5 BCD_LEN:= R2
6 GLOBAL
P 0000 7 BCDADD PROCEDURE
8 !*****************************************************
9 Purpose = To add two packed BCD strings of
10 equal length.
11 dst <-- dst + src
12
13 Input RO pointer to dst BCD string.
14 R1 pOinter to src BCD string.
15 R2 byte count in BCD string
16 (digit count = (R2)*2 ).
17
18 Output BCD string pOinted to by RO is
19 the sum.
20 Carry FLAG = 1 if overflow.
21 RO , R1 as on entry.
22 R2 = 0
23 *****************************************************!
24 ENTRY
25
P 0000 02 12 26 add BCD_SRC,BCD_LEN Istart at least ••• I
P 0002 02 02 27 add BCD_DST,BCD_LEN !significant digitsl
P 0004 CF 28 ref !carry = 01
29 add_again:
P 0005 00 E1 30 dec !point to next two
31 src digitsl
P 0007 00 EO 32 dec Ipoint to next two
33 dst digits I
P 0009 E3 31 34 ld R3,@BCD_SRC Iget src digitsl
P OOOB 13 30 35 ADC R3,@BCD_DST ladd dst digitsl
P OOOD 40 E3 36 DA R3 !decimal adjustl
P OOOF F3 03 37 ld @BCD_DST,R3 Imove to dstl
P 0011 2A F2 38 djnz BCD_LEN, add_again !loop for next
39 digitsl
P 0013 ,AF 40 ret I all done I
41
P 0014 42 END BCDADD
43 END ARITH
o ERRORS
ASSEMBLY COMPLETE
11 instructions
20 bytes
Execution time is a function oJ the number of byles (n) in input BCD string:
20 p3 + 12.5 (n - 1) p3
1257
9. Arithmetic 9.3 Multiply. The following module illustrates to the high-order byte of the partial product.
Routines an efficient algorithm for the multiplication of As the high-order bits of the multiplicand are
(Continued) two unsigned 8-bit values, resulting in a l6-bit vacated by the shift, the resulting partial-
product. The algorithm repetitively shifts the product bits are rotated in. Thus, the multipli-
multiplicand right (using RRC)' with the low- cand and the low byte of the product occupy
order bit being shifted out (into the carry flag). the same byte, which saves register space,
If a one is shifted out, the multiplier is added code, and execution time.
9 instructions
16 bytes
92.5,.. (average)
9.4 Divide. The following module. illustrates divisor is subtracted from the high byte of the
an efficient algorithm for the division of a dividend. As the low:order bits of the dividend
l6-bit unsigned value by an 8-bit unsigned are vacated by the shift left, the resulting
value, resulting in an 8-bit unsigned quotient. partial-quotient bits are rotated in. Thus, the
The algorithm repetitively shifts the dividend quotient and the low byte of the dividend
left (via RLC). If the high-order bit shifted Qut occupy the same byte, which saves register
is a one or if the resulting high-order dividend space, code, and execution time.
byte is greater than or equal to the divisor, the
1258
9. Arithmetic Z8ASM 2.0
Routines LOC OBJ CODE STMT SOURCE STATEMENT
(Continued) 1 ARITH MODULE
2 CONSTANT
3 COUNT RO
4 DIVISOR Rl
5 DIVIDEND_HI R2
6 DIVIDEND_LO R3
7 GLOBAL
P 0000 8 DIVIDE PROCEDURE
9 !*****************************************************
10 Purpose To perform a 16-bit by 8-bit unsigned
11 binary division.
12
13 Input = Rl = 8-bit divisor
14 RR2 16-bit dividend
15
16 Output = R3 8-bit quotient
17 R2 8-bit remainder
18 Carry flag = 1 if overflow
19 = 0 if no overflow
20 *****************************************************1
21 ENTRY
P 0000 OC 08 22 ld COUNT ,118 !LOOP COUNTERI
23
24 ICHECK IF RESULT WILL FIT IN 8 BITS!
P 0002 A2 12 25 cp DIVISOR,DIVIDEND_HI
P 0004 BB 02 26 jr UGT,LOOP ICARRY o (FOR RLC)I
27 !WON'T FIT. OVERFLOW!
P 0006 DF 28 SCF !CARRY 1!
P 0007 AF 29 ret
30
31 LOOP: !RESULT WILL FIT. GO AHEAD WITH DIVISION!
P 0008 10 E3 32 RLC DIVIDEND_LO !DIVIDEND * 2!
P OOOA 10 E2 33 RLC DIVIDEND_HI
P OOOC 7B 04 34 jr c,subt
P OOOE A2 12 35 cp DIVISOR,DIVIDEND_HI
P 0010 BB 03 36 jr UGT,next !CARRY = O!
P 0012 22 21 37 subt: SUB DIVIDEND_HI, DIVISOR
P 0014 DF 38 SCF !TO BE SHIFTED INTO RESULT I
P 0015 OA Fl 39 next: djnz COUNT,LOOP !no flags affected!
40
41 IALL DONE!
P 0017 10 E3 42 RLC
43 !CARRY 0: no overflow!
P 0019 AF 44 ret
P 001A 45 END DIVIDE
46 END ARITH
o ERRORS
ASSEMBLY COMPLETE
15 instructions
26 bytes
124.5/1S (average)
1259
MfM)RY SPACE AND REGISTER line 4 of tne Port 3 (P34) to select between
program and data memry for external Jremry oper-
ORGANIZATION ations.
Memory Space Port 0 is used to provide the addit10nal
'address bits for external memory beyond the
The za can address up to 126K Dytes of first 256 locations up to a full 16-bits of
program and data meJJl)ry separately from the on external memory address. It becomes imnediately
chip registers. The 16-bit program counter obvious that the first 8-bits of external memory
provides for 64K bytes of program memory, the address from Port 1 must be latched externally
first 2K bytes of which are internal to the Z8. to the za so that program or data may be trans-
The remaining 62K bytes of program Jremry are ferred over the same 8 lines during the external
located externally and can be l.IIIpleJrented with memory transaction machine cycle. The J{S', JlS',
I«M, EPI«M, or RAM. and R/W control lines simplify the required
The 62K bytes of data memry are also loc- interface logic. The timing for external Jremory
ated external to tne Z8 and begin with location transactions is given in Figure 3.
20411. The two address spaces, program memory
and data memory,. are individuallr.. selected by Reg1sters
the Data Memory Select output (rN) which is
available from 'Port 3. The Z8 has 144 8-bit registers including
four Port registers (RO-R3), 124 general purpose
The Program Memry Map and the Data Memry registers (R4-R127), and 16 control and status
Map are shown in Figure 2. register (RZ40-RZ55). The 144 registers are all
located in the same 8-bit address space to allow
Program Memory Map Data Memory Map
any Z8 instruction to operate on them. The 124
general purpose registers can function as accum-
15535 .5535 r-------., ulators, address pointers, or index registers.
EXTERNAL
The registers are read When they are referenced
ROM OR RAM as source registers, and written when they are.
~f-------l referenced as destination registers. Registers
LOCATION OF FIRST ON.CHIP may be addressed directly with an 8-bit address,
BYTE OF INSTRUCTION"",
EXECUTED AFTER RESET
ROM or indirectly through another register with an
12 1""-------:----- EXTERNAL
DATA
8-bit address, or W1th a 4-Dit address and Reg-
11 lAOS
MEMORY ister Pointer.
10 IA05
IRQ.
IRQ.
The entire Z8 register space may De divided
INTERRUPT VEctOR IR03 into 16 contiguous Working Register Areas, each
(LOWER IYTE) IIIQ3 having 16 registers. A control register, called
INTERRUPT VECTOR
tUPPER BYTE)
IA02
IA02
IRQI
......., the Register Pointer, may be loaded with tne
most significant nibble of a Working Reg1ster
IRQt
NDT ADDRESSAILE
Area address. The Register P01nter provides for
'ROO
'ROO
the selection of the Working Register Area, and
allows registers within that area to be selected
with a 4-bit address.
Figure 2 Program Memory Map And Data Memory Map The Z8 register organization is shown in
Figure 4.
~
The 28 provides for stack operations
External memry access is accomplished by through the use of a stack pointer, and the
the za tnrough its rIo Ports. When less than stack may be located 1n the internal register
256 bytes of external memry are required, Port space or in the external data Jremory space. The
1 is programmed for the rultiplexed address/data "stack selecUon" bit (D2) in the Port 0-1 MJde
mode lATI0-AD7). In this configurat10n 8-bits of control register selects an internal or external
address and a-bits of data are time multiplexed stack. When the stack is located internally,
on the 8 I/O lines for memry transfers. Tne reg1ster 255 contains an 8-bit stack pointer and
JrentOry "nandshake" control lines are provided by' register 254 is available as a general purpose
tne Address Strobe (liS), Data Strobe (Il5), and register. If an external stack is used, register
the Read/Write (R/W) pins on tne za. If program 255 or registers 254 and 255 may De used as the
and data are included in the external memory stack pointer depending on the anticipated
space, the Data Memory Select (lR) function may "depth" of the stack. When registers 254 and
be programmed into the Port :5 MJde register. 255 are both used, the stack pointer is a full
When this is done, the m signal is available on 16-bits wide. The CALL, lRET, RET, PUSH, and
1261
pop :instructions are Z8 :instructions which in- a parity error flag which indicates a parity
clude implicit stack operations. error if it is set to a ONE.
As memtioned in the last section, Port 3 , When simultaneous interrupts' occur for
can be progrlllllllld to be a serial I/O port with enabled interrupt sources, the Interrupt Prior-
bits 0 and 7, the serial input and serial out- ity Reglster determines which interrupt is ser-
put lines respectively. The serial I/O capabil- viced first. The priority is progrannnable in a
ity provides for full duplex asynchronous serial way that 1s described by Figure 6.
data at rates up to 62.SK bits per second. The
transmitted format is one start bit, eight data When an interrupt is recognized by the Z8,
bits including odd parity lif parity is enab- all other interrupts are diSabled, the program
led), and two stop bits. '!he received data counter and program control flags are saved, and
format is one start bit, eight data bits and at the program counter is loaded with the corres-
least one stop bit. If parity is enabled, the ponding interrupt vector. Interrupts must be
eighth data bit received (bit 7) is replaced by re-enabled by the user upon entenng the service
1262
SUPERB
APPLICATION NOTES
AND TECHNICAL ARTICLES
1263
~ ZiIm Application Note
GETTING STARTED
WITH THE ZILOG SUPERB
by Charles M. Link, II
Any time an engineer switches to a new processor, he will present the address earlier than the 'LS374. JU1
usually begins the time consuming process of leaming selects the EPROM size, correcting for the IPGM pin on
the quirks of the new part. This article is the first of a 2764 and 27128 EPROMs. It is necessary to use pull
series of articles written to speed that transition time from down resistors on the upper 4 bits of the address bus be-
any other processor to the Zilog Super8.
cause on reset, the ROMLESS Super8 defines only 12
Getting started is the most difficult part of switching to a bits for address; the other 4 are set as inputs. Since LS-
strange new processor and development tools. Weeks TTL devices require more current to pull down the inputs,
can be spent just getting the first lines of initialization this pull down trick will only work for MOS and CMOS in-
code written and successfully assembled. Testing the puts, hence the requirement for the logic chips in this
code becomes another problem. The soIl" 1re from this design to be HCT type devices.
article series has been tested and it should be possible
to copy most of the software directly to a user's applica- The remaining logic is required to select the EPROM or
tion. All of the software is available in machine readable RAM. JU2 selects the half-RAM protect mode. JU3 is
form as noted at the end of the article. set to determine what size ram to protect. This circuit al-
lows the lower half of CMOS battery backed RAM to be
This first article demonstrates the proper initialization of read only, and removes chip select on any writes to that
the Zilog SuperS microcontroller. It sets up a Z8800 address space. Of course, that exact Circuitry and the
ROMLESS for 64K bytes of extemal program memory, battery is optional, and might be replaced by a power
although most typical applications probably do not re- threshold detector. On the other front, a Maxim MAX
quire more than maybe 4K or 8K bytes. Ports 2 and 3, 232 provides the RS-232 interface requiring only 5 volts.
which are bit mappable as inputs or outputs, are set into
the output mode. Port 4, also bit mappable, is set into To make the software initialization more interesting, a
the input mode. A hardware schematic has been in- few other typical initialization tasks are demonstrated.
cluded as an example. The entire block of registers (user ram) is cleared to
zero, and one of the counter timer units is initialized to
The hardware schematic shown defines a simple Super8 provide a periodic interrupt to form the heart of a real
implementation that was used to test the code in this time clock function.
series of articles. This example defines a simple evalua-
tion board that contains 32K bytes of programable The program shows the typical pseudo-op usage
EPROM, and up to 32K bytes of RAM. The design con- demonstrated. This article series uses a cross as-
tains a simple RS-232 interface that is used in future ar- sembler available from Zilog for. either an IBM PC or a
ticles of the series. The entire board, including the VAX operating under VMS. The program begins by
RS-232 interface, is powered from 5 volts. The RAM defining the registers used as general purpose storage.
battery option allows the software to be downloaded into This is done so the user does not have to refer to register
the RAM and saved if power fails. Additional logic on the numbers, but may refer to a name equated to the
design allows a user to protect the lower half of RAM register.
with a simple jumper change. This prevents the proces-
sor from destroying executable code if it goes off into The first 32 bytes of every program (beginning at OOOOH)
space on a power failure. always contain the interrupt vectors for the different sour-
ces. Using the Zilog assembler, the .WORD pseudo-op
Specifically, the ROMLESS SuperS is used as the core. defines a pair of bytes for each of the 16 sources.
The SuperB requires a latch to demultiplex the address Program execution begins at location 0020H. Since
from the data bus. A 74LS373 fits nicely here, requiring copyright requirements usually require the notice as
only an inverter to correct for the address strobe. The close to the beginning as pOSSible, it becom~s necessary
'LS373 with inverter is preferred here rather than a single to jump around an ASCII string. The .ASCII pseudo-op
'LS374 because the 'LS373 is a transparent latch and generates the necessary string for this notice.
1265
The source code describes almost completely, without. In the next article of this series, we will take the same.
further explainatlon, the entire initialization. Once initial- basic initialization routine and modify it to support the
ized, the processor loops in a WAIT loop waiting on the serial UART. That article will demonstrate polled serial
periodic interrupt generated by the counterltimer. The communications using the Zilog Super 8.
counter timer interrupts 60 times per second, and the in-
terrupt bumps ram storage locations representing [Editors note: The sofware for this series is available on
seconds, minutes, and hours. Each time a location is an IBM PC diskette and is included with the Super 8
bumped, an external port line is toggled so that those Emulator package available from Creative Technology
without emulators can see some activity with an oscillo- Corporation, 5144 Peachtree Road, Suite 301, Atlanta,
scope. GA 30341. (404) 455-8255. Any Zilog Field Application
engineer should also be able to provide copies of the
One point of notice, is the interrupt service routine for the software on a user provided diskette.]
timer. One must reset the end of count interrupt bit (the
source of interrupt) before exiting the interrupt service
routine.
1266
START: jr START1 ;program execution unconditionally
;begins at this location after reset
land power up.
• ASCII 'REL 0 6/16/86' ;jump around optional ascii string
;containing release info, copyright, etc.
START1: di ;begin
sbO ;select register bank 0
ld EMT,j/OOOOOOOOB ;external memory timing=no wait input, normal
;memory timing, no wait states, stack internal,
land DMA internal
ld PO,#OOH ;address begins at OOOOh, set upper byte
ld POM, #11111111B ;select all lines as address
ld PM, '00110000B ;enable port 0 as upper 8 bits address
ld H1C,/lOOOOOOOOB ;handshake not enabled port 0
,
;port 1 is defined in romless part as address/data. it is not necessary
;here to initialize that port
1d P2, #OOH ;port 2 outputs low
ld P3,#00H ;port 3 outputs low
ld P2AM,jjl0101010B ;p30,31,20,21 as output
1d P2BM, jjl0101010B ;p32,33,22,23 as output,
ld P2CM,1I10101010B ;p34,35,24,25 as output
ld P2DM,1I10101010B ;p36,37,26,27 as output
ld P4,#00000000B ;clear port 4 register
ld P4D,I/11111111B ;set all bits of P4 as inputs
ld P40D,#00000000B ;active push/pull [not necessary since all
; bits are inputs
;basic Super 8 I/O is initialized, now internal registers
ld RPO,#OCOH ;set working register low to lower 8 bytes
ld RP1,#OC8H ;set working register high to upper 8 bytes
ld SPL, #OFFH ;set stack pointer to start at top of set two
;note here that only lower 8 bits are used
;for stack pointer. location OFFH is wasted
laS stack operation. SPH is general purpose
; storage.
: now clear the internal memory and stack area
ld SPH,#OFFH ;point to top of general purpose register
ZERO: clr @SPH ;zero it
dec SPH
jr nz,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
;now everything except working registers is cleared
cpu and memory now initialized, set up timer for real time clock
ld SYM,j/OOOOOOOOB ;disable fast interrupt response
ld IPR,1/00000010B ;interrupt priority
;IRQ2>IRQ3>IRQ4>IRQ5>IRQ6>IRQ7>IRQO>IRQ1
ld IMR,#00000100B ;enable only interrupt 2
sb1 ;select bank 1
ld COTCH,#AHB(50000) ;high byte of time constant
ld COTCL,#ALB(50000) ;low byte of time constant
;12,000,000 hertz / 4 / 50,000 = 60 hertz
;12 Mhz is xta1 freq, 4 is internal divider
ld COM,#00000100B ;p27,37 is I/O, programmed up/down, no capture
;timer mode is selected
sbO ;select bank 0
ld COCT,j/10100101B ;continuous, count down, load counter,
;zero count interrupt enable, enable counter
timer is initialized, now lets enable interrupts and wait
ei ;enable interrupts
WAIT: nop
nop
nop
nop
jr WAIT ;loop back
1267
nop
nop
nop
TIMERO: inc period ;bump periodic counter (60 hertz)
cp period, 1/60 lone second yet?
jr ne,NOROLL ;no rollover
xor P2,/lOOOOOOOlB ;complement the second bit
clr period ;start it over again
inc second ;bump the seconds timer
cp second, 1/60 ;reached maximum
jr ne,NORoLL ;no rollover
xor P2,,00000010B ;complement the minute bit
clr second ;start it over again
inc minute ;bump the minutes timer
cp minute,/l6o ;reached maximum
jr ne,NOROLL ;no rollover
xor P2"OOOOOlOOB ;complement the hour bit
clr minute ;start it over again
inc hours ;bump the hours timer
cp hours, #24 ;reached maximum
jr ne,NOROLL ;no rollover
clr hours ;start it over again
NOROLL: or COCT,#OOOOOOlOB ;reset end of count interrupt
nop
nop
INTRET: iret land return from interrupt
.END
1268
~ ZiIm Application Note
POLLED ASYNCHRONOUS
SERIAL OPERATION
WITH THE ZILOG SUPERB
by Charles M. Link, \I
The transition from one processor to another often invol- Next, the baud rate generator must be loaded. The for-
ves many hours of trial-and-error software development mula for determining the baud rate is shown below:
to determine the quirks (manufacturers call it features) of
the part. .Once the real features are discovered, TIME CONSTANT = (XTAL FREQ / 8 / CLOCK MULT /
programming the processor to perform as described can DESIRED RATE) -1
be hazardous to one's health. This article, the second in
a series of eight, attempts to introduce the Zilog SuperS where TIME CONSTANT is a 16 bit value, XTAL FREQ
user to the serial communications port, and its initializa- is the crystal ]frequency in hertz, CLOCK MULT is the
tion in a polled serial environment. clock rate loaded into UART MODE A register (as above
X1, X16, X32, and X64), and DESIRED rate is the
The universal asynchronous receiver/transmitter (UART) desired bit rate in bits per second. Note that the baud
on the SuperS is a fairly unique implementation among rate generator may be used as an additional counter,
single chip microcomputers in that it supports all of the and may be loaded with any value permitting just about
functions generally available only on chip level UARTs. any crystal frequency to operate the SuperS.
The UART is a close approximation of the zao DART
device in one channel. It supports independent The cross-assembler permitted a single 16-bit decimal
receiver/transmitter clocking, 5 to a bits per character, number to be loaded into the UART BAUD RATE GEN-
plus optional odd or even parity, and even an optional ERATOR, high and low byte, without unnecessary figur-
wake· up bit. The UART can serve full duplex com- ing using the highllow byte pseudo-op.
munications via polled, interrupt, or DMA modes of
operation. Auto-echo and intemal loopback can be The' initialization sequence continues, with the UART
programmed as options. The most unique of the UART MODE B register next. This example sends port 21 data
features is the character match and interrupt option. to the port 21 pin. An option allows different clocks to be
sent out from this pin. It could be used for clocking exter-
The following article describes the initialization and use nal logiC, or for diagnostic purposes to make sure the
of the UART in a polled environment. This software has baud rate generator is running. Auto-echo is not
been tested and provides several routines that may be selected in this application, as that is primarily what the
copied into a user's software. Although the demonstra- example software does. The receive and transmit clock
tion software does not do much, it is fully functional as a input is the baud rate generator and the generator source
stand-alone program, and may be "burned" into eprom is the intemal clock; the crystal divided by four. Since
as a test. the baud rate generator has been loaded, it is enabled,
and the UART is set for normal operation (without loop-
The basic software is almost the same general purpose back). Loopback operation permits transmitting and
initialization software from the first article in the series. receiving data without any external logic in front of the
Routines set-up counterltimer 0 for a real time clock op- SuperS.
tion. Note, however, the change to configuration register
P2AM. It is necessary to configure port 30 as input for The UART TRANSMIT CONTROL register is initialized
receive data and p31 as output for transmit data. next in the sequence. Select transmit data out on port 31
and transmit enable. The stop bits are optional, and the
The UART initialization sequence begins by setting the DMA and WAKE-UP enables are for features discussed
functions in the UART MODE A register. Since the UMA in future application articles. At this point, the transmitter
register is in the alternate bank, the instruction SB1 must is operational, and except for housekeeping, is usable.
be execute.d to gain access to the following registers. The housekeeping is in reference to selecting the bank 0
Th'e loaded data selects a X16 clock, S bits per charac- by executing the SBO instruction.
ter, no parity, and no wake up values. Note that the
clock options are X1, X16, X32, and X64. For true Since polled mode communications are desired, all of the
asynchronous operation, a clock multiplier option of at UART interrupts are disabled by loading the UART IN-
least X16 is required. The X1 mode could be used for TERRUPT ENABLE with aU zeros. Lastly, the receiver
extemally syncing the received data to the UART. The must be enabled by setting bit 0 of the UART RECEIVE
transmitter is not affected. CONTROL register.
1269
This program primarily sends a message to the console The receive character routine "GETC" monitors the
and then accepts input from the console and echos it RECEIVE CHARACTER AVAILABLE bit of the UART
upon receiving a carriage retum. It is necessary to delay RECEIVE CONTROL register. When this bit is a "1", a
sending data to the console after initialization because new character has been received by the UART.
the transmit data line is in the SPACE state when idle.
Altemately, add a pull-up resistor to the output, and while The polled mode of UART operation is simple. Making
idle and before initialized, it would exibit the MARK state. the UART operate in an interrupt mode requires a few
minor modifications, and DMA mode requires a few more
The transmit character routine "SENDC" monitors the modifications. Those modes are the subject of future ap-
TRANSMIT BUFFER EMPTY bit of the UART TRANS- plication articles in this series.
MIT CONTROL register. When this bit is a "1", the trans-
mit buffer is empty and may be loaded with a new
character for transmission. To transmit a character, load
the character into the UART data register (UIO) .
;=====-===========--=====================================--===
;= TITLE: UART1.S
;= DATE: JULY 17, 1986
:- PURPOSE: TO DEMONSTRATE INITIALIZATION
;= AND USAGE OF SERIAL PORT IN
:- POLLED MODE.
:= ASSEMBLER: ZILOG ASMS8 ASSEMBLER
:= PROGRAMMER: CHARLES M. LINK, I I
;=====================--=====================================
1270
INTR13 • WORD INTRET
INTR14 • WORD INTRET
INTR15 • WORD INTRET
;
;***********************************************************
:* *
;* START OF PROGRAM EXECUTION *
;* *
;***********************************************************
START: jr START1 ;program execution unconditionally
;begins at this location after reset
land power up.
• ASCII 'REL 0 7/17/86' ;jump around optional ascii string
;containing release info, copyright, etc.
START1: di ;begin
sbO ;select register bank 0
ld EMT,#OOOOOOOOB ;external memory timing=no wait input, normal
;memory timing, no wait states, stack internal,
land DMA internal
ld PO,#OOH ;address begins at OOOOh, set upper byte
ld POM, #11111111B ;select all lines as address
ld PM, #00110000B ;enable port 0 as upper 8 bits address
ld H1C,1I00000000B ;handshake not enabled port 0
;port 1 is defined in romless part as address/data. it is not necessary
;here to initialize that port
ld P2,1I00H ;port 2 outputs low
ld P3,1I00H ;port 3 outputs low
ld P2AM,1I10001010B ;p31,20,21 as output,p30 input
lit is necessary here to configure p30 as input
;for the receive data, and p31 as output for
;transmit data for UART
ld P2BM,1I10101010B ;p32,33,22,23 as output
ld P2CM,1I10101010B ;p34,35,24,25 as output
ld P2DM,1I10101010B ;p36,37,26,27 as output
ld P4,1I00000000B ;clear port 4 register
ld P4D, #11l1l111B ;set all bits of P4 as inputs
ld P40D,#00000000B ;active push/pull [not necessary since all
; bits are inputs
,
;basic Super 8 I/O is initialized, now internal registers
ld RPO,IIOCOH ;set working register low to lower 8 bytes
ld RP1,IIOC8H ;set working register high to upper 8 bytes
ld SPL,IIOFFH ;set stack pointer to start at top of set two
;note here that only lower 8 bits are used
;for stack pointer. location OFFH is wasted
las stack operation. SPH is general purpose
; storage.
;now clear the internal memory and stack area
ld SPH,/IOFFH ;point to top of general purpose register
ZERO: clr @SPH ;zero it
dec SPH
jr nz,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
; now everything except working registers is cleared
; cpu and memory now initialized, set up timer for real time clock
ld SYM,/lOOOOOOOOB ;disable fast interrupt response
ld IPR,#00000010B ;interrupt priority
;IRQ2>IRQ3>IRQ4>IRQ5>IRQ6>IRQ7>IRQO>IRQ1
ld IMR,#00000100B ;enable only interrupt 2
sb1 ;select bank 1
ld COTCH,/lAHB(50000) ;high byte of time constant
ld COTCL"ALB(50000) ;low byte of time constant
;12,000,000 hertz / 4 / 50,000 = 60 hertz
;12 Mhz is xtal freq, 4 is internal divider
ld COM,1I00000100B ;p27,37 is I/O, programmed up/down, no capture
;timer mode is selected
1271
sbO select bank 0
ld COCT,#10100101B continuous, count down, load counter,
zero count interrupt enable, enable counter
,
;timer is set, now lets initialize the UART for polled operation
sb1 ;bank 1
ld UMA,#01110000B
;time constant = (12,000,000/4/16/9600/2)-1=
;8.76 rounded to 9.
;note that a 12 Mhz does not make a very
;accurate baud rate source. error is large
ld UBGH,#~HB(00009) thigh byte of time constant
ld UBGL,#~LB(00009) ;low byte of time constant
ld UMB,#00011110B ;p21=p21data,auto-echo is off, transmit and
;receive clock is baud rate generator output,
;baud rate generator input is system clock / 2,
;baud rate generator is enabled, loopback
lis disabled
sbO ;select bank 0
ld UTC,#10001000B ;select p31 as transmit data out, 1 stop bit
land transmit enable
ld UIE,#OOOOOOOOB ;disable all interrupts, no DMA
ld URC,#00000010B tenable receive
;UART is initialized, enable interrupts for real time clock
ei tenable interrupts
,
;wait 1 full second for serial line to mark before sending anything
WAIT: cp second, #1 ;wait 1 second
jr ne,WAIT
;display the logon message
LOGON: ldw MPTR,#MSG ;load the address of MSG into word reg MPTR
call SENDM ;send the message
,
;logon message displayed, get response from console
land move to upper register memory
GET: ld r1,#80 ;maximum character count
ld r2,#80H ;point to first location in upper register bank
GETN: call GETC ;get input from console
and rO,#7fH ;remove upper parity bit
call SENDC ;echo to console
ld @r2,rO ;move to upper internal ram in super8
cp rO,lcR twas the received character a carriage return
jr eq,ECHO ;if so, echo it to console
inc r2 ;bump pointer
djnz r1,GETN ;get next character if not done
;
;if carriage return typed, or 80 characters exceeded, echo message
ECHO: ldw MPTR,#MSG1 ;load the address of MSG1 in word reg MPTR
call SENDM ;send the message
ld r1,#80 ;maximum character count
ld r2,#80H ;first location of character buffer
ECH01: ld rO,@r2 ;get character from buffer
call SENDC ;send the character to console
cp rO,#CR ;carriage return?
jr eq,LOGON ;if so, end message display
inc r2 ;bump pointer
djnz r1,ECHOi ;display next character if not done
jr LOGON
,
; subroutines
,
;send message at MPTR until '$' character found
SENDM: ldci rO,@MPTR ;get the character
call SENDC ;otherwise send character
cp rO,#'$' ;last character?
jr ne,SENDM land loop back to send next one
ret
1272
;send character in rO
SENDC: tm UTC,#OOOOOOlOB transmit buffer empty yet
jr z,SENDC if not, wait until it is
ld UIO,rO load the character into the transmitter
ret
;get a character from the uart, return in rO
GETC: tm URC,#OOOOOOOlB ;character available
jr z,GETC ;if not, wait until it is
ld rO,UIO ;get the character from the receiver
ret
,
;real time interrupt running in background
TIMERO: inc period ;bump periodic counter (60 hertz)
cp period,#60 lone second yet?
jr ne,NOROLL ;no rollover
xor P2,#OOOOOOOlB ;complement the second bit
clr period ;start it over again
inc second ;bump the seconds timer
cp second,#60 ;reached maximum
jr ne,NOROLL ;no rollover
xor P2,II000000l0B ;complement the minute bit
clr second ;start it over again
inc minute ;bump the minutes timer
cp minute, #60 ;reached maximum
jr ne,NOROLL ;no rollover
xor P2,#00000lOOB ;complement the hour bit
clr minute ;start it over again
inc hours ;bump the hours timer
cp hours, #24 ;reached maximum
jr ne,NOROLL ;no rollover
clr hours ;start it over again
NOROLL: or COCT,#ooOooOlOB ;reset end of count
nop
nop
INTRET: iret land return from interrupt
.END
1273
~ ZiIill Application Note
1275
.TITLE Sample Zilog Super 8 Serial Interrupt Mode Operation
;===========================================================
;= TITLE: UART2.S
;= DATE: JULY 17, 1986
:= PURPOSE: TO DEMONSTRATE INTERRUPT
:= DRIVEN SERIAL PORT
;= COMMUNICATIONS
;= ASSEMBLER: ZILOG ASMS8 ASSEMBLER
;= PROGRAMMER: CHARLES M. LINK, II
;======~=============================================== =====
:***********************************************************
:. *
1* REGISTER EQUATE TABLE *
1* *
.
:***********************************************************
period: .equ 0 1period timer
second: .equ 1 ;seconds timer
minute: .equ 2 1minutes timer
hours: .equ 3 ;hours timer
;working register equates
.
MPTR: .equ RR8 1message pointer for external memory
:***********************************************************
:. *
INTERRUPT VECTOR TABLE *
:* *
;***********************************************************
INTRO: ' • WORD INTRET ;this area should always be defined
INTR1: •WORD INTRET 1as it reserves the lower 32 bytes
INTR2: •WORD INTRET ;for the interrupt table. the name
INTR3: •WORD INTRET 10f the subroutine for each particular
INTR4: • WORD INTRET ;interrtipt service would normally be
INTR5: • WORD INTRET 1named here.
INTR6: •WORD TIMERO
INTR7: •WORD INTRET
INTR8: •WORD INTRET
INTR9: •WORD INTRET
INTR10: •WORD RXDATI
INTRl1: • WORD INTRET
INTR12: • WORD INTRET
INTR13: • WORD TXDATI
INTR14: •WORD INTRET
,INTR15: •WORD INTRET
;***********************************************************
;* *
1* START OF PROGRAM EXECUTION *
;* *
;***************************************************~* ******
1276
ld EMT,J/OOOOOOOOB ;external memory timing=no wait input, normal
;memory timing, no wait states, stack internal,
land DMA internal
ld PO,IOOH ;address begins at OOOOh, set upper byte
ld POM, /I 11111111B ;select all lines as address
ld PM,#00110000B ;enable port 0 as upper 8 bits address
ld H1C,#00000000B ;handshake not enabled port 0
port 1 is defined in romless part as address/data. it is not necessary
here to initialize that port
ld P2,J/00H ;port 2 outputs low
ld P3,/IOOH ;port 3 outputs low
ld P2AM,j/l0001010B ;p31,20,21 as output,p30 input
lit is necessary here to configure p30 as input
;for the receive data, and p31 as output for
;transmit data for UART
ld P2BM,j/l0101010B ;p32,33,22,23 as output
ld P2CM,j/l0101010B ;p34,35,24,25 as output
ld P2DM,j/l0101010B ;p36,37,26,27 as output
ld P4,J/00000000B ;clear port 4 register
ld P4D, #11111111B ;set all bits of P4 as inputs
ld P40D,J/0000OOOOB ;active push/pull [not necessary since all
; bits are inputs
,
;basic Super B I/O is initialized, now internal registers
ld RPO,/IOCOH ;set working register low to lower 8 bytes
ld RP1,J/OC8H ;set working register high to upper 8 bytes
ld SPL, J/OFFH ;set stack pointer to start at top of set two
;note here that only lower 8 bits are used
;for stack pointer. location OFFH is wasted
las stack operation. SPH is general purpose
; storage.
;now clear the internal memory and stack area
ld SPH,J/OFFH ;point to top of general purpose register
ZERO: clr @SPH izera it
dec SPH
jr nz,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
; now everything except working registers is cleared
; cpu and memory now initialized, set up timer for real time clock
ld SYM,J/OOOOOOOOB ;disable fast interrupt response
ld IPR,/l00000010B ;interrupt priority
;IRQ2>IRQ3>IRQ4>IRQ5>IRQ6>IRQ7>IRQO>IRQ1
ld IMR,#01000110B ;enable counter, rx and tx interrupts
sb1 ;select bank 1
ld COTCH,/I~HB(50000) ;high byte of time constant
ld COTCL,#~LB(50000) :low byte of time constant
;12,000,000 hertz I 4 / 50,000 = 60 hertz
;12 Mhz is xtal freq, 4 is internal divider
ld COM,#OOOOOlOOB ;p27,37 is I/O, programmed up/down, no capture
;timer mode is, selected
sbO ;select bank 0
ld COCT,/110100101B ;continuous, count down, load counter,
;zero count interrupt enable, enable counter
timer is set, now lets initialize the UART for polled operation
sb1 ;bank 1
ld· UMA, #01110000B
;time constant = (12,000,000/4/16/9600/2)-1=
;8.76 rounded to 9.
;note that a 12 Mhz does not make a very
;accurate baud rate source. error is large
ld UBGH,J/~HB(00009) ;high byte of time constant
ld UBGL,#~LB(00009) ;low byte of time constant
ld UMB,#00011110B ;p21=p21data,auto-echo is off, transmit and
;receive clock is baud rate generator output,
;baud rate generator input is system clock / 2,
;baud rate generator is enabled, loopback
lis disabled
1277
sbO ;select bank 0
ld UTC,1/10001000B ;select p31 as transmit data out, 1 stop bit
land transmit enable
ld UIE,I/OOOOOOOOB ;no interrupts, no OMA
ld URC,1/00000010B ;enable receive
;UART is initialized, enable interrupts for real time clock
ei ;enable interrupts
;
;wait 1 full second of serial line mark before sending anything
WAIT: cp second,i/'l ;wait 1 second
jr ne,WAIT
;display the logon message
LOGON: ldw MPTR,I/MSG ;load the address of MSG into word reg MPTR
call SENOM ;send the message
call TXWAT ;wait for transmitter to complete
;logon message displayed, get response from console
land move to upper register memory
GET: ld rl,1/80 ;maximum character count
ld r2,1I80H ;pbint to first location in upper register bank
di ;stop interrupts
or UIE,i/00000001B ;receive character enable
ei
;now wait for input to be completed
GW: tm UIE,i/00000001B ;wait for interrupt to be disabled
jr nz,GW ;if interrupt still enabled
,
;if carriage return typed, or 80 characters exceeded, echo message
ECHO: ldw MPTR,i/MSGl ;load the address of MSGl in word reg MPTR
call SENOM ;send the message
;
;since messages are interrupt driven, we must wait for message to
;complete before transmitting next message
call TXWAT ;wait on transmitter
ld rl,i/80 ;maximum character count
ld r2,i/80H ;first location of 9haracter buffer
ECH01: ld rO,@r2 ;get character from buffer
call SENOC ;send the character to console
cp rO,IICR ;carriage return?
jr eq,LOGON ;if so, end message display
inc r2 ;bump pointer
djnz rl,ECHOl ;display next character if not done
jr LOGON
;
.
; subroutines
;send message at MPTR until '$' character found
SENOM: ldci rO,@MPTR ;get the character
call SENOC ;start UART transmitting
di ;no interrupts
or UIE,i/00000100B ;enable transmit interrupts
ei
ret
;send character in rO
SENOC: tm UTC,i/00000010B ;transmit buffer empty yet
jr z,SENOC ;if not, wait until it is
ld UIo,rO ;load the character into the transmitter
ret
;transmit buffer available interrupt
TXOATI: ldci rO,@MPTR ;get next character to transmit
ld UIO,rO ;load the character in transmitter
cp rO,#'$' ;last character
jr eq,LASTT ;if last transmit character
iret
LASTT: and UIE, #1111l011B ;disable transmi~ interrupts
iret ;ignore it if no character to transmit
; transmitter wait routine
TXWAT: tm UIE,il00000100B ;wait until interrupts disabled
jr, nz,TXWAT ;wait if bit set
ret
1278
;receive character available interrupt
RXDATI: ld rO,UIO ;get input from console
and ro,#7fH ;remove upper parity bit
call SENDC ;echo to console
ld @r2,rO ;move to upper internal ram in Super8
cp rO,#CR ;was the received character a carriage return
jr eq,LASTR ;if so, disable interrupts
inc r2 ;bump pointer
djnz rl,RXR ;exit if not last
LASTR: and UIE,#lllllllOB ;disable the receive interrupts
RXR: iret
,
;real time interrupt running in background
TlMERO: inc period ;bump periodic counter (60 hertz)
cp period, #60 lone second yet?
jr ne,NOROLL ;no rollover
xor P2,#0000000lB ;complement the second bit
clr period ;start it over-again
inc second ;bump the seconds timer
cp second, #60 ;reached maximum
jr ne,NoROLL ;no rollover
xor P2,#000000lOB ;complement the minute bit
clr second ;start it over again
inc minute ;bump the minutes timer
cp minute, #60 ;reached maximum
jr ne,NOROLL ;no rollover
xor P2,#00000lOOB ;complement the hour bit
clr minute ;start it over again
inc hours ;bump the hours timer
cp hours, #24 ;reached maximum
jr ne,NOROLL ;no rollover
clr hours ;start it over again
NOROLL: or COCT,#OOOOOOlOB ;reset end of count
nop
nop
INTRET: iret land return from interrupt
1279
~ Zim Application Note
The SuperB, with its on-board DMA can reduce proces- Initially, the DMA transfers from EPROM. The address
sor overhead in data transfer tasks. It allows direct from which to transfer is CO and C1 as defined by the
transfer of serial input characters to either internal working register pOinters. It is necessary to set RPO to
register mernory (256 bytes) or external ram memory. CO to access the register, and it is accessed as RO and
For example, this transfer can be set to transfer a R1 or RRO. The count for the transfer is taken from DMA
specific number of input characters, then interrupt the COUNT HIGH and DMA COUNT LOW. For each trans-
processor. Processor program service overhead is mini- fer, initialize the address and count values. Upon com-
mal. Serial output characters can be transfered from ex- pletion of the DMA transmit process, when the count
ternal EPROM or ram memory, or the internal register goes to -1, a transmit interrupt is generated. The ex-
memory. ample program disables transmit interrupts and DMA,
and returns. The main line program was polling the inter-
The required setup for the DMA transfers are much the rupt enable bit for completion.
same as that of interrupt or polled operation. This
program example uses the DMA to interrupt upon ter- Next, the DMA is set up to transfer 25 characters into the
mination of data transfers so that approopriate vectors internal register memory. One must select internal
and routines are required. Since the program links to the memory in the EMT register by clearing bit O. The ad-
serial port, the DMA uses the serial port receive and dress for transfer requires only one byte, so that working
transmit interrupt vectors 10 and 13, respectively. Upon register 1 (R1), when RPO equals CO, is the address
completion of a receive DMA transfer, the service routine pointer. The DMA count must also be loaded, in this
defined by the receive vector is executed. Upon comple- case with 25. For demonstration purposes, the auto-
tion of the transrnit DMA transfer, service routine defined echo bit of the UART MODE B register is selected. This
by the transmit vector is executed. causes any characters received to be automatically
looped back to the transmit port. Finally, the receive in-
It is necessary to define the memory source/destination terrupt and DMA enable bits (BITS 0 and 1) are set to
by setting the appropriate state of bit 0 in the EXTERNAL enable and begin DMA operation. When 25 characters
MEMORY TIMING (EMT) register. Initially, the example have been input to the SuperB, a receive interrupt will be
program selects external memory as the source/destina- generated, and control will be transfered to the "RXDATI"
tion. A special note: read the fine print in the technical routine, where interrupts and DMA are disabled.
manual. Many hours were spent debugging the DMA
mode of operation, with the final realization that intemal The last routine in the example software sends another
rom does not qualify as external memory. Only that message from EPROM to the console and then sends
memory that would be selected if the /DM line was true the characters frorn the internal memory buffer that were
would be a valid source/destination. Since this article previously entered. The prime consideration is to
uses the hardware defined from the first of the series, remember to select the source/destination memory in the
and uses a ZB800 with external EPROM, it will work per- EMT register.
fectly. ROM and PIGGYBACK or prototype type parts
will not work. Neither will emulators. In this DMA example, the code is simple for DMA opera-
. . . . . . . . . . . . . . . . . . . . . .tion. It is important to note that this example does not
12Bl
fully utilize the functionality of the DMA transfer. The ex- under DMA controls and transmitting characters under
ample purposely waits in a software loop while the DMA interrupt control with processing occurring somewhere in
transfer occurs. This prevents the supporting code from the middle.
becoming too complex to follow for an example. Normal
operation might have the UART receiving characters
;===========================================================
;= TITLE: UART3.S
;= DATE: JULY 17, 1986
i= PURPOSE: TO DEMONSTRATE DMA
;= DRIVEN SERIAL PORT
;= COMMUNICATIONS
;= ASSEMBLER: ZILOG ASMS8 ASSEMBLER
;= PROGRAMMER: CHARLES M. LINK, II
i===========================================================
i***************************************************** ******
;* *
REGISTER EQUATE TABLE *
*
i***************************************************** ******
period: .equ 0 ;period timer
second: .equ 1 ;seconds timer
minute: .equ 2 ;minutes timer
hours: .equ 3 ;hours timer
;working register equates
MPTR: .equ RRO ;message pointer for external memory
i***************************************************** ******
i* *
INTERRUPT VECTOR TABLE *
i***************************************************** ******
*
INTRO: • WORD INTRET ;this area should always be defined
INTR1: • WORD INTRET ;as it reserves the lower 32 bytes
INTR2: . WORD INTRET ;for the interrupt table. the name
INTR3: . WORD INTRET ;of the subroutine for each particular
INTR4: . WORD INTRET ;interrupt service would normally be
INTR5: . WORD INTRET ;named here.
INTR6: . WORD TIMERO
INTR7: . WORD INTRET
INTR8: . WORD INTRET
INTR9: . WORD INTRET
INTRIO: . WORD RXDATI
INTRll: . WORD INTRET
INTR12: . WORD INTRET
INTR13: . WORD TXDATI
INTR14: • WORD INTRET
INTR15: . WORD INTRET
;***********************************************************
;* *
START OF PROGRAM EXECUTION *
;*********~******************************************* ******
*
START: jr STARTl ;program execution unconditionally
1282
:begins at this location after reset
:and power up.
• ASCII 'REL 0 7/17/86' :jump around optional ascii string
:containing release info, copyright, etc.
START1: di :begin
sbO :select register bank 0
ld EMT,#OOOOOOOIB :external memory timing=no wait input, normal
;memory timing, no wait states, stack internal,
:and DMA external
ld PO,i/OOH ;address begins at OOOOh, set upper byte
ld POM, #11111111B :select all lines as address
ld PM,/lOO110000B :enable port 0 as upper 8 bits address
ld H1C,i/OOOOOOOOB :handshake not enabled port 0
,
:port 1 is defined in romless part as address/data. it is not necessary
:here to initialize that port
ld P2,#OOH :port 2 outputs low
ld P3,#OOH :port 3 outputs low
ld P2AM,lI10001010B :p31,20,21 as output,p30 input
:it is necessary here to configure p30 as input
;for the receive data, and p31 as output for
:transmit data for UART
ld P2BM,iI10101010B :p32,33,22,23 as output
ld P2CM,i/10101010B :p34,35,24,25 as output
ld P2DM,1I10101010B :p36,37,26,27 as output
ld P4,i/OOOOOOOOB ;clear port 4 register
ld P4D, iI11111111B :set all bits of P4 as inputs
ld P40D,i/OOOOOOOOB :active push/pull [not necessary since all
: bits are inputs
,
;basic Super 8 I/O is initialized, now internal registers
ld RPO,i/OCOH :set working register low to lower 8 bytes
ld RP1,#OC8H :set working register high to upper 8 bytes
ld SPL,i/OFFH :set stack pointer to start at top of set two
:note here that only lower 8 bits are used
:for stack pointer. location OFFH is wasted
:as stacIe operation. SPH is general purpose
: storage.
: now clear the internal memory and stack area
ld SPH,/IOFFH :.point to top of general purpose register
ZERO: c1r @SPH ;zero it
dec SPH
jr nz,ZERO :do it until register set is all cleared
clr @SPH :zero last register
;now everything except working registers is cleared
:cpu and memory now initialized, set up timer for real time clocle
ld SYM,i/OOOOOOOOB :disable fast interrupt response
ld IPR,i/00000010B :interrupt priority
;IRQ2>IRQ3>IRQ4>IRQ5>IRQ6>IRQ7>IRQO>IRQ1
ld IMR,#01000110B :enable counter, rx and tx interrupts
sb1 :select bank 1
ld COTCH,#AHB(50000) :high byte of time constant
ld COTCL,#ALB(50000) :low byte of time constant
:12,000,000 hertz / 4 / 50,000 = 60 hertz
:12 Mhz is xtal freq, 4 is internal. divider
ld COM,#00000100B :p27,37 is I/O, programmed up/down, no capture
:timer mode is selected
sbO ;select bank 0
ld COCT,i/10100101B : continuous, count down, load counter,
:zero count interrupt enable, enable counter
timer is set, now lets initialize the UART for polled operation
sb1 :bank 1
ld UMA,#01110000B
:time constant = (12,000,000/4/16/9600/2)-1=
:8.76 rounded to 9.
:note that a 12 Mhz does not make a very
;accurate baud rate source. error is large
1283
ld UBGH,#AHB(00009) ;high byte of time constant
ld UBGL,#ALB(00009) ;low byte of time constant
ld UMB,#00011110B ;p2l=p2ldata,auto-echo is off, transmit and
;receive clock is baud rate generator output,
;baud rate generator input is system clock / 2,
;baud rate generator is enabled, loopback
lis disabled
sbO ;select bank 0
ld UTC,#10001000B ;select p31 as transmit data out, 1 stop bit
land transmit enable
ld UIE,#OOOOOOOOB ;no interrupts, no DMA
ld URC,#00000010B ;enable receive
;UART is initialized, enable interrupts for real time clock
ei ;enable interrupts
;because uart was just enabled, allow data line to mark for at least 1 second
WAIT: cp second,il1
jr ne,WAIT ;wait 1 second
;display the logon message
LOGON: ldw MPTR, #MSG ;load the address of MS y into word reg MPTR
call SENDM ;send the message
call TXWAT ;wait for transmitter to complete
;logon message displayed, get response from console
land move to upper register memory
GET: di ;no interrupts while setting up for DMA
ldw MPTR,#OOBOH ;first character receive location
and EMT, #111111l0B ;select register file for receiving character
sb1 ;select bank one
ld DCH,#O ;DMA count high byte
ld DCL,U5 ;DMA count low byte
or UMB,#00100000B ;auto echo enable
sbO ;restore to bank zero
or UIE, #OOOOOOl1B ;receive character DMA link, interrupt enable
ei
call RXWAT ;wait for receiver to complete receiving input
,
;receive characters in buffer, restore SuperB non DMA state
di ;no interrupts while cleaning up
sb1 ;bank 1
and UMB,il11011111B ;disable auto echo
sbO ;restore bank 0
or EMT,#OOOOOOOlB ;select data memory for DMA transfers
ei
;25 characters received via DMA, now display "ECHO" message
ECHO: ldw MPTR,#MSG1 ;load the address of MSG1 in word reg MPTR
call SENDM ;send the message
call TXWAT ;wait on transmitter
message sent, now replay typed input
di
ldw MPTR,#OOBOH ;point to beginning of buffer.
and EMT, #11111110B ;select register bank for DMA transfer
sb1 ;select bank 1
ld DCH,#O ;DMA count high byte
ld DCL,#25 ;DMA count low byte
sbO ;select bank 0
or UIE,#00000100B ;enable transmit interrupts
or UTC,#OOOOOOOlB ;transmit DMA enable
ei ;enable interrupts
call TXWAT ;wait on transmitter
di
or EMT,#OOOOOOOlB ;select external data memory for DMA transfer
ei
replay complete, loop back and do it again
jr LOGON
1284
,
; subroutines
;send message at MPTR for length in first byte
SENDM: ldci r7,@MPTR ;get the character
dec r7 ;count actually should be n-1 for n bytes
di ;no interrupts while setting up
or EMT,#00000001B ;select external data memory for DMA transfer
sb1 ;select bank 1
ld DCH,#O ;DMA count high byte is 0
ld DCL,r7 ;move the count DMA count low byte
sbO ;select bank 0
or UIE,#00000100B ;enable transmit interrupts
or UTC,#00000001B ;transmit DMA enable
ei
ret
;transmit DMA complete
TXDATI: and UIE, #11111011B ;disable transmit interrupts
and UTC, #11111110B ;disable transmit DMA
iret ;ignore it if no character to transmit
; transmitter wait routine
TXWAT: tm UIE,#00000100B ;wait until interrupts disabled
jr nz,TXWAT ;wait if bit set
ret
;receive character available interrupt
RXDATI: and UIE,#11111100B ;disable the receive interrupts
iret
;receive wait routine
RXWAT: tm UIE,ilo0000001B ;wait until interrupts disabled
jr nz,RXWAT ;wait if bit still set
ret
oreal time interrupt running in background
TIMERO: inc period ;bump periodic counter (60 hertz)
cp period,il60 tone second yet?
jr ne,NOROLL :no rollover
xor P2,ilOOOOOO01B ;complement the second bit
clr period ; start it over again
inc second ;bump the seconds timer
cp second,il60 ;reached maximum
jr ne,NOROLL :no rollover
xor P2,ilOOOOO010B ;complement the minute bit
clr second ;start it over again
inc minute ;bump the minutes timer
cp minute, #60 ;reached maximum
jr ne,NOROLL ;no rollover
xor P2,#00000100B ;complement the hour bit
clr minute ; start it over again
inc hours ;bump the hours timer
cp hours, #24 ;reached maximum
jr ne,NOROLL ;no rollover
clr hours ; start it over again
NOROLL: or COCT,#00000010B ; reset end of count
nop
nop
INTRET: iret ;and return from interrupt
MSG: . BYTE 56
. ASCII CR,LF,'Super8 Uart DMA test program.',CR,LF
• ASCII 'Enter 25 characters',CR,LF,'$'
MSG1: . BYTE 34
. ASCII CR,LF,'Echoed back, your line was .•• ',CR,LF,'$'
.END
1285
~ ZiIill Application Note
1287
table and the sample frequency, very accurate sine fre- With the addition of a filter with sharp cutoff just above
quencies may be generated. Calculate the actual error the highest desired frequency, the SuperS serves quite
by using the following formula: well as a programmable sine wave generator. In addition
to sine waves, complex waveforms may be easily
[ ABS ( REAL FREQI - INTEGER FREQI) I REAL FREQI IX generated by the Super8 with the addition of the low-cost
100=% ERROR DAC. The next article in this series will describe how to
generate some of these more complex waveforms.
where REAL FREQI is the actual calculated frequency
increment, INTEGER FREQI is the nearest rounded in-
teger of the calculated frequency increment, and the
result is the actual percent error form the desired value .
1288
INTR8: • WORD INTRET
INTR9: • WORD INTRET
INTR10: • WORD INTRET
INTR11: • WORD INTRET
INTR12: • WORD INTRET
INTR13: • WORD INTRET
INTR14: • WORD INTRET
INTR15: • WORD INTRET
,
:***********************************************************
i* *
;* START OF PROGRAM EXECUTION *
:* *
;***********************************************************
START: jr START1 ;program execution unconditionally
;begins at this location after reset
land power up.
• ASCII 'REL 0 6/16/86' ;jump around optional ascii string
;containing release info, copyright, etc.
START1: di ; begin
sbO ;select register bank 0
Id EMT,#OOOOOOOOB ;external memory timing=no wait input, normal
;memory timing, no wait states, stack internal,
land DMA internal
Id PO,#OOH ;address begins at OOOOh, set upper byte
Id POM,1I11111111B ;select all lines as address
Id PM,1I00110000B ;enable port 0 as upper 8 bits address
Id H1C,#000OOOOOB ;handshake not enabled port 0
,
;port 1 is defined in romless part as address/data. it is not necessary
;here to initialize that port
Id P2, #OOH ;port 2 outputs low
Id P3,IIOOH ;port 3 outputs low
Id P2AM, #10101010B ;p30,31,20,21 as output
Id P2BM,#10101010B ;p32,33,22,23 as output
Id P2CM,#10101010B ;p34,35,24,25 as output
Id P2DM,#lo101010B ;p36,37,26,27 as output
Id P4,#10000000B ;set midpoint for DAC inputs
Id P4D,#OOOOOOOOB ;set all bits of P4 as output
Id P40D,#00000000B ;active push/pull
,
;basic Super 8 I/O is initialized, now internal registers
ld RPO,#OCOH ;set working register low to lower 8 bytes
ld RP1,#OC8H ;set working register high to upper 8 ·bytes
ld SPL,IIOFFH ;set stack pointer to start at top of set two
;note here that only lower 8 bits are used
;for stack pointer. location OFFH is wasted
las stack operation. SPH is general purpose
; storage.
;now clear the internal memory and stack area
,ld SPH,IIOFFH ;point to top of general purpose register
ZERO: clr @SPH ;zero it
dec SPH
jr nZ,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
;now everything except working registers is cleared
;cpu and memory now initialized, set up timer for real time clock
Id SYM,IIOOOOOOOOB ;disable fast interrupt response
ld IPR,#00000010B ;interrupt priority
;IRQ2>IRQ3>IRQ4>IRQ5>IRQ6>IRQ7>IRQO>IRQ1
Id IMR,#00000100B ;enable only interrupt 2
sb1 ;select bank 1
Id COTCH,#AHB(CTVAL) ;high byte of time constant
Id COTCL,#ALB(CTVAL) ;low byte of time constant
Id COM,II00000100B ;p27,37 is I/O, programmed up/down, no capture
;timer mode is selected
sbO ;select bank 0
ld COCT,#10100101B ; continuous , count down, load counter,
1289
;zero count interrupt enable, enable counter
,
; timer is_initialized, now lets enable interrupts and wait
ldw INCR,/Il ;start at the beginning of sine table
ldw FINCR,#FREQI ;load frequency of increment
ldw POINT,#SINTAB ;pointer points to sine table
ld CVAL,#080H ;initial value to prevent glitch at start
ei ;enable interrupts
WAIT: nop
nop
nop
nop
jr WAIT ;loop back
,
;Timer interrupt. Occurs SAMPLE times per second
;interrupt outputs value to DAC-08 and then determines value for next
; interrupt. This assures no bit jitter.
TIMERO: ld p4,CVAL ;write new value to DAC-08
rcf ;clear carry flag
add INCRL,FINCRL ;find next position in sine table
adc INCRH,FINCRH ;by adding frequency offset to last position
ld POINTL,INCRH ;set new pointer into sine table
;upper byte ok since on boundary
ldc CVAL,@POINT ;get value from sine table
or COCT,#00000010B ;reset end of count interrupt
INTRET: iret land return from interrupt
,
;***********************************************************
;* *
SINE WAVE LOOKUP **
:*
;************.**********************************************
,
;sine table for sine wave generation using DAC-08. Table based upon
;case of waveform with minumum amplititude = 0 volts and maximum
;amplititude = 5 volts. DAC-08 input for 0 volts = OOH
;5 volts = OFFH. Table generated using following BASICA program,
;then typed into program.
10 CLS ;clear screen
20 PI=3.141593 ;define PI
30 FOR 1=0 TO 255 ;256 total values
40 C=360/256 ;define basic interval value
50 D=C*I ;value from zero on sine wave
60 E=D*PI/180
70 F=SIN(E) ;figure sine for interval from 0
80 G=F*127 ;sine range should be from -127 to 127
90 H=128+G ;make result from 0 to 255
100 J=CINT(H) ;round to nearest integer
110 A$=HEX$(J) ;convert to hex
120 PRINT A$ Ion screen
130 LPRINT A$ Ion printer
140 NEXT ;do next inverval
150 END
;
;*note-remove comments, BASICA will not accept ; as comment delimiter
1290
• byte 099H,096H,093H,090H,08CH,089H,086H,083H,080H,07DH,07AH,077H
• byte 074H,070H,06DH,06AH,067H,064H,06IH,OSEH,05BH,058H,055H,052H
• byte 04FH,04DH,04AH,047H,044H,04IH,03FH,03CH,039H,037H,034H,032H
• byte 02FH,02DH,02BH,028H,026H,024H,022H,020H,OIEH,OICH,OIAH,Ol8H
• byte Ol6H,OI5H,OI3H,OIIH,OIOH,OOFH,OODH,OOCH,OOBH,OOAH,008H,007H
• byte 006H,006H,005H,004H,003H,003H,002H,002H,002H,OOIH,OOIH,OOIH'
• byte OOIH,OOIH,OOIH,OOIH,002H,002H,002H,003H,003H,004H,005H,006H
• byte 006H,007H,008H,OOAH,OOBH,OOCH,OODH,OOFH,OIOH,OlIH,OI3H,OISH
• byte OI6H,OI8H,OIAH,OICH,OIEH,020H,022H,024H,026H,028H,02BH,02DH
• byte 02FH,032H,034H,037H,039H,03CH,03FH,04IH,044H,047H,04AH,04DH
• byte 04FH,052H,055H,058H,05BH,05EH,06IH,064H,067H,06AH,06DH,O70H
• byte 074H,077H,07AH,07DH
• END
1291
~ Zilffi Application Note
1293
.TITLE Supers Example DTMF Generation
:===========================================================
;= TITLE: DTMF.S
;= DATE: JUNE 17, 19S6
i= PURPOSE: TO DEMONSTRATE USING SUPERS
;= TO GENERATE HIGH QUALITY DTMF
:= WAVES.
:= HARDWARE: DAC-OS ON PORT 4
:= SEE DIAGRAM
:= ASSEMBLER: ZILOG ASMSS ASSEMBLER
:= PROGRAMMER: CHARLES M. LINK, I I
;===========================================================
:***********************************************************
:* *
;* REGISTER EQUATE TABLE *
:* *
i***************************************************** ******
,
;column tone equates
CINCR: .equ rrO ;current increment in sine table
CINCRH: .equ rO ;high byte of current increment value
CINCRL: .equ rl ;low byte of current increment value
CFINCR: .equ rr2 ;increment in sine table for frequency
CFINCH: .equ r2 ;high byte of frequency increment value
CFINCL: .equ r3 ;low byte of frequency increment value
POINT: .equ rr4 ;pointer into sine table
POINTH: .equ r4 ;high byte of sine table pointer
POINTL: .equ r5 ;low byte of sine table pointer
;row tone equates
RINCR: .equ rr6 ;current increment in sine table
RINCRH: .equ r6 ;high byte of current increment value
RINCRL: .equ r7 ;low byte of current increment value
RFINCR: .equ rrS ;increment in sine table for frequency
RFINCH: .equ rS ;high byte of frequency increment value
RFINCL: .equ r9 ;low byte of frequerlcy increment value
CVAL: .equ rIO ;current value to output to DAC-08
RVAL: .equ rll ;current row value
i***************************************************** ******
:* *
;* GENERAL EQUATES *
:*, *
;***********************************************************
XTAL: .equ 12000000 ;crystal freq in hertz
SAMPLE: .equ SOOO ;sample frequency in hertz
CTVAL: .equ XTAL/4/SAMPLE ;counter load value
T~BSTP: .equ 256 ;number of values in sine table
CFREQ: .equ 1209 ;desired column frequency
RFREQ: .equ 697 ;desired row frequency
CFREQI: .equ (TABSTP*256*CFREQ)/SAMPLE
RFREQI: .equ (TABSTP*256*RFREQ)/SAMPLE
;note dtmf frequencies are 697,770,S52,941,1209,1336,1477,1633
:***********************************************************
:* *
;* INTERRUPT VECTOR TABLE *
:* *
:***********************************************************
INTRO: • WORD INTRET ;this area should always be defined
INTRl: • WORD INTRET las it reserves the lower 32 bytes
INTR2: • WORD INTRET ;for the interrupt table. the name
INTR3: • WORD INTRET ;of the subroutine for each particular
INTR4: • WORD INTRET ;interrupt service would normally be
INTR5: • WORD INTRET ;named here.
INTR6: • WORD TIMERO
INTR7: .WORO INTRET
INTRS: • WORD INTRET
INTR9: • WORD INTRET
INTR10: • WORD INTRET
1294
INTRll: .WORD INTRET
INTR12: .WORD INTRET
INTR13: .WORD INTRET
INTR14: '. WORD INTRET
INTR15: .WORD INTRET
,
;***********************************************************
i* *
;* START OF PROGRAM EXECUTION *
:* *
:***********************************************************
START: jr START1 ;program execution unconditionally
;begins at this location after reset
land power up.
• ASCII 'REL 0 6/16/86' ;jump around optional ascii string
;containing release info, copyright, etc.
START1: di ;begin
sbO ;select register bank 0
ld EMT,IIOOOOOOOOB ;external memory timing=no wait input, normal
;memory timing, no wait states, stack internal,
land DMA internal
ld PO,IIOOH ;address begins at OOOOh, set upper byte
1d POM,#llllllllB ;select all lines as address
1d PM,lIOOllOOOOB ;enable port 0 as upper 8 bits address
ld H1C,#OOOOOOOOB ;handshake not enabled port 0-
;port 1 is defined in romless part as address/data. it is not necessary
;here to initialize that port
ld P2,II00H ;port 2 outputs low
ld P3,#00H ;port 3 outputs low
ld P2AM,iIl0101010B ;p30,31,20,21 as output
ld P2BM,iIl0101010B ;p32,33,22,23 as output
ld P2CM,#10101010B ;p34,35,24,25 as output
ld P2DM,iIl0101010B ;p36,37,26,27 as output
ld P4,IIIOOOOOOOB ;set midpoint for DAC inputs
ld P4D,#00000000B ;set all bits of P4 as output
ld P40D,#00000000B ;active push/pull
,
;basic Super 8 I/O is initialized, now internal registers
ld RPO,IIOCOH ;set working register low to lower 8 bytes
Id RP1,IIOC8H ;set working register high to upper 8 bytes
ld SPL,#OFFH ;set stack pointer to start at top of set two
;note here that only lower 8 bits are used
;for stack pointer. location OFFH is wasted
las stack operation. SPH is general purpose
;storage.
;now clear the internal memory and stack area
ld SPH,#OFFH ;point to top of general purpose register
ZERO: clr @SPH ;zero it
dec SPH
jr nZ,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
;now everything except working registers is cleared
;cpu and memory now initialized, set up timer for real time clock
ld SYM,IIOOOOOOOOB ;disable fast interrupt response
ld IPR,IIOOOOOOIOB ;interrupt priority
;IRQ2>IRQ3>IRQ4>IRQ5>IRQ6>IRQ7>IRQO>IRQ1
ld IMR,#OOOOOlOOB ;enable only interrupt 2
sb1 ;select bank 1
ld COTCH,#~HB(CTVAL) ;high byte of time constant
ld COTCL,#~LB(CTVAL) ;low byte of time constant
ld COM,#OOOOOlOOB ;p27,37 is I/O, programmed up/down, no capture
;timer mode is selected
sbO ;select bank 0
ld COCT,IIIOI0010IB ; continuous , count down, load counter,
;zero count interrupt enable, enable counter
:
;timer is initialized, now lets enable interrupts and wait
Idw eINeR, #1 ;start column at beginning of sine table
ldw RINCR, #l : start row at beginning of sine table
1295
;this example loads the tones for digit 11'
;user software would, of course have to manipulate these registers for
;proper tone control
ldw CFINCR, #CFREQI ; load column frequency increment
ldw RFINCR, #RFREQI ; load row frequency increment
ldw POINT,#SINTAB ;pointer points to sine table
ld CVAL,,080H ; initial value to prevent glitch at start
ei ;enable interrupts
WAIT: nop
nop
nop
nop
, jr WAIT ;loop back
1Timer interrupt. Occurs SAMPLE times per second
,interrupt outputs value to OAC-OS and then determines value for next
,
1 interrupt. This assures 'no bit jitter.
••••• **.**.**
: sine table for DTMF generation using CAC-08. Table based upon
lease of waveform consisting of two sine waves summed to provide a single
;eo~plex waveform. with minumum amplititude = 0 volts and maximum
,amplititude - 5 volts. OAC-OB input for 0 volts = OOH
;5 volts - OFFH. Both waves must total no more than OFFH, therefore
;maximum for one wav~ must be 1/2 5 volts or 080H.
;Table generated using following BASICA program,
,,then typed into proqram.
10 CLS : clear screen
20 PI=3.141593 :define PI
30 FOR 1-0 TO 255 : 256 total values
40 C,,;360/256 :define basic interval value
50 D=C*I :value from zero on sine wave
60 E=O*PI/180
70 F=SIN(E) : fiqure sine for interval from 0
80 G=F*63 ;sine range should be from -63 to 63
90 H"*64+G :make result from 0 to 127
100 J-CINT (H) : round to nearest integer
110 A$-HEX$ (J) ; convert to hex
120 PRINT A$ Ion screen
130 LPRINT A$ Ion printer
140 NEXT ; do next inverval
, 150 EJlO
1296
~ ZiIffi Application Note
A SIMPLE SERIAL TO
PARALLEL CONVERTER
USING THE ZILOG SUPER8
by Charles M. Link, II
The Zilog SuperS has many on-board peripherals that Hardware for this application is fairly simple. Port 4 is
provide multiple user applications. Earlier articles have buffered and hooked to the data lines, as shown, to
demonstrated simple application ·stubs· or short test interface to a centronics type printer connector. The
programs. This article and the next article demonstrate a strobe from P25 provides the strobe (pin 1) to the printer.
useful application for the SuperS. Although it The acknowledge line from the printer is inverted and
underutilizes the SuperS's power, the simple serial to tied to P24 of the SuperS. The busy signal from the
parallel converter in this application and the print buffer in printer is buffered and tied to P23 of the SuperS. The
the next application demonstrate the ease at which design was tested on an Okidata printer and is not
applications are developed with the SuperS. guaranteed to work on all printers.
The Zilog SuperS has several features that enhance its Software is fairly straightforward. The serial port is
use as a communication controller. The interrupt or DMA initialized just like it was in the application article on the
driven serial port are helpful, but the handshaking interrupt driven serial port. Port 4 must be set-up as
parallel pnrts finish the job. In the serial to parallel outputs with activ!'! push-pull drivers. Port 2, bits 3 and 4,
converter, the 256 byte internal register memory is used are set up as input with P24 set to enable interrupts. P25
as a small circular queue. is set as output and handshake 0 is set in HOC to provide
a strobe of 16 clock periods in length .
:===========================================================
;= TITLE: SERPAR.S
;= DATE: JULY 17, 19B6
;= PURPOSE: TO DEMONSTRATE INTERRUPT
;= DRIVEN SERIAL PORT IN A
;= REALISTIC APPLICATION.
:= THIS APPLICATION RECEIVES
;= SIMPLE SERIAL DATA A SENDS IT
i= OUT THE PARALLEL PORT TO A
;= PRINTER.
i= ASSEMBLER: ZILOG ASMSB ASSEMBLER
;= PROGRAMMER: CHARLES M. LINK, II
;===========================================================
i***************************************************** ******
:. *
REGISTER EQUATE TABLE *
:***********************************************************
*
,
;working register equates
INPNT: .equ R3 ;input character pointer
OUTPNT: .equ R4 ;output character pointer
1297
MPTR: .equ RR6 ;message pointer for external memory
ACKB: .equ RS ;byte containing acknowledge bit
ACKBIT: .equ o ;bit set = no acknowledge yet
;bit clear = not waiting on acknowledge
,
:******************************************************.* •••
i* *
INTERRUPT VECTOR TABLE *
*
i*A* •••••••••••••••••••• * ••••••••••••••••••••••••••••• *.* •••
1298
ld SPH,#OFFH' ;point to top of general purpose register
ZERO: clr @SPH ;zero it
dec SPH
jr nz,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
timer is set, now lets initialize the UART for polled operation
sb1 ;bank 1
ld UMA,/l01110000B
;time constant ; (12,000,000/4/16/9600/2)-1=
;8.76 rounded to 9.
;note that a 12 Mhz'does not make a very
;accurate baud rate source. error is large
ld UBGH,/I~HB(00009) ;high byte of time constant
ld UBGL,/I~LB(00009) ;low byte of time constant
ld UMB,#00011110B ;p21;p21data,auto-echo is off, transmit and
;receive clock is baud rate generator output,
;baud rate generator input is system clock / 2,
;baud rate generator is enabled, loopback
lis disabled
sbO ;select bank 0
ld UTC,#10001000B ;select p31 as transmit data out, 1 stop bit
land transmit enable
ld UIE,#OOOOOOOlB ;receive interrupts, no DMA
ld URC,#00000010B ;enable receiver
UART is initialized, reset acknowledge bit and begin
di
bits ACKB,/IACKBIT ;set acknowledge bit before writing to output
ld P4,@OUTPNT ;send the character
tm P2,/l00000001B
1299
jr z,HON ;if host is on
ld rO,OUTPNT ;get the output pointer
xor rO,/IloOOOOOOB ;add 128 to it
cp INPNT,rO ;turn host back on when 128 bytes left in buf
jr ne,HON ;otherwise keep sending
and P2, #11111110B ;host back on
HON: nop
inc OUTPNT ;bump pointer
ei Ito make sure pointer not changed
ret
,
;send character in rO
SENDC: tm UTC,#00000010B ;transmit buffer empty yet
jr z,SENDC ;if not, wait until it is
ld Ulo,rO ;load the character into the transmitter
ret
;receive character available interrupt
RXDATI: ld rO,UIO ;get input from console
and rO,#7fH ;remove upper parity bit
call SENDC ;echo to console
ld @INPNT,rO ;save the character
inc INPNT ;bump input pointer
cp INPNT,OUTPNT ;has the input made a complete loop?
jr ne,RXIT
,
;receive character buffer full, stop sending device
or P2,#00000001B ;raise DTR to stop host sending
INTRET:
RXIT: iret
ACKSTB: tm P2,j/00010000B lis line low or high now
bitr ACKB,#ACKBIT ;reset acknowledge bit in register
ACKS1: tm P2,#00010000B ;test ack bit
jr z,ACKS1 ;wait here till end of strobe
ld P2BIP,#OOOOOOOlB ;reset p24 interrupt pending register
iret land return
MSG: .ASCII CR,LF,'super8 serial/parallel test program.',CR,LF
.ASCII 'Second line test data',CR,LF,'$'
• END
;===========================================================
;= TITLE: SERPAR1.S
;= DATE: JULY 17, 1986
:= PURPOSE: TO DEMONSTRATE INTERRUPT
;= DRIVEN SERIAL PORT IN A
;= REALISTIC APPLICATION.
;= THIS APPLICATION RECEIVES
;= SIMPLE SERIAL DATA A SENDS IT
:= OUT THE PARALLEL PORT TO A
:= PRINTER. FLOW CONTROL IS BY
;= XON/XOFF COMMANDS ON THE BACK
;= CHANNEL TO THE HOST
;= ASSEMBLER: ZILOG ASMS8 ASSEMBLER
;= PROGRAMMER: CHARLES M. LINK, II
;===========================================================
1300
XON: .equ 11H ;control-Q or DCl
XOFF: .equ l3H ;control-S or DC3
:*****************************************************.* •• *.
;* *
;* REGISTER EQUATE TABLE *
:****._.*** •••• *.*.*.*** ••••• * •••• * ••• *.** •• ** •••••••• *.** ••*
;working register equates
INPNT: .equ R3 ;input character pointer
OUTPNT: .equ R4 ;output character pointer
MPTR: .equ RR6 ;message pointer for external memory
ACKB: .equ R5 ;byte containing acknowledge bit
ACKBIT: .equ 0 ;bit set = no acknowledge yet
;bit clear = not waiting on acknowledge
.
XBIT: .equ 1 ;XOFF send to host
:** •• *••••• *_* ••• * •••••• _.**** •••• * •••• **.*.***.**** •• **It*.*
:* *
;* INTERRUPT VECTOR TABLE *
:. *
:******************************************************.A.**
INTRO: •WORD INTRET ;this area should always be defined
INTRl: •WORD INTRET las it reserves the lower 32 bytes
INTR2: •WORD INTRET ;for the interrupt table. the name
INTR3: •WORD INTRET ;of the subroutine for each particular
INTR4: •WORD INTRET ;interrupt service would normally be
INTR5: • WORD INTRET ;named here.
INTR6: •WORD INTRET
INTR7: • WORD INTRET
INTR8: • WORD INTRET
INTR9: •WORD INTRET
INTRlO: • WORD RXDATI ;receive data interrupt
INTR11: •WORD INTRET
INTRl2: • WORD INTRET
INTRl3: • WORD INTRET
INTRl4: •WORD ACKSTB ;acknowledge strobe interrupt
.
INTRl5: •WORD INTRET
i***************************************************** *A.***
:. *
;* START OF PROGRAM EXECUTION *
:* •.
;**************~************************************** A.***.
1301
ld P400,#00000000B ;active push/pull
ld HOC,#11110001B ;handshake enable for port 4, 16 clock pulse
basic Super 8 I/O is initialized, now internal registers
ld RPO,'OCOH ';set working register low to lower 8 bytes
ld RP1,J/OC8H ;set working register high to upper 8 bytes
ld SPL,#OFFH ;set stack pointer to start at top of set two
;note here that only lower 8 bits are used
;for stack pointer. location OFFH is wasted
las stack operation. SPH is general purpose
; storage.
;now clear the internal memory and stack area
ld SPH,#OFFH ;point to top of general purpose register
ZERO: clr @SPH ;zero it
dec SPH
jr nz,ZERO ;do it until register set is all cleared
clr @SPH ;zero last register
now everything except working registers is cleared.
cpu and memory now initialized, set up timer for real time clock
ld SYM,j/OOOOOOOOB ;disable fast interrupt response
ld IPR, j/lOll1111B ;interrupt priority
;IRQ6>IRQ7>IRQ5>IRQ4>IRQ3>IRQ2>IRQ1>IRQO
ld IMR,#01010000B ;rx interrupts, acknowledge strobe
timer is set, now lets initialize the UART for polled operation
sb1 ;bank 1
ld UMA,#01110000B
;time constant = (12,000,000/4/16/9600/2)-1=
;8.76 rounded to 9.
;note that a 12 Mhz does not make a very
;accurate baud rate source.· error is large
ld UBGH,#~HB(00009) ;high byte of time constant
ld UBGL,#ALB(00009) ;low byte of time constant
ld UMB,#00011110B ;p21=p21data,auto-echo is off, transmit and
;receive clock is baud rate generator output,
;baud rate generator input is system clock / 2,
;baud rate generator is enabled, I09pback
lis disabled
sbO ;select bank 0
ld UTC,'10001000B ;select p31 as transmit data out, i stop bit
land transmit enable
ld UIE,#OOOOOOOlB ;receive interrupts, no OMA
ld URC,#00000010B ;enable receiver
UART is initialized, reset acknowledge bit and begin
bitr ACKB,#ACKBIT ;reset acknowldege bit if set
bitr ACKB,#XBIT ;reset XON/XOFF bit
ld P2BIP,#00000001B ;reset interrupt input flip-flop
ei ;enable interrupts
WAIT: ldw MPTR,#MSG ;point to message
call SENOM ;send the message
ld INPNT,j/O ;set input pointer to register 0
ld OUTPNT,#O .;set output pointer to register 0
WAIT1: call SNOBUF ;send any characters in buffer
jr WAIT1 ;loop back
1303
SNDBUF: cp INPNT,OUTPNT ;compare inpointer to outpointer
jr ne,SCl ;send character if any to send
ret ;otherwise return
SC1: tm P2,'00001000B ;printer busy?
jr nz,SC1 ;if so, wait until it is not busy
btjrt" SC1,ACKB,'ACKBIT ;see if acknowledge has occurred
;from possible last byte
di
bits ACKB,#ACKBIT ;set acknowledge bit before writing to output
ld P4,@OUTPNT ;send the character
btjrf HON,ACKB,j/XBIT ;host is still sending
ld rO,OUTPNT ;get the output pointer
xor rO,UOOOOOOOB ;add 128 to it
cp INPNT,rO ;turn host back on when 128 bytes left in buf
jr ne,HON ;otherwise keep sending
ld rO,XON ;send XON to host to start it sending again
call SENDC
bitr ACKB,/lXBIT ;reset XOFF bit
HON: nop
inc OUTPNT ;bump pointer
ei Ito make sure pointer not changed
ret
;send character in rO
SENDC: tm UTC,'00000010B ;transmit buffer empty yet
jr z,SENDC ;if not, wait until it is
ld UIO,ro ;load the character into the transmitter
ret
;receive character available interrupt
RXDATI: ld ro,UIO ;get input from console
and rO,#7fH ;remove upper parity bit
call SENDC ;echo to console
ld @INPNT,rO ;save the character
inc IN!?NT ;bump input pointer
ld rO,INPNT ;get the input pointer
add rO,'S ;allow S characters after XOFF
cp rO,OUTPNT ;has the input made a complete loop?
. jr ne,RXIT
;receive character buffer full, stop sending device
ld rO,'XOFF ;send XOFF to host
call SENDC ;send it
bits ACKB,#XBIT ;set the XOFF bit
INTRET:
RXIT: iret
ACKSTB: tm P2,'OOO10000B lis line low or high now
bitr ACKB,#ACKBIT ;reset acknowledge bit in register
ACKS1: tm P2,'00010000B ;test ack bit
jr z,ACKS1 ;wait here till end of strobe
ld P2BIP,#00000001B ;reset p24 interrupt pending register
iret land return
MSG: .ASCII CR,LF,'Super8 serial/parallel test program.',CR,LF
.ASCII 'Second line test data',CR,LF,'$'
• END
1304
ADDITIONAL INFORMATION
1305
Support Products Summary
1307
~
(..)
..-•
•-.
.-•
•
=c
••
•
·1 1
• •
·Excludlng SPI
•Zilog Z86C0800ZDP Required
Z0860000ZCO
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z8 Development Board
CMOS Z86C91 MPU
12 MHz Crystal
(32K)/8K x 8 EPROM
(32K)/8K x 8 STATIC RAM
RS-232C PC Interface
Z86C91 Expansion Header
Cables
25-Pin RS-232 Cable
Dimensions
Width: 4.0 in. (10.2 cm)
Length: 8.0 in. (20.3 cm)
Serial Interface
RS-232C @ 9600 baud
1309
Z0860000ZDP
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z8&00 Adapter Board
PC Board
ORDERING INFORMATION
Part No: Z0860000ZDP
SUPPORTED DEVICES
Z8&OO
DESCRIPTION
The Z8600 Adapter Kit allows a standard Z8
emulator to emulate a Z8600 mieroeontroller
by converting a 40-pin Z8 pinout to a 28-pin
Z8 pinout.
SPECIFICATIONS
Power Requirements
Not Applicable
DlmellSlons
Width: 0.9 in. (2.3 cm)
Length: 2.2 in. (5.4 em)
1310
Z0860200ZCO
PRODUCT SPECIFICATION
KIT CONTENTS
Z086021011102 Keyboard
NMOS Z08602 MPU
2 MHz Crystal
101/102 Keyboard Option
3LEDs
Two 8-Position Dip Switches
6"J4QCommunication Header
SPECIFICATIONS
Power Requirements
+5 Vdc @ .2 A (Supplied By PC)
Dimensions
Width: 4.6in.(11.7cm)
Length: 9.3 in. (23.6 cm)
1311
Z0860200ZDP
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z08602 Adapt. Board
40-pin Z08601/Z08611 MPU Socket
40-pin Z08602 Connecter
Docullentatlon
Z08602 Adapter Kit User Guide
ORDERING INFORMATION
Part No: Z0860200ZDP
SUPPORTED DEVICES
Z08602
DESCRIPTION
The Z08602 adapter board is a tool used to
adapt a standard Z8601 type device or
emulation system to a Z8602 target socket.
SPECIFICATIONS
Power Requirements
Not Applicable
Dimensions
Width: 1.3 in. (3.3 cm)
Length: 2.3 in. (5.8 cm)
1312
Z86C0800ZCO
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C08 Application Board
CMOS Z86C08 MPU
4 MHz Crystal
Four 7-segment LED Displays
17 Key Keypad
SPECIFICATIONS
Power Requirements
+5Vdc@50mA
Dimensions
Width: 4.4in.(11.2cm)
Length: 4.8 in. (12.2 cm)
1313
Z86C0800ZDP
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C08 Adapter Board
40-pin Z8 MPU Socket
18-pin Z86C08 Socket
12 MHz Crystal
Gables
18-Pin Z86C08 Emulation Cable
'- .
Documentation
Z86C08 Adapter Kit User Guide
'DESCRIPTION
The Z86C08 adapter board converts the Z8
4O-pin pinout to a Z8 18-pin part. This'
adapter board allows a standard Z8 emula-
tion device to emulate the Z86C08. The
Z86C08 Adapter Board is placed between
the Z8 emulator and the user's target
socket. The board does not emulate the
watchdog timer function.
SPECIFICATIONS
P..,.r R....Ire_nts
Not Applicable
DI_nslans
Width: 2.5 in. (6.4 cm)
Length: 2.9 in. (7.4 cm)
1314
Z86C0800ZEM
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C08 Emulation Board
CMOS Z86C12 ICE
4 MHz Crystal
EP900LC-3 EPLD
(32K)/8K x 8 EPROM Socket
Z86E08 Socket
8-Position Dip Switch
Cables
18-Pin Z86C19 Emulation Cable
SPECIFICATIONS
Power Requirements
+5 Vdc @ 100 mA from target board
Dimensions
Width: 3.0 in. (7.6 cm)
Length: 3.6 in. (9.1 cm)
1315
Z86E0800ZPR
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86E08 Progr_lOer Board
CMOS Z86C91 MPU
7.3728 MHz Crystal
8Kx8EPROM
(32K)/8K x 8 ZIFSocket (for user EPROM)
Z86E08 ZIF SQcket
Two 7805 Voltage Regulators
7812 Voltage Regulator
Bridge Rectifier
2LEDs
2 Key Switches
SUPPORTED DEVICES Software (IBM-PC Platform)
Z86E08
Programming source code
DESCRIPTION DoculOentatlon
The Kit contains an assembled circuit Z86E08 Product Specification
board, software, and documentation to Z86E08 Kit User Guide
program the Z86E08 OTP.
The Z86E08 is an OTP version of the ORDERING INFORMATION
Z86C08 single chip microcomputer housed Part No: Z86E0800ZPR
. in an 18-pin DIP. It offers the same architec-
ture and all the features of the Z86C08. The
Z86E08 also offers "LOW NOISE" and
"ROM PROTECT" options, which can be
programmed by the programmer ..
SPECIFICATIONS
Power RequlrelOents
+15Vdc@1A
Or 12-15 Vac @ 1 A
DllOenslons
Width: 4.9 in. (12.4 cm)
Length: 5.4 in. (13.7cm)
1316
Z86C1200ZDP
PRODUCT SPECIFICATION ~ZiIffi
'-I.. KIT CONTENTS
Z8&C12 Adapter Board
CMOS Z86C12 ICE
64-Pin Z8612 Connector
5-Position Dip Switch
Documenlallon
Z86C12 Adapter Kit User Guide
ORDERING INFORMATION
Pari No: Z86C1200ZDP
Prlca:
SUPPORTED DEVICES
Z8&C12
DESCRIPTION
The Z86C12 adapter board is a simple
adapter w.hich converts the 64-pin footprint
of the Zilog Z8612 ICE chip to the 84-pin
PGA configuration of the CMOS Z86C12
ICE chip.
The Z86C12 Adapter Kit allows a stan-
dard Z8 emulator to emulate Z8 CMOS
microcontrollers.
SPECIFICATIONS
Power Requirements
Not Applicable
DlmBnsl1llS
Width: 2.4 in. (6.1 cm)
Length: 4.3 in. (10.9 cm)
1317
Z86C1900ZCO
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C19 Universall.R. Remote Control Board
CMOS Z86C 19 MPU (With Mask ROM)
8 MHz Crystal
29 Key Switches
Documentation
SUPPORTED DEVICES Z8 Family Data Book
Z8 Cross Assembler User Guide
Z86C09,Z86C19
MOBJ Link/Loader User Guide
Z86C09/19 Product Specification
DESCRIPTION Z86C19LR. Application Kit User Guide
The kit contains an assembled circuit
board, software and documentation for the
UniversalLR. Transmitter Application. The
ORDERING INFORMATION
Part No: Z86C 1900ZCO
transmitter can be set up to operate most
models of remote-controlled TVs, VCRs and
Cable TV Decoders even if they are in
different brands.
With the set-up feature and the easy
operation capability, the UniversalLR.
Transmitter can be used to replace several
remote controllers. The documentation
contains the look up codes of each corre-
sponding brand.
SPECIFICATIONS
Power Requirements
+3 < Vcc < +5 Vdc
Dimensions
Width: 2.3 in. (5.8 cm)
Length: 5.5 in. (14.0 cm)
1318
Z86C1900ZEM
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C19 Evaluation Board
CMOS Z86C90 MPU
8 MHz Crystal
(32K)/8K x 8 ZIF Socket (supplied with
Debug Monitor EPROM)
(32K)/8K x 8 STATIC RAM
RS-232C PC Interface
Z86C90 ExpanSion Header
Z86C09/19 Emulation Header
Cables
SUPPORTED DEVICES 25-Pin RS-232 Cable
Z8&C09,Z86C19,Z86C90 18-Pin Z86C19 Emulation Cable
SPECIFICATIONS
Power Requirements
+5 Vdc@ .5A
Dimensions
Width: 3.5 in. (8.9 em)
Length: 4.0 in. (10.2 cm)
Serial Interface
RS-232C @ 9600 baud
1319
Z86E0600ZDP
PRODUCT SPECIFICATION
KIT CONTENTS
Z8&E06 Converter Board
28-Pin Z86E30 MCU Socket
18-Pin Z86E06/09/19 Connector
cables
25-Pin RS-232 Cable
18-Pin Z86C19 Emulation Cable
Documentation
Z86E06 OTP Converter Kit User Guide
DESCRIPTION
The Z86E06 converter board is a simple·
adapter which converts the 28-pin footprint 0
the Zilog Z86E30 OTP chip to the 18-pin DIP
configuration of the Z86E06/09/19 OTP chip.
The converter supports all the functions of th
Z86E06/09/19 except for SPI function.
SPECIFICATIONS
Power Rellulrements
Not applicable
Dimensions
Width: 0.8 in. (2.0 cm)
Length: 1.5 in. (3.8 cm)
1320
Z86E2100ZDF
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86E21 QFP OTP Program Adapter Board
44-Pin QFP ZIF Socket
28-Pin Connector
Documentation
Z86E2100Z0F Adapter User Guide
ORDERING INFORMATION
Part No: Z86E2100Z0F
SUPPORTED DEVICES
Z86E21
DESCRIPTION
The Z86E21 QFP OTP Adapter Kit allows
the 2764A standard EPROM programmer to
program the Z86E21 One Time Program-
mable microcontroller.
SPECIFICATIONS
Power Requirements
+12.5 Vdc@.5A
Dimensions
Width: 1.75 in. (4.4 cm)
Length: 2.20 in. (5.6 cm)
1321
Z86E2100ZDP
PRODUCT SPECIFICATION
~ZiIffi
KIT CONTENTS
Z86E21 OTP Pro.,am Adapter Board
40-Pin DIP ZIF Socket
28-Pin Connector
Documentation
Z86E21 ZOP Adapter User Guide
ORDERING INFORMATION
Part No: Z86E2100Z0P
SUPPORTED DEVICES
Z86E21
DESCRIPTION
The Z86E21 DIP OTP Adapter Kit allows the
2764A standard EPROM programmer to
program the Z86E21 One Time Program-
mable microcontroller.
SPECIFICATIONS
Power Requirements
+12.5 Vdc @.5 A
Dimensions
Width: 1.4 in. (3.6 cm)
Length: 2.6 in. (6.6 cm)
1322
Z86E2100ZDV
PRODUCT SPECIFICATION
KIT CONTENTS
Z86E21 PLee OTP Prog" Adapter Board
44-Pin PLCC ZIF Socket
28-Pin Connector
Documentation
Z86E2100ZDV Adapter User Guide
ORDERING INFORMATION
Part No: Z86E21 OOZDV
SUPPORTED DEVICES
Z86E21
DESCRIPTION
The Z86E21 PLCC OTP Adapter Kit allows
the 2764A standard EPROM programmer to
program the Z86E21 One Time Program-
mable microcontroller.
SPECIFICATIONS
Power Requirements
+12.5 Vdc @.5A
Dimensions
Width: 1.75 in. (4.4 cm)
Length: 2.20 in. (5.6 cm)
1323
Z86C2700ZCO
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C27 Application Board
CMOS Z86C27 MPU Socket
4 MHz Crystal
24 Key Multiplexed Keypad
Two 7-segment LED Displays
8 LEOs
13 PWMs
Low Pass Filter Interface
PLL Interface
Documentation
SUPPORTED DEVICES Z8 Family Data Book
Z86C27, Z86C97 Z86C27 Application Kit User Guide
SPECIFICATIONS
Power Requirements
Supplied By TV Set
Dimensions
Width: 6.2 in. (15.7 cm)
Length: 8.6 in. (21.8 cm)
1324
Z86C2700ZEM
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C27 Emulation Board
CMOS Z86C97 MPU
EP1800LC-2 EPLD
(32K)/8K x 8 ZIF Socket
4 MHz Crystal
Z86C97 Adapter Board
Z86C97 Expansion Header
Unilab 8620 or 8420 Analyzer-
Emulator Headers
Cables
SUPPORTED DEVICES Unilab 8620 or 8420 Analyzer Cable
Z8&C27,Z8&C97 Unilab 8620 or 8420 Emulator Cable
Dimensions
Width: 3.0 in. (7.6 cm)
Length: 6.8 in. (17.3 cm)
1325
Z86E3000ZDP
PRODUCT SPECIFICATION ~ZiIID
KIT CONTENTS
Z8&E30 OTP Program Adapter Board
28-Pin DIP ZIF Socket
28-Pin Connector
Documentall..
Z86E30ZDP Adapter User Guide
ORDERING INFORMATION
Part No: Z8BE3000ZDP
SUPPORTED DEVICES
Z8&E30
DESCRIPTION
The Z86E30 OTP DIP Adapter Kit allows a
standard EPROM programmer to program
the Z86E30 One-Time-Programmable
m icrocontroller.
.SPECIFICATIONS
Pewer Requlremants
+12.5 Vdc @ .5A .
Dimensions
Width: 1.45 in. (3.68 cm)
Length: 2.0 in. (5.08 cm)
1326
Z86E4000ZDF
PRODUCT SPECIFICATION
~ZiIffi
KIT CONTENTS
Z86E40 QFP OTP Program Adapter Board
44-Pin QFP ZIF Socket
28-Pin Connector
Documentation
,'
>~ Z86E4000ZDF Adapter User Guide
, > '
,." 0"
,~
I I ,
'I I I II ORDERING INFORMATION
'III
,II ' Part No: Z86E4000ZDF
SUPPORTED DEVICES
Z86E40
DESCRIPTION
The Z86E40 QFP OTP Adapter Kit allows a
standard EPROM programmer to program
the Z86E40 One-Time-Programmable
microcontroller.
SPECIFICATIONS
Power Requirements
+12.5 Vdc @.5 A
Dimensions
Width: 1.75 in. (4.4 cm)
Length: 2.20 in. (5.6 cm)
1327
Z86E4000ZDP
PRODUCT SPECIFICATION
KIT CONTENTS
Z86E40 OJP p..... Adapter Board
40-Pin DIP ZIF Socket
28-Pin Connector
Documentatlell
Z86E40ZDP Adapter User Guide
ORDERING INFORMATION
Part No: Z86E4000ZDP
SUPPORTED DEVICES
Z8&E40
DESCRIPTION
The Z86E40 OTP DIP Adapter Kit allows a
standard EPROM programmer to program
the Z86E40 One-Time-Programmable
microcontroller.
SPECIFICATIONS
Power Requirements
+12.5 Vdc @.5A
Dimensions
Width: 1.4 in. (3.6 cm)
Length: 2.6 in. (6.6 cm)
1328
Z86E4000ZDV
PRODUCT SPECIFICATION
~ZiIffi
KIT CONTENTS
Z86E40 PLee OTP Prog... Adapter Board
40-Pin ZIF Socket
28-Pin Connector
Documentation
Z86E4000ZDV Adapter User Guide
ORDERING INFORMATION
Part No: Z86E4000ZDV
SUPPORTED DEVICES
Z8&E40
DESCRIPTION
The Z86E40 PLCC OTP DIP Adapter Kit
allows a standard EPROM programmer to
program the Z86E40 One-Time-Program-
mable microcontroller.
SPECIFICATIONS
Power Requirements
+12.5 Vdc @.5 A
Dlmenslens
Width: 1.6 in. (4.1 cm)
Length: 2.0 in. (5.1 cm)
1329
Z0880000ZCO
PRODUCT SPECIFICATION .~ZiIm
KIT CONTENTS
Super8 Development Board
NMOS Z08800 Super8 MPU
20 MHz Crystal
(32K)/8K x 8 EPROM
(32K)/8K x 8 STATIC RAM
RS-232C PC Interface
Documentation
DESCRIPTION Z8 Family Data Book
The Super8 Development Kit can be used Z8 Cross Assembler User Guide
for several purposes. As an evaluation tool, MOBJ Link/Loader User Guide
the user can learn the Super8's instruction
set plus the r:nanipulation of the Super8's
interrupt vectors and register set. Secondly,
ORDERING INFORMATION
The Super8 Development Kit is designed to Part No: Z0880000ZCO
aid the user in constructing specific appli-
cations using the Super8 microcontroller.
Lastly, application prototypes may be run
using the Super8 Development Kit.
SPECIFICATIONS
Power Requirements
+5 Vdc@.4A
Dimensions
Width: 4.0 in. (10.2 cm)
Length: 4.5 in. (11.4 cm)
Serial Interface
RS-232C @ 9600 baud
1330
Z86C1200ZEM
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86C12 Emulator
Z8 Emulation Base Board
CMOS Z86C9120PSC
8K x 8 EPROM
, i
(Programmed with Debug Monitor)
EPM5128 EPLD
'~.; 32K x 8 STATIC RAM
, "
1331
Z86C5000ZEM
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
Z86CSO Emulator
Z8 Emulation Base Board
CMOS Z86C9120PSC
8K x 8 EPROM
(Programmed with Debug Monitor)
EPM5128 EPLD
32K x 8 STATIC RAM
3 64K x 4 STATIC RAMs
RS-232C Interface
Reset Switch
Z86C50 Emulation Daughter Board
20 MHz CMOS Z86C5020GSE ICE Chip
EPM5128 EPLD
SUPPORTED DEVICES 2K x 8 STATIC RAM
Z86C06,Z86C09/19,Z86E19,Z86C30,Z86E30, 40/28/18 Pin ZIF OTP Sockets
Z86C40,Z86E40,Z86C89,Z86C90 6 HP-16500A Logic Analysis
System interface Connectors
DESCRIPTION 80/60/40 Pin Target Connectors
The Z86C50boZEM is a member of Zilog's
ICE BOX product family of in-circuit emula- Components
tors. The ICE BOX -C50 provides emulation Z86E4012PSC
and OTP programming support for Zilog's Z86E30 12PSC
Consumer Controller Processor (CCP)
microcontroller. The Emulator provides all the Cables
essential MCU timing and I/O circuitry which 12", 40-Pin DIP Emulation Cable
simplifies user emulation of the prototype 12", 28-Pin DIP Emulation Cable
hardware/software product. The Emulator can 12", 18-Pin DIP Emulation Cable
be connected to a serial port COM 1 or COM 48" Power Cable
20fthe host computer (IBM* XT, AT Compat- 15" Power Cable with Banana Plugs
ible). 60" DB 25 RS-232C Cable
1332
Z86C9300ZEM
PRODUCT SPECIFICATION ~ZiIffi
KIT CONTENTS
186C93 Emulator
Z8 Emulation Base Board
CMOS Z86C9120PSC
8K x 8 EPROM
(Programmed with Debug Monitor)
EPM5128 EPLD
32K x 8 STATIC RAM
3 64K x 4 STATIC RAMs
RS-232C Interface
Reset Switch
Z86C93 Emulation Daughter Board
20 MHz CMOS Z86C5020GSE ICE Chip
SUPPORTED DEVICES EPM512S EPLD
18&C93
3 HP-16500A Logic Analysis
System Interface Connectors
DESCRIPTION SO-Pin Target Connector
The Z86C9300ZEM is a member of Zilog's
ICE BOX product family of in-circuit emula- Cables
tors. The ICE BOX -C93 provides emulation 12", 44-Pin DIP Emulation Cable
for Zilog's Z86C93 microcontroller. This
12", 40-Pin DIP Emulation Cable
includes all the essential MCU timing and 1/
o circuitry which simplifies user emulation 12", 1S-Pin DIP Emulation Cable
of the prototype hardware/software product. 4S" Power Cable
The Emulator can be connected to a serial 15" Power Cable with Banana Plugs
port COM 1 or COM 2 of the host computer 60" DB 25 RS-232C Cable
(IBM* XT, AT, 386, 486 Compatible).
Software (IBM-PC Platform)
SPECIFICATIONS Z8/ZS0/ZS000 Cross Assembler
Emulation Specification MOBJ Link/Loader
Maximum Emulation Speed 16 MHz Host Package
1333
Z8
REAL TIME EMULATOR ~ZiIffi
Operating Temperature:
O°C to +40°C
Storage Temperature:
-10°C to +65°C
Operating Humidity:
o to 90%
Maximum Emulation Program MemOl'J:
64 Kbytes with Z86COOOOZUSP064
128 Kbytes with Z86COOOOZUSSP128
256 Kbytes with Z86COOOOZUSP256
DESCRIPTION
Maximum Emulation Data Memory:
The system comprises three base unit op- 64 Kbytes
tions, (64K, 128K, or 256K of emulation pro-
gram ROM), and three pod options which Program Memory Mapping:
allow the emulation of various Z8 1K blocks
microcontrollers. Features include real-time
transparent emulation up to 20MHz, in-line Pass Counters:
symbolic assembler qnd disassembler, real- Two, 16-bit .each
time hardware breakpoints, eight channel user
logic analyser, external trigger input and out- Trace Buffer:
puts, trace display and memory display/edit 32K - 80 bits
during execution, and window or command
driven user interface. Sequencer:
Hardware, 8 levels
SPECIFICATIONS User Probe:
Eight channel logic input
Mlcrocontrollers Emulated:
One trigger input
Z86C1200ZPD Z86COO,Z86C10,Z86C20, Sever trigger outputs (Events, Pass
Z86C11, Z86C21 , Z86E21, Counters, Sequencer)
Z86C91
Host Interface:
Z86C5000ZPD Z86C09,Z86C19,Z86C30, Asynchronous RS-232C
Z86C40,Z86C90 9600/115 KBaud
XON/XOFF support
Z86C9300ZPD Z86C93
File Upward/Downward Format:
Maximum Emulation Speed: Zitog MUFOM (EEE 695-1985)
Up to 20 MHz (microcontroller dependent) Intel HEX
Intel AOMF
Size: 2500AD Software
260 mm wide, 260 mm deep, 64 mm high
1334
~ZiIffi
MINIMUM HOST REQUIREMENTS MINIMUM EMULATION SUPPORT
• IBM compatible PC/XT/AT/386 or PS-2 . One base unit and one emulation pod is
• 640 Kbyte memory required.
• 20 Mbyte hard disk
• RS-232 serial port (COM1 or COM2) Pari Numbers
• Mouse (serial or bus) Base Systems Pod Systems
• MDA, CGA, EGA, or VGA video adaptor Z86COOOOZUSP064· Z86C9300ZPD
Z86COOOOZUSP128 Z86C1200ZPD
Z86COOOOZUSP256 Z86C5000ZPD
1335
~ZiIill QUALITY AND RELIABILITY
Zilog's Quality and Process Template is the profile "waterfall" methodology in its testing.
Reliability Program displayed by the process evalualion The first electrical tests made on the
parameters which are automatically circuit, at the wafer probe operations,
Introduction recorded from the test patterns on are guard banded to tile linal test
Zilog has an excellent reputation for wafers as they proceed through the specifications. The final test specilicfl-
the quality and reliability of its prod- production line. These parameters are lions, in turn, are guardbanded to tile
ucts. translated into the design teclll1010gy quality control outgoing sample. '111e
Zilog's Quality and Reliability file attributes such that every product quality control outgoin[J sample is
Program is based on careful study of design bears a key and lock relation- guard banded to the customer pro-
the principles laid down by such ship to the process. curement or data sheet specilicalions.
pioneers as W.E. Deming and J.M. This technique of "waterfall" guard-
Juran and, perhaps even more 2. Training banding assures that circuits Wllicll
important. observation of the practical Product Design and Processing are may be marginal to tile customer's
implementation of those principles in people dependent. Zilog training expectations are eliminated in tile
Japanese, European and American emphasizes the fundamentals in- manufacturing process long before
manufacturing facilities. volved in design for quality and they get to the shipping container.
The Zilog program begins with reliability.
employee involvement. Whether the Customer Service, an important 5. Probe at Temperature
judgement of our performance is aspect of Zilog's quality performance Semiconductor devices tend to
based on perfection in incoming as a vendor, also depends upon our exhibit their most limited performance
inspection, trouble free service in the people clearly understanding their at the highest operating temperature.
field or timely and accurate customer jobs, and our obligations to our Therefore, it is Zilog's policy that all
service, we recognize that our em- customers. This too is part of the chips are tested at high temperature
ployees ultimately control these training curriculum administered by the very first time tlley are electrically
factors. Hence, our Quality Program is Zilog. screened, at the wafer probe station.
broadly shared throughout the organi- The circuits are tested again at tlwir
zation. 3. Order Acknowledgement upper operating temperature limit in
Policy the 100% final test operation.
1. Harmony Between Design One definition of vendor quality
and Process performance is that the vendor "does 6. Process Characterization
High product quality and reliability what he promises or acknowledges." Before release to production, every
in VLSI products is possible only if Reliability and quality warranties can process is thoroughly characterized
there is structural harmony between be met only if Zilog and the customer by an exhaustive series of pilol
product design and the manufactur- are in agreement on product and production runs and tests which
ing process. Great care is taken to delivery specifications. Zilog makes identify the statistical, electrical, and
assure that the statistical process an extra effort to assure that the mechanical limits of Wllich that
control limits observed within the customer is fully informed by provid- particular process regime is capal1le.
manufacturing plants properly ing documents with its purchase order This documentation, which fills a large
guardband the design technology acknowledgements that clearly state loose leaf binder for each process, is
used to configure the circuit and what Zilog understands the specifica- maintained as the historical record or
layout in Zilog's automated design tions to be. "footprint" for that particular regime.
methodology. Process recharacterization is done
Through use of a technique which 4. Test Guardbanding any time there is a major process or
we call Process Templating, the No physical attribute is absolute. manufacturing site change, and tile
technology file in the automated Customers' test methods may differ resulting documentation is tllen
design system is periodically updated from Zilog's due to variations in test added to the cllaracterization history.
to assure that product design param- equipment. temperature or specifica- Once the process is fully character-
eters fall within the statistical control tion interpretation. To assure that ized, the frequent test site eVfllualion
limits with which the process is every Zilog product performs to full and process template data demon-
actually operated. In simple terms, the customer expectations, Zilog uses a strates that the process remains in
specification.
1337
~ZiIm QUALITY AND RELIABILITY
7. Product Characterization sampling of production lots prepared ties, staffed by experienced profes-
Every Zilog product design is for shipment. This information is then sion.als, exist at each Zilog site to
evaluated over extremes of operating translated by our statisticians to a provide rapid evaluation of in-process
temperature, supply voltage and statement of our parts per million (or and in'-field rejects to determine the
clock frequencies, prior to release to parts per billion) outgoing quality cause and provide corrective action
production. This information permits performance. through a feedback loop into tile
the proper guard banding of the test Of course, it is one thing for Zilog to production, design, and applications
program waterfall and identification of think it is doing a good job in outgoing process. Zilog is pleased to share
many marginal "comers" in design product quality and it is another for a product analysis reports on'specific
tolerances. customer to agree. Therefore, we ask products with the customer upon
A product characterization report, certain key customers to provide us request
which summarizes the more important with their incoming inspection data
tolerances identified in the process of which helps us calibrate our outgoing 14. Test Site Step·Stress
this exhaustive product design performance in terms of the actual The process evaluation test sites on
evaluation, is available to Zilog's results in the field. The fact that Zilog the wafer are packaged and sub-
customers. has been awarded "ship to stock" jected to step-stress testing. Any drift
status by many customers testifies to in parameters under severe condi-
8. Process Qualification our success in this area. tions of stress outside the norm is
Zilog also qualifies every process taken as an indication of possible
prior to production by an exhaustive 11. FIT Measurement Direct .process contamination or variation.
stress sequence performed on test and Indirect
chips and on representative products. Just as Zilog records its outgoing 15. Statistical Process Control
Once a process regime is qualified, a quality in terms of parts per million, it Zilog employs Statistical Process
process requalification is performed also measures its outgoing product Control at all critical process steps.
any time there is a major process reliability in terms of "FITS" or failures Deviations from norms must be
change, or whenever the process per billion device hours, using the evaluated by a QIR review board,
template statistical quality limits are results of weekly operating life test
significantly exceeded or adjusted. measurements on the circuits, per- 16. Perfection Plus Program
formed in accordance with the Zilog employees actively participate
9. Product Qualification standard specifications. in meetings in which methods which
In addition to characterization, every will enable a department to do its job
new Zilog product deSign is fully 12. Field Quality Engineers more perfectly are proposed, re-
qualified by a comprehensive series It is frequently said that, "the viewed, and adopted. Employees who
of life, electrical, and environmental customer is always right." If the have made suggestions proudly wear
tests before release to production. customer has an application quality or the Zilog Perfection Plus pin.
Again, a qualification report is avail- reliability problem while using a Zilog
able to our customers which summa- product. whether it is Zilog's responsi- 17. Zilog Vendor of the Year
rizes certain' key life and environmen- bilityor not, we believe that we have a Award
tal data taken in the course of these responsibility to resolve it. Therefore, Zilog is proud of the many quality
evaluations. Whenever possible, Zilog maintains a force of skilled and performance awards it has
industry standard environmental and Applications Engineers who are also received from its customers. In turn,
life tests are employed. trained as field quality engineers and Zilog makes an annual award to the
are available on immediate call to vendor who has done the best overall
10. PPM Measurement, Direct consult at the customer's locations on job for Zilog,
and Indirect any problems they may be experienc-
It is frequently said that if you want ing with Zilog product performance. Zilog's Quality and Reliability
to improve something, you need to Summary
put a measure on it. Therefore, Zilog 13. Product Analysis Zilog is proud of its Quality and
measures its outgoing quality "parts As noted earlier, we feel that a Reliability programs and is pleased to
per million" by the maintenance of customer problem is a Zilog problem. share this data with its customers. For
careful records on the statistical Accordingly, Product Analysis facili- further information, contact Zilog's
Director of R/QA.
1338
~Zilffi LITERATURE GUIDE
Z8@/SUPER8'" MICROCONTROLLER FAMILY
1339
~ZiIm LITERATURE GUIDE
Z8(!)/SUPER8'" MICROCONTROLLER FAMILY (Continued)
Z8 Product Specifications, Technical Manuals and Users Guides Part No Unit Cost
asm sa Super8/Z8 Cross Assembler Use(s Guide DC-8267-05 3.00
ZOOC06 CMOS Z8 CCP Preliminary Product Specification DC-2563-00 N/C
ZOOCOO CMOS Z8 8-Bit Microcontroller Product Specification DC-2527-02 N/C
ZOOE08 CMOS Z8 8-Bit Microcontroller Product Specification DC-2542-02 N/C
ZOOC09/C19 CMOS Z8 8-Bit Microcontroller Product Specification DC-2506-02 N/C
ZOOC11 CMOS Z8 Microcontroller Product Specification DC-2572-01 N/C
ZOOC12 Z8 ICE Product Specification DC-2553-01 N/C
ZOOC21 CMOS Z8 Microcontroller DC-2568-01 N/C
Z86E21 CMOS OTP Microcontroller Product Specification DC-2514-01 N/C
Z86C27/97 Z8 DTC~ Product Specification DC-2561-01 N/C
ZOO127 Low-Cost Digital Television Controller Advance Information Specification DC-2574-0A N/C
Z86C30 CMOS Z8 8-Bit Microcontroller Product Specification DC-2509-03 N/C
Z86E30 CMOS Z8 OTP CCP Product Specification DC-2573-01 N/C
ZOOC40 CMOS CCP Product Specification DC-255o-01 . N/C
ZOOE40 CMOS OTP CCP Product Specification DC-2571-01 N/C
ZOOC50 CMOS Z8 CCP ICE Advance Information Specification DC-2559-0A N/C
ZOOC89/C90 ROMless CMOS Z8 8-Bit Microcontroller Product Specification DC-2506-01 N/C
ZOOC91 Z8 CMOS ROMless Microcontroller Producl Specification DC-2566-01 N/C
ZOOC93 CMOS Z8 ROMless Microcontroller Preliminary Product Specification DC-2508-01 N/C
Z88COO CMOS SuperB ROM less Microcontroller Advance Information Specification DC-2551-0A N/C
Z8602 NMOS Z8 8-Bit Microcomputer Keyboard Controller Preliminary Product Spec. DC-2525-01 N/C
ZOO04 NMOS Z8 8-Bit Microcontroller Preliminary Product Specification DC-2524-02 N/C
ZOO128 Closed-Captioned Controller Advance Information Specification DC-257o-0A N/C
ZOO71 Single Chip Basic Interpreter Basic Debug Software Reference Manual DC-3149-03 3.00
1340
~Zirm LITERATURE GUIDE
Z80@/Z180"'/Z280"'MICROPROCESSOR FAMILY
Intelligent Peripherals Data Book (includes the following documents) DC-248o-02 5.00
Z80 NMOS/CMOS
Z84COO NMOS/CMOS Z80 CPU Prelim. Product Specification Binary Synchronous Comm Using the Z80 StO
Z84C01 Z80 CPU with CGC Product Specification Serial Communication with the ZaOA DART
Z8410/C10 NMOS/CMOS Z80 DMA Product Specification Interfacing Z8500 Peripherals to the zao
Z8420/C20 NMOS/CMOS Z80 PIO Product Specification Serial Clock Generation using the Z8536 CIO
Z8430/C30 NMOS/CMOS Z80 CTC Product Specification Timing in Interrupt-Based System with zao CTC
Z8440/1/2/4/C40/1/2/3/4 NMOS/CMOS Z80 SID Product Spec. AZa~-Based System Using the DMA with the SID
Z84C50 RAM80~ Preliminary Product Specification Interfacing zao CPUs to the Z8500 Peripheral Family
Z8470 Z80 DART Product Specification ZlaO/SCC~ Serial Communications Controller Interface at 10 MHz
Z84C!IO CMOS Z80 KIO~ Product Specification Z80 Using the 84Cll/C13/C15 in place olthe 84011/013/015
Z84011/C11 PIO Parallel I/O Controller Product Specification Z80 Questions and Answers
Z84013/15, Z84C13/C15 CMOS IPC~ Product Specification Z180 Questions and Answers
Z80180 Z180~MPU Product Specification
Z80181 SAC Product Specification
N
Other Information
Z280~ MPU Preliminary Product Specification Z80 Product Support
Zilog Quality and Reliability Report
Z80 Application Notes and Technical Articles Zilog Literature List
Z80 Family Interrupt Structure Package Information
Using the ZOO SID in Async Communications Ordering Information
USing the ZOO SID with SDLC
Z801Z1801Z280 Product Specifications, Technical Manuals and Users Guides Part No Unit Cost
1341
~ZiIffi LITERATURE GUIDE
Z8000® MICROPROCESSOR FAMILY
Datacom Family Data Book (includes the following documents) DC-2503-02 5.00
ZBOOO Product Specifications, Technical Manuals and Users Guides Part No Unit Cost
1342
~Zilffi LITERATURE GUIDE
MILITARY COMPONENTS FAMILY
GENERAL LITERATURE
1343
PACKAGE INFORMATION
r:J
~; 1\
I--.m !
-....
I I
065 - -Jl00~-
TYP.
I. .310
.350
8
545 .505
555 .515
.060 .040
C 060
062R 090
060 .050
D 070 060
060 .060
E 065 me
NOTE:
28 IOF Package use interdigitated
600
620
I
I
E m I( CJ
11
f-'~?~ ~
. 11 ; .1f~
q5 .. 020min
I mono .
: ! I
I i! I
~c --Il-..~ ~.100TYP. ~-D I-
~!aJ
1345
PACKAGE INFORMATION (Continued)
20
I
.MQ.. .062 [lAD.
•560
L~~~~
I~ w I
---------~2.070----------_i.,
mox,
600
~
. 20 .
-.~
.015
_.§1ll_
.650
1346
PACKAGE INFORMATION (Continu~d)
24
OG2R .
.540
.560
L~~~~~~~~~
l.JWWW~ I
25
~-----------2410
max.
_ _
~
060
~ ~.~
min.
---r
min.
__ 600_
i .620 ,
4 0 )i
l··~
I
.610
~ I
I
- - - - - .650 - ... -oj
1347
PACKAGE INFORMATION (Continued)
r----
.660 .o62R
.680
1
2.290 ----- - -------- - - - - - - - - - - - - - - -
max.
~~
. " ,
~<I· I,,,,,,,,¥'!
J O~O
I710 ~ .
l.070TYP. -4~
'I
,. lS
J:
I
. ,
~.O~3
037
~!
-1!!!ln.
t------_-no -~-'---
.760
+~
,
(
~-.---
D1S
.
__ .760 _____ ___;
.800
1348
PACKAGE INFORMATION (Continued)
P
.585 Max.
600 Max. glass
20
.350 DIA
UV GLASS
1
L~r=-=-==-=-==-=-=-~
.
21
40 1
1
1 - - - - - - - - - 2.080 Max. --------1
L~ i,""""'=j
.230 M a X ' " 1 d--f:~~~ TYP I II \
~ --jI Ir--
.100 MClX.
BOTH ENDS
.090 TYP
TIO:u2r
.015
II
--jr-- 125
..
-;:-T .0081=-
~ .625
.675
~
.350 dia
UV GLASS
.585 Mo.X.
L I~
1515~~~
~~~~~~~2s281
1349
PACKAGE INFORMATION (Continued)
PIN 1 IOENTIF1O\T1OH
.24 1
•
(
l .S98max.
25 48
~
I
2.42Smax . .--..---J
.~
.D6O
L--.m90TH ENOS
.m J L 100 '.010 TYP.
f----.SJO---1
! max.
I u
. I____ 2Th.. ~
-t-:'l I
.625
1350
PACKAGE INFORMATION (Continued)
J
-
I
,t--
2.05 i
2.25-
05min.
.25max.
1351
PACKAGE INFORMATION (Continued)
'I
80
1 J LO.8IYP
:to.1
~~mi.Omjl~~c_;,.".
---. _QJ
1.4
1352
PACKAGE INFORMATION (Continued)
29
.l6B
.IBO
1353
PACKAGE INFORMATION (Continued)
PIN I I.D.
r
-L
J 1
~
.050+1-.001
L-&,-""",'-:nrc'
-,..,.".' ~U -r
-,.,.",1-""",-n:rc-
TYP
NaffS.
I. ALL DIMENSIDNS-1N ·1I'ICH.
2. ALL LEADS ARE-C(]p'LANAR "!THIN .. .004 INCtb
1354
PACKAGE INFORMATION (Continued)
I. PIN 1 ID
1
~
--r-
W
.026 1.150 1.185
.030 - - - - - -1- - - - - 1.158 1.195
~
.050' / -.001 D
1
TYP~
.045x45DEG
hrrmnrnrmrmnrflfl'nrnmnrnnrm--I...----''--.105
=!::=:!I:idI-ll-U-U-lI-lI'lI-lHJf1I-U-lHHl-U-UmlHHl~ __ .I!5
J:.LQ.
.180 .026
1355
PACKAGE INFORMATION (Continued)
PIN 1
.3/.4x45DEG I
I
E 11.40/11.75 ---~ ~07
2-8DEG
~J L 1.22/1.32TYP
JL~ .36/.46 \
SEATING PLANE
1356
PACKAGE INFORMATION (Continued)
AI PIN
tn._
1.080 sa
.820 MAX
MAX ~
II 1r r
-1
·o.o
lllr
.075
.0.5
1.1.0 MAX
.100 TYP
00000100000
.100 TYP
.820 MAX
--I.
t
r .015 DIA
:ON
(84 PLCS) E
G
00000100000
00000100000
000
000
000
1 000
~~(~L+_~~~
000
1 000
1
0.900 +/-.012
TYP
H 00000100000
j 00000100000
K 000001.0000
1098754·321
,070 DlA TYP
(84 PLCS)
1.325 sa MAX
l.650 MAX
OPTION ·01
1357
PACKAGE INFORMATION (Continued)
L- _.ill ____
.625
J
40-Lead Protopak .
1358
PACKAGE INFORMATION (Continued)
~------,.IOO·19, 1 . 9 0 0 - - - - - -....
_--------2311-----------
TOLERANCE : ,OO~
r ENCAPSULANT
6 -10 EPOXY/6lASS
PIN STANDOFF
4PL
1359
· PACKAGE INFORMATION (Continued)
-+---t-'i.
,I ENCAPSULANT
'i.
I G·,OEPQoc.,.tLASS
!,
±'
lOW PROFIL.E
,I PIN STMO..QfF
SOCKET
..zoo~-
• PI.
I1-.'00
I .300
.300.-1
1360
ORDERING INFORMATION
Support Products
1361
ORDERING INFORMATION (Continued)
1362
ZS SCSI, CMOS, ROMless
Z053S0 Z53CSO
40-pin DIP 4S-pin DIP
Z0538010PSC Z53C8003PSC
1363
PACKAGE TEMPERATURE
, PREFERRED PREFERRED
0= Cerdip S = O°C to +700C
P = Plastic DIP
V = Plastic Leaded Chip Carrier LONGER LEAD TIME
E = -40°C to + 100°C
LONGER LEAD TIME M = -55°C to + 125°C
C = Ceramic Sidebrazed
E = Ceramic Window Lid EXAMPLE
F = Plastic Quad Flatpack
G = Ceramic PGA (Pin Grid Array) Z86C1216GSE is a CMOS 86C12, 16 MHz, PGA,
K = Cerdip Window Lid O°C to +70°C, Hermetic Standard Flow,
L = Ceramic LCC (Lead less Chip Carrier)
R = Ceramic Protopak Z 84C12 16 G S E XXXX
S = SOIC (Small Outline Integrated Circuit)
T = Low Profile Protopack
ENVIRONMENTAL
'
III .
L Sp,dallrn
(Optional)
N,mbm
Environmental Flow
Temperature
PREFERRED Package
C = Plastic Standard L--__________ Speed
E = Hermetic Standard Product Number
F = Protopack Standard L..-_________________ Zilog Prefix
1364
ZILOG DOMESTIC SALES OFFICES INTERNATIONAL SALES OFFICES
AND TECHNICAL CENTERS
CALIFORNIA CANADA
Agoura .. ................ 818-707-2160 Toronto .. .. ..... ...... .................... 41 6-673-0634
Campbell ....................... .............. 408-370-8120
Tustin ...................... ....... 714-838-7800 GERMANY
Munich ....... .......... .............. ....... .. 49-89-672-045
COLORADO Stimmerda ............ ... .....................37-626-23906
Boulder . ....................... ...... .... ..... 303-494-2905
JAPAN
FLORIDA Tokyo ........................................ 81 -3-3587-0528
Largo ........................... .............. 813-585-2533
HONG KONG
GEORGIA Kowloon ........................................ 852-7238979
Norcross ...................................... 404-448-9370
KOREA
ILLINOIS Seoul ........................................... 82-2-552-5401
Schaumburg ............ . ....... .. 708-517-8080
. SINGAPORE
NEW HAMPSHIRE Singapore........................ .. ....... 65-2357155
Nashua ...................... .... .............. 603-888-8590
TAIWAN
NEW JERSEY Taipei ....................................... 886-2-741-3125
Clark ............................................. 201 -382-5700
UNITED KINGDOM
NORTH CAROLINA Maidenhead ................................ 44-628-392-00
Raleigh ................ ... ... ............ .....919-790-7706
OHIO
Independence ............................... 216-447-1480
PENNSYlVANIA
Ambler ... .. ... .. .............. 215-653-0230
TEXAS
Dallas ... ... ................................214-987 -9987
WASHINGTON
Seattle ...................... ... .................. 206-523-3591
© 1991 by Zilog, Inc. All rights reserved. No part of this description, regarding the information set forth herein or
document may be copied or reproduced in any form or by regarding the freedom of the described devices from
any means without the prior written consent of Zilog, Inc. intellectual property infringement. Zilog, Inc. makes no
The information in this document is subject to change warranty of merchantability or fitness for any purpose.
without notice. Devices sold by Zilog, Inc. are covered by Zilog, Inc. shall not be responsible for any errors that may
warranty and patent indemnification provisions appearing appear in this document. Zilog, Inc. makes no commit-
inZilog, Inc.Terms and Conditions of Sale only.Zilog, Inc. ment to update or keep current the information contained
makes no warranty. express, statutory. implied or by in this document.
Zilm
Zitog , Inc. 210 E. Hacienda Ave ., Campbell , CA 95008-6600, Tel: (408) 370-8000 , FAX: 408-370-8056/8027
DC-8275-04