HD404369 HITACHI | Alldatasheet

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 115

Technical content

Features

  • 512-digit · 4-bit RAM
  • 54 I/O pins ¾ One input-only pin ¾ 53 input/output pins: 8 pins are intermediate-voltage NMOS open drain with high-current pins (15 mA, max.)
  • On-chip A/D converter (8-bit · 12-channel) ¾ Low power voltage 2.7 V to 6.0 V
  • Three timers ¾ One event counter input ¾ One timer output ¾ One input capture timer
  • Eight-bit clock-synchronous serial interface (1 channel)
  • Alarm output
  • Built-in oscillators ¾ Ceramic oscillator or crystal ¾ External clock drive is also possible ¾ Subclock: 32.768-kHz crystal oscillator
  • Seven interrupt sources ¾ Two by external sources ¾ Three by timers ¾ One by A/D converter ¾ One by serial interface
  • Four low-power dissipation modes ¾ Standby mode ¾ Stop mode ¾ Watch mode ¾ Subactive mode
  • Instruction cycle time ¾ 0.47 ms (fOSC = 8.5 MHz, 1/4 division ratio): HD40A4364, HD40A4368, HD40A43612, HD40A4369, HD407A4369 ¾ 0.8 ms (fOSC = 5 MHz, 1/4 division ratio): HD404364, HD404368, HD4043612, HD404369 ¾ 1/4, 1/8, 1/16, 1/32 system clock division ratio can be selecte

Ordering Information

Type Instruction Cycle Time Product Name Model Name ROM (Words) Package Mask ROM Standard version (fOSC = 5 MHz) HD404364 HD404364S 4,096 DP-64S HD404364F FP-64B HD404364H FP-64A HD404368 HD404368S 8,192 DP-64S HD404368F FP-64B HD404368H FP-64A HD4043612 HD4043612S 12,288 DP-64S HD4043612F FP-64B HD4043612H FP-64A HD404369 HD404369S 16,384 DP-64S HD404369F FP-64B HD404369H FP-64A High speed versions HD40A4364 HD40A4364S 4,096 DP-64S (fOSC = 8.5 MHz) HD40A4364F FP-64B HD40A4364H FP-64A HD40A4368 HD40A4368S 8,192 DP-64S HD40A4368F FP-64B HD40A4368H FP-64A HD40A43612 HD40A43612S 12,288 DP-64S HD40A43612F FP-64B HD40A43612H FP-64A HD40A4369 HD40A4369S 16,384 DP-64S HD40A4369F FP-64B HD40A4369H FP-64A ZTAT ä (fOSC = 8.5 MHz) HD407A4369 HD407A4369S 16,384 DP-64S HD407A4369F FP-64B HD407A4369H FP-64A

Item Symbol DP-64S FP-64B FP-64A I/O Function Power V CC 33 27 25 Applies power voltage Supply GND 16 10 8 Connected to ground Test TEST 12 6 4 I Cannot be used in user applications. Connect this pin to GND. Reset RESET 13 7 5 I Resets the MCU Oscillator OSC1 14 8 6 I Input/output pin for the internal oscillator. Connect these pins to the ceramic oscillator or crystal oscillator, or OSC 1 to an external oscillator circuit. OSC 2 1 597O X1 17 11 9 I Used with a 32.768-kHz crystal ocillator for clock purposes X2 18 12 10 O Port D 0–D 13 34–47 28–41 26–39 I/O Input/output pins consisting of standard voltage pins addressed individually by bits RA 1 64 58 56 I One-bit standard-voltage input port pin R0 0–R0 3, R3 0–R9 3 1–11, 20–31, 48–55 1–5, 14–25, 42–49, 59–64 1–3, 12–23, 40–47, 57–64 I/O Four-bit input/output pins consisting of standard voltage pins R1 0–R2 3 56–63 50–57 48–55 I/O Four-bit input/output pins consisting of intermediate voltage pins InterruptINT0, INT1 34, 35 28, 29 26, 27 I Input pins for external interrupts Stop clearSTOPC 38 32 30 I Input pin for transition from stop mode to active mode Serial SCK 8 2 64 I/O Serial interface clock input/output pin Interface SI 9 3 1 I Serial interface receive data input pin SO 10 4 2 O Serial interface transmit data output pin Timer TOC 11 5 3 O Timer output pin EVNB 36 30 28 I Event count input pin Alarm BUZZ 37 31 29 O Square waveform output pin

Pin Description (cont) Pin Number Item Symbol DP-64S FP-64B FP-64A I/O Function A/D converter AV CC 32 26 24 Power supply for the A/D converter. Connect this pin as close as possible to the VCC pin and at the same voltage as VCC . If the power supply voltage to be used for the A/D converter is not equal to V CC , connect a 0.1-mF bypass capacitor between the AVCC and AVSS pins. (However, this is not necessary when the AVCC pin is directly connected to the VCC pin.) AV SS 19 13 11 Ground for the A/D converter. Connect this pin as close as possible to GND at the same voltage as GND. AN 0–AN 11 20–31 14–25 12–23 I Analog input pins for the A/D converter

(16,384× 10 bits)(12,288× 10 bits) (4,096× 10 bits) PC (14 bits) Instruction decoder SP (10 bits) B (4 bits) A (4 bits) ST (1 bit) CA (1 bit) ALU SPY (4 bits) Y (4 bits) SPX (4 bits) X (4 bits) W (2 bits) RAM (512× 4 bits) System controlInterrupt control Timer A Timer B Timer C Serial interface A/D converter Buzzer Internal data bus Internal data bus Internal address bus BUZZ AV CC AN 11 AVSS AN 0 SI SO SCK TOC EVNB INT0 INT1 Data bus Intermediate voltage pin Directional signal line GND VCC OSC 2 OSC 1 STOPC TEST RESET (8,192× 10 bits)

The ROM memory map is shown in figure 1 and described below. Vector Address Area ($0000–$000F): Reserved for JMPL instructions that branch to the start addresses of the reset and interrupt routines. After MCU reset or an interrupt, program execution continues from the vector address. Zero-Page Subroutine Area ($0000–$003F): Reserved for subroutines. The program branches to a subroutine in this area in response to the CAL instruction. Pattern Area ($0000–$0FFF): Contains ROM data that can be referenced with the P instruction. Program Area ($0000-$0FFF (HD404364, HD40A4364), $0000–$1FFF (HD404368, HD40A4368), $0000–$2FFF (HD4043612, HD40A43612), $0000–$3FFF (HD404369, HD40A4369, HD407A4369)): The entire ROM area can be used for program coding. $000F $0FFF $1000 $2FFF $0010 $003F $0040 Vector address (16 words) Zero-page subroutine (64 words) Program (4,096 words) Program (8,192 words) $0000 $0000 $0001 $0002 $0003 $0004 $0005 $0006 $0007 $0008 $0009 $000A $000B $000C $000D $000E $000F JMPL instruction (jump to RESET, STOPC routine) JMPL instruction (jump to INT routine) JMPL instruction (jump to timer A routine) JMPL instruction (jump to timer B routine) JMPL instruction (jump to timer C routine) JMPL instruction (jump to A/D converter routine) JMPL instruction (jump to INT routine) JMPL instruction (jump to serial routine) Program (12,288 words) Program (16,384 words) For HD404369, HD40A4369, HD407A4369 $1FFF $2000 $3000 $3FFF For HD404364, HD40A4364 For HD404368, HD40A4368 For HD4043612, HD40A43612 Note: Since the ROM address areas between $0000–$0FFF overlap, the user can determine how these areas are to be used. Figure 1 ROM Memory Map RAM Memory Map The MCU contains 512-digit · 4 bit RAM areas. These RAM areas consist of a memory register area, a data area, and a stack area. In addition, an interrupt control bits area, special function register area, and register flag area are mapped onto the same RAM memory space labeled as a RAM-mapped register area. The RAM memory map is shown in figure 2 and described below.

A/D channel register (ACR) $000 $000 $040 $050 $003 $004 $005 $006 $007 $008 $009 $00A $00B $00C $00D $00E $00F $020 $023 $033 $034 $035 $036 $037 $00A $00B $00E $00F W W R/W W W W W W W W W W R R R R W R/W R/W R/W R/W R/W $3C0 RAM-mapped registers Memory registers (MR) Stack (64 digits) Interrupt control bits area Port mode register A (PMRA) Serial mode register (SMR) Serial data register lower (SRL) Serial data register upper (SRU) Timer mode register A (TMA) Timer mode register B1 (TMB1) Timer B (TRBL/TWBL) (TRBU/TWBU) Miscellaneous register (MIS) Timer mode register C (TMC) Timer C (TRCL/TWCL) (TRCU/TWCU) Register flag area Port R0 DCR (DCR0) Port R3 DCR (DCR3) Not used 1. Two registers are mapped on the same area ($00A, $00B, $00E, $00F). 2. Undefined. Timer read register B lower (TRBL) Timer read register B upper (TRBU) Timer read register C lower (TRCL) Timer read register C upper (TRCU) Timer write register B lower (TWBL) Timer write register B upper (TWBU) Timer write register C lower (TWCL) Timer write register C upper (TWCU) R: Read only W: Write only R/W: Read/write $200 Notes: $016 RA/D data register lower (ADRL)$017 $024 $025 $026 $027 $028 $018 $019 $01A $3FF A/D data register upper (ADRU) A/D mode register 1 (AMR1) A/D mode register 2 (AMR2) R W W W Port mode register B (PMRB) Port mode register C (PMRC) Timer mode register B2 (TMB2) System clock selection register 1 (SSR1) Not used Port R4 DCR (DCR4) Port R5 DCR (DCR5) Port R6 DCR (DCR6) Port R7 DCR (DCR7) W W W W W W W W W $030 Not used System clock selection register 2 (SSR2) Not used Not used 0000 0000 0000 Undefined Undefined 0000 0000 *2/0000 0000 0000 0000 0000 0000 1000 0000 -000 0000 00-0 -000 000- 0000 0000 0000 -000 --00 Undefined *2/0000 Undefined Initial values after reset $03F Data (432 digits) 0000 0000 0000 --00 Port D0–D 3 Port D4–D 7 Port D8–D 11 Port D12, D13 Port R1 DCR (DCR1) Port R2 DCR (DCR2) W W 0000 0000 W W W W 0000 0000 W W Port R8 DCR (DCR8) Port R9 DCR (DCR9) DCR DCR DCR DCR (DCD0) (DCD1) (DCD2) (DCD3) $02C $02D $02E $02F $031 $032 $038 $039 Figure 2 RAM Memory Map

RAM-Mapped Register Area ($000–$03F):

  • Interrupt Control Bits Area ($000–$003) This area is used for interrupt control bits (figure 3). These bits can be accessed only by RAM bit manipulation instructions (SEM/SEMD, REM/REMD, and TM/TMD). However, note that not all the instructions can be used for each bit. Limitations on using the instructions are shown in figure 4.
  • Special Function Register Area ($004–$01F, $024–$03F) This area is used as mode registers and data registers for external interrupts, serial interface, timer/counters, A/D converter, and as data control registers for I/O ports. The structure is shown in figures 2 and 5. These registers can be classified into three types: write-only (W), read-only (R), and read/write (R/W). RAM bit manipulation instructions cannot be used for these registers.
  • Register Flag Area ($020–$023) This area is used for the DTON, WDON, and other register flags and interrupt control bits (figure 3). These bits can be accessed only by RAM bit manipulation instructions (SEM/SEMD, REM/REMD, and TM/TMD). However, note that not all the instructions can be used for each bit. Limitations on using the instructions are shown in figure 4. Memory Register (MR) Area ($040–$04F): Consisting of 16 addresses, this area (MR0–MR15) can be accessed by register-register instructions (LAMR and XMRA). The structure is shown in figure 6. Data Area ($050–$1FF) Stack Area ($3C0–$3FF): Used for saving the contents of the program counter (PC), status flag (ST), and carry flag (CA) at subroutine call (CAL or CALL instruction) and for interrupts. This area can be used as a 16-level nesting subroutine stack in which one level requires four digits. The data to be saved and the save conditions are shown in figure 6. The program counter is restored by either the RTN or RTNI instruction, but the status and carry flags can only be restored by the RTNI instruction. Any unused space in this area is used for data storage.

$000 $003 PMRA $004 SMR $005 SRL $006 SRU $007 TMA $008 TMB1 $009 TRBL/TWBL $00A TRBU/TWBU $00B MIS $00C TMC $00D TRCL/TWCL $00E TRCU/TWCU $00F ACR $016 ADRL $017 ADRU $018 AMR1$019 AMR2 $01A $020 $023 PMRB $024 PMRC $025 TMB2 $026 SSR1 $027 SSR2 $028 DCD0 $02C DCD1 $02D DCD2 $02E DCD3 $02F DCR0 $030 DCR1 $031 DCR2 $032 DCR3 $033 DCR4 $034 DCR5 $035 DCR6 $036 DCR7 $037 DCR8 $038 DCR9 $039 $03F Bit 3 Bit 2 Bit 1 Interrupt control bits area D 3/BUZZ R0 3/TOC R0 2/SO Serial transmit clock speed selection Serial data register (lower digit) Serial data register (upper digit) Clock source selection (timer A) Clock source selection (timer B) Timer B register (lower digit) Timer B register (upper digit) SO PMOS control Interrupt frame period selection Clock source selection (timer C) Timer C register (lower digit) Timer C register (upper digit) Analog channel selection A/D data register (lower digit) A/D data register (upper digit) Register flag area Port D3 DCD Port D7 DCD Port D2 DCD Port D6 DCD Port D1 DCD Port D5 DCD Port D9 DCD Port D0 DCD Port D4 DCD Port D8 DCD Port R03 DCR Port R23 DCR Port D11 DCD Port R43 DCR Port R53 DCR Port R63 DCR Port R02 DCR Port R22 DCR Port D10 DCD Port R42 DCR Port R52 DCR Port R62 DCR Port R72 DCR Port R01 DCR Port R11 DCR Port R21 DCR Port D13 DCD Port R41 DCR Port R51 DCR Port R61 DCR Port R71 DCR Port R00 DCR Port R10 DCR Port R20 DCR Port D12 DCD Port R40 DCR Port R50 DCR Port R60 DCR Port R70 DCR 0/SCK Bit 0 Timer-A/time-base Auto-reload on/off Pull-up MOS control A/D conversion time SO output level control in idle states Serial clock source selection Input capture selection 32-kHz oscillation stop 32-kHz oscillation division ratio Notes: R0 1/SI Not used R3 3/AN3 R3 2/AN2 R3 1/AN1 R3 0/AN0 4*R5/AN 8–AN 11 R4/AN 4–AN 7 Port R83 DCR Port R93 DCR Port R82 DCR Port R92 DCR Port R81 DCR Port R91 DCR Port R80 DCR Port R90 DCR D 4/STOPC Buzzer output D 2/EVNB D 1/INT1 EVNB detection edge selection Clock select D 0/INT0 Not used Clock division ratio selection Port R13 DCR Port R33 DCR Port R12 DCR Port R32 DCR Port R31 DCR Port R30 DCR Not used Not used Not used Not used Not used Not used Not used Not used Figure 5 Special Function Register Area

$040 $041 $042 $043 $044 $045 $046 $047 $048 $049 $04A $04B $04C $04D $04E $04F MR(0) MR(1) MR(2) MR(3) MR(4) MR(5) MR(6) MR(7) MR(8) MR(9) Level 16 Level 15 Level 14 Level 13 Level 12 Level 11 Level 10 Level 9 Level 8 Level 7 Level 6 Level 5 Level 4 Level 3 Level 2 Level 1 MR(10) MR(11) MR(12) MR(13) MR(14) MR(15) PC PC PC PC PC PC PC PC PC PC PC PC ST PC CA PC Bit 3 Bit 2 Bit 1 Bit 0 PC –PC : ST: Status flag CA: Carry flag Program counter Stack area $3C0 $3FF $3FC $3FD $3FE $3FF Figure 6 Configuration of Memory Registers and Stack Area, and Stack Position

The MCU has nine registers and two flags for CPU operations. They are shown in figure 7 and described below. (B) (A) (W) (X) (Y) (SPX) (SPY) (CA) (ST) (PC) (SP)11 11 Accumulator B register W register X register Y register SPX register SPY register Carry Status Program counter Initial value: 0, no R/W Stack pointer Initial value: $3FF, no R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: Undefined, R/W Initial value: 1, no R/W Figure 7 Registers and Flags Accumulator (A), B Register (B): Four-bit registers used to hold the results from the arithmetic logic unit (ALU) and transfer data between memory, I/O, and other registers. W Register (W), X Register (X), Y Register (Y): Two-bit (W) and four-bit (X and Y) registers used for indirect RAM addressing. The Y register is also used for D-port addressing.

SPX Register (SPX), SPY Register (SPY): Four-bit registers used to supplement the X and Y registers. Carry Flag (CA): One-bit flag that stores any ALU overflow generated by an arithmetic operation. CA is affected by the SEC, REC, ROTL, and ROTR instructions. A carry is pushed onto the stack during an interrupt and popped from the stack by the RTNI instruction—but not by the RTN instruction. Status Flag (ST): One-bit flag that latches any overflow generated by an arithmetic or compare instruction, not-zero decision from the ALU, or result of a bit test. ST is used as a branch condition of the BR, BRL, CAL, and CALL instructions. The contents of ST remain unchanged until the next arithmetic, compare, or bit test instruction is executed, but become 1 after the BR, BRL, CAL, or CALL instruction is read, regardless of whether the instruction is executed or skipped. The contents of ST are pushed onto the stack during an interrupt and popped from the stack by the RTNI instruction—but not by the RTN instruction. Program Counter (PC): 14-bit binary counter that points to the ROM address of the instruction being executed. Stack Pointer (SP): Ten-bit pointer that contains the address of the stack area to be used next. The SP is initialized to $3FF by MCU reset. It is decremented by 4 when data is pushed onto the stack, and incremented by 4 when data is popped from the stack. The top four bits of the SP are fixed at 1111, so a stack can be used up to 16 levels. The SP can be initialized to $3FF in another way: by resetting the RSP bit with the REM or REMD instruction. Reset The MCU is reset by inputting a low-level voltage to the RESET pin. At power-on or when stop mode is cancelled, RESET must be low for at least one t RC to enable the oscillator to stabilize. During operation, RESET must be low for at least two instruction cycles. Initial values after MCU reset are listed in table 1. Interrupts The MCU has 7 interrupt sources: two external signals (INT0 and INT1), three timer/counters (timers A, B, and C), serial interface, and A/D converter. An interrupt request flag (IF), interrupt mask (IM), and vector address are provided for each interrupt source, and an interrupt enable flag (IE) controls the entire interrupt process. Interrupt Control Bits and Interrupt Processing: Locations $000 to $003 in RAM are reserved for the interrupt control bits which can be accessed by RAM bit manipulation instructions. The interrupt request flag (IF) cannot be set by software. MCU reset initializes the interrupt enable flag (IE) and the IF to 0 and the interrupt mask (IM) to 1. A block diagram of the interrupt control circuit is shown in figure 8, interrupt priorities and vector addresses are listed in table 2, and interrupt processing conditions for the 7 interrupt sources are listed in table 3.

figure 10. After an interrupt is acknowledged, the previous instruction is completed in the first cycle. The interrupt program, and reset the IF by a software instruction within the interrupt program.

Table 1 Initial Values After MCU Reset Item Abbr. Initial Value Contents Program counter (PC) $0000 Indicates program execution point from start address of ROM area Status flag (ST) 1 Enables conditional branching Stack pointer (SP) $3FF Stack level 0 Interrupt flags/mask Interrupt enable flag (IE) 0 Inhibits all interrupts Interrupt request flag (IF) 0 Indicates there is no interrupt request Interrupt mask (IM) 1 Prevents (masks) interrupt requests I/O Port data register (PDR) All bits 1 Enables output at level 1 Data control register (DCD0- DCD2) All bits 0 Turns output buffer off (to high impedance) (DCD3) - - 00 (DCR0– DCR6, DCR8, DCR9) All bits 0 (DCR7) - 000 Port mode register A (PMRA) 0000 Refer to description of port mode register A Port mode register B bits 2–0 (PMRB2– PMRB0)

000 Refer to description of port mode register B

Port mode register C (PMRC) 00 - 0 Refer to description of port mode register C Timer/count- ers, serial interface Timer mode register A (TMA) 0000 Refer to description of timer mode register A Timer mode register B1 (TMB1) 0000 Refer to description of timer mode register B1 Timer mode register B2 (TMB2) - 000 Refer to description of timer mode register B2 Timer mode register C (TMC) 0000 Refer to description of timer mode register C Serial mode register (SMR) 0000 Refer to description of serial mode register Prescaler S (PSS) $000 — Prescaler W (PSW) $00 — Timer counter A (TCA) $00 — Timer counter B (TCB) $00 — Timer counter C (TCC) $00 — Timer write register B (TWBU, TWBL) $X0 — Timer write register C (TWCU, TWCL) $X0 — Octal counter 000 —

Item Abbr. Initial Value Contents A/D A/D mode register 1 (AMR1) 0000 Refer to description of A/D mode register A/D mode register 2 (AMR2) - 000 A/D channel register (ACR) 0000 Refer to description of A/D channel register A/D data register (ADRL) 0000 Refer to description of A/D data register (ADRU) 1000 Bit registers Low speed on flag (LSON) 0 Refer to description of operati ng modes Watchdog timer on flag (WDON) 0 Refer to description of timer C A/D start flag (ADSF) 0 Refer to description of A/D converter IAD off flag (IAOF) 0 Refer to the description of A/D converter Direct transfer on flag (DTON) 0 Refer to description of operati ng modes Input capture status flag (ICSF) 0 Refer to description of timer B Input capture error flag (ICEF) 0 Refer to description of timer B Others Miscellaneous register (MIS) 0000 Refer to description of operati ng modes, I/O, and serial interface System clock select register 1 (SSR1) 000 - Refer to description of operati ng modes, and oscillation circuits System clock select register 2 (SSR2) - - 00 Refer to description of oscillation circuits Notes: 1. The statuses of other registers and flags after MCU reset are shown in the following table. 2. X indicates invalid value. – indicates that the bit does not exist.

Item Abbr. Status After Cancellation of Stop Mode by STOPC Input Status After all Other Types of Reset Carry flag (CA) Pre-stop-mode values are not guaranteed; values must be initialized by program Pre-mcu-reset values are not guaranteed; values must be initialized by program Accumulator (A) B register (B) W register (W) X/SPX register (X/SPX) Y/SPY register (Y/SPY) Serial data register (SRL, SRU) RAM Pre-stop-mode values are retained RAM enable flag (RAME) 1 0 Port mode register B bit 3 (PMRB3) Pre-stop-mode values are retained 0 System clock select register 1 bit 3 (SSR13) Table 2 Vector Addresses and Interrupt Priorities Reset/Interrupt Priority Vector Address RESET, STOPC* — $0000 INT0 1 $0002 INT1 2 $0004 Timer A 3 $0006 Timer B 4 $0008 Timer C 5 $000A A/D 6 $000C Serial 7 $000E Note: * The STOPC interrupt request is valid only in stop mode.

$ 000,0 $ 000,2 $ 000,3 $ 001,0 $ 001,1 $ 001,2 $ 001,3 $ 002,0 $ 002,1 $ 002,2 $ 002,3 $ 003,0 $ 003,1 Sequence control

  • Push PC/CA/ST
  • Reset IE
  • Jump to vector address Priority control logic Vector address Note: $m,n is RAM address $m, bit number n. IFS IMS $ 003,2 $ 003,3 INT0 interrupt INT1 interrupt Timer A interrupt Timer B interrupt Timer C interrupt A/D interrupt Serial interrupt Figure 8 Interrupt Control Circuit

Table 3 Interrupt Processing and Activation Conditions Interrupt Source INT0 INT1 Timer A Timer B Timer C A/D Serial I E 1111111 IF0 IM0 1000000 IF1 IM1 * 100000 IFTA IMTA 10000 IFTB IMTB * 1000 IFTC IMTC **** 100 Note: Bits marked * can be either 0 or 1. Their values have no effect on operation. Instruction cycles 1234 56 Instruction execution* IE reset Interrupt acceptance Execution of JMPL instruction at vector address Execution of instruction at start address of interrupt routine Vector address generation Note: * The stack is accessed and the IE reset after the instruction is executed, even if it is a two-cycle instruction. Stacking Figure 9 Interrupt Processing Sequence

RESET = 0? Reset MCU Interrupt request? Execute instruction PC (PC) + 1← PC $0002← PC $0004← PC $0006← PC $0008← PC $000A← PC $000E← IE = 1? Accept interrupt IE 0 Stack (PC) Stack (CA) Stack (ST) INT interrupt? INT1 interrupt? Timer-A interrupt? Timer-B interrupt? No Yes No Yes No Yes Yes Yes Yes Yes Yes No No No No (serial interrupt) PC $000C← A/D interrupt? Yes No No Timer-C interrupt? Figure 10 Interrupt Processing Flowchart

Interrupt Enable Flag (IE: $000, Bit 0): Controls the entire interrupt process. It is reset by the interrupt processing and set by the RTNI instruction, as listed in table 4. Table 4 Interrupt Enable Flag (IE: $000, Bit 0) IE Interrupt Enabled/Disabled

0 Disabled

1 Enabled

External Interrupts (INT0, INT1): Two external interrupt signals. External Interrupt Request Flags (IF0: $000, Bit 2; IF1: $001, Bit 0): IF0 and IF1 are set at the rising edge of signals input to INT0 and INT1, as listed in table 5. Table 5 External Interrupt Request Flags (IF0: $000, Bit2; IF1: $001, Bit 0) IF0, IF1 Interrupt Request 0N o

1 Yes

External Interrupt Masks (IM0: $000, Bit 3; IM1: $001, Bit 1): Prevent (mask) interrupt requests caused by the corresponding external interrupt request flags, as listed in table 6. Table 6 External Interrupt Masks (IM0: $000, Bit 3; IM1: $001, Bit 1) IM0, IM1 Interrupt Request

0 Enabled

1 Disabled (masked)

Timer A Interrupt Request Flag (IFTA: $001, Bit 2): Set by overflow output from timer A, as listed in table 7. Table 7 Timer A Interrupt Request Flag (IFTA: $001, Bit 2) IFTA Interrupt Request 0N o Timer A Interrupt Mask (IMTA: $001, Bit 3): Prevents (masks) an interrupt request caused by the timer A interrupt request flag, as listed in table 8.

Table 8 Timer A Interrupt Mask (IMTA: 001, Bit 3) IMTA Interrupt Request Timer B Interrupt Request Flag (IFTB: $002, Bit 0): Set by overflow output from timer B, as listed in table 9. Table 9 Timer B Interrupt Request Flag (IFTB: $002, Bit 0) IFTB Interrupt Request 0N o Timer B Interrupt Mask (IMTB: $002, Bit 1): Prevents (masks) an interrupt request caused by the timer B interrupt request flag, as listed in table 10. Table 10 Timer B Interrupt Mask (IMTB: $002, Bit 1) IMTB Interrupt Request Timer C Interrupt Request Flag (IFTC: $002, Bit 2): Set by overflow output from timer C, as listed in table 11. Table 11 Timer C Interrupt Request Flag (IFTC: $002, Bit 2) IFTC Interrupt Request 0N o Timer C Interrupt Mask (IMTC: $002, Bit 3): Prevents (masks) an interrupt request caused by the timer C interrupt request flag, as listed in table 12. Table 12 Timer C Interrupt Mask (IMTC: $002, Bit 3) IMTC Interrupt Request

Serial Interrupt Request Flag (IFS: $003, Bit 2): Set when data transfer is completed or when data transfer is suspended, as listed in table 13. Table 13 Serial Interrupt Request Flag (IFS: $003, Bit 2) IFS Interrupt Request 0N o Serial Interrupt Mask (IMS: $003, Bit 3): Prevents (masks) an interrupt request caused by the serial interrupt request flag, as listed in table 14. Table 14 Serial Interrupt Mask (IMS: $003, Bit 3) Mask IMS Interrupt Request A/D Interrupt Request Flag (IFAD: $003, Bit 0): Set at the completion of A/D conversion, as listed in table 15. Table 15 A/D Interrupt Request Flag (IFAD: $003, Bit 0) IFAD Interrupt Request 0N o A/D Interrupt Mask (IMAD: $003, Bit 1): Prevents (masks) an interrupt request caused by the A/D interrupt request flag, as listed in table 16. Table 16 A/D Interrupt Mask (IMAD: $003, Bit 1) IMAD Interrupt Request

The MCU has five operating modes as shown in table 17. The operations in each mode are listed in tables 18 and 19. Transitions between operating modes are shown in figure 11. Active Mode: All MCU functions operate according to the clock generated by the system oscillator OSC1 and OSC 2. Table 17 Operating Modes and Clock Status Mode Name Active Standby Stop Watch Subactive * Activation methodRESET cancellation, interrupt STOPC cancellation in stop mode, STOP/SBY instruction in subactive mode (when direct transfer is selected) SBY instruction STOP instruction when TMA3 = 0 STOP instruction when TMA3 = 1 INT 0 or timer A interrupt request from watch mode Status System oscillator OP OP Stopped Stopped Stopped Subsystem oscillator OP OP *1 OP OP OP Cancellation method RESET input, STOP/SBY instruction RESET input, interrupt request RESET input, STOPC input in stop mode RESET input, INT 0 or timer A interrupt request RESET input, STOP/SBY instruction Notes: OP implies in operation 1. Operating or stopping the oscillator can be selected by setting bit 3 of the system clock select register 1 (SSR1: $027). 2. Subactive mode is an optional function; specify it on the function option list.

Table 18 Operations in Low-Power Dissipation Modes Function Stop Mode Watch Mode Standby Mode Subactive Mode CPU Reset Retained Retained OP RAM Retained Retained Retained OP Timer A Reset OP OP OP Timer B Reset Stopped OP OP Timer C Reset Stopped OP OP Serial Reset Stopped OP OP A/D Reset Stopped OP Stopped I/O Reset Retained Retained OP Note: OP implies in operation Table 19 I/O Status in Low-Power Dissipation Modes Output Input Standby Mode, Watch mode Stop Mode Active Mode, Subactive mode RA 1 — — Input enabled D 0–D 13, R0–R9 Retained or output of peripheral functions High impedance Input enabled

fOSC : fX: ø CPU : ø CLK : ø PER : Oscillate Oscillate Stop f cyc fcyc fOSC : fX: ø CPU : ø CLK : ø PER : Oscillate Oscillate Stop f W fcyc fOSC : fX: øCPU : øCLK : øPER : Oscillate Oscillate f cyc fcyc fcyc fOSC : fX: ø CPU : ø CLK : ø PER : Oscillate Oscillate f cyc fW fcyc fOSC : fX: ø CPU : ø CLK : ø PER : Stop Oscillate f SUB fW fSUB fOSC : fX: øCPU : øCLK : øPER : Stop Stop Stop Stop Stop f OSC : fX: ø CPU : ø CLK : ø PER : Stop Oscillate Stop f W Stop fOSC : fX: ø CPU : ø CLK : ø PER : Stop Oscillate Stop f W Stop Standby mode Stop mode (TMA3 = 0, SSR13 = 1) Watch mode Subactive mode (TMA3 = 1) (TMA3 = 1, LSON = 0) (TMA3 = 1, LSON = 1) SBY Interrupt SBY Interrupt STOP INT0, timer A* STOP 1. Interrupt source 2. STOP/SBY (DTON = 1, LSON = 0) 3. STOP/SBY (DTON = 0, LSON = 0) 4. STOP/SBY (DTON = Don’t care, LSON = 1) f OSC : fX: fcyc: fSUB : fW : LSON: DTON: Main oscillation frequency Suboscillation frequency for time-base f OSC /4, fOSC /8, fOSC /16, fOSC /32 fX/8 or fX/4 (software selectable) f X/8 System clock Clock for time-base Clock for other peripheral functions Low speed on flag Direct transfer on flag Active mode Notes: øCPU : øCLK : øPER : fOSC : fX: øCPU : øCLK : øPER : Stop Oscillate Stop Stop Stop (TMA3 = 0, SSR13 = 0) RESET1 RESET2 RAME = 0 RAME = 1 INT0, timer A (TMA3 = 0) STOP STOPC STOPC STOP (software selectable) f Figure 11 MCU Status Transitions

Standby Mode: In standby mode, the oscillators continue to operate, but the clocks related to instruction execution stop. Therefore, the CPU operation stops, but all RAM and register contents are retained, and the D or R port status, when set to output, is maintained. Peripheral functions such as interrupts, timers, and serial interface continue to operate. The power dissipation in this mode is lower than in active mode because the CPU stops. The MCU enters standby mode when the SBY instruction is executed in active mode. Standby mode is terminated by a RESET input or an interrupt request. If it is terminated by RESET input, the MCU is reset as well. After an interrupt request, the MCU enters active mode and executes the next instruction after the SBY instruction. If the interrupt enable flag is 1, the interrupt is then processed; if it is 0, the interrupt request is left pending and normal instruction execution continues. A flowchart of operation in standby mode is shown in figure 12.

Oscillator: Active Peripheral clocks: Active All other clocks: Stop No Yes No Yes No Yes No Yes No Yes No Yes Yes (SBY only) Watch Oscillator: Stop Suboscillator: Active Peripheral clocks: Stop All other clocks: Stop Restart processor clocks Reset MCU Execute next instruction Accept interrupt Restart processor clocks No YesIF = 1, IM = 0, and IE = 1? RESET = 0? IF0 • IM0 = 1? IF1 • IM1 = 1? IFTA • IMTA = 1? IFTB • IMTB = 1? IFTC • IMTC = 1? IFAD • IMAD = 1? No Yes IFS • IMS = 1? No Stop Oscillator: Stop Suboscillator: Active/Stop Peripheral clocks: Stop All other clocks: Stop RESET = 0? STOPC = 0? RAME = 1 RAME = 0 Yes Yes No No Execute next instruction (SBY only) (SBY only) (SBY only) (SBY only) Figure 12 MCU Operation Flowchart Stop Mode: In stop mode, all MCU operations stop and RAM data is retained. Therefore, the power dissipation in this mode is the least of all modes. The OSC1 and OSC2 oscillator stops. For the X1 and X2 oscillator to operate or stop can be selected by setting bit 3 of the system clock select register 1 (SSR1: $027; operating: SSR13 = 0, stop: SSR13 = 1) (figure 23). The MCU enters stop mode if the STOP instruction is executed in active mode when bit 3 of timer mode register A (TMA: $008) is set to 0 (TMA3 = 0) (figure 37). Stop mode is terminated by a RESET input or a STOPC input as shown in figure 13. RESET or STOPC must be applied for at least one t RC to stabilize oscillation (refer to the AC Characteristics section). When the MCU restarts after stop mode is cancelled, all RAM contents before entering stop mode are retained,

but the accuracy of the contents of the accumulator, B register, W register, X/SPX register, Y/SPY register, carry flag, and serial data register cannot be guaranteed. Watch Mode: In watch mode, the clock function (timer A) using the X1 and X2 oscillator operates, but other function operations stop. Therefore, the power dissipation in this mode is the second least to stop mode, and this mode is convenient when only clock display is used. In this mode, the OSC 1 and OSC2 oscillator stops, but the X1 and X2 oscillator operates. The MCU enters watch mode if the STOP instruction is executed in active mode when TMA3 = 1, or if the STOP or SBY instruction is executed in subactive mode. Watch mode is terminated by a RESET input or a timer-A/INT 0 interrupt request. For details of RESET input, refer to the Stop Mode section. When terminated by a timer-A/INT0 interrupt request, the MCU enters active mode if LSON = 0, or subactive mode if LSON = 1. After an interrupt request is generated, the time required to enter active mode is t RC for a timer A interrupt, and TX (where T + tRC < TX < 2T + tRC ) for an INT0 interrupt, as shown in figures 14 and 15. Operation during mode transition is the same as that at standby mode cancellation (figure 12). /#09 /#14/#18 /#09 /#02 /#07 /#0C/#0D/#0E Stop mode Oscillator Internal clock STOP instruction execution tres≥ tRC (stabilization period) tres RESET or STOPC Figure 13 Timing of Stop Mode Cancellation Subactive Mode: The OSC 1 and OSC2 oscillator stops and the MCU operates with a clock generated by the X1 and X2 oscillator. In this mode, functions except the A/D conversion operate. However, because the operating clock is slow, the power dissipation becomes low, next to watch mode. The CPU instruction execution speed can be selected as 244 ms or 122 ms by setting bit 2 (SSR12) of the system clock select register 1 (SSR1: $027). Note that the SSR12 value must be changed in active mode. If the value is changed in subactive mode, the MCU may malfunction. When the STOP or SBY instruction is executed in subactive mode, the MCU enters either watch or active mode, depending on the statuses of the low speed on flag (LSON: $020, bit 0) and the direct transfer on flag (DTON: $020, bit 3). Interrupt Frame: In watch and subactive modes, ø CLK is applied to timer A and the INT0 circuit. Prescaler W and timer A operate as the time-base and generate the timing clock for the interrupt frame. Three interrupt frame lengths (T) can be selected by setting the miscellaneous register (MIS: $00C) (figure 15). In watch and subactive modes, the timer-A/INT 0 interrupt is generated synchronously with the interrupt frame. The interrupt request is generated synchronously with the interrupt strobe timing except during transition to active mode. The falling edge of the INT 0 signal is input asynchronously with the interrupt

frame timing, but it is regarded as input synchronously with the second interrupt strobe clock after the falling edge. An overflow and interrupt request in timer A is generated synchronously with the interrupt strobe timing. tRCTT XT t : Interrupt frame length Oscillation stabilization periodRC (During the transition from watch mode to active mode only) Interrupt strobe INT Interrupt request generation Active mode Watch mode Active mode Oscillation stabilization period T + tRC ≤ TX ≤ 2T + tRC Figure 14 Interrupt Frame Direct Transition from Subactive Mode to Active Mode: Available by controlling the direct transfer on flag (DTON: $020, bit 3) and the low speed on flag (LSON: $020, bit 0). The procedures are described below:

  • Set LSON to 0 and DTON to 1 in subactive mode.
  • Execute the STOP or SBY instruction.
  • The MCU automatically enters active mode from subactive mode after waiting for the MCU internal processing time and oscillation stabilization time (figure 16). Notes: 1. The DTON flag ($020, bit 3) can be set only in subactive mode. It is always reset in active mode. 2. The transition time (T D ) from subactive mode to active mode: tRC < TD < T + tRC

used after transition to active mode), execute the TEST instruction to the RAM enable flag (RAME) at the beginning of the program. MCU Operation Sequence: The MCU operates in the sequence shown in figures 17 to 19. It is reset by an asynchronous RESET input, regardless of its status. The low-power mode operation sequence is shown in figure 19. With the IE flag cleared and an interrupt flag set together with its interrupt mask cleared, if a STOP/SBY instruction is executed, the instruction is cancelled (regarded as an NOP) and the following instruction is executed. Before executing a STOP/SBYinstruction, make sure all interrupt flags are cleared or all interrupts are masked. Power on RESET = 0 ? RAME = 0 Reset MCU MCU operation cycle No Yes Figure 17 MCU Operating Sequence (Power On)

IF = 1? Instruction execution SBY/STOP instruction? PC Next location PC Vector address Low-power mode operation cycle IE 0 Stack (PC), (CA), (ST) IM = 0 and IE = 1? Yes No No Yes Yes No IF: IM: IE: PC: CA: ST: Interrupt request flag Interrupt mask Interrupt enable flag Program counter Carry flag Status flag Figure 18 MCU Operating Sequence (MCU Operation Cycle)

IF = 1 and IM = 0? Hardware NOP execution ←PC Next Iocation MCU operation cycle Standby/watch mode IF = 1 and IM = 0? Hardware NOP execution PC Next Iocation Instruction execution Stop mode No Yes No Yes For IF and IM operation, refer to figure 12. STOPC = 0? RAME = 1 Reset MCU No Yes Figure 19 MCU Operating Sequence (Low-Power Mode Operation) Note: When the MCU is in watch mode or subactive mode, if the high level period before the falling edge of INT0 is shorter than the interrupt frame, INT0 is not detected. Also, if the low level period after the falling edge of INT0 is shorter than the interrupt frame, INT0 is not detected. Edge detection is shown in figure 20. The level of the INT0 signal is sampled by a sampling clock. When this sampled value changes to low from high, a falling edge is detected. In figure 21, the level of the INT 0 signal is sampled by an interrupt frame. In (a) the sampled value is low at point A, and also low at point B. Therefore, a falling edge is not detected. In (b), the sampled value is high at point A, and also high at point B. A falling edge is not detected in this case either. When the MCU is in watch mode or subactive mode, keep the high level and low level period of INT 0 longer than the interrupt frame

A block diagram of the clock generation circuit is shown in figure 22. As shown in table 20, a ceramic oscillator or crystal oscillator can be connected to OSC1 and OSC2, and a 32.768-kHz oscillator can be connected to X1 and X2. The system oscillator can also be operated by an external clock. Registers for Oscillator Circuit Operation System Clock Selection Register 1 (SSR1: $027): Four bit write-only register which sets the subsystem clock frequency (fSUB ) division ratio, and sets the subsystem clock oscillation in stop mode. Bit 1 (SSR11) of system clock select register 1 must be set according to the frequency of the oscillator connected to OSC1 and OSC 2 (figure 23). Bit 1 (SSR11) and bit 2 (SSR12) are initialized to 0 on reset and in stop mode. Bit 3 (SSR13) is initialized to 0 only on reset. OSC 2 OSC 1 System oscillator Sub- system oscillator 1/4, 1/8, 1/16 or division circuit*1 Timing generator circuit System clock selection CPU with ROM, RAM, registers, flags, and I/O Peripheral function interrupt Time-base interrupt Time-base clock selection 1/8 or 1/4 division circuit*2 Timing generator circuit Timing generator circuit division circuit fW fSUB tsubcyc LSON TMA3 fcyc tcyc fOSC fX tWcyc øCPU øPER øCLK Notes: 1/4, 1/8, 1/16 or 1/32 division ratio can be selected by setting bits 0 and 1 of system clock select register 2 (SSR2: $028). 1/8 or 1/4 division ratio can be selected by setting bit 2 of system clock select register 1 (SSR1: $027). Figure 22 Clock Generation Circuit

W SSR13 W SSR12 Not used W SSR11 System clock selection register 1 (SSR1: $027) System Clock Selection 0.4 to 1.0 MHz 1.6 to 5.0 MHz (HD404369 Series) 1.6 to 8.5 MHz (HD40A4369 Series) SSR11 SSR12 Ratio Selection f SUB = fX/8 fSUB = fX/4 32-kHz Oscillation Division SSR13 32-kHz Oscillation Stop Oscillation operates in stop mode Oscillation stops in stop mode Notes: 1. SSR13 will only be cleared to 0 by a RESET input. A STOPC input during stop mode will not clear SSR13. Also note that SSR13 will not be cleared upon transition to stop mode. 1. Do not use fOSC = 1.0 to 1.6 MHz with 32-kHz oscillation. Figure 23 System Clock Selection Register 1 (SSR1) System Clock Selection Register 2 (SSR2: $028): Four bit write-only register which is used to select the system clock divisor (figure 24). The division ratio of the system clock can be selected as 1/4, 1/8, 1/16, or 1/32 by setting bits 0 and 1 (SSR20, SSR21) of system clock select register 2 (SSR2). The values of SSR20 and SSR21 are valid after the MCU enters watch mode. The system clock must be stopped when the division ratio is to be changed. There are two methods for changing the system clock divisor, as follows.

  • In active mode, set the divisor by writing to SSR20 and SSR21. At this point, the prior divisor setting will remain in effect. Now, switch to watch mode, and then return to active mode. When active mode resumes, the system clock divisor will have switched to the new value.
  • In subactive mode, set the divisor by writing to SSR20 and SSR21. Then return to active mode through watch mode. When active mode resumes, the system clock divisor will have switched to the new value. (The change will also take effect for direct transition to active mode.)

SSR2 is initialized to $0 on reset or in stop mode. Notes on Usage If the system clock select register 1 (SSR1: $027) setting does not match the oscillator frequency, the subsystem using the 32.768-kHz oscillation will malfunction. Bit Initial value Read/Write Bit name Not used Not used W SSR20 W SSR21 System clock selection register 2 (SSR2: $028) SSR21 SSR20 System Clock Division Ratio 1/4 division 1/8 division 1/16 division 1/32 division Figure 24 System Clock Selection Register 2 (SSR2)

Table 20 Oscillator Circuit Examples Circut Configuration Circut Constants External clock operation External oscillator OSC Open OSC 2 Ceramic oscillator (OSC 1, OSC2) OSC C 1 OSC R fCeramic GND Ceramic oscillator: CSA4.00MG (Murata) R f = 1 MW –20% C 1 = C2 = 30 pF –20% Crystal oscillator (OSC 1, OSC2) OSC C 1 OSC R fCrystal GND L SC R S C 0 OSC 1 OSC 2 R f = 1 MW –20% C 1 = C2 = 10 to 22 pF –20% Crystal: Equivalent to circuit shown below C 0 = 7 pF max. R S = 100 W max. Crystal oscillator (X1, X2) X1 C 1 Crystal GND L SC R S C 0 X1 X2 Crystal: 32.768 kHz: MX38T (Nippon Denpa) C 1 = C2 = 20 pF –20% R S = 14 kW C 0 = 1.5 pF Notes: 1. Since the circuit constants change depending on the crystal or ceramic oscillator and stray capacitance of the board, the user should consult with the crystal or ceramic oscillator manufacturer to determine the circuit parameters. 2. Wiring among OSC 1, OSC2, X1, X2 and elements should be as short as possible, and must not cross other wiring (see figure 25). 3. When a 32.768-kHz crystal oscillator is not used, fix pin X1 to GND and leave pin X2 open.

Figure 25 Typical Layout of Crystal and Ceramic Oscillators

The MCU has 53 input/output pins (D0–D 13, R0–R9) and an input pin (RA1). The features are described below.

  • Eight pins (R1–R2) are high-current (15 mA max) input/output with intermediate voltage NMOS open drain pins.
  • The D0–D 4, R0, R3–R5 input/output pins are multiplexed with peripheral function pins such as for the timers or serial interface. For these pins, the peripheral function setting is done prior to the D or R port setting. Therefore, when a peripheral function is selected for a pin, the pin function and input/output selection are automatically switched according to the setting.
  • Input or output selection for input/output pins and port or peripheral function selection for multiplexed pins are set by software.
  • Peripheral function output pins are CMOS output pins. Only the R0 2/SO pin can be set to NMOS open- drain output by software.
  • In stop mode, the MCU is reset, and therefore peripheral function selection is cancelled. Input/output pins are in high-impedance state.
  • Each input/output pin except for R1 and R2 has a built-in pull-up MOS, which can be individually turned on or off by software. I/O buffer configuration is shown in figure 26, programmable I/O circuits are listed in table 21, and I/O pin circuit types are shown in table 22.

Table 21 Programmable I/O Circuits MIS3 (bit 3 of MIS) 0 1 DCD, DCR 0 1 0 1 P D R 01010101 CMOS buffer PMOS ———O n ———O n Note: — indicates off status. MIS3 Input control signal VCC Pull-up MOS DCD, DCR PDR Input data VCC HLT Pull-up control signal Buffer control signal Output data Figure 26 I/O Buffer Configuration

Table 22 Circuit Configuration of I/O Pins I/O Pin Type Circuit Pins Input/output pins VCC VCC Pull-up control signal Buffer control signal Output data Input data HLT MIS3 PDR Input control signal DCD, DCR D 0–D 13, R0 0, R01, R03 R3 0–R9 3 VCC VCC Pull-up control signal Buffer control signal Output data Input data HLT MIS3 DCR PDR Input control signal MIS2 R0 2 HLT DCR PDR Input data Output data Input control signal R1 0–R2 3 Input pins Input data Input control signal RA 1 Notes on next page.

TOC, BUZZ TOC, BUZZ Input pins Input data VCC HLT MIS3 SI, INT0, INT1, EVNB, STOPC PDR SI, INT0, INT1, EVNB, STOPC VCC HLT MIS3 A/D input PDR Input control signal AN 0–AN 11 Notes: 1. In stop mode, the MCU is reset and the peripheral function selection is cancelled. The HLT signal goes low, and input/output pins enter the high-impedance state. 2. The HLT signal is 1 in active, standby, watch, and subactive modes.

Evaluation Chip Set and ZTAT ä /Mask ROM Product Differences As shown in figure 27, the NMOS intermediate-voltage open drain pin circuit in the evaluation chip set differs from that used in the ZTATä microcomputer and built-in mask ROM microcomputer products. Please note that although these outputs in the ZTATä microcomputer and built-in mask ROM microcomputer products can be set to high impedance by the combinations shown in table 23, these outputs cannot be set to high impedance in the evaluation chip set. Table 23 Program Control of High Impedance States Register Set Value DCR 0 1 PDR * 1 Notes:* An asterisk indicates that the value may be either 0 or 1 and has no influence on circuit operation. This applies to the ZTATä and built-in mask ROM microcomputer NMOS open drain pins. VCC VCC HLT MIS3 DCR PDR CPU input Input control signal (a) Evaluation Chip Set Circuit Structure Input control signal (b) ZTAT and Built-In Mask ROM Microcomputer Circuit Structure HLT DCR PDR CPU input Figure 27 NMOS Intermediate-Voltage Open Drain Pin Circuits

D Port (D0–D 13): Consist of 14 input/output pins addressed by one bit. Pins D0–D 13 are set by the SED and SEDD instructions, and reset by the RED and REDD instructions. Output data is stored in the port data register (PDR) for each pin. All pins D0–D 13 are tested by the TD and TDD instructions. The on/off statuses of the output buffers are controlled by D-port data control registers (DCD0–DCD3: $02C–$02F) that are mapped to memory addresses (figure 28). Pins D0–D 2, D4 are multiplexed with peripheral function pins INT0, INT1, EVNB, and STOPC, respectively. The peripheral function modes of these pins are selected by bits 0–3 (PMRB0– PMRB3) of port mode register B (PMRB: $024) (figure 29). Pin D 3 is multiplexed with peripheral function pin BUZZ. The peripheral function mode of this pin is selected by bit 3 (PMRA3) of port mode register A (PMRA: $004) (figure 30). R Ports (R00–R9 3): 39 input/output pins addressed in 4-bit units. Data is input to these ports by the LAR and LBR instructions, and output from them by the LRA and LRB instructions. Output data is stored in the port data register (PDR) for each pin. The on/off statuses of the output buffers of the R ports are controlled by R-port data control registers (DCR0–DCR9: $030–$039) that are mapped to memory addresses (figure 28). Pin R0 0 is multiplexed with peripheral function pin SCK. The peripheral function mode of this pin is selected by bit 3 (SMR3) of serial mode register (SMR: $005) (figure 31). Pins R01–R0 3 are multiplexed with peripheral pins SI, SO and TOC, respectively. The peripheral function modes of these pins are selected by bits 0–2 (PMRA0–PMRA2) of port mode register A (PMRA: $004), as shown in figure 30. Port R3 is multiplexed with peripheral function pins AN 0–AN 3, respectively. The peripheral function modes of these pins can be selected by individual pins, by setting A/D mode register 1 (AMR1: $019) (figure 32). Ports R4 and R5 are multiplexed with peripheral function pins AN 4–AN 11, respectively. The peripheral function modes of these pins can be selected in 4-pin units by setting bits 1 and 2 (AMR21, AMR22) of A/D mode register 2 (AMR2: $01A) (figure 33). Pull-Up MOS Transistor Control: A program-controlled pull-up MOS transistor is provided for each input/output pin. The on/off status of all these transistors is controlled by bit 3 (MIS3) of the miscellaneous register (MIS: $00C), and the on/off status of an individual transistor can also be controlled by the port data register (PDR) of the corresponding pin—enabling on/off control of that pin alone (table 21 and figure 34). The on/off status of each transistor and the peripheral function mode of each pin can be set independently. How to Deal with Unused I/O Pins: I/O pins that are not needed by the user system (floating) must be connected to V CC to prevent LSI malfunctions due to noise. These pins must either be pulled up to VCC by their pull-up MOS transistors or by resistors of about 100 kW .

W W W W DCD0 to DCD3, DCR0 to DCR9 Data control register(DCD0 to 3: $02C to $02F) (DCR0 to 9: $030 to $039) Correspondence between ports and DCD/DCR bits DCD0 DCD1 DCD2 DCD3 DCR0 DCR1 DCR2 DCR3 DCR4 DCR5 DCR6 DCR7 DCR8 DCR9 Off (high-impedance) On Bits 0 to 3 CMOS Buffer On/Off Selection Register Name D 3 D 7 D 11 Not used R0 3 R1 3 R2 3 R3 3 R4 3 R5 3 R6 3 Not used R9 3 Bit 3 D 2 D 6 D 10 Not used R0 2 R1 2 R2 2 R3 2 R4 2 R5 2 R6 2 R7 2 R8 2 R9 2 Bit 2 D 1 D 5 D 9 D 13 R0 1 R1 1 R2 1 R3 1 R4 1 R5 1 R6 1 R7 1 R8 1 R9 1 Bit 1 D 0 D 4 D 8 D 12 R0 0 R1 0 R2 0 R3 0 R4 0 R5 0 R6 0 R7 0 R8 0 R9 0 Bit 0 DCD03– DCD23, DCR03– DCR63, DCR83– DCR93 DCD02– DCD22, DCR02– DCR92 DCD01– DCD31, DCR01– DCR91 DCD00– DCD30, DCR00– DCR90 Figure 28 Data Control Registers (DCD, DCR)

The MCU has the following two prescalers, S and W. The prescaler operating conditions are listed in table 24, and the prescaler output supply is shown in figure 35. The timer A–C input clocks except external events and the serial transmit clock except the external clock are selected from the prescaler outputs, depending on corresponding mode registers. Prescaler Operation Prescaler S: 11-bit counter that inputs the system clock signal. After being reset to $000 by MCU reset, prescaler S divides the system clock. Prescaler S keeps counting, except in watch and subactive modes and at MCU reset. Prescaler W: Five-bit counter that inputs the X1 input clock signal (32-kHz crystal oscillation) divided by eight. After being reset to $00 by MCU reset, prescaler W divides the input clock. Prescaler W can be reset by software. Table 24 Prescaler Operating Conditions Prescaler Input Clock Reset Conditions Stop Conditions Prescaler S System clock (in active and standby mode), subsystem clock (in subactive mode) MCU reset MCU reset, stop mode, watch mode Prescaler W 32-kHz crystal oscillation MCU reset, software MCU reset, stop mode Subsystem clock Prescaler W Timer A Timer B Timer C Serial Alarm output circuit System clock Prescaler SClock selector fX/8 fX/4 or fX/8 Figure 35 Prescaler Output Supply

The MCU has four timer/counters (A to C).

  • Timer A: Free-running timer
  • Timer B: Multifunction timer
  • Timer C: Multifunction timer Timer A is an 8-bit free-running timer. Timers B and C are 8-bit multifunction timers, whose functions are listed in table 25. The operating modes are selected by software. Timer A Timer A Functions: Timer A has the following functions.
  • Free-running timer
  • Clock time-base The block diagram of timer A is shown in figure 36. Timer A Operations:
  • Free-running timer operation: The input clock for timer A is selected by timer mode register A (TMA: $008). Timer A is reset to $00 by MCU reset and incremented at each input clock. If an input clock is applied to timer A after it has reached $FF, an overflow is generated, and timer A is reset to $00. The overflow sets the timer A interrupt request flag (IFTA: $001, bit 2). Timer A continues to be incremented after reset to $00, and therefore it generates regular interrupts every 256 clocks.
  • Clock time-base operation: Timer A is used as a clock time-base by setting bit 3 (TMA3) of timer mode register A (TMA: $008) to 1. The prescaler W output is applied to timer A, and timer A generates interrupts at the correct timing based on the 32.768-kHz crystal oscillation. In this case, prescaler W and timer A can be reset to $00 by software. Registers for Timer A Operation: Timer A operating modes are set by the following registers.
  • Timer mode register A (TMA: $008): Four-bit write-only register that selects timer A’s operating mode and input clock source as shown in figure 37.

Functions Timer A Timer B Timer C Clock source Prescaler S Available Available Available Prescaler W Available — — External event — Available — Timer functions Free-running Available Available Available Time-base Available — — Event counter — Available — Reload — Available Available Watchdog — — Available Input capture — Available — Timer output PWM — — Available Note: — implies not available. 1/4 1/232.768-kHz oscillator System clock Prescaler W (PSW) Selector Selector Prescaler S (PSS) Selector Internal data bus Timer A interrupt request flag (IFTA) Clock Overflow Timer counter A (TCA) Timer mode register A (TMA) 2 f 1/2 tWcyc f tWcyc øPER 128 512 1024 2048 W W Figure 36 Timer A Block Diagram

W TMA3 W TMA2 W TMA0 W TMA1 Timer mode register A (TMA: $008) 0 0 PSS PSS PSS PSS PSS PSS PSS PSS PSW PSW PSW PSW PSW Operating Mode Timer A mode TMA3 TMA1TMA2 TMA0 Source Prescaler 2048tcyc 1024tcyc 512tcyc 128tcyc 32tcyc 8tcyc 4tcyc 2tcyc Input Clock Frequency 32t Wcyc 16tWcyc 8tWcyc 2tWcyc 1/2tWcyc Time-base mode Inhibited PSW and TCA reset Notes: 1. t Wcyc = 244.14µs (when a 32.768-kHz crystal oscillator is used) Timer counter overflow output period (seconds) = input clock period (seconds) × 256. The division ratio must not be modified during time-base mode operation, otherwise an overflow cycle error will occur. Don't care Figure 37 Timer Mode Register A (TMA)

Timer B Functions: Timer B has the following functions.

  • Free-running/reload timer
  • External event counter
  • Input capture timer The block diagram for each operation mode of timer B is shown in figures 38 and 39. Timer B Operations:
  • Free-running/reload timer operation: The free-running/reload operation, input clock source, and prescaler division ratio are selected by timer mode register B1 (TMB1: $009). Timer B is initialized to the value set in timer write register B (TWBL: $00A, TWBU: $00B) by software and incremented by one at each clock input. If an input clock is applied to timer B after it has reached $FF, an overflow is generated. In this case, if the reload timer function is enabled, timer B is initialized to its initial value set in timer write register B; if the free-running timer function is enabled, the timer is initialized to $00 and then incremented again. The overflow sets the timer B interrupt request flag (IFTB: $002, bit 0). IFTB is reset by software or MCU reset. Refer to figure 3 and table 1 for details.
  • External event counter operation: Timer B is used as an external event counter by selecting the external event input as an input clock source. In this case, pin D 2/EVNB must be set to EVNB by port mode register B (PMRB: $024). Either falling or rising edge, or both falling and rising edges of input signals can be selected as the external event detection edge by timer mode register 2 (TMB2: $026). When both rising and falling edges detection is selected, the time between the falling edge and rising edge of input signals must be cyc or longer. Timer B is incremented by one at each detection edge selected by timer mode register 2 (TMB2: $026). The other operation is basically the same as the free-running/reload timer operation.
  • Input capture timer operation: The input capture timer counts the clock cycles between trigger edges input to pin EVNB. Either falling or rising edge, or both falling and rising edges of input signals can be selected as the trigger input edge by timer mode register 2 (TMB2: $026). When a trigger edge is input to EVNB, the count of timer B is written to timer read register B (TRBL: $00A, TRBU: $00B), and the timer B interrupt request flag (IFTB: $002, bit 0) and the input capture status flag (ICSF: $021, bit 0) are set. Timer B is reset to $00, and then incremented again. While ICSF is set, if a trigger input edge is applied to timer B, or if timer B generates an overflow, the input capture error flag (ICEF: $021, bit 1) is set. ICSF and ICEF are reset to 0 by MCU reset or by writing 0.

(TCB) ÷32 ÷128 ÷512 ÷2048 Timer mode register B2 (TMB2) EVNB Selector System clock øPER Prescaler S (PSS) Edge detector Edge detection control signal Timer write register B lower (TWBL) Timer mode register B1 (TMB1) Timer write register B upper (TWBU) Clock Free-running timer control signal Timer read register B lower (TRBL) Interrupt request flag of timer B (IFTB) Timer read register B upper (TRBU) Overflow Internal data bus Figure 38 Timer B Free-Running and Reload Operation Block Diagram

(TCB) Internal data bus ÷32 ÷128 ÷512 ÷2048 Timer mode register B2 (TMB2) EVNB Selector System clock øPER Prescaler S (PSS) Edge detector Edge detection control signal Timer mode register B1 (TMB1) Clock Input capture timer control signal Timer read register B lower (TRBL) Interrupt request flag of timer B (IFTB) Timer read register B upper (TRBU) Overflow Read signal Input capture status flag (ICSF) Input capture error flag (ICEF) Error controller Figure 39 Timer B Input Capture Operation Block Diagram Registers for Timer B Operation: By using the following registers, timer B operation modes are selected and the timer B count is read and written. ¾ Timer mode register B1 (TMB1: $009) ¾ Timer mode register B2 (TMB2: $026) ¾ Timer write register B (TWBL: $00A, TWBU: $00B) ¾ Timer read register B (TRBL: $00A, TRBU: $00B) ¾ Port mode register B (PMRB: $024)

  • Timer mode register B1 (TMB1: $009): Four-bit write-only register that selects the free-running/reload timer function, input clock source, and the prescaler division ratio as shown in figure 40. It is reset to $0 by MCU reset. Writing to this register is valid from the second instruction execution cycle after the execution of the previous timer mode register B1 write instruction. Setting timer B’s initialization by writing to timer write register B (TWBL: $00A, TWBU: $00B) must be done after a mode change becomes valid. When selecting the input capture timer operation, select the internal clock as the input clock source. Bit Initial value Read/Write Bit name W TMB13 W TMB12 W TMB10 W TMB11 Timer mode register B1 (TMB1: $009) 2048t cyc 512tcyc 128tcyc 32tcyc 8tcyc 4tcyc 2tcyc TMB12 TMB10TMB11 Input Clock Period and Input Clock Source D 2/EVNB (external event input) TMB13 Free-Running/Reload Timer Selection Free-running timer Reload timer Figure 40 Timer Mode Register B1 (TMB1)
  • Timer mode register B2 (TMB2: $026): Three-bit write-only register that selects the detection edge of signals input to pin EVNB and input capture operation as shown in figure 41. It is reset to $0 by MCU reset.
  • Timer write register B (TWBL: $00A, TWBU: $00B): Write-only register consisting of the lower digit (TWBL) and the upper digit (TWBU). The lower digit is reset to $0 by MCU reset, but the upper digit value is invalid (figures 42 and 43). Timer B is initialized by writing to timer write register B (TWBL: $00A, TWBU: $00B). In this case, the lower digit (TWBL) must be written to first, but writing only to the lower digit does not change the timer B value. Timer B is initialized to the value in timer write register B at the same time the upper digit (TWBU) is written to. When timer write register B is written to again and if the lower digit value needs no change, writing only to the upper digit initializes timer B.

W PMRB3 W PMRB2 W PMRB0 W PMRB1 PMRB0 D 0/INT0 Mode Selection D 0 INT0 Port mode register B (PMRB: $024) PMRB1 D 1/INT1 Mode Selection D 1 INT1 PMRB2 D 2/EVNB Mode Selection D 2 EVNB PMRB3 D 4/STOPC Mode Selection D 4 STOPC Note: PMRB3 is reset to 0 only by RESET input. When STOPC is input in stop mode, PMRB3 is not reset but retains its value. Figure 46 Port Mode Register B (PMRB)

Timer C Functions: Timer C has the following functions.

  • Free-running/reload timer
  • Watchdog timer
  • Timer output operation (PWM output) The block diagram of timer C is shown in figure 47. Timer counter C (TCC) ÷32 ÷128 ÷512 ÷1024 ÷2048 Port mode register A (PMRA) Selector System clock øPER Prescaler S (PSS) Timer write register C lower (TWCL) Timer mode register C (TMC) Timer write register C upper (TWCU) Clock Free-running timer control signal Timer read register C lower (TRCL) Interrupt request flag of timer C (IFTC) Timer read register C upper (TRCU) Overflow TOC Timer output control signal Watchdog timer controller Watchdog on flag (WDON) System reset signal Internal data bus Timer output control logic Figure 47 Timer C Block Diagram

T (N + 1) T 256T T (256 – N) TMC3 = 0 (free-running timer) TMC3 = 1 (reload timer) Notes: T: Input clock period supplied to counter. (The clock source and system clock division ratio are determined by timer mode register C.) N: Value of timer write register C. (When N = 255 ($FF), PWM output is fixed low.) Figure 49 PWM Output Waveform Registers for Timer C Operation: By using the following registers, timer C operation modes are selected and the timer C count is read and written. ¾ Timer mode register C (TMC: $00D) ¾ Port mode register A (PMRA: $004) ¾ Timer write register C (TWCL: $00E, TWCU: $00F) ¾ Timer read register C (TRCL: $00E, TRCU: $00F)

  • Timer mode register C (TMC: $00D): Four-bit write-only register that selects the free-running/reload timer function, input clock source, and the prescaler division ratio as shown in figure 50. It is reset to $0 by MCU reset. Writing to this register is valid from the second instruction execution cycle after the execution of the previous timer mode register C write instruction. Setting timer C’s initialization by writing to timer write register C (TWCL: $00E, TWCU: $00F) must be done after a mode change becomes valid.

Table 26 PWM Output Following Update of Timer Write Register PWM Output Mode Timer Write Register is Updated during High PWM Output Timer Write Register is Updated during Low PWM Output Reload Timer write register updated to value N Interrupt request TT × (255 – N)T Timer write register updated to value N Interrupt request TT × (255 – N) T

The MCU has a built-in pulse output function called BUZZ. The pulse frequency can be selected from the prescaler S’s outputs, and the output frequency depends on the state of port mode register C (PMRC: $025). The duty cycle of the pulse output is fixed at 50%. Port Mode Register C (PMRC: $025): Four-bit write-only register that selects the alarm frequencies as shown in figure 57. It is reset to $0 by MCU reset. Port Mode Register A (PMRA: $004): Four-bit write-only register that selects D 3/BUZZ pin function as shown in figure 51. It is reset to $0 by MCU reset. Internal data bus ÷256 ÷512 ÷1024 ÷2048 Selector System clock øPER Prescaler S (PSS) Alarm output control signal BUZZ Alarm output controller Port mode register C (PMRC) Port mode register A (PMRA) Figure 56 Alarm Output Function Block Diagram

W PMRC3 W PMRC2 W PMRC0 Undefined W PMRC1 Port mode register C (PMRC: $025) PMRC1 Output Level Control in Idle States Low level High level PMRC0 Serial Clock Division Ratio Prescaler output divided by 2 Prescaler output divided by 4 PMRC3 PMRC2 System Clock Divisor ÷2048 ÷1024 ÷512 ÷256 Figure 57 Port Mode Register C (PMRC)

The serial interface serially transfers and receives 8-bit data, and includes the following features.

  • Multiple transmit clock sources ¾ External clock ¾ Internal prescaler output clock ¾ System clock
  • Output level control in idle states Four registers, an octal counter, and a selector are also configured for the serial interface as follows. ¾ Serial data register (SRL: $006, SRU: $007) ¾ Serial mode register (SMR: $005) ¾ Port mode register A (PMRA: $004) ¾ Port mode register C (PMRC: $025) ¾ Miscellaneous register (MIS: $00C) ¾ Octal counter (OC) ¾ Selector The block diagram of the serial interface is shown in figure 58.

÷32 ÷128 ÷512 ÷2048 Port mode register C (PMRC) SCK Selector System clock øPER Prescaler S (PSS) Idle controller Serial mode register (SMR) Clock Serial data register (SR) Serial interrupt request flag (IFS) Selector 1/2 1/2 SI SO Octal counter (OC) I/O controller Transfer control signal Figure 58 Serial Interface Block Diagram Serial Interface Operation Selecting and Changing the Operating Mode: Table 27 lists the serial interface’s operating modes. To select an operating mode, use one of these combinations of port mode register A (PMRA: $004) and the serial mode register (SMR: $005) settings; to change the operating mode, always initialize the serial interface internally by writing data to the serial mode register. Note that the serial interface is initialized by writing data to the serial mode register. Refer to the following Serial Mode Register section for details. Pin Setting: The R0 0/SCK pin is controlled by writing data to the serial mode register (SMR: $005). The R0 1/SI and R02/SO pins are controlled by writing data to port mode register A (PMRA: $004). Refer to the following Registers for Serial Interface section for details. Transmit Clock Source Setting: The transmit clock source is set by writing data to the serial mode register (SMR: $005) and port mode register C (PMRC: $025). Refer to the following Registers for Serial Interface section for details. Data Setting: Transmit data is set by writing data to the serial data register (SRL: $006, SRU, $007). Receive data is obtained by reading the contents of the serial data register. The serial data is shifted by the transmit clock and is input from or output to an external system.

The output level of the SO pin is invalid until the first data is output after MCU reset, or until the output level control in idle states is performed. Transfer Control: The serial interface is activated by the STS instruction. The octal counter is reset to 000 by this instruction, and it increments at the rising edge of the transmit clock. When the eighth transmit clock signal is input or when serial transmission/receive is discontinued, the octal counter is reset to 000, the serial interrupt request flag (IFS: $003, bit 2) is set, and the transfer stops. When the prescaler output is selected as the transmit clock, the transmit clock frequency is selected as 4t cyc to 8192tcyc by setting bits 0 to 2 (SMR0– SMR2) of serial mode register (SMR: $005) and bit 0 (PMRC0) of port mode register C (PMRC: $025) as listed in table 28. Operating States: The serial interface has the following operating states; transitions between them are shown in figure 59. ¾ STS wait state ¾ Transmit clock wait state ¾ Transfer state ¾ Continuous clock output state (only in internal clock mode)

  • STS wait state: The serial interface enters STS wait state by MCU reset (00, 10 in figure 59). In STS wait state, the serial interface is initialized and the transmit clock is ignored. If the STS instruction is then executed (01, 11), the serial interface enters transmit clock wait state.
  • Transmit clock wait state: Transmit clock wait state is the period between the STS execution and the falling edge of the first transmit clock. In transmit clock wait state, input of the transmit clock (02, 12) increments the octal counter, shifts the serial data register, and puts the serial interface in transfer state. However, note that if continuous clock output mode is selected in internal clock mode, the serial interface does not enter transfer state but enters continuous clock output state (17). The serial interface enters STS wait state by writing data to the serial mode register (SMR: $005) (04, 14) in transmit clock wait state.
  • Transfer state: Transfer state is the period between the falling edge of the first clock and the rising edge of the eighth clock. In transfer state, the input of eight clocks or the execution of the STS instruction sets the octal counter to 000, and the serial interface enters another state. When the STS instruction is executed (05, 15), transmit clock wait state is entered. When eight clocks are input, transmit clock wait state is entered (03) in external clock mode, and STS wait state is entered (13) in internal clock mode. In internal clock mode, the transmit clock stops after outputting eight clocks. In transfer state, writing data to the serial mode register (SMR: $005) (06, 16) initializes the serial interface, and STS wait state is entered. If the state changes from transfer to another state, the serial interrupt request flag (IFS: $003, bit 2) is set by the octal counter that is reset to 000.
  • Continuous clock output state (only in internal clock mode): Continuous clock output state is entered only in internal clock mode. In this state, the serial interface does not transmit/receive data but only outputs the transmit clock from the SCK pin.

When bits 0 and 1 (PMRA0, PMRA1) of port mode register A (PMRA: $004) are 00 in transmit clock wait state and if the transmit clock is input (17), the serial interface enters continuous clock output state. If the serial mode register (SMR: $005) is written to in continuous clock output mode (18), STS wait state is entered. Output Level Control in Idle States: In idle states, that is, STS wait state and transmit clock wait state, the output level of the SO pin can be controlled by setting bit 1 (PMRC1) of port mode register C (PMRC: $025) to 0 or 1. The output level control example is shown in figure 60. Note that the output level cannot be controlled in transfer state. Transmit Clock Error Detection (In External Clock Mode): The serial interface will malfunction if a spurious pulse caused by external noise conflicts with a normal transmit clock during transfer. A transmit clock error of this type can be detected as shown in figure 61. Table 27 Serial Interface Operating Modes SMR PMRA Bit 3 Bit 1 Bit 0 Operating Mode 1 0 0 Continuous clock output mode

1 Transmit mode

1 Transmit/receive mode

Table 28 Serial Transmit Clock (Prescaler Output) PMRC SMR Bit 0 Bit 2 Bit 1 Bit 0 Prescaler Division Ratio Transmit Clock Frequency 0000 ‚ 2048 4096t cyc 1 ‚ 512 1024t cyc 10 ‚ 128 256t cyc 1 ‚ 32 64t cyc 100 ‚ 8 16t cyc 1 ‚ 24 t cyc 1000 ‚ 4096 8192t cyc 1 ‚ 1024 2048t cyc 10 ‚ 256 512t cyc 1 ‚ 64 128t cyc 100 ‚ 16 32t cyc 1 ‚ 48 t cyc

If more than eight transmit clocks are input in transfer state, at the eighth clock including a spurious pulse by noise, the octal counter reaches 000, the serial interrupt request flag (IFS: $003, bit 2) is set, and transmit clock wait state is entered. At the falling edge of the next normal clock signal, the transfer state is entered. After the transfer completion processing is performed and IFS is reset, writing to the serial mode register (SMR: $005) changes the state from transfer to STS wait. At this time IFS is set again, and therefore the error can be detected. Notes on Use:

  • Initialization after writing to registers: If port mode register A (PMRA: $004) is written to in transmit clock wait state or in transfer state, the serial interface must be initialized by writing to the serial mode register (SMR: $005) again.
  • Serial interrupt request flag (IFS: $003, bit 2) set: If the state is changed from transfer to another by writing to the serial mode register (SMR: $005) or executing the STS instruction during the first low pulse of the transmit clock, the serial interrupt request flag is not set. To set the serial interrupt request flag, serial mode register write or STS instruction execution must be programmed to be executed after confirming that the SCK pin is at 1, that is, after executing the input instruction to port R0. STS wait state (octal counter = 000, transmit clock disabled) Transmit clock wait state (octal counter = 000) Transfer state (octal counter ≠ 000) MCU reset00 SMR write 04 STS instruction01 Transmit clock02 8 transmit clocks STS instruction (IFS 1) SMR write (IFS 1)06 ← External clock mode STS wait state (octal counter = 000, transmit clock disabled) Transmit clock wait state (octal counter = 000) Transfer state (octal counter ≠ 000) SMR write 14 STS instruction11 Transmit clock12 STS instruction (IFS 1)← 8 transmit clocks13 Internal clock mode Continuous clock output state (PMRA 0, 1 = 0, 0) SMR write Transmit clock17 Note: Refer to the Operating States section for the corresponding encircled numbers. MCU reset10 ←SMR write (IFS 1) Figure 59 Serial Interface State Transitions

/,/#01/#05 /#09/#0A/#0E /#14/#15 State MCU reset PMRA write SMR write PMRC write SRL, SRU write STS instruction SCK pin (input) SO pin IFS STS wait state Transmit clock wait state Transfer state Transmit clock wait state STS wait state Port selection External clock selection Output level control in idle states Dummy write for state transition Output level control in idle states Data write for transmission Undefined LSB MSB Flag reset at transfer completionExternal clock mode State MCU reset PMRA write SMR write PMRC write SRL, SRU write STS instruction SCK pin (output) SO pin IFS STS wait state Transfer state Transmit clock wait state STS wait state Port selection Internal clock selection Output level control in idle states Data write for transmission Output level control in idle states Undefined LSB MSB Flag reset at transfer completionInternal clock mode Figure 60 Example of Serial Interface Operation Sequence

(IFS 1) Interrupts inhibited IFS 0 SMR write IFS = 1 Transmit clock error processing Normal termination Yes No Transmit clock error detection flowchart /#0A/#0E Transmit clock error detection procedure State SCK pin (input) Transmit clock wait state Transfer state Transfer state Transmit clock wait state Noise Transfer state has been entered by the transmit clock error. When SMR is written, IFS is set. Flag set because octal counter reaches 000 Flag reset at transfer completion SMR write IFS 12 345678 Figure 61 Transmit Clock Error Detection Registers for Serial Interface The serial interface operation is selected, and serial data is read and written by the following registers. ¾ Serial Mode Register (SMR: $005) ¾ Serial Data Register (SRL: $006, SRU: $007) ¾ Port Mode Register A (PMRA: $004) ¾ Port Mode Register C (PMRC: $025) ¾ Miscellaneous Register (MIS: $00C)

Serial Mode Register (SMR: $005): This register has the following functions (figure 62).

  • R0 0/SCK pin function selection
  • Transmit clock selection
  • Prescaler division ratio selection
  • Serial interface initialization Serial mode register (SMR: $005) is a 4-bit write-only register. It is reset to $0 by MCU reset. A write signal input to serial mode register (SMR: $005) discontinues the input of the transmit clock to the serial data register and octal counter, and the octal counter is reset to 000. Therefore, if a write is performed during data transfer, the serial interrupt request flag (IFS: $003, bit 2) is set. Written data is valid from the second instruction execution cycle after the write operation, so the STS instruction must be executed at least two cycles after that. Bit Initial value Read/Write Bit name W SMR3 W SMR2 W SMR0 W SMR1 Serial mode register (SMR: $005) SMR2 SMR0SMR1SMR3 0/SCK Mode Selection R0 0 SCK SCK Output Output Input Clock Source External clock Prescaler Division Ratio Refer to table 28 Prescaler System clock Figure 62 Serial Mode Register (SMR)

Port Mode Register C (PMRC: $025): This register has the following functions (figure 63).

  • Prescaler division ratio selection
  • Output level control in idle states Port mode register C (PMRC: $025) is a 4-bit write-only register. It cannot be written during data transfer. By setting bit 0 (PMRC0) of this register, the prescaler division ratio is selected. Bit 0 (PMRC0) can be reset to 0 by MCU reset. By setting bit 1 (PMRC1), the output level of the SO pin is controlled in idle states. The output level changes at the same time that PMRC1 is written to. Bit Initial value Read/Write Bit name W PMRC3 W PMRC2 W PMRC0 Undefined W PMRC1 Port mode register C (PMRC: $025) PMRC1 Output Level Control in Idle States Low level High level PMRC0 Serial Clock Division Ratio Prescaler output divided by 2 Prescaler output divided by 4 Alarm output function. Refer to figure 57. Figure 63 Port Mode Register C (PMRC)

Port Mode Register A (PMRA: $004): This register has the following functions (figure 67).

  • R0 1/SI pin function selection
  • R0 2/SO pin function selection Port mode register A (PMRA: $004) is a 4-bit write-only register, and is reset to $0 by MCU reset. Bit Initial value Read/Write Bit name W PMRA3 W PMRA2 W PMRA0 W PMRA1 PMRA0 2/SO Mode Selection R0 2 SO Port mode register A (PMRA: $004) PMRA1 R0 1/SI Mode Selection R0 1 SI PMRA2 3/TOC Mode Selection R0 3 TOC PMRA3 D 3/BUZZ Mode Selection D 3 BUZZ Figure 67 Port Mode Register A (PMRA)

Miscellaneous Register (MIS: $00C): This register has the following functions (figure 68).

  • R0 2/SO pin PMOS control Miscellaneous register (MIS: $00C) is a 4-bit write-only register and is reset to $0 by MCU reset. Bit Initial value Read/Write Bit name W MIS3 W MIS2 W MIS0 W MIS1 MIS2 CMOS Buffer On/Off Selection for Pin R0 2/SO Miscellaneous register (MIS: $00C) PMOS active PMOS off Refer to figure 15 in the operation modes section. tRC selection. MIS3 Pull-Up MOS On/Off Selection Pull-up MOS off Pull-up MOS on (refer to table 21) MIS1 MIS0 Figure 68 Miscellaneous Register (MIS)

The MCU has a built-in A/D converter that uses a sequential comparison method with a resistor ladder. It can measure twelve analog inputs with 8-bit resolution. The block diagram of the A/D converter is shown in figure 69. IAD off flag (IAOF) Selector A/D channel register (ACR) A/D mode register 2 (AMR2) A/D mode register 1 (AMR1) A/D interrupt request flag (IFAD) Encoder A/D data register (ADRU, L) A/D start flag (ADSF) D/A AV CC AV SS Operating mode signal (1 in stop, watch, and subactive modes) Internal data bus+ Comp A/D controller AN 0 AN 1 AN 2 AN 3 AN 4 AN 5 AN 6 AN 7 AN 8 AN 9 AN 10 AN 11 Control signal for conversion time Figure 69 A/D Converter Block Diagram

A/D Channel Register (ACR: $016): Four-bit write-only register which indicates analog input pin information, as shown in figure 72. Bit Initial value Read/Write Bit name W ACR3 W ACR2 W ACR0 W ACR1 A/D channel register (ACR: $016) 0 0 Analog Input Selection AN AN 1 AN 2 AN 3 AN 4 AN 5 AN 6 AN 7 AN 8 AN 9 AN 10 AN 11 Not used ACR3 ACR1ACR2 ACR0 Don’t care. Don’t care. Figure 72 A/D Channel Register (ACR)

  • Use the SEM or SEMD instruction for writing to the A/D start flag (ADSF)
  • Do not write to the A/D start flag during A/D conversion
  • Data in the A/D data register during A/D conversion is undefined
  • Since the operation of the A/D converter is based on the clock from the system oscillator, the A/D converter does not operate in stop, watch, or subactive mode. In addition, to save power while in these modes, all current flowing through the converter’s resistance ladder is cut off.
  • If the power supply for the A/D converter is to be different from V CC , connect a 0.1-mF bypass capacitor between the AVCC and AVSS pins. (However, this is not necessary when the AVCC pin is directly connected to the VCC pin.)
  • The contents of the A/D data register are not guaranteed during A/D conversion. To ensure that the A/D converter operates stably, do not execute port output instructions during A/D conversion.
  • The port data register (PDR) is initialized to 1 by an MCU reset. At this time, if pull-up MOS is selected as active by bit 3 of the miscellaneous register (MIS3), the port will be pulled up to VCC . When using a shared R port/analog input pin as an input pin, clear PDR to 0. Otherwise, if pull-up MOS is selected by MIS3 and PDR is set to 1, a pin selected by A/D mode register 1 or 2 (AMR1 or AMR2) as an analog pin will remain pulled up (figure 78). VCC VCC HLT MIS3 DCR PDR CPU input Input control signal ACR A/D input A/D channel register value AMR A/D mode register value Figure 78 R Port/Analog Multiplexed Pin Circuit

Pin Description in PROM Mode The HD407A4369 is a PROM version of a ZTAT ä microcomputer. In PROM mode, the MCU stops operating, thus allowing the user to program the on-chip PROM. Pin Number MCU Mode PROM Mode DP-64S FP-64B FP-64A Pin I/O Pin I/O 1 5 95 7R 6 0 I/O 2 6 05 8R 6 1 I/O 3 6 15 9R 6 2 I/O 4 6 26 0R 6 3 I/O 5 6 36 1R 7 0 I/O 6 6 46 2R 7 1 I/O 7 1 63 R7 2 I/O 8 2 64 R0 0/SCK I/O V CC 9 31R 0 1/SI I/O V CC 1 042R 0 2/SO I/O O 1 I/O 1 153R 0 3/TOC I/O O 2 I/O 12 6 4 TEST I V PP 13 7 5 RESET I RESET I 14 8 6 OSC 1 IV CC 15 9 7 OSC 2 O 16 10 8 GND — GND 17 11 9 X1 I GND 18 12 10 X2 O 19 13 11 AV SS — GND 20 14 12 R3 0/AN0 I/O O 0 I/O 21 15 13 R3 1/AN1 I/O O 1 I/O 22 16 14 R3 2/AN2 I/O O 2 I/O 23 17 15 R3 3/AN3 I/O O 3 I/O 24 18 16 R4 0/AN4 I/O O 4 I/O 25 19 17 R4 1/AN5 I/O M0 I 26 20 18 R4 2/AN6 I/O M1 I 27 21 19 R4 3/AN7 I/O 28 22 20 R5 0/AN8 I/O 29 23 21 R5 1/AN9 I/O 30 24 22 R5 2/AN10 I/O

Pin Number MCU Mode PROM Mode DP-64S FP-64B FP-64A Pin I/O Pin I/O 31 25 23 R5 3/AN11 I/O 32 26 24 AV CC —V CC 33 27 25 V CC —V CC 34 28 26 D 0/INT0 I/O O 3 I/O 35 29 27 D 1/INT1 I/O O 4 I/O 36 30 28 D 2/EVNB I/O A 1 I 37 31 29 D 3/BUZZ I/O A 2 I 38 32 30 D 4/STOPC I/O 39 33 31 D 5 I/O A 3 I 40 34 32 D 6 I/O A 4 I 41 35 33 D 7 I/O A 9 I 42 36 34 D 8 I/O V CC 43 37 35 D 9 I/O 44 38 36 D 10 I/O 45 39 37 D 11 I/O 46 40 38 D 12 I/O 47 41 39 D 13 I/O 48 42 40 R8 0 I/O CE I 49 43 41 R8 1 I/O OE I 50 44 42 R8 2 I/O A 13 I 51 45 43 R8 3 I/O A 14 I 52 46 44 R9 0 I/O 53 47 45 R9 1 I/O 54 48 46 R9 2 I/O 55 49 47 R9 3 I/O 56 50 48 R1 0 I/O A 5 I 57 51 49 R1 1 I/O A 6 I 58 52 50 R1 2 I/O A 7 I 59 53 51 R1 3 I/O A 8 I 60 54 52 R2 0 I/O A 0 I 61 55 53 R2 1 I/O A 10 I 62 56 54 R2 2 I/O A 11 I 63 57 55 R2 3 I/O A 12 I 64 58 56 RA 1 IO 0 I/O Notes: 1. I/O: Input/output pin; I: Input pin; O: Output pin 2. O0 to O4 consist of two pins each. Tie each pair together before using them.

Programming the Built-In PROM The MCU’s built-in PROM is programmed in PROM mode. PROM mode is set by pulling RESET, M0, and M1 low, as shown in figure 79. In PROM mode, the MCU does not operate, but it can be programmed in the same way as any other commercial 27256-type EPROM using a standard PROM programmer and a 100-to-28-pin socket adapter. Recommended PROM programmers and socket adapters are listed in table 29. Since an HMCS400-series instruction is ten bits long, the HMCS400-series MCU has a built-in conversion circuit to enable the use of a general-purpose PROM programmer. This circuit splits each instruction into five lower bits and five upper bits that are read from or written to consecutive addresses. This means that if, for example, 16 kwords of built-in PROM are to be programmed by a general-purpose PROM programmer, a 32-kbyte address space ($0000–$7FFF) must be specified. Control signals Address bus Data bus VCC GND VPP O 7–O 0 O 7 O 6 O 5 O 4–O 0 CE, OE A14–A0 O 4–O 0 RESET VCC GND VPP HD407A4369 PROM mode pins Socket adapter PROM programmer Figure 79 PROM Mode Connections

Table 29 Recommended PROM Programmers and Socket Adapters PROM Programmer Socket Adapter Manufacture Model Name Package Manufacture Model Name DATA I/O corp 121 B DP-64S Hitachi HS4369ESS01H FP-64B HS4369ESF01H FP-64A HS4369ESH01H AVAL corp PKW-1000 DP-64S Hitachi HS4369ESS01H FP-64B HS4369ESF01H FP-64A HS4369ESH01H Warnings 1. Always specify addresses $0000 to $7FFF when programming with a PROM programmer. If address $8000 or higher is accessed, the PROM may not be programmed or verified correctly. Set all data in unused addresses to $FF. Note that the plastic-package version cannot be erased and reprogrammed. 2. Make sure that the PROM programmer, socket adapter, and LSI are aligned correctly (their pin 1 positions match), otherwise overcurrents may damage the LSI. Before starting programming, make sure that the LSI is firmly fixed in the socket adapter and the socket adapter is firmly fixed onto the programmer. 3. PROM programmers have two voltages (V PP ): 12.5 V and 21 V. Remember that ZTATä devices require a VPP of 12.5 V—the 21-V setting will damage them. 12.5 V is the Intel 27256 setting. Programming and Verification The built-in PROM of the MCU can be programmed at high speed without risk of voltage stress or damage to data reliability. Programming and verification modes are selected as listed in table 30. For details of PROM programming, refer to the following Notes on PROM Programming section. Table 30 PROM Mode Selection Pin Mode CE OE VPP O 0–O 4 Programming Low High V PP Data input Verification High Low V PP Data output Programming inhibited High High V PP High impedance

The MCU has three RAM addressing modes, as shown in figure 80 and described below. Register Indirect Addressing Mode: The contents of the W, X, and Y registers (10 bits in total) are used as a RAM address. Direct Addressing Mode: A direct addressing instruction consists of two words. The first word contains the opcode, and the contents of the second word (10 bits) are used as a RAM address. Memory Register Addressing Mode: The memory registers (MR), which are located in 16 addresses from $040 to $04F, are accessed with the LAMR and XMRA instructions. AP 9 AP 0 W 1 Y0 W register X register Y register RAM address Register Direct Addressing AP 9 AP 0RAM address Direct Addressing d 9 d0 2nd word of Instruction Opcode 1st word of Instruction AP 9 AP 0RAM address Memory Register Addressing m 3Opcode Instruction 000100 AP 8 AP 7 AP AP 5 AP 46 AP 3 AP 2 AP 1 AP AP AP AP AP AP AP AP87654321 d 8 d7 d6 d 5 d4 d3 d2 d1 AP 8 AP 7 AP 6 AP 5 AP 4 AP 3 AP 2 AP 1 W 0 X3 X2 X1 X0 Y3 Y2 Y1 m 2 m 1 m 0 Figure 80 RAM Addressing Modes

ROM Addressing Modes and the P Instruction The MCU has four ROM addressing modes, as shown in figure 81 and described below. Direct Addressing Mode: A program can branch to any address in the ROM memory space by executing the JMPL, BRL, or CALL instruction. Each of these instructions replaces the 14 program counter bits (PC 13–PC 0) with 14-bit immediate data. Current Page Addressing Mode: The MCU has 64 pages of ROM with 256 words per page. A program can branch to any address in the current page by executing the BR instruction. This instruction replaces the eight low-order bits of the program counter (PC 7–PC 0) with eight-bit immediate data. If the BR instruction is on a page boundary (address 256n + 255), executing that instruction transfers the PC contents to the next physical page, as shown in figure 83. This means that the execution of the BR instruction on a page boundary will make the program branch to the next page. Note that the HMCS400-series cross macroassembler has an automatic paging feature for ROM pages. Zero-Page Addressing Mode: A program can branch to the zero-page subroutine area located at $0000– $003F by executing the CAL instruction. When the CAL instruction is executed, 6 bits of immediate data are placed in the six low-order bits of the program counter (PC 5–PC 0), and 0s are placed in the eight high- order bits (PC13–PC 6). Table Data Addressing Mode: A program can branch to an address determined by the contents of four-bit immediate data, the accumulator, and the B register by executing the TBR instruction. P Instruction: ROM data addressed in table data addressing mode can be referenced with the P instruction as shown in figure 82. If bit 8 of the ROM data is 1, eight bits of ROM data are written to the accumulator and the B register. If bit 9 is 1, eight bits of ROM data are written to the R1 and R2 port output registers. If both bits 8 and 9 are 1, ROM data is written to the accumulator and the B register, and also to the R1 and R2 port output registers at the same time. The P instruction has no effect on the program counter.

d9 d 8 d7 d6 d 5 d4 d3 d2 d1 d0 2nd word of instruction Opcode 1st word of instruction [JMPL] [BRL] [CALL] PC 9 PC 8 PC 7 PC 6 PC 5 PC 4 PC 3 PC 2 PC 1 PC 0PCPCPCPC 10111213Program counter Direct Addressing Zero Page Addressing d5 d 4 d3 d2 d 1 d 0 Instruction [CAL] Opcode PC 98 PC 76 PC 54 PC 3 PC 1 PC 0PCPC 10111213Program counter 00000000 PCPC PC PC PC PC 2 B 1 B 0 A 3 A 2 A 1 A 0 Accumulator Program counter Table Data Addressing PC 9 PC 8 PC 7 PC 6 PC 5 PC 4 PC 3 PC 2 PC 1 PC 0PCPCPC 10111213 B 2B 3 B register p3 p0[TBR] Instruction Opcode p2 p1 PC Opcode b7 b6 b 5 b4 b3 b2 b1 b0 Instruction PC 90PCPCPC 111213Program counter Current Page Addressing [BR] PC 10 7 PC 6 PC 5 PC 4 PC 3 PC 2 PC 1 PCPC 8 PC p0p1p2p3 Figure 81 ROM Addressing Modes

RA 9 RA 8 RA 7 RA 6 RA 5 RA 4 RA 3 RA 2 RA 1 RA 0RARARA 10111213 B 2B 3 B register p3 p0[P] Instruction Opcode p2 p1 RA R2 3 R2 2 R2 1 R2 0 R1 3 R1 2 R1 1 R1 0 RO 9 RO 0RO 8 RO 7 RO 6 RO 5 RO 4 RO 3 RO 2 RO 1 BBB B AA AA321 0 32 10 If RO = 18Accumulator, B register ROM data Pattern Output RO 9ROM data If RO = 19Output registers R1, R2 RO 0RO 8 RO 7 RO 6 RO 5 RO 4 RO 3 RO 2 RO 1 Figure 82 P Instruction

256 (n – 1) + 255 256n BR AAA BR BBB 256n + 254 256n + 255 256 (n + 1) BBB NOP Figure 83 Branching when the Branch Destination is on a Page Boundary

The HD404369 Series has 101 instructions, classified into the following 10 groups:

  • Immediate instructions
  • Register-to-register instructions
  • RAM address instructions
  • RAM register instructions
  • Arithmetic instructions
  • Compare instructions
  • RAM bit manipulation instructions
  • ROM address instructions
  • Input/output instructions
  • Control instructions

Item Symbol Value Unit Notes Supply voltage V CC –0.3 to +7.0 V Programming voltage V PP –0.3 to +14.0 V 1 Pin voltage V T –0.3 to VCC + 0.3 V 2 –0.3 to +15.0 V 3 Total permissible input currentå IO 105 mA 4 Total permissible output current –å IO 50 mA 5 Maximum input current I O 4 mA 6, 7 30 mA 6, 8 Maximum output current –I O 4 mA 7, 9 Operating temperature T opr –20 to +75 °C Storage temperature T stg –55 to +125 °C Notes: Permanent damage may occur if these absolute maximum ratings are exceeded. Normal operation must be under the conditions stated in the electrical characteristics tables. If these conditions are exceeded, the LSI may malfunction or its reliability may be affected. 1. Applies to pin TEST (V PP ) of HD407A4369. 2. Applies to all standard voltage pins. 3. Applies to intermediate-voltage pins. 4. The total permissible input current is the total of input currents simultaneously flowing in from all the I/O pins to GND. 5. The total permissible output current is the total of output currents simultaneously flowing out from V CC to all I/O pins. 6. The maximum input current is the maximum current flowing from each I/O pin to GND. 7. Applies to ports D 0 to D13, R0, R3 to R9. 8. Applies to ports R1 and R2. 9. The maximum output current is the maximum current flowing from V CC to each I/O pin

Electrical Characteristics

DC Characteristics (HD407A4369: V CC = 2.7 to 5.5 V, GND = 0 V, T a = –20 to +75 °C; HD404364/HD404368/HD4043612/HD404369/HD40A4364/HD40A4368/HD40A43612/HD40A4369:V CC = 2.7 to 6.0 V, GND = 0 V, Ta = –20 to +75°C, unless otherwise specified) Item Symbol Pins Min Typ Max Unit Test Condition Notes Input high voltage VIH RESET, SCK, INT0, INT1, STOPC, EVNB 0.8VCC —V CC + 0.3 V SI 0.7 V CC —V CC + 0.3 V OSC 1 VCC – 0.5 — V CC + 0.3 V Input low voltage VIL RESET, SCK, INT0, INT1, STOPC, EVNB –0.3 — 0.2V CC V SI –0.3 — 0.3V CC V OSC 1 –0.3 — 0.5 V Output high voltage VOH SCK, SO, TOC V CC – 0.5 — — V –I OH = 0.5 mA Output low voltage VOL SCK, SO, TOC — — 0.4 V I OL = 0.4 mA I/O leakage current |IIL| RESET, SCK, SI, SO, TOC, OSC 1, INT0, INT1, STOPC, EVNB —— 1 mAV in = 0 V to VCC 1 Current dissipation in active mode I CC VCC — — 5.0 mA V CC = 5 V, fOSC = 4 MHz Current dissipation in standby mode I SBY VCC — — 2.0 mA V CC = 5 V, fOSC = 4 MHz Current dissipation in subactive mode I SUB VCC — — 100 mAV CC = 5 V, 32 kHz oscillator Current dissipation in watch mode I WTC VCC —— 2 0 mAV CC = 5 V, 32 kHz oscillator

Item Symbol Pins Min Typ Max Unit Test Condition Notes Current dissipation in stop mode I STOP VCC —— 1 0 mAV CC = 5V, X1 = GND, X2 = Open Stop mode retaining voltage VSTOP VCC 2— — V Notes: 1. Excludes current flowing through pull-up MOS and output buffers. 2. ICC is the source current when no I/O current is flowing while the MCU is in reset state. Test conditions: MCU: Reset Pins: RESET, TEST at GND 3. ISBY is the source current when no I/O current is flowing while the MCU timer is operating. Test conditions: MCU: I/O reset Standby mode Pins: RESET at VCC TEST at GND D 0–D 13, R0–R9, RA1 at VCC 4. This is the source current when no I/O current is flowing. Test conditions: Pins: RESET at VCC TEST at GND D 0–D 13, R0–R9, RA1 at VCC

I/O Characteristics for Standard Pins (HD407A4369: VCC = 2.7 to 5.5 V, GND = 0 V, Ta = –20 to +75°C; HD404364/HD404368/HD4043612/HD404369/HD40A4364/HD40A4368/HD40A43612/HD40A 4369: VCC = 2.7 to 6.0 V, GND = 0 V, Ta = –20 to +75°C, unless otherwise specified) Item Symbol Pins Min Typ Max Unit Test Condition Note Input high voltage VIH D 0–D 13, R0, R3–R9, RA1 0.7VCC —V CC + 0.3 V Input low voltage VIL D 0–D 13, R0, R3–R9, RA1 –0.3 — 0.3V CC V Output high voltage VOH D 0–D 13, R0, R3–R9 VCC – 0.5 —— V – I OH = 0.5 mA Output low voltage VOL D 0–D 13, R0, R3–R9 — — 0.4 V I OL = 1.6 mA Input leakage current |IIL|D 0–D 13, R0, R3–R9, RA1 —— 1 mAV in = 0 V to VCC 1 Pull-up MOS current –IPU D 0–D 13, R0, R3–R9 30 150 300 mAV CC = 5 V, Vin = 0 V Note: 1. Output buffer current is excluded. I/O Characteristics for Intermediate-Voltage Pins (HD407A4369: VCC = 2.7 to 5.5 V, GND = 0 V, Ta = –20 to +75°C; HD404364/HD404368/HD4043612/HD404369/HD40A4364/HD40A4368/HD40A43612/ HD40A4369: V CC = 2.7 to 6.0 V, GND = 0 V, Ta = –20 to +75°C, unless otherwise specified) Item Symbol Pins Min Typ Max Unit Test Condition Note Input high voltage VIH R1, R2 0.7V CC —1 2 V Input low voltage VIL R1, R2 –0.3 — 0.3V CC V Output high voltage VOH R1, R2 11.5 — — V 500 k W at 12 V Output low voltage VOL R1, R2 — — 0.4 V I OL = 0.4 mA — — 2.0 V I OL = 15 mA, VCC = 4.5 to 5.5 V I/O leakage current |IIL| R1, R2 — — 20 mAV in = 0 V to 12 V 1 Note: 1. Excludes output buffer current.

A/D Converter Characteristics (HD407A4369: VCC = 2.7 to 5.5 V, GND = 0 V, T a = –20 to +75°C;HD404364/HD404368/HD4043612/HD404369/HD40A4364/HD40A4368/HD40A43612/HD40A 4369: VCC = 2.7 to 6.0 V, GND = 0 V, Ta = –20 to +75°C, unless otherwise specified) Item Symbol Pins Min Typ Max Unit Test Condition Notes Analog supply voltage AV CC AV CC VCC – 0.3 VCC VCC + 0.3 V 1 Analog input voltage AVin AN 0–AN 11 AV SS —A V CC V Current flowing between AVCC and AV SS IAD — — 200 mAV CC = AVCC = 5.0 V Analog input capacitance CA in AN 0–AN 11 — — 30 pF Resolution 8 8 8 Bit Number of input channels 0 — 12 Chan nel Absolute accuracy — — –2.0 LSB Conversion time 34 — 67 t cyc Input impedance AN 0–AN 11 1— — M W Note: 1. Connect this to VCC if the A/D converter is not used.

Standard fOSC = 5 MHz Version AC Characteristics (HD404364/HD404368/HD4043612/HD404369: V CC = 2.7 to 6.0 V, GND = 0 V, Ta = –20 to +75°C) Item Symbol Pins Min Typ Max Unit Test Condition Notes Clock oscillation frequency fOSC OSC 1, OSC2 0.4 4 5.0 MHz 1/4 system clock division ratio X1, X2 — 32.768 — kHz Instruction cycle time tcyc 0.8 1 10 ms1 tsubcyc — 244.14 — ms 32-kHz oscillator, 1/8 system clock division ratio — 122.07 — ms 32-kHz oscillator, 1/4 system clock division ratio Oscillation stabilization time (ceramic oscillator) t RC OSC 1, OSC2 — — 7.5 ms 2 Oscillation stabilization time (crystal oscillator) t RC OSC 1, OSC2 — — 40 ms 2 X1, X2 — — 2 s 2 External clock high width tCPH OSC 1 80 — — ns 3 External clock low width tCPL OSC 1 80 — — ns 3 External clock rise time tCPr OSC 1 — — 20 ns 3 External clock fall time tCPf OSC 1 — — 20 ns 3 INT0, INT1, EVNB high widths tIH INT0, INT1, EVNB 2 — — t cyc/ tsubcyc INT0, INT1, EVNB low widths tIL INT0, INT1, EVNB 2 — — t cyc/ tsubcyc RESET low width tRSTL RESET 2— — t cyc 5 STOPC low width tSTPL STOPC 1— — t RC 6 RESET rise time tRSTr RESET — — 20 ms 5 STOPC rise time tSTPr STOPC — — 20 ms 6 Input capacitance Cin All input pins except R1 and R2 — — 15 pF f = 1 MHz, Vin = 0 V R1, R2 — — 30 pF f = 1 MHz, Vin = 0 V

Notes: 1. When using the subsystem oscillator (32.768 kHz), one of the following relationships for fOSC must be applied. 0.4 MHz £ fOSC £ 1.0 MHz or 1.6 MHz £ fOSC £ 5.0 MHz The operating range for fOSC can be set with bit 1 of system clock selection register 1 (SSR1: $027). 2. The oscillation stabilization time is the period required for the oscillator to stabilize in the following situations: a. After VCC reaches 2.7 V at power-on. b. After RESET input goes low when stop mode is cancelled. c. After STOPC input goes low when stop mode is cancelled. To ensure the oscillation stabilization time at power-on or when stop mode is cancelled, RESET or STOPC must be input for at least a duration of tRC . When using a crystal or ceramic oscillator, consult with the manufacturer to determine what stabilization time is required, since it will depend on the circuit constants and stray capacitance. 3. Refer to figure 84. 4. Refer to figure 85. 5. Refer to figure 86. 6. Refer to figure 87.

High-Speed fOSC = 8.5 MHz Version AC Characteristics (HD407A4369: VCC = 2.7 to 5.5 V, GND = 0 V, Ta = –20 to +75°C; HD40A4364/HD40A4368/HD40A43612/HD40A4369: V CC = 2.7 to 6.0 V, GND Item Symbol Pins Min Typ Max Unit Test Condition Notes Clock oscillation frequency fOSC OSC 1, OSC2 0.4 4 5.0 MHz 1/4 system clock division ratio 0.4 4 8.5 MHz 2, 3 X1, X2 — 32.768 — kHz Instruction cycle time tcyc 0.8 1 10 ms1 0.47 1 10 ms 2, 3 tsubcyc — 244.14 — ms 32-kHz oscillator, 1/8 system clock division ratio — 122.07 — ms 32-kHz oscillator, 1/4 system clock division ratio Oscillation stabilization time (ceramic oscillator) t RC OSC 1, OSC2 — — 7.5 ms 4 Oscillation stabilization time (ceramic oscillator) t RC OSC 1, OSC2 — — 40 ms 4 X1, X2 — — 2 s 4 External clock high width tCPH OSC 1 8 0——n s 5 47 — — ns 3, 5 External clock low width tCPL OSC 1 8 0——n s 5 47 — — ns 3, 5 External clock rise time tCPr OSC 1 — — 20 ns 5 — — 15 ns 3, 5 External clock fall time tCPf OSC 1 — — 20 ns 5 — — 15 ns 3, 5 INT0, INT1, EVNB high widths tIH INT0, INT1, EVNB 2 ——t cyc/ tsubcyc INT0, INT1, EVNB low widths tIL INT0, INT1, EVNB 2 ——t cyc/ tsubcyc

Item Symbol Pins Min Typ Max Unit Test Condition Notes RESET low width tRSTL RESET 2 ——t cyc 7 STOPC low width tSTPL STOPC 1 ——t RC 8 RESET rise time tRSTr RESET — — 20 ms 7 STOPC rise time tSTPr STOPC — — 20 ms 8 Input capacitance Cin All input pins except TEST, R1 and R2 — — 15 pF f = 1 MHz, V in = 0 V TEST — — 15 pF f = 1 MHz, V in = 0 V 9 TEST — — 180 pF f = 1 MHz, V in = 0 V 10 R1, R2 — — 30 pF f = 1 MHz, V in = 0 V Notes: 1. When using the subsystem oscillator (32.768 kHz), one of the following relationships for fOSC must be applied. 0.4 MHz £ fOSC £ 1.0 MHz or 1.6 MHz £ fOSC £ 5.0 MHz The operating range for fOSC can be set with bit 1 of system clock selection register 1 (SSR1: $027). 2. When using the subsystem oscillator (32.768 kHz), one of the following relationships for fOSC must be applied. 0.4 MHz £ fOSC £ 1.0 MHz or 1.6 MHz £ fOSC £ 8.5 MHz The operating range for fOSC can be set with bit 1 of system clock selection register 1 (SSR1: $027). 3. VCC = 4.5 to 5.5V 4. The oscillation stabilization time is the period required for the oscillator to stabilize in the following situations: a. After VCC reaches 2.7 V at power-on. b. After RESET input goes low when stop mode is cancelled. c. After STOPC input goes low when stop mode is cancelled. To ensure the oscillation stabilization time at power-on or when stop mode is cancelled, RESET or STOPC must be input for at least a duration of tRC . When using a crystal or ceramic oscillator, consult with the manufacturer to determine what stabilization time is required, since it will depend on the circuit constants and stray capacitance. 5. Refer to figure 84. 6. Refer to figure 85. 7. Refer to figure 86. 8. Refer to figure 87. 9. Applies to the HD40A4364, HD40A4368, HD40A43612, and HD40A4369. 10. Applies to the HD407A4369.

Serial Interface Timing Characteristics (HD407A4369: VCC = 2.7 to 5.5 V, GND = 0 V, Ta = –20 to +75°C; HD404364/HD404368/HD4043612/HD404369/HD40A4364/HD40A4368/HD40A43612/HD40A 4369: VCC = 2.7 to 6.0 V, GND = 0 V, Ta = –20 to +75°C, unless otherwise specified) During Transmit Clock Output Item Symbol Pins Min Typ Max Unit Test Condition Note Transmit clock cycle time tScyc SCK 1—— t cyc Load shown in figure 89 1 Transmit clock high width tSCKH SCK 0.4 — — t Scyc Load shown in figure 89 1 Transmit clock low width tSCKL SCK 0.4 — — t Scyc Load shown in figure 89 1 Transmit clock rise time tSCKr SCK — — 80 ns Load shown in figure 89 1 Transmit clock fall time tSCKf SCK — — 80 ns Load shown in figure 89 1 Serial output data delay time tDSO SO — — 300 ns Load shown in figure 89 1 Serial input data setup time tSSI SI 100 — — ns 1 Serial input data hold time tHSI SI 200 — — ns 1 During Transmit Clock Input Item Symbol Pins Min Typ Max Unit Test Condition Note Transmit clock cycle time tScyc SCK 1— — t cyc 1 Transmit clock high width tSCKH SCK 0.4 — — t Scyc 1 Transmit clock low width tSCKL SCK 0.4 — — t Scyc 1 Transmit clock rise time tSCKr SCK — — 80 ns 1 Transmit clock fall time tSCKf SCK — — 80 ns 1 Serial output data delay time tDSO SO — — 300 ns Load shown in figure 89 1 Serial input data setup time tSSI SI 100 — — ns 1 Serial input data hold time tHSI SI 200 — — ns 1 Note: 1. Refer to figure 88.

Please pay attention to the following items regarding ROM out. On ROM out, fill the ROM area indicated below with 1s to create the same data size for the HD404364, HD40A4364, HD404368, HD40A4368, HD4043612 and HD40A43612 as a 16-kword version (HD404369, HD40A4369). The 16-kword data sizes are required to change ROM data to mask manufacturing data since the program used is for a 16-kword version. This limitation applies when using an EPROM or a data base. Vector address Zero-page subroutine (64 words) Pattern & program (4,096 words) Not used Vector address Zero-page subroutine (64 words) Pattern & program (12,288 words) Not used ROM 4-kword version: HD404364, HD40A4364 ROM 12-kword version: HD4043612, HD40A43612 $0000 $000F $0010 $003F $0040 $0FFF $1000 $3FFF $0000 $000F $0010 $003F $0040 $2FFF $3000 $3FFF Fill this area with 1s Vector address Zero-page subroutine (64 words) Pattern & program (8,192 words) Not used ROM 8-kword version: HD404368, HD40A4368 $0000 $000F $0010 $003F $0040 $1FFF $2000 $3FFF

HD404364/HD404368/HD4043612/HD404369/HD40A4364/HD40A4368/ HD40A43612/HD40A4369 Option List Please check off the appropriate applications and enter the necessary information. 3. ROM Code Media Date of order Customer Department Name ROM code name LSI number EPROM: Ceramic oscillator Crystal oscillator External clock f = MHz f = MHz f = MHz 4. System Oscillator (OSC1, OSC2) With 32-kHz CPU operation, with time base for clock Without 32-kHz CPU operation, with time base for clock Without 32-kHz CPU operation, without time base 2. Optional Functions Note: * Options marked with an asterisk require a subsystem crystal oscillator (X1, X2). The upper bits and lower bits are mixed together. The upper five bits and lower five bits EPROM: The upper bits and lower bits are separated. The upper five bits and lower five bits are programmed to different EPROMS.

5 MHz operation

8.5 MHz operation

  1. ROM size DP-64S FP-64B FP-64A 6. Package Please specify the first type below (the upper bits and lower bits are mixed together), when using the EPROM on-package microcomputer type (including ZTAT™ version). Used Not used 5. Stop mode
  1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s patent, copyright, trademark, or other intellectual property rights for information contained in this document. Hitachi bears no responsibility for problems that may arise with third party’s rights, including intellectual property rights, in connection with use of the information contained in this document. 2. Products and product specifications may be subject to change without notice. Confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. Hitachi makes every attempt to ensure that its products are of high quality and reliability. However, contact Hitachi’s sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. Design your application so that the product is used within the ranges guaranteed by Hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. Hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. Even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail- safes, so that the equipment incorporating Hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the Hitachi product. 5. This product is not designed to be radiation resistant. 6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from Hitachi. 7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi semiconductor products. Hitachi, Ltd. Semiconductor & Integrated Circuits. Nippon Bldg., 2-6-2, Ohte-machi, Chiyoda-ku, Tokyo 100-0004, Japan Tel: Tokyo (03) 3270-2111 Fax: (03) 3270-5109 Copyright © Hitachi, Ltd., 1998. All rights reserved. Printed in Japan. Hitachi Asia Pte. Ltd.

16 Collyer Quay #20-00

Tel: 535-2100 Fax: 535-1533 URL NorthAmerica : http:semiconductor.hitachi.com/ Europe : http://www.hitachi-eu.com/hel/ecg Asia (Taiwan) : http://www.hitachi.com.tw/E/Product/SICD_Frame.htm Asia (HongKong) : http://www.hitachi.com.hk/eng/bo/grp3/index.htm Japan : http://www.hitachi.co.jp/Sicd/indx.htm Hitachi Asia Ltd. Taipei Branch Office 3F, Hung Kuo Building. No.167, Tun-Hwa North Road, Taipei (105) Tel: <886> (2) 2718-3666 Fax: <886> (2) 2718-8180 Hitachi Asia (Hong Kong) Ltd. Group III (Electronic Components) 7/F., North Tower, World Finance Centre, Harbour City, Canton Road, Tsim Sha Tsui, Kowloon, Hong Kong Tel: <852> (2) 735 9218 Fax: <852> (2) 730 0281 Telex: 40815 HITEC HXHitachi Europe Ltd. Electronic Components Group. Whitebrook Park Lower Cookham Road Maidenhead Berkshire SL6 8YA, United Kingdom Tel: <44> (1628) 585000 Fax: <44> (1628) 778322 Hitachi Europe GmbH Electronic components Group Dornacher Straße 3 D-85622 Feldkirchen, Munich Germany Fax: <49> (89) 9 29 30 00 Hitachi Semiconductor (America) Inc.

179 East Tasman Drive,

San Jose,CA 95134 For further information write to: