Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER CUSTOMER P ROCUREMENT SPECIFICA TION Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER FEATURES ■ Low Power Consumption - 750 mW ■ Hardware Watch-Dog Timer (WDT) ■ 32 Input/Output Lines ■ Two Programmable 8-Bit Counter/Timers, Each with 6-Bit Programmable Prescaler ■ Digital Inputs NMOS Levels with Internal Pull-Up Resistors ■ Six Vectored, Priority Interrupts from Six Different Sources ■ On-Chip RC Oscillator ■ Clock Frequency: Up to 5MHz ■ Low EMI Emission ■ 4 Kbytes ROM ■ Four Direct Connect LED Drive Pins ■ 124 Bytes of RAM GENERAL DESCRIPTION The Z08617 Keyboard Controller is a member of the Z8® single-chip microcontroller family with 4 Kbytes of ROM. The device is housed in a 40-pin DIP package, and is manufactured in NMOS technology. The Z08617 microcontroller offers fast execution, efficient use of memory, sophisticated interrupt, input/output bitmanipulation capabilities, and easy hardware/software system expansion along with low cost and low power consumption. The Z08617 architecture is characterized by a flexible I/O scheme, an efficient register, I/O, and a number of ancillary features that are useful in many industrial and advanced scientific applications. For applications which demand powerful I/O capabilities, the Z08617 provides 32 pins dedicated to input and output. These lines are grouped into four ports, each port consists of 8 lines, and are configurable under software control to provide timing, status signals, and serial or parallel I/O ports. DS96KEY0300 The Z08617 offers low EMI emission which is achieved by means of several modifications in the output drivers and clock circuitry of the device. There are two basic address spaces which are available to support this wide range of configurations: Program Memory and 124 General-Purpose Registers. The Z08617 offers two on-chip counter/timers with a large number of user-selectable modes. This unburdens the program from coping with real-time problems such as counting/timing (Figure 1). 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 1 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER Machine Timing & Instruction Control Port 3 WDT ALU Counter/ Timers (2) POR Flags Program Memory Register Pointer Interrupt Control Register File 124 x 8-Bit Program Counter Port 0 Port 1 Port 2 4 I/O (Bit Programmable) 4 I/O Output Open-Drain (Nibble Programmable) 8 I/O Output Open-Drain (Byte Programmable) Figure 1. Z08617 Functional Block Diagram 2 /WDTOUT /RESET GND XTAL2 Vcc Output Input XTAL1 GENERAL DESCRIPTION (Continued) Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER PIN IDENTIFICATION VCC CLK Out RC In P37 1 P30 /RESET 5 6 *GND *N/C /WDTOUT 7 8 40 39 38 2 3 4 37 36 35 34 33 9 Z08617 DIP P36 P31 P27 P26 P25 P24 P23 P22 32 31 30 P21 P34 P17 P35 GND P32 10 11 12 29 P00 P01 P02 P03 13 14 15 16 28 27 26 P04 P05 P06 P07 17 18 19 20 25 24 23 22 21 P20 P33 P16 P15 P14 P13 P12 P11 P10 Note: * Pin 8 is connected to the chip, although used only for testing. This pin must float. Pin 7 is a test pin and must be grounded. Figure 2. 40-Pin DIP Pin Configuration Table 1. 40-Pin DIP Pin Identification Pin # Symbol Function Direction Pin # Symbol Function Direction 1 2 3 4 5 V CC CLK Out RC In P37 P30 Power Supply Clock Out Z8 Clock Port 3, Pin 7 Port 3, Pin 0 Input Output Input Output Input 11 12 13-20 21-28 29 GND P32 P07-P00 P17-P10 P34 Ground Port 3, Pin 2 Port 0, Pins 0,1,2,3,4,5,6,7 Port 1, Pins 0,1,2,3,4,5,6,7 Port 3, Pin 4 Input In/Output In/Output Output 6 *7 *8 9 10 /RESET GND N/C /WDTOUT P35 Reset Ground Not Connected Watch-Dog Timer Port 3, Pin 5 Input 30 P33 Port 3, Pin 3 Input 31-38 P27-P20 Port 2, Pins 0,1,2,3,4,5,6,7 In/Output Output Output 34-38 39 40 P24-P20 P31 P36 Port 2, Pins 0, 1, 2, 3, 4 Port 3, Pin 1 Port 3, Pin 6 In/Output Input Output 3 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER ABSOLUTE MAXIMUM RATINGS Symbol Description Min Max Units V CC T STG Supply Voltage* Storage Temp –0.3 –65 +7.0 +150 TA Oper Ambient Temp † † V C Notes: * Voltage on all pins with respect to GND. † 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. STANDARD TEST CONDITIONS The characteristics listed here apply for standard test conditions as noted. All voltages are referenced to GND. Positive current flows into the referenced pin (Figure 17). From Output Under Test 150 pF Figure 17. Test Load Diagram STANDARD TEST CONDITIONS TA = 25°C, VCC = GND = 0V, f = 1.0 MHz, unmeasured pins returned to ground. Parameter Input capacitance Output capacitance I/O capacitance 4 Max 12 pF 12 pF 12 pF Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER DC CHARACTERISTICS VCC = 4.75V to 5.25V @ 0°C to -55°C Sym Parameter Min Max Typ* V IH V IL Input High Voltage Input Low Voltage 2.0 –0.3 VCC 0.8 V V V RH V RL V OH Reset Input High Voltage Reset Input Low Voltage Output High Voltage Output High Voltage 3.8 –0.3 2.0 2.4 VCC 0.8 V V V V IOH = –250 µA (Port 2 only) IOH = –250 µA (Port 3 only) V OL IIL IOL Output Low Voltage Input Leakage Output Leakage –10 –10 0.8 10 10 V µA µA IOL = 10.0 mA (See note [1] below.) V IN = 0V, 5.25V (See note [3] below.) V IN = 0V, 5.25V (See note [2] below.) IIR Reset Input Current –335 –775 µA V IN = 0V, 5.25V IR1 Input Current –335 –775 µA Pull-up resistor=10.4 Kohms, V IN=0.0V IR2 Input Current –1.6 –2.9 mA Pull-up resistor = 2.4 Kohms, V IN=0.0V ICC V CC Supply Current 160 mA WDT Watch-Dog Timer 2.0 mA –477 Unit Condition V OL=0.4 Volt Notes: * Typical @ 25°C [ 1 ] Ports P37-P34 may be used to sink 12 mA. These may be used for LEDs or as general-purpose outputs requiring high sink current. [ 2 ] P00-P07, P10-P17, P20-P25, P30-P33 as output mode opendrain as a logic one. [ 3 ] P00-P07, P10-P17, P20-P25, P30-P33 as output mode opendrain as a logic one. 5 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER PIN FUNCTIONS RCIN This pin is connected between a precision resistor on the power supply from the precision RC Oscillator. CLK Out This pin is the syste m clock of the Z8 and runs at the frequency of the RC Oscillator. Any load on this pin will effect the RC Oscillator frequency. Port 0 (P07-P00). Port 0 is an 8-bit, nibble programmable, bi-directional, NMOS compatible I/O port. These eight I/O lines can be configured under software control as a nibble input port, or as a nibble open-drain output port. When used as an I/O port, inputs are standard NMOS (Figure 5). Port P03-P00 has 10.4 Kohms (± 35%) pull-up resistors when configured as inputs. 4 Z8615 Port 0 4 I/O (Open-Drain Output) (a) Port P00-P03 10.4 Kohms Pad Input OEN Output (b) Port P04-P07 Input OEN Output Figure 5. Port 0 Configuration 6 Pad Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER PIN FUNCTIONS (Continued) Port 1 (P17-P10). Port 1 is an 8-bit, byte programmable, bidirectional, NMOS compatible I/O port. These eight I/O lines are configured under software control program as a Z8615 byte input port or as an open-drain output port. When used as an I/O port, inputs are standard NMOS (Figure 6). 8 Port 1 I/O (Open-Drain Output) Pad Input OEN Output Figure 6. Port 1 Configuration 7 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER Port 2 (P27-P20). Port 2 is an 8-bit, bit programmable, bidirectional, NMOS compatible I/O port. These eight I/O lines are configured under the software control program for I/O. Port 2 can be programmed as bit-by-bit independently, as input or output, or configured to provide open- Z8615 drain outputs (Figure 7). P26 and P27 have 2.4 Kohms (± 25%) pull-up resistors and are capable of sourcing 2.4 mA. P24 and P25 have 10.4 Kohms (± 35%) pull-up when configured as inputs. Port 2 (I/O) OEN Open-Drain Pad (a) Ports P20-P23 OUT Input IN 10.4 Kohms OEN Open-Drain (b) Ports P24-P25 Pad OUT Input IN 2.4 Kohms OEN Open-Drain Pad (c) Ports P26-P27 OUT Input IN Figure 7. Port 2 Configuration 8 Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER PIN FUNCTIONS (Continued) Port 3 (P37-P30). Port 3 is an 8-bit, NMOS compatible fourfixed-input and four-fixed-output I/O port. These eight I/O lines have four-fixed-input (P33-P30) and four-fixed-output (P37-P34) ports. Port 3 inputs have 10.4 Kohms (± 35%) pull-up resistors and port 3 outputs are capable of driving up to four LEDs. Port 3 is configured under software control to provide the following control functions: four external interrupt request signals (IRQ3-IRQ0); timer input and output signals (TIN and TOUT - Figure 8). /RESET (input, active Low). When activated, /RESET initializes the Z08617. When /RESET is deactivated, program execution begins from the internal program location at 000CH. Reset pin has a 10.4 Kohms pullup resistor. Once this pin is pulled Low, it takes about 150 ms for microcon-troller initialization. Z8615 Port 3 (I/O or Control) Output Pad (a) Port 3 P34-P37 10.4 Kohms Input Pad (b) Port 3 P30-P33 Figure 8. Port 3 Configuration 9 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER FUNCTIONAL DESCRIPTION The device incorporates special functions to enhance Zilog's Z8 applications as a keyboard controller, scientific research and advanced technologies applications. The first 12 bytes of program memory are reserved for the interrupt vectors. These locations have six 16-bit vectors that correspond to the six available interrupts. Program Memory. The 16-bit program counter addresses 4 Kbytes of program memory space at internal locations (Figure 9). Byte 12 to byte 4095 consists of on-chip, mask programmed ROM. Addresses 4096 and greater are reserved. 65535 Reserved Location of First Byte of Instruction Executed After RESET Interrupt Vector (Lower Byte) Interrupt Vector (Upper Byte) 4096 4095 On-Chip ROM 12 11 IRQ5 10 IRQ5 9 IRQ4 8 IRQ4 7 IRQ3 6 IRQ3 5 IRQ2 4 IRQ2 3 IRQ1 2 IRQ1 1 IRQ0 0 IRQ0 Figure 9. Program Memory Map 10 Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER FUNCTIONAL DESCRIPTION (Continued) Register File. The register file (Figure 10) consists of four I/O port registers, 124 general-purpose registers and 16 control and status registers (R3-R0, R127-R4, and R255R240, respectively). The instructions can access registers directly or indirectly through an 8-bit address field. This allows short, 4-bit register addressing using the Register LOCATION R255 R254 Pointer (Figure 11). In the 4-bit mode, the register file is divided into nine working-register groups, each occupying 16 continuous locations. The Register Pointer addresses the starting location of the active working-register group. IDENTIFIERS Stack Pointer (Bits 7-0) SPL General-Purpose Register (Bits 7-0) GPR r7 r6 R253 Register Pointer R252 Program Control Flags FLAGS R251 Interrupt Mask Register IMR R250 Interrupt Request Register IRQ FF R249 Interrupt Priority Register IPR F0 R248 Ports 1-0 Mode P01M R247 Port 3 Mode P3M R246 Port 2 Mode P2M R245 T0 Prescaler PREQ R244 Timer/Counter0 R243 T1 Prescaler R242 Timer/Counter1 R241 Timer Mode R240 Reserved 2F Not Implemented 20 1F r5 r4 r3 r2 r1 r0 R253 (Register Pointer) RP The upper nibble of the register file address provided by the register pointer specifies the active working-register group. Register Group F R15 to R0 • • • • • • • • T0 PRE1 T1 TMR R127 • • • • • • 10 0F General-Purpose Registers R4 Specified Working Register Group The lower nibble of the register file address provided by the instruction points to the specified register. Register Group 1 R15 to R0 Register Group 0 R15 to R4 I/O Ports R3 to R0 00 R3 Port 3 P3 R2 Port 2 P2 R1 Port 1 P1 R0 Port 0 P0 Figure 11. Register Pointer Configuration Figure 10. Register File Configuration 11 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER Stack. The Z08617 internal register files are used for the stack. An 8-bit Stack Pointer (R255) is used for the internal stack that resides within the 124 general-purpose registers. Counter/Timers. There are two 8-bit programmable counter/timers (T0-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 prescaler is driven by the internal clock only (Figure 12). The 6-bit prescalers can further divide the input frequency of the clock source by any integer number from 1 to 64. Each prescaler drives its own counter, which decrements the value (1 to 256) that has been loaded into the counter. When both the counter and prescaler reach the end of count, a timer interrupt request, IRQ4 (T0) or IRQ5 (T1), is generated. 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 (modulon continuous mode). The counters, but not the prescalers, are read at any time without disturbing their value or count mode. The clock source for T1 is user-definable and are either the internal microprocessor clock divided by four, or an external signal input through Port 3. The Timer Mode register configures the external timer input as an external clock, a trigger input that can be retriggerable or non-triggerable, or as a gate input for the internal clock. The counter/timers can be programmable cascaded by connecting the T0 output to the input of T1. Port 3 lines P36 also serves as a timer output (T OUT) through which T0, T1 or the internal clock are output. Internal Data Bus Write RC OSC Write Read PRE0 Initial Value Register T0 Initial Value Register 6-Bit Down Counter 8-bit Down Counter T0 Current Value Register ÷2 CLK Out ÷4 IRQ4 Internal Clock TOUT P36 ÷2 External Clock Clock Logic ÷4 Internal Clock Gated Clock Triggered Clock T P31 IN Write 6-Bit Down Counter 8-Bit Down Counter PRE1 Initial Value Register T1 Initial Value Register Write Internal Data Bus Figure 12. Counter/Timers Block Diagram 12 IRQ5 T1 Current Value Register Read Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER FUNCTIONAL DESCRIPTION (Continued) Interrupts. The Z08617 has six different interrupts from six different sources. These interrupts are maskable and prioritized (Figure 13). The six sources are divided as follows: four sources are claimed by Port 3 lines P33-P30, and two are claimed by the counter/timers. The Interrupt Masked Register globally or individually enables or disables the six interrupts requests. interrupt request is granted. This disables all of the 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 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 request needs service. When more than one interrupt is pending, priorities are resolved by a programmable priority encoder that is controlled by the Interrupt Priority register. All interrupts are vectored through locations in the program memory. When an interrupt machine cycle is activated an IRQ0-IRQ5 6 IRQ IMR 6 Global Interrupt Enable Interrupt Request IPR Priority Logic Vector Select Figure 13. Interrupt Block Diagram 13 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER RC Oscillator. The Z08617 provides an internal capacitor to accommodate an RC oscillator configuration. A 1% precision resistor is necessary to achieve ± 10% accurate frequency oscillation. EMI. The Z08617 offers low EMI emission due to circuit modifications to improve EMI performance. The internal divide-by-two circuit has been removed to improve EMI performance. 5V 1% Precision XTAL1 NC XTAL2 RC Oscillator Figure 14. Oscillator Configuration 14 Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER FUNCTIONAL DESCRIPTION (Continued) Watch-Dog Timer. The Z08617 is equipped with a hardware Watch-Dog Timer which will be turned on automatically by power-on (Figure 15). The Watch-Dog Timer must be refreshed at least once every 50 ms by executing the instruction WDT (Opcode = %5F), otherwise the Z08617 will reset itself if /WDTOUT pin 9 is connected to /RESET (Pin 6). Figure 16 shows the block diagram of WDT. The Watch-Dog Timer is automatically enabled upon power-up of the microcontroller and /RESET going High. The /WDTOUT pin can be connected to the /RESET pin to provide an automatic reset upon WDT time-out. Dur- ing WDT time-out, the /WDTOUT pin goes Low for approximately 8-15 µs. WDT Hot Bit. Bit 7 of the Interrupt Request Register (IRR register FAH) determines whether a hot start or cold start occurred. A cold start is defined as a rest occurring from the power-up of the Z08617 (bit 7 is set to zero upon power-up). A hot start occurs when a WDT timeout has occurred (bit 7 is set to 1). Bit 7 of the IRQ register is read-only and is automatically reset to 0 when accessed. Power-On Reset. Upon power-up of the microcontroller, a reset condition is enabled. A delay of 150 ms ± 20% is used to assist in initializing the microcontroller. VCC 8-15 µs /WDT Output /Reset Internal Reset Reset Delay POR * Reset Delay = POR 150 ms ±20% Figure 15. WDT Turn-On Timing After Reset 10.4 Kohms Reset Reset Logic WDT 50 ms Internal Reset 150 ms Counter Internal RC Figure 16. WDT Block Diagram 15 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER Z8® CONTROL REGISTER DIAGRAMS R244 T0 R241 TMR D7 D6 D7 D6 D5 D4 D3 D2 D1 D0 D5 D4 D3 D2 D1 D0 T0 Initial Value (When WRITE) (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 Figure 21. Counter/Timer 0 Register (F4H: Read/Write) 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) R245 PRE0 D7 D6 D5 D4 D3 D2 D1 D0 TOUT Mode 00 = Not Used 01 = T0 OUT 10 = T1 OUT 11 = Internal Clock Out Count Mode 0 = T0 Single Pass 1 = T0 Modulo N Reserved (Must be 0) Figure 18. Timer Mode Register (F1H: Read/Write) Prescaler Modulo (Range: 1-64 Decimal 01-00 HEX) Figure 22. Prescaler 0 Register (F5H: Write Only) R242 T1 D7 D6 D5 D4 D3 D2 D1 D0 R246 P2M T1 Initial Value (When WRITE) (Range 1-256 Decimal 01-00 HEX) T1 Current Value (When READ) D7 D6 D5 D4 D3 D2 D1 D0 P20-P27 I/O Definition 0 Defines Bit as OUTPUT 1 Defines Bit as INPUT Figure 19. Counter Timer 1 Register (F2H: Read/Write) Figure 23. Port 2 Mode Register (F6H: Write Only) R243 PRE1 R247 P3M D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 Count Mode 0 = T1 Single Pass 1 = T1 Modulo N Clock Source 1 = T0 Internal 0 = T0 External Timing Input (TIN) Mode Prescaler Modulo (Range: 1-64 Decimal 01-00 HEX) Figure 20. Prescaler 1 Register (F3H: Write Only) 16 0 Port 2 Pull-Ups Open-Drain 1 Port 2 Pull-Ups Active Reserved (Must be 0) Figure 24. Port 3 Mode Register (F7H: Write Only) Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER Z8® CONTROL REGISTER DIAGRAMS (Continued) R250 IRQ R248 P01M D7 D6 D5 D4 D3 D2 D1 D7 D6 D5 D4 D3 D2 D1 D0 D0 IRQ0 = P32 Input (D0 = IRQ0) IRQ1 = P33 Input IRQ2 = P31 Input IRQ3 = P30 Input IRQ4 = T0 IRQ5 = T1 P00 - P03 Mode 00 = Output 01 = Input Stack Selection 1 = Internal (Must be 1) P10-P17 Mode 0 = Byte Output 1 = Byte Input Reserved (Must be 0) WDT Hot Bit 0 = POR* 1 = WDT TIME OUT *Default setting after setup. Reserved (Must be 0) P04 - P07 Mode 00 = Output 01 = Input Figure 27. Interrupt Request Register (FAH: Read/Write) Figure 25. Port 0 and 1 Mode Register (F8H: Write Only) R251 IMR R249 IPR D7 D6 D5 D4 D3 D2 D1 D7 D6 D5 D4 D3 D2 D1 D0 D0 Interrupt Group Priority Reserved = 000 C > A > B = 001 A > B > C = 010 A > C > B = 011 B > C > A = 100 C > B > A = 101 B > A > C = 110 Reserved = 111 IRQ1, IRQ4 Priority (Group C) 0 = IRQ1 > IRQ4 1 = IRQ4 > IRQ1 IRQ0, IRQ2 Priority (Group B) 0 = IRQ2 > IRQ0 1 = IRQ0 > IRQ2 IRQ3, IRQ5 Priority (Group A) 0 = IRQ5 > IRQ3 1 = IRQ3 > IRQ5 1 Enables IRQ0-IRQ5 (D0 = IRQ0) Reserved (Must be 0) 1 Enables Interrupts Figure 28. Interrupt Mask Register (FBH: Read/Write) Reserved (Must be 0) Figure 26. Interrupt Priority Register (F9H: Write Only) 17 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER R252 Flags R254 GPR D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 User Flag F1 GPR User Flag F2 Half Carry Flag Figure 31. General-Purpose Register (FEH: Read/Write) Decimal Adjust Flag Overflow Flag Sign Flag Zero Flag Carry Flag Figure 29. Flag Register (FCH: Read/Write) D7 D6 D5 D4 D3 D2 D1 D0 Stack Pointer Lower Byte (SP0-SP7) Figure 32. Stack Pointer (FFH: Read/Write) R253 RP D7 D6 D5 D4 D3 D2 D1 D0 Reserved (Must be 0) r4 r5 r6 Register Pointer r7 Figure 30. Register Pointer (FDH: Read/Write) 18 R255 SPL Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER INSTRUCTION SET NOTATION Addressing Modes. The following notation is used to describe the addressing modes and instruction operations as shown in the instruction summary. Symbol Meaning IRR ingIrr X DA RA IM R r IR Indirect register pair or indirect workregister pair address Indirect working-register pair only Indexed address Direct address Relative address Immediate Register or working-register address Working-register address only Indirect-register or indirect working-register address Indirect working-register address only Register pair or working register pair address Ir RR Flags. Control register (R252) contains the following six flags: Symbol Meaning C Z S V D H Carry flag Zero flag Sign flag Overflow flag Decimal-adjust flag Half-carry flag Affected flags are indicated by: 0 1 * x Clear to zero Set to one Set to clear according to operation Unaffected Undefined Symbols. The following symbols are used in describing the instruction set. Symbol Meaning dst src cc @ SP PC FLAGS RP IMR Destination location or contents Source location or contents Condition code Indirect address prefix Stack Pointer Program Counter Flag register (Control Register 252) Register Pointer (R253) Interrupt mask register (R251) 19 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER CONDITION CODES Value Mnemonic Meaning Flags Set 1000 0111 1111 0110 1110 — C NC Z NZ Always True Carry No Carry Zero Not Zero — C=1 C=0 Z=1 Z=0 1101 0101 0100 1100 0110 PL MI OV NOV EQ Plus Minus Overflow No Overflow Equal S S V V Z 1110 1001 0001 1010 0010 NE GE LT GT LE Not Equal Greater Than or Equal Less than Greater Than Less Than or Equal Z=0 (S XOR V) = 0 (S XOR V) = 1 [Z OR (S XOR V)] = 0 [Z OR (S XOR V)] = 1 1111 0111 1011 0011 0000 UGE ULT UGT ULE F Unsigned Greater Than or Equal Unsigned Less Than Unsigned Greater Than Unsigned Less Than or Equal Never True (Always False) C=0 C=1 (C = 0 AND Z = 0) = 1 (C OR Z) = 1 — 20 =0 =1 = 1 = 0 =1 Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER INSTRUCTION FORMATS OPC dst CCF, DI, EI, IRET, NOP, RCF, RET, SCF OPC One-Byte Instructions OPC MODE dst/src OR 1110 dst/src OPC CLR, CPL, DA, DEC, DECW, INC, INCW, POP, PUSH, RL, RLC, RR, RRC, SRA, SWAP OPC MODE OR 1110 src OR 1110 dst OR 1110 dst src OR 1110 src dst OR 1110 dst src dst ADC, ADD, AND, CP, LD, OR, SBC, SUB, TCM, TM, XOR JP, CALL (Indirect) dst OR 1110 dst OPC MODE dst OPC ADC, ADD, AND, CP, LD, OR, SBC, SUB, TCM, TM, XOR VALUE SRP VALUE MODE OPC MODE dst src MODE OPC dst/src src/dst ADC, ADD, AND, CP, OR, SBC, SUB, TCM, TM, XOR LD, LDE, LDEI, LDC, LDCI OPC MODE OPC dst/src x LD LD ADDRESS dst/src OPC src/dst LD OR 1110 src cc OPC JP DAU dst OPC LD DAL DJNZ, JR DAU VALUE OPC dst/CC OPC DAL RA FFH 6FH CALL STOP/HALT 7FH Two-Byte Instructions Three-Byte Instructions INSTRUCTION SUMMARY Note: Assignment of a value is indicated by the symbol “←”. For example: dst ← dst + src indicates that the source data is added to the destination data and the result is stored in the destination location. The notation “addr (n)” is used to refer to bit (n) of a given operand location. 21 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER INSTRUCTION SUMMARY (Continued) Instruction and Operation Address Flags Mode Opcode Affected dst src Byte (Hex) C Z S V D H ADC dst, src † dst ← dst + src + C 1[ ] ✻ ✻ ✻ ✻ 0 ✻ ADD dst, src dst ← dst + src † 0[ ] ✻ ✻ ✻ ✻ 0 ✻ AND dst, src † dst ← dst AND src 5[ ] ✻ ✻ 0 – – CALL dst SP ← SP – 2 @SP ← PC, PC ← dst D6 D4 – – – – – – EF ✻ – – – – – DA IRR CCF C ← NOT C CLR dst dst ← 0 R IR B0 B1 – – – – COM dst dst ← NOT dst R IR 60 61 – ✻ ✻ 0 – – CP dst, src dst – src † A[ ] ✻ ✻ ✻ ✻ – – DA dst dst ← DA dst R IR 40 41 ✻ ✻ ✻ X – – DEC dst dst ← dst – 1 R IR 00 01 – ✻ ✻ ✻ – – DECW dst dst ← dst – 1 RR IR 80 81 – ✻ ✻ ✻ – – DI IMR(7) ← 0 8F – – – – – – DJNZr, dst RA r←r–1 if r ≠ 0 PC ← PC + dst Range: +127,–128 rA r=0–F – – – – – – EI 9F IMR(7) ← 1 22 – – Instruction and Operation INC dst dst ← dst + 1 INCW dst dst ← dst + 1 – – – – – – ✻ ✻ ✻ – – R IR rE r=0–F 20 21 RR IR A0 A1 – ✻ ✻ ✻ – – BF ✻ ✻ ✻ ✻ ✻ ✻ CD C=0–F 30 – – – – – – CB C=0–F – – – – – – – – – – – – r IRET FLAGS ← @SP; SP ← SP + 1 PC ← @SP; SP ← SP + 2; IMR(7) ← 1 JP cc, dst if cc is true PC ← dst DA IRR JR cc, dst RA if cc is true, PC ← PC + dst Range: +127,–128 LD dst, src dst ← src – Address Flags Mode Opcode Affected dst src Byte (Hex) C Z S V D H r r R Im R r r X r Ir R R R IR IR X r Ir r R IR IM IM R rC r8 r9 r=0–F C7 D7 E3 F3 E4 E5 E6 E7 F5 LDC dst, src r Irr C2 – – – – – – LDCI dst, src dst ← src r ← r + 1; rr ← rr + 1 Ir Irr C3 – – – – – – Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER INSTRUCTION SUMMARY (Continued) Instruction and Operation Address Opcode Mode Byte dst src (Hex) NOP FF OR dst, src † dst ← dst OR src 4[ ] Flags Affected C Z S V D H – – Instruction and Operation R IR PUSH src SP ← SP – 1; @SP ← src 50 51 R IR – – – SUB dst, src dst ← dst – src † 2[ ] [ – ✻ ✻ 0 – – SWAP dst R IR F0 F1 X ✻ ✻ X – – TCM dst, src (NOT dst) AND src † 6[ ] – ✻ ✻ 0 – – TM dst, src dst AND src † 7[ ] – ✻ ✻ 0 – – WDT 5F – X X X – – B[ ] – ✻ ✻ 0 – – – 70 71 Flags Affected C Z S V D H – 7 POP dst dst ← @SP; SP ← SP + 1 Address Opcode Mode Byte dst src (Hex) – – – – – – 0 – – AF – – – XOR dst, src † dst ← dst XOR src R IR 90 91 ✻ ✻ ✻ ✻ – – R IR 10 11 ✻ ✻ ✻ ✻ – – † 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 value is found in the following table to the left of the applicable addressing mode pair. R IR E0 E1 ✻ ✻ ✻ ✻ – R IR C0 C1 ✻ ✻ ✻ ✻ – C 7 0 RLC dst C 7 0 RR dst C 7 0 RRC dst C 7 0 – – 1 [ RET PC ← @SP; SP ← SP + 2 – – – [ CF – – – 3 [ RCF C←0 RL dst 0 – – 4 [ – For example, the opcode of an ADC instruction using the addressing modes r (destination) and Ir (source) is 13. – Address Mode dst src 3[ SCF C←1 DF 1 – – – D0 D1 ✻ ✻ ✻ 0 – – 31 – C 7 SRP src RP ← src R IR r r [2] r Ir [3] R R [4] R IR [5] R IM [6] IR IM [7] ✻ ✻ ✻ ✻ 1 ✻ SBC dst, src † dst ← dst — src – C SRA dst ] – Lower Opcode Nibble – – 0 Im – – – – – 23 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER OPCODE MAP Lower Nibble (Hex) 0 0 1 2 3 4 5 Upper Nibble (Hex) 6 7 8 9 A B C D E F 6.5 DEC R1 6.5 RLC R1 6.5 INC R1 8.0 JP IRR1 8.5 DA R1 10.5 POP R1 6.5 COM R1 10/12.1 PUSH R2 10.5 DECW RR1 6.5 RL R1 10.5 INCW RR1 6.5 CLR R1 6.5 RRC R1 6.5 SRA R1 6.5 RR R1 8.5 SWAP R1 1 2 3 6.5 6.5 6.5 ADD ADD DEC r1, Ir2 r1, r2 IR1 6.5 6.5 6.5 ADC ADC RLC r1, Ir2 r1, r2 IR1 6.5 6.5 6.5 SUB SUB INC r1, Ir2 r1, r2 IR1 6.5 6.5 6.1 SBC SBC SRP r1, Ir2 r1, r2 IM 6.5 6.5 8.5 OR OR DA r1, Ir2 r1, r2 IR1 6.5 6.5 10.5 AND AND POP r1, Ir2 r1, r2 IR1 6.5 6.5 6.5 TCM TCM COM r1, Ir2 r1, r2 IR1 6.5 6.5 12/14.1 TM TM PUSH r1, Ir2 r1, r2 IR2 10.5 DECW IR1 6.5 RL IR1 6.5 6.5 10.5 CP CP INCW r1, Ir2 r1, r2 IR1 6.5 6.5 6.5 XOR XOR CLR r1, Ir2 r1, r2 IR1 18.0 12.0 6.5 LDCI LDC RRC r1, Irr2 Ir1, Irr2 IR1 6.5 SRA IR1 6.5 6.5 LD RR r1, IR2 IR1 6.5 8.5 LD SWAP Ir1, r2 IR1 4 5 6 10.5 ADD R2, R1 10.5 ADC R2, R1 10.5 SUB R2, R1 10.5 SBC R2, R1 10.5 OR R2, R1 10.5 AND R2, R1 10.5 TCM R2, R1 10.5 TM R2, R1 10.5 ADD IR2, R1 10.5 ADC IR2, R1 10.5 SUB IR2, R1 10.5 SBC IR2, R1 10.5 OR IR2, R1 10.5 AND IR2, R1 10.5 TCM IR2, R1 10.5 TM IR2, R1 10.5 ADD R1, IM 10.5 ADC R1, IM 10.5 SUB R1, IM 10.5 SBC R1, IM 10.5 OR R1, IM 10.5 AND R1, IM 10.5 TCM R1, IM 10.5 TM R1, IM 7 8 6.5 10.5 LD ADD IR1, IM r1, R2 10.5 ADC IR1, IM 10.5 SUB IR1, IM 10.5 SBC IR1, IM 10.5 OR IR1, IM 10.5 AND IR1, IM 10.5 TCM IR1, IM 10.5 TM IR1, IM 9 A B C 12/10.5 12/10.0 6.5 6.5 LD JR DJNZ LD r2, R1 r1, RA cc, RA r1, IM D E 12.10.0 JP cc, DA 6.5 INC r1 6.0 WDT 6.1 DI 6.1 EI 14.0 RET 10.5 10.5 10.5 10.5 CP CP CP CP R2, R1 IR2, R1 R1, IM IR1, IM 10.5 10.5 10.5 10.5 XOR XOR XOR XOR R2, R1 IR2, R1 R1, IM IR1, IM 10.5 LD r1,x,R2 10.5 20.0 20.0 LD CALL CALL* r2,x,R1 DA IRR1 10.5 10.5 10.5 10.5 LD LD LD LD R2, R1 IR2, R1 R1, IM IR1, IM 10.5 LD R2, IR1 2 3 16.0 IRET 6.5 RCF 6.5 SCF 6.5 CCF 6.0 NOP 2 3 Bytes per Instruction Lower Opcode Nibble Execution Cycles Pipeline Cycles 4 Upper Opcode Nibble First Operand A 10.5 CP R1 , R 2 Mnemonic Second Operand Legend: R = 8-bit Address r = 4-bit Address R1 or r1 = Dst Address R2 or r2 = Src Address Sequence: Opcode, First Operand, Second Operand Note: Blank areas not defined. *2-byte instruction appears as a 3-byte instruction 24 F 1 Z08617 NMOS Z8® 8-BIT MCU KEYBOARD CONTROLLER PACKAGE INFORMATION 40-Pin DIP Package Diagram 25 Z08617 NMOS Z8® 8-B IT MCU KEYBOARD CONTROLLER ORDERING INFORMATION 5 MHz Z0861705PSC For fast results, contact your local Zilog sales office for assistance in ordering the part desired. Package P = Plastic DIP V = Plastic Leaded Chip Carrier Speed 05 = 5 MHz Environmental C = Plastic Standard Temperature S = 0°C to +70°C (standard temp for the Z8615 is 0 to –55°C) Example: Z 8615 05 P S* C is a Z8615, 5 MHz, DIP, 0°C to –55°C, Plastic Standard Flow Environmental Flow Temperature (standard temp for the Z8615 is 0 to –55°C) Package Speed Product Number Zilog Prefix 26