PRELIMINARY PRODUCT SPECIFICATION 1 Z86318 1 Z8® MCU 8-BIT MICROCONTROLLER FEATURES Device ROM (KB) RAM* (Bytes) I/O Lines Voltage Range Z86318 124 14 21 0V to 6.0V – – – Note: *General-Purpose – ■ –40°C to +105°C Operating Temperature Range ■ Low-Power Consumption: 33 mW (Typical) ■ ROM Mask Options: – Permanent Watch-Dog Timer ROM Protect Low-Voltage Protection Pull-Up/Pull-Down I/O Pins (Nibble Programmable) Feedback Resistor on the On-Chip Oscillator ■ On-Chip Oscillator (Crystal, Ceramic Resonator, LC, or External Clock Drive) ■ Fast Instruction Pointer: 1.5 µs @ 4 MHz ■ ESD Protection Circuitry GENERAL DESCRIPTION The Z86318 is a member of the Z8® MCU family of CMOS microcontrollers. This device offers on-board pull-up and pull-down resistors (ROM mask-option programmable on a nibble basis), a scalable trip-point buffer to accommodate opto-transistor outputs, and high drive ports capable of up to 20 mA current sinking per pin (3 pins maximum). The Z86318 features I/O Ports (IOL = 20 mA at VOL = 0.8V, 3 pins max.) to provide increased current sinking capabilities. These devices also offer users a selection of ROM mask options, which include a permanently enabled Watch-Dog Timer that ensures operational reliability across a broad range of application environments. For applications requiring powerful I/O capabilities, the Z86318 provides dedicated input and output lines that are grouped into three ports. These ports can be configured by means of ROM mask options (nibble-programmable) as pull ups, pull downs, or neither. There are two basic address spaces available. Program Memory, and 124 bytes of general-purpose registers. DS96KEY0103 (8/96) The Z86318 devices provide two on-chip 8-bit programmable counter/timers with a large number of user-selectable modes. Each counter/timer is driven by its own 6-bit programmable prescaler. The Z86318 counter/timers off-load system real-time tasks such as counting/timing and input/output data communications for increased system efficiency. Notes: All Signals with a preceding front slash, “/”, are active Low, e.g.; B//W (WORD is active Low); /B/W (BYTE is active Low, only). Power connections follow conventional descriptions below: Connection Circuit Device Power Ground VCC GND VDD VSS PRELIMINARY 1 Z86318 Z8® MCU 8-Bit Microcontroller GENERAL DESCRIPTION (Continued) VDD Input VSS XTAL Machine Timing & Inst. Control Port 3 ALU Counter/ Timers (2) FLAG Register Pointer Interrupt Control Register File 144 x 8-Bit Port 2 Port 0 I/O (Bit Programmable) I/O Figure 1. Z86318 Functional Block Diagram 2 PRELIMINARY Prg. Memory 3072 x 8-Bit (318) 2048 x 8-Bit (319) Program Counter Z86318 Z8® MCU 8-Bit Microcontroller PIN DESCRIPTIONS P24 1 18 P23 P25 2 17 P22 P26 3 16 P21 P27 4 15 P20 VDD 5 Z86318 14 XTAL2 6 13 P02 XTAL1 7 12 P01 P31 8 11 P00 P32 9 10 P33 1 Table 1. Z86318 18 Pin DIP/SOIC Pin Identification Pin # 1-4 5 6 7 8 9 10 11-13 14 15-18 VSS Symbol P24-P27 VDD XTAL2 XTAL1 P31 P32 P33 P00-P02 VSS P20-P23 Function Port 2, Pins 4, 5, 6, 7 Power Supply XTAL Osc. Clock XTAL Osc. Clock Port 3, Pin 1 Port 3, Pin 2 Port 3, Pin 3 Port 0, Pins 0, 1, 2 Ground Port 2, Pins 0, 1, 2, 3 Direction In/Output Input Output Input Input Input Input In/Output In/Output Figure 2. Z86318 18-Pin DIP/SOIC Pin Configuration ABSOLUTE MAXIMUM RATINGS Sym. Parameter Min. Max. Units VDD Supply Voltage* –0.3 +7 V TSTG Storage Temp. –65° +150° C TA Oper. Ambient Temp. † † C Note: *Voltages on all pins with respect to Ground. †See Ordering Information. Stresses greater than those listed under Absolute Maximum Ratings may cause permanent damage to the device. This is a stress rating only; operation of the device at any condition above those indicated in the operational sections of these specifications is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. PRELIMINARY 3 Z86318 Z8® MCU 8-Bit Microcontroller STANDARD TEST CONDITIONS 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 3). From Output Under Test I 150 pF Figure 3. Test Load Diagram CAPACITANCE TA = GND = 0V, f = 1.0 MHz, unmeasured pins returned to Ground. Parameter Input Capacitance Output Capacitance I/O Capacitance Min. Max. 0 0 0 10 pF 20 pF 25 pF VCC SPECIFICATION VCC = 4.0V to 6.0V 4 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller DC ELECTRICAL CHARACTERISTICS Sym Parameter VDD TA= 0°C to +70°C Typical Min @ 25°C Max 1 Units Conditions V VIN < 250 µA (Port Pins Only) 2.0 3.0 V V Driven by External Clock Generator 0.2 VDD 0.2 VDD 0.8 1.5 V V Driven by External Clock Generator 0.7 VDD 0.7 VDD VDD + 0.3 VDD + 0.3 1.6 2.6 V V 4.0V 6.0V 0.7 VDD 0.7 VDD VDD + 0.3 VDD + 0.3 1.4 2.6 V V Input Low Voltage Schmitt-Triggered 4.0V 6.0V VSS – 0.3 VSS – 0.3 0.2 VDD 0.2 VDD 0.8 1.5 V V VIL Input Low Voltage CMOS Input 4.0V 6.0V VSS – 0.3 VSS – 0.3 0.2 VDD 0.2 VDD 1.3 2.4 V V VOH Output High Voltage 4.0V 4.5V VDD – 0.4 VDD – 0.4 2.8 4.4 V V IOH = –2.0 mA VOL1 Output Low Voltage Output Low Voltage 0.6 0.4 1.5 0.8 0.2 0.1 0.8 0.3 V V V V IOL = +4.0 mA VOL2 4.0V 6.0V 4.0V 6.0V IOL = 20.0 mA, 3 Pin Max OL = 10.0 mA, 6 Pin Max VLV VCC Low-Voltage Protection* Trip-Point Voltage* 2.7 2.3 V @ 2 MHz Max V V P24-P27 1.8 2.2 2.4 1.04 1.15 1.27 1.37 0.4 0.4 0.4 0.4 0.4 0.4 V V V No Off-Chip Resistance V V V µA VIN = 0V, VCC µA µA µA VIN = 0V, VCC µA µA Max Input Voltage 4.0V VCH Clock Input High Voltage 4.0V 6.0V 0.7 VDD 0.7 VDD VDD + 0.3 VDD + 0.3 VCL Clock Input Low Voltage 4.0V 6.0V VSS – 0.3 VSS – 0.3 VIH Input High Voltage Schmitt-Triggered 4.0V 6.0V VIH Input High Voltage CMOS Input VIL VTP VOC Input Open-Circuit Voltage IIL Input Leakage IOL Output Leakage 12 1.6 4.0V 4.5V 1.5 5.5V 6.0V 4.5V 5.0V 5.5V 6.0V 3.0V 5.5V 6.0V 4.0V 5.5V 6.0V 1.9 2.1 0.95 1.05 1.15 1.25 –1.0 –1.0 –1.0 –1.0 –1.0 –1.0 0.4 VDD 2.1 2.5 2.7 1.15 1.25 1.39 1.49 1.0 1.0 1.0 1.0 1.0 1.0 Note: *The Z86318 is functional to VLV voltage. The minimum operational VDD is determined by the value of the VLV voltage at ambient temperature. The VLV voltage increases as temperature decreases. PRELIMINARY 5 Z86318 Z8® MCU 8-Bit Microcontroller DC ELECTRICAL CHARACTERISTICS (Continued) TA= 0°C to +70°C Typical Parameter VDD IDD Supply Current IDD1 Standby Current Sym. Min. Max. @ 25°C 4.0V 4.0V 4.0V 6.0V 6.0V 6.0V 4.0V 4.0V 4.0V 1.5 2.0 3.0 3.0 4.0 6.0 0.6 0.8 1.0 0.41 0.93 1.64 1.44 2.60 4.28 0.15 0.20 0.3 mA mA mA mA mA mA mA mA mA @ 1 MHz [1] @ 2 MHz [1] @ 4 MHz [1] @ 1 MHz [1] @ 2 MHz [1] @ 4 MHz [1] HALT mode VIN = 0V, VCC @ 1 MHz HALT mode VIN = 0V, VCC @ 2 MHz HALT mode VIN = 0V, VCC @ 4 MHz 6.0V 6.0V 6.0V 1.3 1.5 2.0 0.70 0.80 1.0 mA mA mA HALT mode VIN = 0V, VCC @ 1 MHz HALT mode VIN = 0V, VCC @ 2 MHz HALT mode VIN = 0V, VCC @ 4 MHz 10 1.5 mA STOP mode VIN = 0V, VCC µA VIH @ 1V VIH @ 1V µA VIL @ 3V VIL @ 4V µA VIH @ 0V VIH @ 0V µA VIH @ 3V VIH @ 3V IDD2 Standby Current 6.0V IPU Pull-Up Current (100K) Port P00–P02; Port P22, P23; Port P31–P33 Pull-Down Current (100K) Port P00–P02; Port P22, P23; Port P31–P33 Pull-Up Current (10K) Port P20, P21 4.5V 6.0V -20 4.5V 6.0V 20 4.5V 6.0V 208 Pull-Down Current (10K) Port P20, P21 4.5V 6.0V 170 IPD IPU IPD 105 114 870 870 Note: [1] All outputs unloaded, I/O pins floating, inputs at rail. 6 Units Conditions PRELIMINARY Notes Z86318 Z8® MCU 8-Bit Microcontroller AC ELECTRICAL CHARACTERISTICS Timing Diagrams 1 3 1 Clock 2 7 2 3 7 T IN 4 5 6 IRQ N 8 9 Figure 4. Electrical Timing Diagram PRELIMINARY 7 Z86318 Z8® MCU 8-Bit Microcontroller AC ELECTRICAL CHARACTERISTICS (VDD = 4V to 6V ±10%, TA = 0°C to +70°C, unless otherwise specified) TA = 0°C to +70°C 1 MHz 4 MHz No. Symbol Parameter VDD Min. Max. Min. Max. Units Notes 1 2 TpC TrC,TfC 6.0V 6.0V 1,000 100,000 25 250 100,000 25 ns ns [1] 3 4 5 6 7 100 70 ns ns 100 ns [1] [1] [1] [1] [1] 8 TwC TwTinL TwTinH TpTin TrTin, TtTin TwIL ns [1,2] 9 TwIH 10 11 Twdt TPOR Input Clock Period Clock Input Rise and Fall Times Input Clock Width Timer Input Low Width Timer Input High Width Timer Input Period Timer Input Rise and Fall Timer Int. Request Input Low Time Int. Request Input High Time Watch-Dog Timer Power-On Reset Time 6.0V 6.0V 6.0V 6.0V 6.0V 475 70 2.5TpC 4TpC 2.5TpC 4TpC 100 6.0V 70 70 6.0V 2.5TpC 2.5TpC 6.0V 6.0V 24 6 24 6 Notes: 1. Timing Reference uses 0.9 VDD for a logic 1 and 0.1 VDD for a logic 0. 2. Interrupt request through Port 3 (P33-P31). 8 PRELIMINARY [1,2] ms ms [1] Z86318 Z8® MCU 8-Bit Microcontroller PIN FUNCTIONS XTAL1, XTAL2. Crystal in, crystal out (time-based input and output, respectively). These pins connect a parallelresonant crystal, LC, or an external single-phase clock (4 MHz Max.) to the on-chip clock oscillator and buffer. Note: XTAL1 has a pull-down resistor. Port 0 (P02-P00). Port 0 is a 3-bit, I/O programmable, bidirectional, CMOS-compatible I/O port. These three I/O lines can be configured under software control to be input or output (see Figure 5). When Port 0 is configured as an input port, all lines have the capability to be globally configured (ROM mask option) for a 100K pull-down or pull-up resistor. The pull-up/pull-down resistor can be disabled as well. (No current is drawn if disabled.) Graphs showing current versus pin voltage are shown in Figures 6 and 7. Pull-Up Enable /OEN Pad Out In Pull-Down Enable Figure 5. Port 0 Configuration PRELIMINARY 9 1 Z86318 Z8® MCU 8-Bit Microcontroller PIN FUNCTIONS (Continued) Figure 6. Typical Current Versus Pin Voltage Values 10 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller 1 Figure 7. Typical Current Versus Pin Voltage Values PRELIMINARY 11 Z86318 Z8® MCU 8-Bit Microcontroller PIN FUNCTIONS (Continued) Port 2 (P27-P20). Port 2 is an 8-bit, bit-programmable, bidirectional, CMOS-compatible I/O port. P23-P20 can be configured under software control to be input or output, independently. Note: Bits D3 and D4 of POIM register must be set to 0. Bits programmed as outputs may be globally programmed as either push-pull or open-drain via bit D0, P3M register. P20 and P21 can be configured with a ROM mask option for 10 Kohm pull-up/pull-down, or none. P22 and P23 can be configured with a ROM mask option for 100 Kohm pull-up/pull-down, or none (Figure 8). No cur- rent is drawn if pull-up/pull-down is disabled. Note: P23-20 are configured for pull-up/pull-down/none globally. P24-P27 can be configured as a voltage divider. The voltage divider consists of an internal 25K pull-up resistor (Figure 9), and a 7.5K pull-down resistor. The zero trip-point input levels on P24-P27 are adjusted for connection to the emitters of opto-transistors and switch at a voltage level of 0.4 VDD. All four of the voltage dividers are globally configured as enabled or disabled. Pull-Up Enable /Open-Drain /OEN Pad Out In Pull-Down Enable Note: P20, P21: 10K Pull-Up/Down or none. P22, P23: 100K Pull-Up/Down or none. P23-20 are globally selected for Pull-Up/Down or none. Figure 8. Port 2 P20-P23 Configuration 12 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller Resistance Tolerance (0 - +40°C) Min. Max. Typ. Pull-Down 5.2K 8.9K 7.5K Pull-Up 18K 30K 25K 1 25K 7.5K Divenb /Open-Drain /OE Pad Out In 0.4 VDD Trip Point Buffer Figure 9. Port 2 P27-P24 Configuration Port 3 (P33, P32, P31). Port 3 is a 3-bit, CMOS-compatible port with three fixed input lines (P33–P31). These three lines can also be used as the interrupt sources IRQ2, IRQ1, and IRQ0. P31 can also be configured as a timer input. All three lines can be configured globally by means of ma ROM mask option for a 100 Kohm pull-up or pull-down resistor (Figure 10), or no pull-up/pull-down. No current is drawn if pull-up/pull-down is disabled. PRELIMINARY 13 Z86318 Z8® MCU 8-Bit Microcontroller PIN FUNCTIONS (Continued) Pull-Up Enable Pad Data Latch P31 IRQ2, TIN Pull-Down /Enable Pull-Up Enable Pad Data Latch P32 Pull-Down /Enable Pull-Up Enable Pad P33 Pull-Down /Enable Figure 10. Port 3 P31-P33 Configuration 14 Data Latch IRQ1 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller The Z86318 MCU incorporates the following special features to enhance the Z8® architectural core for use in mouse and trackball applications. Reset. The Z86318 is reset in one of the following conditions: 1) Power-On Reset (POR), 2) Watch-Dog Timer (WDT) Mode, 3) Stop-Mode Recovery source, and 4) LowVoltage Recovery. Other sources of Reset, ports are configured in an input mode, asynchronous of the clock. However, a clock is required to generate the internal reset that resets the internal registers. Auto POR circuitry is built into the Z86318, eliminating the need for an external reset circuit to reset on power-on. 3064 Location of First Byte of Instruction Executed After RESET On-Chip ROM 12 Table 2. Z86318 Control Registers 11 IRQ5 Reset Values 10 IRQ5 9 IRQ4 8 IRQ4 7 Reserved 6 Reserved 5 IRQ2 4 IRQ2 3 IRQ1 2 IRQ1 1 Reserved 0 Reserved Addr.Reg. F1 TMR F2 T1 F3 PRE1 F4 T0 F5 PRE0 F6* P2M F7* F8* F9 FA FB FC FD FF Program Memory. The Z86318 device can address up to 3 KB of internal program memory (Figure 11). The first 12 bytes of Program Memory are reserved for the interrupt vectors. These locations contain four 16-bit vectors that correspond to the four available interrupts. Bytes 0-3064 are programmed on-chip by means of a ROM mask option. D7 0 U U U U 1 P3M U P01M U IPR U IRQ U IMR 0 FLAGS U RP U SPL U D6 0 U U U U 1 U U U U U U U U D5 0 U U U U 1 U U U 0 U U U U D4 0 U U U U 1 U 0 U 0 U U U U D3 0 U U U U 1 U U U 0 U U U U D2 0 U U U U 1 U U U 0 U U U U D1 0 U 0 U U 1 1 0 U 0 U U U U D0 Comments 0 U 0 U 0 1 Inputs after reset 0 1 U 0 U U U U Interrupt Vector (Lower Byte) Interrupt Vector (Upper Byte) Notes: * Figure 11. Program Memory Map A reset after a Low on P27 to exit STOP mode may affect device reliability. PRELIMINARY 15 1 Z86318 Z8® MCU 8-Bit Microcontroller FUNCTIONAL DESCRIPTION Register File. The Register File consists of three I/O port registers, 124 general-purpose registers, and 15 control and status registers, R0-R3, R4-R127 and R241-R255, respectively (see Figure 12). The Z86318 instructions can access registers directly or indirectly via an 8-bit address field. This allows short, 4-bit register addressing using the Register Pointer. In the 4-bit mode, the register file is divided into eight working register groups, each occupying 16 continuous locations. The Register Pointer addresses the starting location of the active working-register group (Figures 13 and 14). r7 r6 r5 r4 r3 r2 r1 r0 R253 (Register Pointer) The upper nibble of the register file address provided by the register pointer specifies the active working-register group. FF Register Group F R15 to R0 F0 7F 70 6F LOCATION IDENTIFIERS R255 Stack Pointer (Bits 7-0) SPL R254 General-Purpose GPR R253 Register Pointer RP R252 Program Control Flags FLAGS R251 Interrupt Mask Register IMR R250 Interrupt Request Register IRQ R249 Interrupt Priority Register IPR R248 Ports 0-1 Mode P01M R247 Port 3 Mode P3M R246 Port 2 Mode P2M R245 T0 Prescaler PRE0 R244 Timer/Counter0 R243 T1 Prescaler R242 Timer/Counter1 R241 Timer Mode 10 0F TMR Not Implemented R128 R127 Port 3 P3 R2 Port 2 P2 R1 Reserved R0 Port 0 P0 Figure 12. Register File 16 Specified Working Register Group Register Group 1 R15 to R0 Register Group 0 R15 to R4 I/O Ports 00 Figure 13. Register Pointer T1 R3 30 2F The lower nibble of the register file address provided by the instruction points to the specified register. 20 1F PRE1 General-Purpose Registers 50 4F 40 3F T0 R4 60 5F PRELIMINARY R3 to R0 Z86318 Z8® MCU 8-Bit Microcontroller Z8® STANDARD CONTROL REGISTERS REGISTER POINTER 7 6 5 4 3 2 1 1 RESET CONDITION 0 D7 D6 D5 D4 D3 D2 D1 D0 Working Register Group Pointer % FF REGISTER Bits 0-3 must be 0 Z8 Register File % FO % EO * * % 7F % FF SPL U U U U U U U U % FE GPR U U U U U U U U % FD RP 0 0 0 0 0 0 0 0 % 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 0 1 0 0 1 1 0 1 % F7 P3M 0 0 0 0 0 0 0 0 % F6 P2M 1 1 1 1 1 1 1 1 % F5 PRE0 U U U U U U U U % F4 T0 U U U U U U U U % F3 PRE1 U U U U U U U U % F2 T1 U U U U U U U U % F1 TMR 0 0 0 0 0 0 0 0 % F0 Reserved REGISTER * * % 0F % 00 RESET CONDITION % (0) 03 P3 0 0 0 0 U U U U % (0) 02 P2 U U U U U U U U % (0) 01 Reserved % (0) 00 P0 U U U U U U U U Notes: All addresses are in Hexadecimal U = Unknown * Will not be reset with a Stop-Mode Recovery Figure 14. Register File Architecture ROM Protect. A ROM Protect feature prevents “dumping” of the ROM contents without inhibiting execution of LDC, LDCI, LDE, and LDEI instructions. This feature is maskprogrammable. Stack Pointer. The Z86318 features an 8-bit Stack Pointer (R255) used for the internal stack that resides within the 124 general-purpose registers. Counter/Timer. There are two 8-bit programmable counter/timers (T0 and T1), each driven by its own 6-bit programmable prescaler. The T1 prescaler can be driven by internal or external clock sources, however, the T0 can be driven by the internal clock source only (see Figure 15). The 6-bit prescalers can divide the input frequency of the clock source by any integer number from 1 to 64. Each prescaler drives its counter, which decrements the value (1 to 256) that has been loaded into the counter. When both counter and prescaler reach the end of count, a timer interrupt request IRQ4 (T0) or IRQ5 (T1) is generated. PRELIMINARY 17 Z86318 Z8® MCU 8-Bit Microcontroller FUNCTIONAL DESCRIPTION (Continued) The counter 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 the initial value and continue counting (modulo-n continuous mode). clock source for T1 is user-definable and can be either the internal microprocessor clock divided by four, or an external signal input via Port 3. The Timer Mode register configures the external timer input (P31) as an external clock, a trigger input that is retriggerable or not retriggerable, or as a gate input for the internal clock. The counters, but not the prescalers, may be read at any time without disturbing their value or count mode. The Internal Data Bus Write Write Read PRE0 Initial Value Register T0 Initial Value Register 6-Bit Down Counter 8-Bit Down Counter 6-Bit Down Counter 8-Bit Down Counter PRE1 Initial Value Register T1 Initial Value Register T0 Current Value Register OSC ÷4 IRQ4 Internal Clock External Clock Clock Logic ÷4 TIN P31 Internal Clock Gated Clock Triggered Clock Write Write Internal Data Bus Figure 15. Counter/Timers Block Diagram 18 PRELIMINARY IRQ5 T1 Current Value Register Read Z86318 Z8® MCU 8-Bit Microcontroller Interrupts. The Z86318 features four interrupts from four different sources. These interrupts are maskable and prioritized (Figure 16). The four sources are divided as follows: the falling edge of P31, P33, and the two counter/timers. The Interrupt Mask Register globally or individually enables or disables the four interrupt requests (Table 4). When more than one interrupt is pending, priorities are resolved by a programmable priority encoder that is controlled by the Interrupt Priority register. All Z86318 interrupts are vectored through locations in program memory. When an interrupt machine cycle is activated, an interrupt request is granted. This disables all subsequent interrupts, saves the Program Counter and Status Flags, and then branches to the program memory vector location reserved for that interrupt. This memory location and the next byte contain the 16-bit starting address of the Interrupt Service Routine for that particular interrupt request. To accommodate polled interrupt systems, interrupt inputs are masked and the Interrupt Request Register is polled to determine which of the interrupt requests needs service. Table 3. Interrupt Types, Sources, and Vectors Source P33 P31 T0 T1 Name IRQ1 IRQ2 IRQ4 IRQ5 Vector 2,3 4,5 8,9 10,11 Location Comments External (F)Edge External (F)Edge Internal Internal Notes: F = Falling edge triggered R = Rising edge triggered IRQ0 - IRQ5 IRQ IMR 6 Global Interrupt Enable Interrupt Request IPR Priority Logic Vector Select Figure 16. Interrupt Block Diagram Clock. The Z86318 on-chip oscillator has a parallel-resonant amplifier for connection to a crystal, ceramic resonator, or any suitable external clock source (XTAL1 = Input, XTAL2 = Output). The crystal should be AT cut, 4 MHz max, with a series resistance (RS) less than or equal to 100 Ohms. The crystal should be connected across XTAL1 and XTAL2 using the recommended capacitors (capacitance is between 10 pF to 250 pF and is specified by the crystal manufacturer, ceramic resonator and PCB layout) from each pin to ground (see Figure 17). PRELIMINARY 19 1 Z86318 Z8® MCU 8-Bit Microcontroller FUNCTIONAL DESCRIPTION (Continued) XTAL1 C1 XTAL1 XTAL1 XTAL2 XTAL2 C1 L XTAL2 C2 C2 Ceramic Resonator or Crystal LC Clock External Clock Figure 17. Oscillator Configuration HALT Mode. This instruction turns off the internal CPU clock but not the on-chip oscillation circuit. The counter/timers and external interrupts IRQ1 and IRQ2 remain active. The device can be recovered by interrupts, either externally or internally generated. An interrupt request must be executed (enabled) to exit HALT mode. After the interrupt service routine, the program continues from the instruction after the HALT. The HALT mode may also be exited via POR/RESET activation or a WDT time-out. In this case, the program execution begins at location 000CH. The WDH instruction is used to enable the WatchDog Timer in HALT mode. STOP Mode. This instruction turns off the internal clock and reduces the standby current. The STOP mode can be released by the following methods: 1) Power-On Reset (POR) and 2) P27 is configured as an input line when the device executes the STOP instruction. A low input condition on P27 that meets a minimum pulse width (TWSM) releases the STOP mode. Note: WDT is disabled in STOP mode. 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 execute a NOP (opcode=FFH) immediately before the appropriate sleep instruction, such as the following: FF NOP ; clear the pipeline 6F STOP FF 7F NOP HALT ; enter the STOP mode or ; clear the pipeline ; enter the HALT mode In STOP or HALT mode, the value of each output line prior to the HALT or STOP instruction is retained during execution. Upon reset, program execution begins at location 000C (hex). However, when P27 is used to release the STOP mode, the I/O port mode registers are not reconfigured to their default power-on conditions. This prevents any I/O, configured as an 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: LDP2M, #1XXX XXXXB(X = user's choice) NOP STOP 20 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller Watch-Dog Timer (WDT). The WDT is initially enabled by executing the WDT instruction and it is refreshed by subsequent WDT instruction executions. Note: Once the WDT has been enabled, it cannot be disabled. The time-out period of the WDT is 24 ms. The WDT instruction affects the Zero (Z), Sign (S), and Overflow (V) flags. The WDT can be permanently enabled (ROM mask option) upon MCU power-up. Opcode WDT (5FH). Execution of WDT clears the WDT counter. This must be done at least every 24 ms, otherwise, the WDT times out and generates a reset. This generated reset is the same as a power-on reset of 6.0 ms, plus 18 clock cycles. Low-Voltage Protection (VLV). The device will function normally between 6.0V and 4.0V under all specified conditions. Below 4.0V, the device is still internally functional until the Low Voltage trip point (VLV) is reached; however, it is not guaranteed to meet all AC and DC Characteristics. When the supply voltage drops below VLV, an automatic hardware reset occurs, re-initializing the Z86318. The Low-Voltage Protection feature may be selected as a ROM mask option. The actual VLV is a function of temperature, operating frequency and process parameters. A typical example of the VLV trip-point function at ambient temperature for a frequency of 4 MHz is illustrated in Figure 18. Vcc (Volts) 2.80 2.75 2.70 2.65 LLV (Typical) 2.60 2.55 2.50 –5 0 5 10 15 20 25 30 35 40 45 Temperature (°C) Figure 18. Typical Z86318 VLV Versus Temperature PRELIMINARY 21 1 Z86318 Z8® MCU 8-Bit Microcontroller Z8 CONTROL REGISTERS R244 T0 R241 TMR D7 D6 D5 D4 D3 D2 D1 D7 D6 D5 D4 D3 D2 D1 D0 D0 T0 Initial Value (When Written) (Range: 1-256 Decimal 01-00 HEX) T0 Current Value (When READ) 0 No Function 1 Load T0 0 Disable T0 Count 1 Enable T0 Count 0 No Function 1 Load T1 0 Disable T1 Count 1 Enable T1 Count TIN Modes 00 External Clock Input 01 Gate Input 10 Trigger Input (Non-retriggerable) 11 Trigger Input (Retriggerable) Figure 22. Counter Timer 0 Register (F4H: Read/Write) R245 PRE0 D7 D6 D5 D4 D3 D2 D1 D0 Count Mode 0 T0 Single Pass 1 T0 Modulo N Reserved (Must be 0) Reserved (Must be 0) Figure 19. Timer Mode Register (F1H:Read/Write) Prescaler Modulo (Range: 1-64 Decimal 01-00 HEX) Figure 23. Prescaler 0 Register (F5H: Write Only) R242 T1 D7 D6 D5 D4 D3 D2 D1 D0 T1 Initial Value (When Written) (Range 1-256 Decimal 01-00 HEX) T1 Current Value (When READ) R246 P2M D7 D6 D5 D4 D3 D2 D1 D0 P27- P20 I/O Definition 0 Defines Bit as OUTPUT 1 Defines Bit as INPUT Figure 20. Counter Timer 1 Register (F2H: Read/Write) Figure 24. Port 2 Mode Register (F6H: Write Only) R243 PRE1 D7 D6 D5 D4 D3 D2 D1 D0 Count Mode 0 T1 Single Pass 1 T1 Modulo R247 P3M D7 D6 D5 D4 D3 D2 Clock Source 1 T1 Internal 0 T1 External Timing Input (TIN) Mode Prescaler Modulo (Range: 1-64 Decimal 01-00 HEX) D0 0 1 Port 2 Open-Drain Port 2 Push-Pull Reserved (Must be 0) Figure 25. Port 3 Mode Register (F7H: Write Only) Figure 21. Prescaler 1 Register (F3H:Write Only) 22 D1 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller R248 P01M R251 IMR D7 D6 D7 D6 D5 D4 D3 D2 D1 D0 D5 D4 D3 D2 D1 D0 1 P00-P03 Mode 00 Output 01 Input 1 Enables IRQ5-IRQ0 (D0 = IRQ0) Reserved (Must be 0) Reserved (Must be 0) Reserved (Must be 0) 1=Global Interrupt Enable 0=Global Interrupt Disable Figure 26. Port 0 and 1 Mode Register (F8H: Write Only) Figure 29. Interrupt Mask Register (FBH: Read/Write) R252 Flags R249 IPR D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 User Flag F1 User Flag F2 Reserved (Must be 0.) 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Reserved IRQ1>4>5>2 Reserved IRQ4>1>5>2 IRQ5>2>1>4 IRQ5>1>4>2 IRQ5>2>4>1 IRQ5>4>1>2 IRQ2>1>4>5 IRQ1>4>2>5 IRQ2>4>1>5 IRQ4>1>2>5 IRQ2>5>1>4 Reserved IRQ2>5>4>1 Reserved Figure 27. Interrupt Priority Register (F9H: Write Only) Half Carry Flag Decimal Adjust Flag Overflow Flag Sign Flag Zero Flag Carry Flag Figure 30. Flag Register (FCH: Read/Write) R253 RP D7 D6 D5 D4 D3 D2 D1 D0 R250 IRQ D7 D6 D5 D4 D3 D2 Reserved (Must be 0) D1 D0 Working Register Pointer Reserved (Must be 0) Figure 31. Register Pointer (FDH: Read/Write) IRQ1 = P33 Input IRQ2 = P31 Input Reserved (Must be 0) IRQ4 = T0 R255 SPL IRQ5 = T1 D7 D6 D5 D4 D3 D2 D1 D0 Reserved (Must be 0) Figure 28. Interrupt Request Register (FAH: Read/Write) Stack Pointer Lower Byte (SP0-SP7) Figure 32. Stack Pointer (FFH: Read/Write) PRELIMINARY 23 Z86318 Z8® MCU 8-Bit Microcontroller PACKAGE INFORMATION Figure 33. 18-Pin DIP Package Diagram Figure 34. 18-Pin SOIC Package Diagram 24 PRELIMINARY Z86318 Z8® MCU 8-Bit Microcontroller ORDERING INFORMATION 1 Z86318 18-Pin DIP 18-Pin SOIC Z8631804PSC Z8631804PEC Z8631804SSC Z8631804SEC For fast results, contact your local Zilog sales offices for assistance in ordering the part desired. Codes Preferred Package P = DIP Longer Lead Time S = SOIC Temperature S = 0°C to +70°C Speed 04 = 4 MHz Environmental C = Plastic Standard Example: Z 86318 04 P S C is a Z86318, 4 MHz, DIP , 0°C to +70°C, Plastic Standar d Flow Environmental Flow Temperature Package Speed Product Number PRELIMINARY 25 Z86318 Z8® MCU 8-Bit Microcontroller 26 PRELIMINARY