NEC 78K0 User Manual
NEC 78K0 User Manual

NEC 78K0 User Manual

8-bit single-chip microcontrollers
Hide thumbs Also See for 78K0:
Table of Contents

Advertisement

User's Manual
78K0/KF1
8-Bit Single-Chip Microcontrollers
µ
PD780143
µ
PD780144
µ
PD780146
µ
PD780148
µ
PD78F0148
Document No. U15947EJ2V0UD00 (2nd edition)
Date Published September 2003 N CP(K)
©
Printed in Japan
µ
PD780143(A)
µ
PD780144(A)
µ
PD780146(A)
µ
PD780148(A)
µ
PD78F0148(A)
*
µ
PD780143(A1)
µ
PD780144(A1)
µ
PD780146(A1)
µ
PD780148(A1)
µ
PD78F0148(A1)
µ
PD780143(A2)
µ
PD780144(A2)
µ
PD780146(A2)
µ
PD780148(A2)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 78K0 and is the answer not in the manual?

Questions and answers

Summary of Contents for NEC 78K0

  • Page 1 User’s Manual 78K0/KF1 8-Bit Single-Chip Microcontrollers µ µ µ µ PD780143 PD780143(A) PD780143(A1) PD780143(A2) µ µ µ µ PD780144 PD780144(A) PD780144(A1) PD780144(A2) µ µ µ µ PD780146 PD780146(A) PD780146(A1) PD780146(A2) µ µ µ µ PD780148 PD780148(A) PD780148(A1) PD780148(A2) µ µ...
  • Page 2 [MEMO] User’s Manual U15947EJ2V0UD...
  • Page 3 NOTES FOR CMOS DEVICES PRECAUTION AGAINST ESD FOR SEMICONDUCTORS Note: Strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred.
  • Page 4 NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this document or any other liability arising from the use of such products. No license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others.
  • Page 5 Regional Information Some information contained in this document may vary from country to country. Before using any NEC Electronics product in your application, pIease contact the NEC Electronics office in your country to obtain a list of authorized representatives and distributors. They will verify: •...
  • Page 6 Major Revisions in This Edition (1/3) Page Description Throughout Addition of products µ PD78F0148(A1), 780143(A2), 780144(A2), 780146(A2), 780148(A2) Under development → Under mass production µ PD780143, 780144, 780146, 780148, 78F0148, 780143(A), 780144(A), 780146(A), 780148(A), 78F0148(A), 780143(A1), 780144(A1), 780146(A1), 780148(A1) Modification of names of the following special function registers (SFRs) •...
  • Page 7 Major Revisions in This Edition (2/3) Page Description p.148 Addition of Cautions 2 and 3 to Figure 6-6 Format of Oscillation Stabilization Time Counter Status Register (OSTC) pp.150 to 152 Modification of Figure 6-8 Examples of External Circuit of X1 Oscillator, Figure 6-9 Examples of External Circuit of Subsystem Clock Oscillator, and Figure 6-10 Examples of Incorrect Resonator Connection p.157...
  • Page 8 Major Revisions in This Edition (3/3) Page Description p.467 Modification of mask flag register 1H (MK1H) in Table 22-1 Hardware Statuses After Reset Acknowledgment p.469 Modification of Figure 23-1 Block Diagram of Clock Monitor p.471 Addition of operation mode to Table 23-2 Operation Status of Clock Monitor (When CLME = 1) pp.474, 475 Addition of (6) Clock monitor status after X1 input clock oscillation is stopped by software and (7) Clock monitor status after Ring-OSC clock oscillation is stopped by software to Figure 23-3 Timing of...
  • Page 9 This manual is intended to give users an understanding of the functions described in the Organization below. Organization The 78K0/KF1 manual is separated into two parts: this manual and the instructions edition (common to the 78K/0 Series). 78K0/KF1 78K/0 Series User’s Manual...
  • Page 10 The related documents indicated in this publication may include preliminary versions. However, preliminary versions are not marked as such. Documents Related to Devices Document Name Document No. 78K0/KF1 User’s Manual This manual 78K/0 Series Instructions User’s Manual U12326E Documents Related to Development Tools (Software) (User’s Manuals) Document Name Document No.
  • Page 11 Document No. SEMICONDUCTOR SELECTION GUIDE − Products and Packages − X13769X Semiconductor Device Mount Manual Note Quality Grades on NEC Semiconductor Devices C11531E NEC Semiconductor Device Reliability/Quality Control System C10983E Guide to Prevent Damage for Semiconductor Devices by Electrostatic Discharge (ESD) C11892E Note See the “Semiconductor Device Mount Manual”...
  • Page 12: Table Of Contents

    Applications ..........................34 Ordering Information ........................ 35 Pin Configuration (Top View)....................38 K1 Family Lineup ........................40 1.5.1 78K0/Kx1 product lineup ......................40 1.5.2 V850ES/Kx1 product lineup ......................42 Block Diagram........................... 44 Outline of Functions ......................... 45 CHAPTER 2 PIN FUNCTIONS ....................... 47 Pin Function List........................
  • Page 13 Processor Registers......................... 74 3.2.1 Control registers..........................74 3.2.2 General-purpose registers ......................78 3.2.3 Special function registers (SFRs)....................79 Instruction Address Addressing..................... 84 3.3.1 Relative addressing........................84 3.3.2 Immediate addressing........................85 3.3.3 Table indirect addressing ......................86 3.3.4 Register addressing ........................86 Operand Address Addressing....................87 3.4.1 Implied addressing ........................87 3.4.2 Register addressing ........................88 3.4.3...
  • Page 14 CHAPTER 6 CLOCK GENERATOR ....................141 Functions of Clock Generator ....................141 Configuration of Clock Generator..................141 Registers Controlling Clock Generator ................143 System Clock Oscillator......................150 6.4.1 X1 oscillator..........................150 6.4.2 Subsystem clock oscillator ......................150 6.4.3 When subsystem clock is not used .................... 153 6.4.4 Ring-OSC oscillator........................
  • Page 15 CHAPTER 9 8-BIT TIMERS H0 AND H1 ..................230 Functions of 8-Bit Timers H0 and H1..................230 Configuration of 8-Bit Timers H0 and H1 ................230 Registers Controlling 8-Bit Timers H0 and H1 ..............234 Operation of 8-Bit Timers H0 and H1..................239 9.4.1 Operation as interval timer/square-wave output................239 9.4.2...
  • Page 16 13.4.2 Input voltage and conversion results ..................288 13.4.3 A/D converter operation mode....................289 13.5 How to Read A/D Converter Characteristics Table ............. 292 13.6 Cautions for A/D Converter....................294 CHAPTER 14 SERIAL INTERFACE UART0 ..................299 14.1 Functions of Serial Interface UART0 ..................299 14.2 Configuration of Serial Interface UART0 ................
  • Page 17 18.4.1 Multiplication operation .......................424 18.4.2 Division operation........................426 CHAPTER 19 INTERRUPT FUNCTIONS .................... 428 19.1 Interrupt Function Types ....................... 428 19.2 Interrupt Sources and Configuration..................428 19.3 Registers Controlling Interrupt Functions ................432 19.4 Interrupt Servicing Operations....................439 19.4.1 Maskable interrupt request acknowledgement ................439 19.4.2 Software interrupt request acknowledgment ................441 19.4.3 Multiple interrupt servicing ......................442 19.4.4 Interrupt request hold ........................445...
  • Page 18 25.4 Operation of Low-Voltage Detector ..................484 25.5 Cautions for Low-Voltage Detector..................488 CHAPTER 26 REGULATOR ......................... 492 26.1 Outline of Regulator ....................... 492 CHAPTER 27 MASK OPTIONS ......................494 µ CHAPTER 28 PD78F0148........................495 28.1 Internal Memory Size Switching Register ................496 28.2 Internal Expansion RAM Size Switching Register...............
  • Page 19 Language Processing Software .................... 603 Control Software........................604 Flash Memory Writing Tools ....................604 Debugging Tools (Hardware) ....................605 A.5.1 When using in-circuit emulators IE-78K0-NS and IE-78K0-NS-A ..........605 A.5.2 When using in-circuit emulator IE-78K0K1-ET ................606 Debugging Tools (Software)....................607 Embedded Software ....................... 608 APPENDIX B NOTES ON TARGET SYSTEM DESIGN..............
  • Page 20 LIST OF FIGURES (1/10) Figure No. Title Page Pin I/O Circuit List .............................59 µ Memory Map ( PD780143)........................62 µ Memory Map ( PD780144)........................63 µ Memory Map ( PD780146)........................64 µ Memory Map ( PD780148)........................65 µ Memory Map ( PD78F0148) ........................66 µ Correspondence Between Data Memory and Addressing ( PD780143) ..........69 µ...
  • Page 21 LIST OF FIGURES (2/10) Figure No. Title Page 4-23 Block Diagram of P142 ........................... 120 4-24 Block Diagram of P143 ........................... 121 4-25 Block Diagram of P144 and P145......................122 4-26 Format of Port Mode Register ........................ 123 4-27 Format of Port Register .......................... 126 4-28 Format of Pull-up Resistor Option Register ....................
  • Page 22 LIST OF FIGURES (3/10) Figure No. Title Page Format of 16-Bit Timer Mode Control Register 01 (TMC01) ..............176 Format of Capture/Compare Control Register 00 (CRC00) ..............177 Format of Capture/Compare Control Register 01 (CRC01) ..............178 7-10 Format of 16-Bit Timer Output Control Register 00 (TOC00)..............179 7-11 Format of 16-Bit Timer Output Control Register 01 (TOC01)..............180 7-12...
  • Page 23 LIST OF FIGURES (4/10) Figure No. Title Page 7-41 Operation Timing of OVF0n Flag......................210 7-42 Capture Register Data Retention Timing ....................210 Block Diagram of 8-Bit Timer/Event Counter 50 ..................212 Block Diagram of 8-Bit Timer/Event Counter 51 ..................213 Format of 8-Bit Timer Counter 5n (TM5n)....................
  • Page 24 LIST OF FIGURES (5/10) Figure No. Title Page 11-1 Block Diagram of Watchdog Timer ......................264 11-2 Format of Watchdog Timer Mode Register (WDTM)................265 11-3 Format of Watchdog Timer Enable Register (WDTE) ................266 11-4 Operation in STOP Mode (CPU Clock and WDT Operation Clock: X1 Input Clock).......269 11-5 Operation in STOP Mode (CPU Clock: X1 Input Clock, WDT Operation Clock: Ring-OSC Clock)..269 11-6...
  • Page 25 LIST OF FIGURES (6/10) Figure No. Title Page 14-5 Format of Port Mode Register 1 (PM1)....................307 14-6 Format of Normal UART Transmit/Receive Data..................310 14-7 Example of Normal UART Transmit/Receive Data Waveform..............310 14-8 Transmission Completion Interrupt Request Timing................312 14-9 Reception Completion Interrupt Request Timing ..................
  • Page 26 LIST OF FIGURES (7/10) Figure No. Title Page 16-5 Format of Serial Clock Selection Register 10 (CSIC10)................363 16-6 Format of Serial Clock Selection Register 11 (CSIC11)................365 16-7 Format of Port Mode Register 0 (PM0) ....................366 16-8 Format of Port Mode Register 1 (PM1) ....................366 16-9 Timing in 3-Wire Serial I/O Mode ......................372 16-10...
  • Page 27 LIST OF FIGURES (8/10) Figure No. Title Page 18-1 Block Diagram of Multiplier/Divider......................419 18-2 Format of Remainder Data Register 0 (SDR0) ..................420 18-3 Format of Multiplication/Division Data Register A0 (MDA0H, MDA0L) ........... 421 18-4 Format of Multiplication/Division Data Register B0 (MDB0)..............422 18-5 Format of Multiplier/Divider Control Register 0 (DMUC0) ...............
  • Page 28 LIST OF FIGURES (9/10) Figure No. Title Page 24-1 Block Diagram of Power-on-Clear Circuit ....................477 24-2 Timing of Internal Reset Signal Generation in Power-on-Clear Circuit ...........477 24-3 Example of Software Processing After Release of Reset ...............478 25-1 Block Diagram of Low-Voltage Detector ....................480 25-2 Format of Low-Voltage Detection Register (LVIM) .................482 25-3...
  • Page 29 LIST OF FIGURES (10/10) Figure No. Title Page Connection Conditions of Target System (When Using NP-H80GK-TQ) ..........613 User’s Manual U15947EJ2V0UD...
  • Page 30 LIST OF TABLES (1/3) Table No. Title Page Flash Memory Versions Corresponding to Mask Options of Mask ROM Versions ........37 Pin I/O Buffer Power Supplies ........................47 Pin I/O Circuit Types ..........................57 Set Values of Internal Memory Size Switching Register (IMS) and Internal Expansion RAM Size Switching Register (IXS)..............61 Internal ROM Capacity..........................67 Vector Table .............................67...
  • Page 31 LIST OF TABLES (2/3) Table No. Title Page 10-5 Interval Timer Interval Time ........................260 11-1 Loop Detection Time of Watchdog Timer ....................262 11-2 Mask Option Setting and Watchdog Timer Operation Mode ..............263 11-3 Configuration of Watchdog Timer ......................264 12-1 Clock Output/Buzzer Output Controller Configuration ................
  • Page 32 LIST OF TABLES (3/3) Table No. Title Page 19-5 Relationship Between Interrupt Requests Enabled for Multiple Interrupt Servicing During Interrupt Servicing ........................442 20-1 Assignment of Key Interrupt Detection Pins....................446 20-2 Configuration of Key Interrupt .........................446 21-1 Relationship Between Operation Clocks in Each Operation Status ............448 21-2 Operating Statuses in HALT Mode ......................452 21-3...
  • Page 33: Chapter 1 Outline

    CHAPTER 1 OUTLINE Features µ Minimum instruction execution time can be changed from high speed (0.2 s: @ 10 MHz operation with X1 input µ clock) to ultra low-speed (122 s: @ 32.768 kHz operation with subsystem clock) General-purpose register: 8 bits × 32 registers (8 bits × 8 registers × 4 banks) ROM, RAM capacities Item Program Memory...
  • Page 34: Applications

    CHAPTER 1 OUTLINE Supply voltage: V = 2.7 to 5.5 V (standard product, (A) grade product) = 3.3 to 5.5 V ((A1) grade product, (A2) grade product) = −40 to +85°C (standard product, (A) grade product) Operating ambient temperature: T = −40 to +105°C (flash memory version of (A1) grade product) = −40 to +110°C (mask ROM version of (A1) grade product) = −40 to +125°C (mask ROM version of (A2) grade product)
  • Page 35: Ordering Information

    CHAPTER 1 OUTLINE Ordering Information (1) Mask ROM versions Part Number Package Quality Grade µ 80-pin plastic TQFP (fine pitch) (12 × 12) PD780143GK-×××-9EU Standard µ 80-pin plastic QFP (14 × 14) PD780143GC-×××-8BT Standard µ 80-pin plastic TQFP (fine pitch) (12 × 12) PD780144GK-×××-9EU Standard µ...
  • Page 36 CHAPTER 1 OUTLINE (2) Flash memory versions Part Number Package Quality Grade µ 80-pin plastic TQFP (fine pitch) (12 × 12) PD78F0148M1GK-9EU Standard µ 80-pin plastic QFP (14 × 14) PD78F0148M1GC-8BT Standard µ 80-pin plastic TQFP (fine pitch) (12 × 12) PD78F0148M2GK-9EU Standard µ...
  • Page 37 CHAPTER 1 OUTLINE µ Mask ROM versions ( PD780143, 780144, 780146, and 780148) include mask options. When ordering, it is possible to select “Power-on-clear (POC) circuit can be used/cannot be used”, “Ring-OSC clock can be stopped/cannot be stopped by software” and “Pull-up resistor incorporated/not incorporated in 1-bit units (P60 to P63)”.
  • Page 38: Pin Configuration (Top View)

    CHAPTER 1 OUTLINE Pin Configuration (Top View) • 80-pin plastic TQFP (fine pitch) (12 × 12) • 80-pin plastic QFP (14 × 14) 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 P44/AD4 P45/AD5 P120/INTP0...
  • Page 39 CHAPTER 1 OUTLINE Pin Identification A8 to A15: Address bus REGC: Regulator capacitance AD0 to AD7: Address/data bus RESET: Reset ANI0 to ANI7: Analog input RxD0, RxD6: Receive data Read strobe ASTB: Address strobe Note Analog reference voltage SCK10, SCK11 Analog ground SCKA0: Serial clock input/output...
  • Page 40: K1 Family Lineup

    PD780122 µ Mask ROM: 8 KB, RAM: 512 bytes PD780121 78K0/KE1: 64-pin (10 × 10 mm 0.5 mm pitch, 12 × 12 mm 0.65 mm pitch, 14 × 14 mm 0.8 mm pitch) µ µ PD78F0134 Flash memory: 32 KB, RAM: 1 KB...
  • Page 41 CHAPTER 1 OUTLINE The list of functions in the 78K0/Kx1 is shown below. Part Number 78K0/KB1 78K0/KC1 78K0/KD1 78K0/KE1 78K0/KF1 Item Package 30 pins 44 pins 52 pins 64 pins 80 pins − − − − − − Internal Mask ROM...
  • Page 42: V850Es/Kx1 Product Lineup

    CHAPTER 1 OUTLINE 1.5.2 V850ES/Kx1 product lineup 80-pin plastic QFP (14 × 14) V850ES/KF1 80-pin plastic TQFP (fine pitch) (12 × 12) µ PD703208 Mask ROM: 64 KB, RAM: 4 KB µ PD703208Y C products µ PD703209 Mask ROM: 96 KB, RAM: 4 KB µ...
  • Page 43 CHAPTER 1 OUTLINE The list of functions in the V850ES/Kx1 is shown below. Function Timer Serial Interface Other Part No. 8-Bit 16-Bit TMH Watch WDT CSIA UART µ PD703208 2 ch 2 ch 2 ch 1 ch 2 ch 2 ch 1 ch 2 ch –...
  • Page 44: Block Diagram

    CHAPTER 1 OUTLINE Block Diagram TO00/TI010/P01 16-bit timer/ Port 0 P00 to P06 event counter 00 TI000/P00 Port 1 P10 to P17 Note Note TO01 /TI011 /P06 Note 16-bit timer/ Note event counter 01 TI001 /P05 Port 2 P20 to P27 TOH0/P15 Port 3 8-bit timer H0...
  • Page 45: Outline Of Functions

    CHAPTER 1 OUTLINE Outline of Functions (1/2) µ µ µ µ µ PD780143 PD780144 PD780146 PD780148 PD78F0148 Item Note Internal memory 24 KB 32 KB 48 KB 60 KB 60 KB (flash memory) High-speed 1 KB − Note Expansion RAM 1 KB 1 KB Buffer RAM...
  • Page 46 CHAPTER 1 OUTLINE (2/2) µ µ µ µ µ PD780143 PD780144 PD780146 PD780148 PD78F0148 Item 10-bit resolution × 8 channels A/D converter Serial interface • UART mode supporting LIN-bus: 1 channel • 3-wire serial I/O mode: 1 channel µ (None in the PD780143, 780144) •...
  • Page 47: Chapter 2 Pin Functions

    CHAPTER 2 PIN FUNCTIONS Pin Function List There are three types of pin I/O buffer power supplies: AV , EV , and V . The relationship between these power supplies and the pins is shown below. Table 2-1. Pin I/O Buffer Power Supplies Power Supply Corresponding Pins P20 to P27...
  • Page 48 CHAPTER 2 PIN FUNCTIONS (1) Port pins (2/2) Pin Name Function After Reset Alternate Function P50 to P57 Port 5. Input A8 to A15 8-bit I/O port. Input/output can be specified in 1-bit units. Use of an on-chip pull-up resistor can be specified by a software setting.
  • Page 49 CHAPTER 2 PIN FUNCTIONS (2) Non-port pins (1/2) Pin Name Function After Reset Alternate Function INTP0 Input External interrupt request input for which the valid edge (rising Input P120 edge, falling edge, or both rising and falling edges) can be INTP1 to INTP3 P30 to P32 specified...
  • Page 50 CHAPTER 2 PIN FUNCTIONS (2) Non-port pins (2/2) Pin Name Function After Reset Alternate Function Output Clock output (for trimming of X1 input clock, subsystem clock) Input P140/INTP6 Output Buzzer output Input P141/INTP7/BUSY0 AD0 to AD7 Lower address/data bus for external memory expansion Input P40 to P47 A8 to A15...
  • Page 51: Description Of Pin Functions

    CHAPTER 2 PIN FUNCTIONS Description of Pin Functions 2.2.1 P00 to P06 (port 0) P00 to P06 function as a 7-bit I/O port. These pins also function as timer I/O, serial interface data I/O, clock I/O, and chip select input. The following operation modes can be specified in 1-bit units.
  • Page 52: P10 To P17 (Port 1)

    CHAPTER 2 PIN FUNCTIONS 2.2.2 P10 to P17 (port 1) P10 to P17 function as an 8-bit I/O port. These pins also function as pins for external interrupt request input, serial interface data I/O, clock I/O, and timer I/O. The following operation modes can be specified in 1-bit units. (1) Port mode P10 to P17 function as an 8-bit I/O port.
  • Page 53: P30 To P33 (Port 3)

    CHAPTER 2 PIN FUNCTIONS 2.2.4 P30 to P33 (port 3) P30 to P33 function as a 4-bit I/O port. These pins also function as pins for external interrupt request input and timer I/O. The following operation modes can be specified in 1-bit units. (1) Port mode P30 to P33 function as a 4-bit I/O port.
  • Page 54: P60 To P67 (Port 6)

    CHAPTER 2 PIN FUNCTIONS 2.2.7 P60 to P67 (port 6) P60 to P67 function as an 8-bit I/O port. These pins also function as control pins in external memory expansion mode. The following operation modes can be specified. (1) Port mode P60 to P67 function as an 8-bit I/O port.
  • Page 55: P140 To P145 (Port 14)

    CHAPTER 2 PIN FUNCTIONS 2.2.11 P140 to P145 (port 14) P140 to P145 function as a 6-bit I/O port. These pins also function as external interrupt request input, clock output, buzzer output, serial interface data I/O, clock I/O, busy input, and strobe output pins. The following operation modes can be specified in 1-bit units.
  • Page 56: Reset

    V in the normal operation mode. 2.2.21 IC (mask ROM versions only) The IC (Internally Connected) pin is provided to set the test mode to check the 78K0/KF1 at shipment. Connect it directly to EV or V pin with the shortest possible wire in the normal operation mode.
  • Page 57: Pin I/O Circuits And Recommended Connection Of Unused Pins

    CHAPTER 2 PIN FUNCTIONS Pin I/O Circuits and Recommended Connection of Unused Pins Table 2-2 shows the types of pin I/O circuits and the recommended connections of unused pins. See Figure 2-1 for the configuration of the I/O circuit of each type. Table 2-2.
  • Page 58 CHAPTER 2 PIN FUNCTIONS Table 2-2. Pin I/O Circuit Types (2/2) Pin Name I/O Circuit Type Recommended Connection of Unused Pins P130 Output Leave open. P140/PCL/INTP6 Input: Independently connect to EV or EV via a resistor. Output: Leave open. P141/BUZ/BUSY0/INTP7 P142/SCKA0 P143/SIA0 P144/SOA0...
  • Page 59 CHAPTER 2 PIN FUNCTIONS Figure 2-1. Pin I/O Circuit List (1/2) Type 2 Type 8-A Pullup P-ch enable Data P-ch IN/OUT Schmitt-triggered input with hysteresis characteristics Output N-ch disable Type 3-C Type 9-C Comparator P-ch N-ch P-ch – Data (threshold voltage) N-ch Input enable...
  • Page 60 CHAPTER 2 PIN FUNCTIONS Figure 2-1. Pin I/O Circuit List (2/2) Type 13-S Type 13-W IN/OUT   Mask   Data  option  N-ch IN/OUT Output disable Data N-ch Output disable Input enable Middle-voltage input buffer Type 13-V Type 16 Feedback ...
  • Page 61: Chapter 3 Cpu Architecture

    CHAPTER 3 CPU ARCHITECTURE Memory Space 78K0/KF1 products can each access a 64 KB memory space. Figures 3-1 to 3-5 show the memory maps. Caution Regardless of the internal memory capacity, the initial values of the internal memory size switching register (IMS) and internal expansion RAM size switching register (IXS) of all 78K0/KF1 products are fixed (IMS = CFH, IXS = 0CH).
  • Page 62 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-1. Memory Map ( PD780143) FFFFH Special function registers (SFR) 256 × 8 bits FF00H FEFFH General-purpose registers 32 × 8 bits FEE0H FEDFH Internal high-speed RAM 1024 × 8 bits 5FFFH FB00H FAFFH Reserved Program area FA20H...
  • Page 63 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-2. Memory Map ( PD780144) FFFFH Special function registers (SFR) 256 × 8 bits FF00H FEFFH General-purpose registers 32 × 8 bits FEE0H FEDFH Internal high-speed RAM 1024 × 8 bits 7FFFH FB00H FAFFH Program area Reserved FA20H...
  • Page 64 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-3. Memory Map ( PD780146) FFFFH Special function registers (SFR) 256 × 8 bits FF00H FEFFH General-purpose registers 32 × 8 bits FEE0H FEDFH Internal high-speed RAM 1024 × 8 bits FB00H FAFFH Reserved FA20H BFFFH FA1FH...
  • Page 65 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-4. Memory Map ( PD780148) FFFFH Special function registers (SFR) 256 × 8 bits FF00H FEFFH General-purpose registers 32 × 8 bits FEE0H FEDFH Internal high-speed RAM 1024 × 8 bits FB00H FAFFH Reserved FA20H EFFFH FA1FH...
  • Page 66 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-5. Memory Map ( PD78F0148) FFFFH Special function registers (SFR) 256 × 8 bits FF00H FEFFH General-purpose registers 32 × 8 bits FEE0H FEDFH Internal high-speed RAM 1024 × 8 bits FB00H FAFFH Reserved FA20H EFFFH FA1FH...
  • Page 67: Internal Program Memory Space

    The internal program memory space stores the program and table data. Normally, it is addressed with the program counter (PC). 78K0/KF1 products incorporate internal ROM (mask ROM or flash memory), as shown below. Table 3-2. Internal ROM Capacity Part Number...
  • Page 68: Internal Data Memory Space

    The area 0800H to 0FFFH can perform a direct subroutine call with a 2-byte call instruction (CALLF). 3.1.2 Internal data memory space 78K0/KF1 products incorporate the following RAMs. (1) Internal high-speed RAM The internal high-speed RAM is allocated to the area FB00H to FEFFH in a 1024 × 8 bits configuration.
  • Page 69: Data Memory Addressing

    Several addressing modes are provided for addressing the memory relevant to the execution of instructions for the 78K0/KF1, based on operability and other considerations. For areas containing data memory in particular, special addressing methods designed for the functions of special function registers (SFR) and general-purpose registers are available for use.
  • Page 70 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-7. Correspondence Between Data Memory and Addressing ( PD780144) FFFFH Special function registers (SFR) SFR addressing 256 × 8 bits FF20H FF1FH FF00H FEFFH General-purpose registers Register addressing 32 × 8 bits Short direct FEE0H addressing FEDFH...
  • Page 71 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-8. Correspondence Between Data Memory and Addressing ( PD780146) FFFFH Special function registers (SFR) SFR addressing 256 × 8 bits FF20H FF1FH FF00H FEFFH General-purpose registers Register addressing 32 × 8 bits Short direct FEE0H addressing FEDFH...
  • Page 72 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-9. Correspondence Between Data Memory and Addressing ( PD780148) FFFFH Special function registers (SFR) SFR addressing 256 × 8 bits FF20H FF1FH FF00H FEFFH General-purpose registers Register addressing 32 × 8 bits Short direct FEE0H addressing FEDFH...
  • Page 73 CHAPTER 3 CPU ARCHITECTURE µ Figure 3-10. Correspondence Between Data Memory and Addressing ( PD78F0148) FFFFH Special function registers (SFR) SFR addressing 256 × 8 bits FF20H FF1FH FF00H FEFFH General-purpose registers Register addressing 32 × 8 bits Short direct FEE0H addressing FEDFH...
  • Page 74: Processor Registers

    CHAPTER 3 CPU ARCHITECTURE Processor Registers The 78K0/KF1 products incorporate the following processor registers. 3.2.1 Control registers The control registers control the program sequence, statuses and stack memory. The control registers consist of a program counter (PC), a program status word (PSW) and a stack pointer (SP).
  • Page 75 CHAPTER 3 CPU ARCHITECTURE (c) Register bank select flags (RBS0 and RBS1) These are 2-bit flags to select one of the four register banks. In these flags, the 2-bit information that indicates the register bank selected by SEL RBn instruction execution is stored.
  • Page 76 CHAPTER 3 CPU ARCHITECTURE Figure 3-14. Data to Be Saved to Stack Memory (a) PUSH rp instruction (when SP = FEE0H) FEE0H FEE0H FEDFH Register pair higher FEDEH Register pair lower FEDEH (b) CALL, CALLF, CALLT instructions (when SP = FEE0H) FEE0H FEE0H FEDFH...
  • Page 77 CHAPTER 3 CPU ARCHITECTURE Figure 3-15. Data to Be Restored from Stack Memory (a) POP rp instruction (when SP = FEDEH) FEE0H FEE0H FEDFH Register pair higher FEDEH Register pair lower FEDEH (b) RET instruction (when SP = FEDEH) FEE0H FEE0H FEDFH PC15 to PC8...
  • Page 78: General-Purpose Registers

    CHAPTER 3 CPU ARCHITECTURE 3.2.2 General-purpose registers General-purpose registers are mapped at particular addresses (FEE0H to FEFFH) of the data memory. The general-purpose registers consists of 4 banks, each bank consisting of eight 8-bit registers (X, A, C, B, E, D, L, and H). Each register can be used as an 8-bit register, and two 8-bit registers can also be used in a pair as a 16-bit register (AX, BC, DE, and HL).
  • Page 79: Special Function Registers (Sfrs)

    CHAPTER 3 CPU ARCHITECTURE 3.2.3 Special function registers (SFRs) Unlike a general-purpose register, each special function register has a special function. SFRs are allocated to the FF00H to FFFFH area. Special function registers can be manipulated like general-purpose registers, using operation, transfer and bit manipulation instructions.
  • Page 80 CHAPTER 3 CPU ARCHITECTURE Table 3-5. Special Function Register List (1/4) Address Special Function Register (SFR) Name Symbol Manipulatable Bit Unit After Reset 1 Bit 8 Bits 16 Bits √ √ − FF00H Port register 0 √ √ − FF01H Port register 1 √...
  • Page 81 CHAPTER 3 CPU ARCHITECTURE Table 3-5. Special Function Register List (2/4) Address Special Function Register (SFR) Name Symbol Manipulatable Bit Unit After Reset 1 Bit 8 Bits 16 Bits √ √ − FF2CH Port mode register 12 PM12 √ √ −...
  • Page 82 CHAPTER 3 CPU ARCHITECTURE Table 3-5. Special Function Register List (3/4) Address Special Function Register (SFR) Name Symbol Manipulatable Bit Unit After Reset 1 Bit 8 Bits 16 Bits √ √ − FF6BH 8-bit timer mode control register 50 TMC50 √...
  • Page 83 Notes 1. PD780146, 780148, and 78F0148 only. The default value of IMS and IXS are fixed (IMS = CFH, IXS = 0CH) in all 78K0/KF1 products regardless of the internal memory capacity. Therefore, set the following value to each product.
  • Page 84: Instruction Address Addressing

    CHAPTER 3 CPU ARCHITECTURE Instruction Address Addressing An instruction address is determined by program counter (PC) contents and is normally incremented (+1 for each byte) automatically according to the number of bytes of an instruction to be fetched each time another instruction is executed.
  • Page 85: Immediate Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.3.2 Immediate addressing [Function] Immediate data in the instruction word is transferred to the program counter (PC) and branched. This function is carried out when the CALL !addr16 or BR !addr16 or CALLF !addr11 instruction is executed. CALL !addr16 and BR !addr16 instructions can be branched to the entire memory space.
  • Page 86: Register Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.3.3 Table indirect addressing [Function] Table contents (branch destination address) of the particular location to be addressed by bits 1 to 5 of the immediate data of an operation code are transferred to the program counter (PC) and branched. This function is carried out when the CALLT [addr5] instruction is executed.
  • Page 87: Operand Address Addressing

    Implied addressing [Function] The register that functions as an accumulator (A and AX) among the general-purpose registers is automatically (implicitly) addressed. Of the 78K0/KF1 instruction words, the following instructions employ implied addressing. Instruction Register to Be Specified by Implied Addressing MULU...
  • Page 88: Register Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.2 Register addressing [Function] The general-purpose register to be specified is accessed as an operand with the register bank select flags (RBS0 to RBS1) and the register specify codes (Rn and RPn) of an operation code. Register addressing is carried out when an instruction with the following operand format is executed.
  • Page 89: Direct Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.3 Direct addressing [Function] The memory to be manipulated is directly addressed with immediate data in an instruction word becoming an operand address. [Operand format] Identifier Description addr16 Label or 16-bit immediate data [Description example] MOV A, !0FE00H; when setting !addr16 to FE00H Operation code OP code [Illustration]...
  • Page 90: Short Direct Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.4 Short direct addressing [Function] The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word. This addressing is applied to the 256-byte space FE20H to FF1FH. Internal RAM and special function registers (SFRs) are mapped at FE20H to FEFFH and FF00H to FF1FH, respectively.
  • Page 91: Special Function Register (Sfr) Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.5 Special function register (SFR) addressing [Function] A memory-mapped special function register (SFR) is addressed with 8-bit immediate data in an instruction word. This addressing is applied to the 240-byte spaces FF00H to FFCFH and FFE0H to FFFFH. However, the SFRs mapped at FF00H to FF1FH can be accessed with short direct addressing.
  • Page 92: Register Indirect Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.6 Register indirect addressing [Function] Register pair contents specified by a register pair specify code in an instruction word and by a register bank select flag (RBS0 and RBS1) serve as an operand address for addressing the memory. This addressing can be carried out for all the memory spaces.
  • Page 93: Based Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.7 Based addressing [Function] 8-bit immediate data is added as offset data to the contents of the base register, that is, the HL register pair in the register bank specified by the register bank select flag (RBS0 and RBS1), and the sum is used to address the memory.
  • Page 94: Based Indexed Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.8 Based indexed addressing [Function] The B or C register contents specified in an instruction word are added to the contents of the base register, that is, the HL register pair in the register bank specified by the register bank select flag (RBS0 and RBS1), and the sum is used to address the memory.
  • Page 95: Stack Addressing

    CHAPTER 3 CPU ARCHITECTURE 3.4.9 Stack addressing [Function] The stack area is indirectly addressed with the stack pointer (SP) contents. This addressing method is automatically employed when the PUSH, POP, subroutine call and return instructions are executed or the register is saved/reset upon generation of an interrupt request. With stack addressing, only the internal high-speed RAM area can be accessed.
  • Page 96: Chapter 4 Port Functions

    P20 to P27 Port pins other than P20 to P27 78K0/KF1 products are provided with the ports shown in Figure 4-1, which enable variety of control operations. The functions of each port are shown in Table 4-2. In addition to the function as digital I/O ports, these ports have several alternate functions. For details of the alternate functions, see CHAPTER 2 PIN FUNCTIONS.
  • Page 97 CHAPTER 4 PORT FUNCTIONS Table 4-2. Port Functions (1/2) Pin Name Function After Reset Alternate Function Port 0. Input TI000 7-bit I/O port. TI010/TO00 Input/output can be specified in 1-bit units. Note SO11 Use of an on-chip pull-up resistor can be specified by a Note SI11 software setting.
  • Page 98: Port Configuration

    CHAPTER 4 PORT FUNCTIONS Table 4-2. Port Functions (2/2) Pin Name Function After Reset Alternate Function − P60 to P63 Port 6. N-ch open-drain I/O port. Input 8-bit I/O port. Use of an on-chip pull-up Input/output can be specified resistor can be specified by a in 1-bit units.
  • Page 99: Port 0

    CHAPTER 4 PORT FUNCTIONS 4.2.1 Port 0 Port 0 is a 7-bit I/O port with an output latch. Port 0 can be set to the input mode or output mode in 1-bit units using port mode register 0 (PM0). When the P00 to P06 pins are used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 0 (PU0).
  • Page 100 CHAPTER 4 PORT FUNCTIONS Figure 4-3. Block Diagram of P01 and P06 PU01, PU06 P-ch Alternate function PORT Output latch P01/TI010/TO00, (P01, P06) Note Note P06/TI011 /TO01 PM01, PM06 Alternate function µ Note Available only in the PD780146, 780148, and 78F0148. PU0: Pull-up resistor option register 0 PM0: Port mode register 0...
  • Page 101 CHAPTER 4 PORT FUNCTIONS Figure 4-4. Block Diagram of P02 PU02 P-ch PORT Output latch Note (P02) P02/SO11 PM02 Alternate function µ Note Available only in the PD780146, 780148, and 78F0148. PU0: Pull-up resistor option register 0 PM0: Port mode register 0 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 102 CHAPTER 4 PORT FUNCTIONS Figure 4-5. Block Diagram of P04 PU04 P-ch Alternate function PORT Output latch Note P04/SCK11 (P04) PM04 Alternate function µ Note Available only in the PD780146, 780148, and 78F0148. PU0: Pull-up resistor option register 0 PM0: Port mode register 0 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 103: Port 1

    CHAPTER 4 PORT FUNCTIONS 4.2.2 Port 1 Port 1 is an 8-bit I/O port with an output latch. Port 1 can be set to the input mode or output mode in 1-bit units using port mode register 1 (PM1). When the P10 to P17 pins are used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 1 (PU1).
  • Page 104 CHAPTER 4 PORT FUNCTIONS Figure 4-7. Block Diagram of P11 and P14 PU11, PU14 P-ch Alternate function PORT Output latch P11/SI10/RxD0, (P11, P14) P14/RxD6 PM11, PM14 PU1: Pull-up resistor option register 1 PM1: Port mode register 1 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 105 CHAPTER 4 PORT FUNCTIONS Figure 4-8. Block Diagram of P12 and P15 PU12, PU15 P-ch PORT Output latch P12/SO10 (P12, P15) P15/TOH0 PM12, PM15 Alternate function PU1: Pull-up resistor option register 1 PM1: Port mode register 1 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 106 CHAPTER 4 PORT FUNCTIONS Figure 4-9. Block Diagram of P13 PU13 P-ch PORT Output latch (P13) P13/TxD6 PM13 Alternate function PU1: Pull-up resistor option register 1 PM1: Port mode register 1 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 107 CHAPTER 4 PORT FUNCTIONS Figure 4-10. Block Diagram of P16 and P17 PU16, PU17 P-ch Alternate function PORT Output latch P16/TOH1/INTP5, (P16, P17) P17/TI50/TO50 PM16, PM17 Alternate function PU1: Pull-up resistor option register 1 PM1: Port mode register 1 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 108: Port 2

    CHAPTER 4 PORT FUNCTIONS 4.2.3 Port 2 Port 2 is an 8-bit input-only port. This port can also be used for A/D converter analog input. Figure 4-11 shows a block diagram of port 2. Figure 4-11. Block Diagram of P20 to P27 A/D converter P20/ANI0 to P27/ANI7 Read signal...
  • Page 109: Port 3

    CHAPTER 4 PORT FUNCTIONS 4.2.4 Port 3 Port 3 is a 4-bit I/O port with an output latch. Port 3 can be set to the input mode or output mode in 1-bit units using port mode register 3 (PM3). When used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 3 (PU3).
  • Page 110 CHAPTER 4 PORT FUNCTIONS Figure 4-13. Block Diagram of P33 PU33 P-ch Alternate function PORT Output latch P33/INTP4/TI51/TO51 (P33) PM33 Alternate function PU3: Pull-up resistor option register 3 PM3: Port mode register 3 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 111: Port 4

    CHAPTER 4 PORT FUNCTIONS 4.2.5 Port 4 Port 4 is an 8-bit I/O port with an output latch. Port 4 can be set to the input mode or output mode in 1-bit units using port mode register 4 (PM4). Use of an on-chip pull-up resistor can be specified in 1-bit units with pull-up resistor option register 4 (PU4).
  • Page 112: Port 5

    CHAPTER 4 PORT FUNCTIONS 4.2.6 Port 5 Port 5 is an 8-bit I/O port with an output latch. Port 5 can be set to the input mode or output mode in 1-bit units using port mode register 5 (PM5). Use of an on-chip pull-up resistor can be specified in 1-bit units using pull-up resistor option register 5 (PU5).
  • Page 113: Port 6

    CHAPTER 4 PORT FUNCTIONS 4.2.7 Port 6 Port 6 is an 8-bit I/O port with an output latch. Port 6 can be set to the input mode or output mode in 1-bit units using port mode register 6 (PM6). This port has the following functions for pull-up resistors. These functions differ depending on the higher 4 bits/lower 4 bits of the port, and whether the product is a mask ROM version or a flash memory version.
  • Page 114 CHAPTER 4 PORT FUNCTIONS Figure 4-17. Block Diagram of P64, P65, and P67 PU64, PU65, PU67 P-ch Selector PORT Output latch P64/RD, (P64, P65, P67) Selector P65/WR, P67/ASTB Alternate function PM64, PM65, PM67 Memory expansion mode register (MEM) PU6: Pull-up resistor option register 6 PM6: Port mode register 6 Read signal WR××: Write signal...
  • Page 115 CHAPTER 4 PORT FUNCTIONS Figure 4-18. Block Diagram of P66 PU66 P-ch Alternate function Selector PORT Output latch Selector P66/WAIT (P66) Memory expansion mode register (MEM) PM66 PU6: Pull-up resistor option register 6 PM6: Port mode register 6 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 116: Port 7

    CHAPTER 4 PORT FUNCTIONS 4.2.8 Port 7 Port 7 is an 8-bit I/O port with an output latch. Port 7 can be set to the input mode or output mode in 1-bit units using port mode register 7 (PM7). When the P70 to P77 pins are used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 7 (PU7).
  • Page 117: Port 12

    CHAPTER 4 PORT FUNCTIONS 4.2.9 Port 12 Port 12 is a 1-bit I/O port with an output latch. Port 12 can be set to the input mode or output mode in 1-bit units using port mode register 12 (PM12). When used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 12 (PU12).
  • Page 118: Port 13

    CHAPTER 4 PORT FUNCTIONS 4.2.10 Port 13 Port 13 is a 1-bit output-only port. Figure 4-21 shows a block diagram of port 13. Figure 4-21. Block Diagram of P130 PORT Output latch P130 (P130) Read signal WR××: Write signal Remark When reset is effected, P130 outputs a low level. If P130 is set to output a high level immediately after reset is released, the output signal of P130 can be dummy-output as the reset signal to the CPU.
  • Page 119: Port 14

    CHAPTER 4 PORT FUNCTIONS 4.2.11 Port 14 Port 14 is a 6-bit I/O port with an output latch. Port 14 can be set to the input mode or output mode in 1-bit units using port mode register 14 (PM14). When the P140 to P145 pins are used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 14 (PU14).
  • Page 120: Block Diagram Of P142

    CHAPTER 4 PORT FUNCTIONS Figure 4-23. Block Diagram of P142 PU14 PU142 P-ch Alternate function PORT Output latch P142/SCKA0 (P142) PM14 PM142 Alternate function PU14: Pull-up resistor option register 14 PM14: Port mode register 14 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 121: Block Diagram Of P143

    CHAPTER 4 PORT FUNCTIONS Figure 4-24. Block Diagram of P143 PU14 PU143 P-ch Alternate function PORT Output latch P143/SIA0 (P143) PM14 PM143 PU14: Pull-up resistor option register 14 PM14: Port mode register 14 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 122: Block Diagram Of P144 And P145

    CHAPTER 4 PORT FUNCTIONS Figure 4-25. Block Diagram of P144 and P145 PU14 PU144, PU145 P-ch PORT Output latch (P144, P145) P144/SOA0, P145/STB0 PM14 PM144, PM145 Alternate function PU14: Pull-up resistor option register 14 PM14: Port mode register 14 Read signal WR××: Write signal User’s Manual U15947EJ2V0UD...
  • Page 123: Registers Controlling Port Function

    CHAPTER 4 PORT FUNCTIONS Registers Controlling Port Function Port functions are controlled by the following three types of registers. • Port mode registers (PM0, PM1, PM3 to PM7, PM12, PM14) • Port registers (P0 to P7, P12 to P14) • Pull-up resistor option registers (PU0, PU1, PU3 to PU7, PU12, PU14) (1) Port mode registers (PM0, PM1, PM3 to PM7, PM12, and PM14) These registers specify input or output mode for the port in 1-bit units.
  • Page 124 CHAPTER 4 PORT FUNCTIONS Table 4-5. Settings of Port Mode Register and Output Latch When Using Alternate Function (1/2) PM×× P×× Pin Name Alternate Function Function Name × TI000 Input × TI010 Input TO00 Output Note 1 SO11 Output × Note 1 SI11 Input...
  • Page 125 CHAPTER 4 PORT FUNCTIONS Table 4-5. Settings of Port Mode Register and Output Latch When Using Alternate Function (2/2) PM×× P×× Pin Name Alternate Function Function Name × P70 to P77 KR0 to KR7 Input × P120 INTP0 Input P140 Output ×...
  • Page 126: Format Of Port Register

    CHAPTER 4 PORT FUNCTIONS (2) Port registers (P0 to P7, P12 to P14) These registers write the data that is output from the chip when data is output from a port. If the data is read in the input mode, the pin level is read. If it is read in the output mode, the value of the output latch is read.
  • Page 127: Format Of Pull-Up Resistor Option Register

    CHAPTER 4 PORT FUNCTIONS (3) Pull-up resistor option registers (PU0, PU1, PU3 to PU7, PU12, and PU14) These registers specify whether the on-chip pull-up resistors of P00 to P06, P10 to P17, P30 to P33, P40 to P47, P50 to P57, P64 to P67, P70 to P77, P120, or P140 to P145 are to be used or not. On-chip pull-up resistors can be used in 1-bit units only for the bits set to input mode of the pins to which the use of an on-chip pull-up resistor has been specified.
  • Page 128: Port Function Operations

    CHAPTER 4 PORT FUNCTIONS Port Function Operations Port operations differ depending on whether the input or output mode is set, as shown below. Caution In the case of a 1-bit memory manipulation instruction, although a single bit is manipulated, the port is accessed as an 8-bit unit.
  • Page 129: Chapter 5 External Bus Interface

    CHAPTER 5 EXTERNAL BUS INTERFACE External Bus Interface The external bus interface connects external devices to areas other than the internal ROM, RAM, and SFR areas. Connection of external devices uses ports 4 to 6. Ports 4 to 6 control address/data, read/write strobe, wait, address strobe, etc.
  • Page 130: Memory Map When Using External Bus Interface

    CHAPTER 5 EXTERNAL BUS INTERFACE The memory maps when the external bus interface is used are as follows. Figure 5-1. Memory Map When Using External Bus Interface (1/2) µ µ µ µ (a) Memory map of PD780143 and of PD78F0148 (b) Memory map of PD780144 and of PD78F0148...
  • Page 131 CHAPTER 5 EXTERNAL BUS INTERFACE Figure 5-1. Memory Map When Using External Bus Interface (2/2) µ µ µ µ (c) Memory map of PD780146 and of PD78F0148 (d) Memory map of PD780148 and of PD78F0148 when internal ROM (flash memory) size is 48 KB when internal ROM (flash memory) size is 60 KB FFFFH FFFFH...
  • Page 132: Registers Controlling External Bus Interface

    CHAPTER 5 EXTERNAL BUS INTERFACE Registers Controlling External Bus Interface The external bus interface is controlled by the following two registers. • Memory expansion mode register (MEM) • Memory expansion wait setting register (MM) (1) Memory expansion mode register (MEM) MEM sets the external expansion area.
  • Page 133: Pins Specified For Address (With Μ Pd780143)

    CHAPTER 5 EXTERNAL BUS INTERFACE Note When the CPU accesses the external memory expansion area, the lower bits of the address to be accessed are output to the specified pins (except in the full-address mode). µ Figure 5-3. Pins Specified for Address (with PD780143) External Address...
  • Page 134: Format Of Memory Expansion Wait Setting Register (Mm)

    CHAPTER 5 EXTERNAL BUS INTERFACE (2) Memory expansion wait setting register (MM) MM sets the number of waits. MM is set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets MM to 10H. Figure 5-4. Format of Memory Expansion Wait Setting Register (MM) Address: FFF8H After reset: 10H Symbol...
  • Page 135: External Bus Interface Function Timing

    CHAPTER 5 EXTERNAL BUS INTERFACE External Bus Interface Function Timing Timing control signal output pins in the external memory expansion mode are as follows. (1) RD pin (Alternate function: P64) Read strobe signal output pin. The read strobe signal is output in data read and instruction fetch from external memory.
  • Page 136: Instruction Fetch From External Memory

    CHAPTER 5 EXTERNAL BUS INTERFACE Figure 5-5. Instruction Fetch from External Memory (a) No wait (PW1, PW0 = 0, 0) setting ASTB Lower address Instruction code AD0 to AD7 Higher address A8 to A15 (b) Wait (PW1, PW0 = 0, 1) setting ASTB Lower address Instruction code...
  • Page 137: External Memory Read Timing

    CHAPTER 5 EXTERNAL BUS INTERFACE Figure 5-6. External Memory Read Timing (a) No wait (PW1, PW0 = 0, 0) setting ASTB Lower address Read data AD0 to AD7 Higher address A8 to A15 (b) Wait (PW1, PW0 = 0, 1) setting ASTB AD0 to AD7 Lower address...
  • Page 138: External Memory Write Timing

    CHAPTER 5 EXTERNAL BUS INTERFACE Figure 5-7. External Memory Write Timing (a) No wait (PW1, PW0 = 0, 0) setting ASTB Hi-Z Lower address Write data AD0 to AD7 Higher address A8 to A15 (b) Wait (PW1, PW0 = 0, 1) setting ASTB Hi-Z Lower...
  • Page 139: External Memory Read Modify Write Timing

    CHAPTER 5 EXTERNAL BUS INTERFACE Figure 5-8. External Memory Read Modify Write Timing (a) No wait (PW1, PW0 = 0, 0) setting ASTB Hi-Z Lower AD0 to AD7 Read data Write data address A8 to A15 Higher address (b) Wait (PW1, PW0 = 0, 1) setting ASTB Hi-Z Lower...
  • Page 140: Example Of Connection With Memory

    CHAPTER 5 EXTERNAL BUS INTERFACE Example of Connection with Memory µ An example of connecting the PD780144 with external memory (in this example, SRAM) is shown in Figure 5-9. In addition, the external bus interface function is used in the full-address mode, and the addresses from 0000H to 7FFFH (32 KB) are allocated to internal ROM, and the addresses after 8000H to SRAM.
  • Page 141: Chapter 6 Clock Generator

    CHAPTER 6 CLOCK GENERATOR Functions of Clock Generator The clock generator generates the clock to be supplied to the CPU and peripheral hardware. The following three system clock oscillators are available. • X1 oscillator The X1 oscillator oscillates a clock of f = 2.0 to 10.0 MHz.
  • Page 142: Block Diagram Of Clock Generator

    CHAPTER 6 CLOCK GENERATOR Figure 6-1. Block Diagram of Clock Generator Internal bus Oscillation Main OSC Processor clock Main clock stabilization time control mode register control register select register register (PCC) (MCM) (OSTS) (MOC) MCM0 OSTS2 OSTS1 OSTS0 CSS PCC2 PCC1 PCC0 MSTOP X1 oscillation...
  • Page 143: Registers Controlling Clock Generator

    CHAPTER 6 CLOCK GENERATOR Registers Controlling Clock Generator The following six registers are used to control the clock generator. • Processor clock control register (PCC) • Ring-OSC mode register (RCM) • Main clock mode register (MCM) • Main OSC control register (MOC) •...
  • Page 144: Format Of Processor Clock Control Register (Pcc)

    CHAPTER 6 CLOCK GENERATOR Figure 6-2. Format of Processor Clock Control Register (PCC) Note 1 Address: FFFBH After reset: 00H Symbol <7> <6> <5> <4> PCC2 PCC1 PCC0 Note 2 Control of X1 oscillator operation Oscillation possible Oscillation stopped Subsystem clock feedback resistor selection On-chip feedback resistor used Note 3 On-chip feedback resistor not used...
  • Page 145: Format Of Ring-Osc Mode Register (Rcm)

    5. f : Subsystem clock oscillation frequency The fastest instruction can be executed in 2 clocks of the CPU clock in the 78K0/KF1. Therefore, the relationship between the CPU clock (f ) and minimum instruction execution time is as shown in the Table 6-2.
  • Page 146: Format Of Main Clock Mode Register (Mcm)

    CHAPTER 6 CLOCK GENERATOR (3) Main clock mode register (MCM) This register sets the CPU clock (X1 input clock/Ring-OSC clock). MCM can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 6-4. Format of Main Clock Mode Register (MCM) Note Address: FFA1H After reset: 00H...
  • Page 147: Format Of Main Osc Control Register (Moc)

    CHAPTER 6 CLOCK GENERATOR (4) Main OSC control register (MOC) This register selects the operation mode of the X1 input clock. This register is used to stop the X1 oscillator operation when the CPU is operating with the Ring-OSC clock. Therefore, this register is valid only when the CPU is operating with the Ring-OSC clock.
  • Page 148: Format Of Oscillation Stabilization Time Counter Status Register (Ostc)

    CHAPTER 6 CLOCK GENERATOR (5) Oscillation stabilization time counter status register (OSTC) This is the status register of the X1 input clock oscillation stabilization time counter. If the Ring-OSC clock is used as the CPU clock, the X1 input clock oscillation stabilization time can be checked. OSTC can be read by a 1-bit or 8-bit memory manipulation instruction.
  • Page 149: Format Of Oscillation Stabilization Time Select Register (Osts)

    CHAPTER 6 CLOCK GENERATOR (6) Oscillation stabilization time select register (OSTS) This register is used to select the X1 oscillation stabilization wait time when STOP mode is released. The wait time set by OSTS is valid only after STOP mode is released with the X1 input clock selected as CPU clock.
  • Page 150: System Clock Oscillator

    CHAPTER 6 CLOCK GENERATOR System Clock Oscillator 6.4.1 X1 oscillator The X1 oscillator oscillates with a crystal resonator or ceramic resonator (Standard: 8.38 MHz, 10 MHz when REGC pin is connected directly to V ) connected to the X1 and X2 pins. An external clock can be input to the X1 oscillator when the REGC pin is connected directly to V .
  • Page 151: Examples Of Incorrect Resonator Connection

    CHAPTER 6 CLOCK GENERATOR Cautions 1. When using the X1 oscillator and subsystem clock oscillator, wire as follows in the area enclosed by the broken lines in the Figure 6-10 to avoid an adverse effect from wiring capacitance. • Keep the wiring length as short as possible. •...
  • Page 152 CHAPTER 6 CLOCK GENERATOR Figure 6-10. Examples of Incorrect Resonator Connection (2/2) (c) Wiring near high alternating current (d) Current flowing through ground line of oscillator (potential at points A, B, and C fluctuates) High current (e) Signals are fetched Remark When using the subsystem clock, replace X1 and X2 with XT1 and XT2, respectively.
  • Page 153: When Subsystem Clock Is Not Used

    6.4.4 Ring-OSC oscillator Ring-OSC oscillator is incorporated in the 78K0/KF1. “Can be stopped by software” or “Cannot be stopped” can be selected by a mask option. The Ring-OSC clock always oscillates after RESET release (240 kHz (TYP.)).
  • Page 154: Clock Generator Operation

    • Clock to peripheral hardware The CPU starts operation when the on-chip Ring-OSC oscillator starts outputting after reset release in the 78K0/KF1, thus enabling the following. (1) Enhancement of security function When the X1 input clock is set as the CPU clock by the default setting, the device cannot operate if the X1 input clock is damaged or badly connected and therefore does not operate after reset is released.
  • Page 155: Timing Diagram Of Cpu Default Start Using Ring-Osc

    CHAPTER 6 CLOCK GENERATOR Figure 6-12. Timing Diagram of CPU Default Start Using Ring-OSC X1 input clock Ring-OSC clock Subsystem clock RESET Switched by software X1 input clock Ring-OSC clock CPU clock Operation stopped: 17/f Note X1 oscillation stabilization time: 2 to 2 Note Check using the oscillation stabilization time counter status register (OSTC).
  • Page 156: Status Transition Diagram

    CHAPTER 6 CLOCK GENERATOR A status transition diagram of this product is shown in Figure 6-13, and the relationship between the operation clocks in each operation status and between the oscillation control flag and oscillation status of each clock are shown in Tables 6-3 and 6-4, respectively.
  • Page 157 CHAPTER 6 CLOCK GENERATOR Figure 6-13. Status Transition Diagram (2/4) (2) When “Ring-OSC can be stopped by software” is selected by mask option (when subsystem clock is used) Status 6 CPU clock: f : Oscillation stopped : Oscillating/ oscillation stopped Interrupt MCC = 0 MCC = 1...
  • Page 158 CHAPTER 6 CLOCK GENERATOR Figure 6-13. Status Transition Diagram (3/4) (3) When “Ring-OSC cannot be stopped” is selected by mask option (when subsystem clock is not used) HALT HALT HALT instruction Interrupt Interrupt instruction Interrupt HALT instruction Status 3 Status 1 Status 2 Note 2 MCM0 = 0...
  • Page 159 CHAPTER 6 CLOCK GENERATOR Figure 6-13. Status Transition Diagram (4/4) (4) When “Ring-OSC cannot be stopped” is selected by mask option (when subsystem clock is used) Status 5 CPU clock: f : Oscillation stopped : Oscillating Interrupt MCC = 0 MCC = 1 HALT instruction Status 4...
  • Page 160 CHAPTER 6 CLOCK GENERATOR Table 6-3. Relationship Between Operation Clocks in Each Operation Status Status X1 Oscillator Ring-OSC Oscillator Subsystem CPU Clock Prescaler Clock Clock After Supplied to Peripherals MSTOP = 0 MSTOP = 1 Note 1 Note 2 Operation Oscillator Release MCC = 0...
  • Page 161: Time Required To Switch Between Ring-Osc Clock And X1 Input Clock

    CHAPTER 6 CLOCK GENERATOR Time Required to Switch Between Ring-OSC Clock and X1 Input Clock Bit 0 (MCM0) of the main clock mode register (MCM) is used to switch between the Ring-OSC clock and X1 input clock. In the actual switching operation, switching does not occur immediately after MCM0 rewrite; several instructions are executed using the pre-switch clock after switching MCM0 (see Table 6-5).
  • Page 162: Time Required For Cpu Clock Switchover

    CHAPTER 6 CLOCK GENERATOR Time Required for CPU Clock Switchover The CPU clock can be switched using bits 0 to 2 (PCC0 to PCC2) and bit 4 (CSS) of the processor clock control register (PCC). The actual switchover operation is not performed immediately after rewriting to the PCC; operation continues on the pre-switchover clock for several instructions (see Table 6-6).
  • Page 163: Clock Switching Flowchart And Register Setting

    CHAPTER 6 CLOCK GENERATOR Clock Switching Flowchart and Register Setting 6.8.1 Switching from Ring-OSC clock to X1 input clock Figure 6-14. Switching from Ring-OSC Clock to X1 Input Clock (Flowchart) After reset release PCC = 00H RCM = 00H ; Ring-OSC oscillation MCM = 00H Register initial ;...
  • Page 164: Switching From X1 Input Clock To Ring-Osc Clock

    CHAPTER 6 CLOCK GENERATOR 6.8.2 Switching from X1 input clock to Ring-OSC clock Figure 6-15. Switching from X1 Input Clock to Ring-OSC Clock (Flowchart) Register setting PCC.7 (MCC) = 0 ; X1 oscillation in X1 input PCC.4 (CSS) = 0 ;...
  • Page 165: Switching From X1 Input Clock To Subsystem Clock

    CHAPTER 6 CLOCK GENERATOR 6.8.3 Switching from X1 input clock to subsystem clock Figure 6-16. Switching from X1 Input Clock to Subsystem Clock (Flowchart) Register setting PCC.7 (MCC) = 0 ; X1 oscillation in X1 input PCC.4 (CSS) = 0 ;...
  • Page 166: Switching From Subsystem Clock To X1 Input Clock

    CHAPTER 6 CLOCK GENERATOR 6.8.4 Switching from subsystem clock to X1 input clock Figure 6-17. Switching from Subsystem Clock to X1 Input Clock (Flowchart) PCC.4 (CSS) = 1 ; Subsystem clock operation MCM = 03H No: X1 oscillating MCC = 1? ;...
  • Page 167: Register Settings

    CHAPTER 6 CLOCK GENERATOR 6.8.5 Register settings The table below shows the statuses of the setting flags and status flags when each mode is set. Table 6-7. Clock and Register Setting Mode Setting Flag Status Flag PCC Register Register Register Register Register Register...
  • Page 168: Chapter 7 16-Bit Timer/Event Counters 00 And 01

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 µ µ PD780143 and 780144 incorporate 16-bit timer/event counter 00, and the PD780146, 780148, and 78F0148 incorporate 16-bit timer/event counters 00 and 01. Functions of 16-Bit Timer/Event Counters 00 and 01 Note 16-bit timer/event counters 00 and 01 have the following functions.
  • Page 169: Configuration Of 16-Bit Timer/Event Counters 00 And 01

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Configuration of 16-Bit Timer/Event Counters 00 and 01 16-bit timer/event counters 00 and 01 consist of the following hardware. Table 7-1. Configuration of 16-Bit Timer/Event Counters 00 and 01 Item Configuration Timer counter 16 bits (TM0n) Register 16-bit timer capture/compare register: 16 bits (CR00n, CR01n)
  • Page 170: Pd780146, 780148, And 78F0148 Only)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 µ Figure 7-2. Block Diagram of 16-Bit Timer/Event Counter 01 ( PD780146, 780148, and 78F0148 Only) Internal bus Capture/compare control register 01 (CRC01) CRC012CRC011 CRC010 INTTM001 Noise 16-bit timer capture/compare TI011/TO01/P06 elimi- register 001 (CR001) nator Match...
  • Page 171: Format Of 16-Bit Timer Counter 0N (Tm0N)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (1) 16-bit timer counter 0n (TM0n) TM0n is a 16-bit read-only register that counts count pulses. The counter is incremented in synchronization with the rising edge of the input clock. Figure 7-3. Format of 16-Bit Timer Counter 0n (TM0n) Address: FF10H, FF11H (TM00), FFB0H, FFB1H (TM01) After reset: 0000H Symbol...
  • Page 172 CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Table 7-2. CR00n Capture Trigger and Valid Edges of TI00n and TI01n Pins (1) TI00n pin valid edge selected as capture trigger (CRC0n1 = 1, CRC0n0 = 1) CR00n Capture Trigger TI00n Pin Valid Edge ES0n1 ES0n0 Falling edge...
  • Page 173: Format Of 16-Bit Timer Capture/Compare Register 01N (Cr01N)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (3) 16-bit timer capture/compare register 01n (CR01n) CR01n is a 16-bit register that has the functions of both a capture register and a compare register. Whether it is used as a capture register or a compare register is set by bit 2 (CRC0n2) of capture/compare control register 0n (CRC0n).
  • Page 174: Registers Controlling 16-Bit Timer/Event Counters 00 And 01

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Registers Controlling 16-Bit Timer/Event Counters 00 and 01 The following six registers are used to control 16-bit timer/event counters 00 and 01. • 16-bit timer mode control register 0n (TMC0n) • Capture/compare control register 0n (CRC0n) •...
  • Page 175: Format Of 16-Bit Timer Mode Control Register 00 (Tmc00)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-6. Format of 16-Bit Timer Mode Control Register 00 (TMC00) Address: FFBAH After reset: 00H Symbol <0> TMC00 TMC003 TMC002 TMC001 OVF00 TMC003 TMC002 TMC001 Operating mode and clear TO00 inversion timing selection Interrupt request generation mode selection Operation stop...
  • Page 176: Format Of 16-Bit Timer Mode Control Register 01 (Tmc01)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-7. Format of 16-Bit Timer Mode Control Register 01 (TMC01) Address: FFB6H After reset: 00H Symbol <0> TMC01 TMC013 TMC012 TMC011 OVF01 TMC013 TMC012 TMC011 Operating mode and clear TO01 inversion timing selection Interrupt request generation mode selection Operation stop...
  • Page 177: Format Of Capture/Compare Control Register 00 (Crc00)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (2) Capture/compare control register 0n (CRC0n) This register controls the operation of the 16-bit timer capture/compare registers (CR00n, CR01n). CRC0n can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears CRC0n to 00H. µ...
  • Page 178: Format Of Capture/Compare Control Register 01 (Crc01)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-9. Format of Capture/Compare Control Register 01 (CRC01) Address: FFB8H After reset: 00H Symbol CRC01 CRC012 CRC011 CRC010 CRC012 CR011 operating mode selection Operates as compare register Operates as capture register CRC011 CR001 capture trigger selection Captures on valid edge of TI011...
  • Page 179: Format Of 16-Bit Timer Output Control Register 00 (Toc00)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-10. Format of 16-Bit Timer Output Control Register 00 (TOC00) Address: FFBDH After reset: 00H Symbol <6> <5> <3> <2> <0> TOC00 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00 OSPT00 One-shot pulse output trigger control via software No one-shot pulse trigger One-shot pulse trigger OSPE00...
  • Page 180: Format Of 16-Bit Timer Output Control Register 01 (Toc01)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-11. Format of 16-Bit Timer Output Control Register 01 (TOC01) Address: FFB9H After reset: 00H Symbol <6> <5> <3> <2> <0> TOC01 OSPT01 OSPE01 TOC014 LVS01 LVR01 TOC011 TOE01 OSPT01 One-shot pulse output trigger control via software No one-shot pulse trigger One-shot pulse trigger OSPE01...
  • Page 181 CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (4) Prescaler mode register 0n (PRM0n) This register is used to set the 16-bit timer counter 0n (TM0n) count clock and TI00n and TI01n input valid edges. PRM0n can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears PRM0n to 00H.
  • Page 182: Format Of Prescaler Mode Register 00 (Prm00)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-12. Format of Prescaler Mode Register 00 (PRM00) Address: FFBBH After reset: 00H Symbol PRM00 ES101 ES100 ES001 ES000 PRM001 PRM000 ES101 ES100 TI010 valid edge selection Falling edge Rising edge Setting prohibited Both falling and rising edges ES001...
  • Page 183: Format Of Prescaler Mode Register 01 (Prm01)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-13. Format of Prescaler Mode Register 01 (PRM01) Address: FFB7H After reset: 00H Symbol PRM01 ES111 ES110 ES011 ES010 PRM011 PRM010 ES111 ES110 TI011 valid edge selection Falling edge Rising edge Setting prohibited Both falling and rising edges ES011...
  • Page 184: Format Of Port Mode Register 0 (Pm0)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (5) Port mode register 0 (PM0) This register sets port 0 input/output in 1-bit units. Note Note When using the P01/TO00/TI010 and P06/TO01 /TI011 pins for timer output, clear PM01 and PM06 and the output latches of P01 and P06 to 0.
  • Page 185: Operation Of 16-Bit Timer/Event Counters 00 And 01

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Operation of 16-Bit Timer/Event Counters 00 and 01 7.4.1 Interval timer operation Setting 16-bit timer mode control register 0n (TMC0n) and capture/compare control register 0n (CRC0n) as shown in Figure 7-15 allows operation as an interval timer. Setting The basic operation setting procedure is as follows.
  • Page 186: Control Register Settings For Interval Timer Operation

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-15. Control Register Settings for Interval Timer Operation (a) 16-bit timer mode control register 0n (TMC0n) TMC0n3 TMC0n2 TMC0n1 OVF0n TMC0n Clears and starts on match between TM0n and CR00n. (b) Capture/compare control register 0n (CRC0n) CRC0n2 CRC0n1 CRC0n0...
  • Page 187: Interval Timer Configuration Diagram

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-16. Interval Timer Configuration Diagram 16-bit timer capture/compare register 00n (CR00n) INTTM00n Note 1 Note 1 Note 2 16-bit timer counter 0n OVF0n Note 1 (TM0n) Noise TI000/P00 eliminator Note 1 (TI001/P05) Clear circuit...
  • Page 188: Ppg Output Operations

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 7.4.2 PPG output operations Setting 16-bit timer mode control register 0n (TMC0n) and capture/compare control register 0n (CRC0n) as shown in Figure 7-18 allows operation as PPG (Programmable Pulse Generator) output. Setting The basic operation setting procedure is as follows.
  • Page 189: Control Register Settings For Ppg Output Operation

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-18. Control Register Settings for PPG Output Operation (a) 16-bit timer mode control register 0n (TMC0n) TMC0n3 TMC0n2 TMC0n1 OVF0n TMC0n Clears and starts on match between TM0n and CR00n. (b) Capture/compare control register 0n (CRC0n) CRC0n2 CRC0n1 CRC0n0...
  • Page 190: Configuration Diagram Of Ppg Output

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-19. Configuration Diagram of PPG Output 16-bit timer capture/compare register 00n (CR00n) Note Note Clear 16-bit timer counter 0n Note circuit (TM0n) TI000/P00 Noise Note eliminator (TI001/P05) TO00/TI010/P01 ( TO01/TI011/P06 ) 16-bit timer capture/compare register 01n (CR01n) Note Frequencies and pin names without parentheses are for 16-bit timer/event counter 00, and those in...
  • Page 191: Pulse Width Measurement Operations

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 7.4.3 Pulse width measurement operations It is possible to measure the pulse width of the signals input to the TI00n pin and TI01n pin using 16-bit timer counter 0n (TM0n). There are two measurement methods: measuring with TM0n used in free-running mode, and measuring by restarting the timer in synchronization with the edge of the signal input to the TI00n pin.
  • Page 192: And One Capture Register (When Ti00N And Cr01N Are Used)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (1) Pulse width measurement with free-running counter and one capture register When 16-bit timer counter 0n (TM0n) is operated in free-running mode, and the edge specified by prescaler mode register 0n (PRM0n) is input to the TI00n pin, the value of TM0n is taken into 16-bit timer capture/compare register 01n (CR01n) and an external interrupt request signal (INTTM01n) is set.
  • Page 193: Configuration Diagram For Pulse Width Measurement With Free-Running Counter

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-23. Configuration Diagram for Pulse Width Measurement with Free-Running Counter Note 16-bit timer counter 0n Note OVF0n (TM0n) Note 16-bit timer capture/compare TI00n register 01n (CR01n) INTTM01n Internal bus Note Frequencies without parentheses are for 16-bit timer/event counter 00, and those in parentheses are for 16- bit timer/event counter 01.
  • Page 194: Control Register Settings For Measurement Of Two Pulse Widths With Free-Running Counter

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (2) Measurement of two pulse widths with free-running counter When 16-bit timer counter 0n (TM0n) is operated in free-running mode, it is possible to simultaneously measure the pulse widths of the two signals input to the TI00n pin and the TI01n pin. When the edge specified by bits 4 and 5 (ES0n0 and ES0n1) of prescaler mode register 0n (PRM0n) is input to the TI00n pin, the value of TM0n is taken into 16-bit timer capture/compare register 01n (CR01n) and an interrupt request signal (INTTM01n) is set.
  • Page 195: (With Both Edges Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-26. Timing of Pulse Width Measurement Operation with Free-Running Counter (with Both Edges Specified) Count clock 0000H 0001H D0 + 1 D1 + 1 FFFFH 0000H D2 + 1 D2 + 2 TM0n count value TI00n pin input CR01n capture value...
  • Page 196: Two Capture Registers (With Rising Edge Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (3) Pulse width measurement with free-running counter and two capture registers When 16-bit timer counter 0n (TM0n) is operated in free-running mode, it is possible to measure the pulse width of the signal input to the TI00n pin. When the rising or falling edge specified by bits 4 and 5 (ES0n0 and ES0n1) of prescaler mode register 0n (PRM0n) is input to the TI00n pin, the value of TM0n is taken into 16-bit timer capture/compare register 01n (CR01n) and an interrupt request signal (INTTM01n) is set.
  • Page 197: And Two Capture Registers (With Rising Edge Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-28. Timing of Pulse Width Measurement Operation with Free-Running Counter and Two Capture Registers (with Rising Edge Specified) Count clock TM0n count value 0000H 0001H D0 + 1 D1 + 1 FFFFH 0000H D2 + 1...
  • Page 198: (With Rising Edge Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-29. Control Register Settings for Pulse Width Measurement by Means of Restart (with Rising Edge Specified) (a) 16-bit timer mode control register 0n (TMC0n) TMC0n3 TMC0n2 TMC0n1 OVF0n TMC0n Clears and starts at valid edge of TI00n pin. (b) Capture/compare control register 0n (CRC0n) CRC0n2 CRC0n1...
  • Page 199: External Event Counter Operation

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 7.4.4 External event counter operation Setting The basic operation setting procedure is as follows. <1> Set the CRC0n register (see Figure 7-31 for the set value). <2> Set the count clock by using the PRM0n register. <3>...
  • Page 200: Control Register Settings In External Event Counter Mode (With Rising Edge Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-31. Control Register Settings in External Event Counter Mode (with Rising Edge Specified) (a) 16-bit timer mode control register 0n (TMC0n) TMC0n3 TMC0n2 TMC0n1 OVF0n TMC0n Clears and starts on match between TM0n and CR00n. (b) Capture/compare control register 0n (CRC0n) CRC0n2 CRC0n1...
  • Page 201: Configuration Diagram Of External Event Counter

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-32. Configuration Diagram of External Event Counter Internal bus 16-bit timer capture/compare register 00n (CR00n) Match INTTM00n Clear Noise eliminator Note OVF0n 16-bit timer counter 0n (TM0n) Valid edge of TI00n Note OVF0n is set to 1 only when CR00n is set to FFFFH.
  • Page 202: Square-Wave Output Operation

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 7.4.5 Square-wave output operation Setting The basic operation setting procedure is as follows. <1> Set the count clock by using the PRM0n register. <2> Set the CRC0n register (see Figure 7-34 for the set value). <3>...
  • Page 203: Square-Wave Output Operation Timing

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-34. Control Register Settings in Square-Wave Output Mode (2/2) (c) 16-bit timer output control register 0n (TOC0n) OSPT0n OSPE0n TOC0n4 LVS0n LVR0n TOC0n1 TOE0n TOC0n Enables TO0n output. Inverts output on match between TM0n and CR00n. Specifies initial value of TO0n output F/F (setting “11”...
  • Page 204: One-Shot Pulse Output Operation

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 7.4.6 One-shot pulse output operation 16-bit timer/event counter 0n can output a one-shot pulse in synchronization with a software trigger or an external trigger (TI00n pin input). Setting The basic operation setting procedure is as follows. <1>...
  • Page 205: Control Register Settings For One-Shot Pulse Output With Software Trigger

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-36. Control Register Settings for One-Shot Pulse Output with Software Trigger (a) 16-bit timer mode control register 0n (TMC0n) TMC0n3 TMC0n2 TMC0n1 OVF0n TMC0n Free-running mode (b) Capture/compare control register 0n (CRC0n) CRC0n2 CRC0n1 CRC0n0 CRC0n CR00n as compare register...
  • Page 206: Timing Of One-Shot Pulse Output Operation With Software Trigger

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-37. Timing of One-Shot Pulse Output Operation with Software Trigger Set TMC0n to 0CH (TM0n count starts) Count clock TM0n count 0000H 0001H N + 1 0000H N – 1 M – 1 M + 1 M + 2 CR01n set value CR00n set value...
  • Page 207: (With Rising Edge Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-38. Control Register Settings for One-Shot Pulse Output with External Trigger (with Rising Edge Specified) (a) 16-bit timer mode control register 0n (TMC0n) TMC0n3 TMC0n2 TMC0n1 OVF0n TMC0n Clears and starts at valid edge of TI00n pin.
  • Page 208: Timing Of One-Shot Pulse Output Operation With External Trigger (With Rising Edge Specified)

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Figure 7-39. Timing of One-Shot Pulse Output Operation with External Trigger (with Rising Edge Specified) When TMC0n is set to 08H (TM0n count starts) Count clock − − TM0n count value 0000H 0001H 0000H N + 1 N + 2...
  • Page 209: Cautions For 16-Bit Timer/Event Counters 00 And 01

    CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 Cautions for 16-Bit Timer/Event Counters 00 and 01 (1) Timer start errors An error of up to one clock may occur in the time required for a match signal to be generated after timer start. This is because 16-bit timer counter 0n (TM0n) is started asynchronously to the count clock.
  • Page 210 CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (6) Operation of OVF0n flag <1> The OVF0n flag is also set to 1 in the following case. When any of the following modes is selected: the mode in which clear & start occurs on a match between TM0n and CR00n, the mode in which clear &...
  • Page 211 CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01 (8) Timer operation <1> Even if 16-bit timer counter 0n (TM0n) is read, the value is not captured by 16-bit timer capture/compare register 01n (CR01n). <2> Regardless of the CPU’s operation mode, when the timer stops, the input signals to the TI00n/TI01n pins are not acknowledged.
  • Page 212: Chapter 8 8-Bit Timer/Event Counters 50 And 51

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Functions of 8-Bit Timer/Event Counters 50 and 51 8-bit timer/event counters 50 and 51 have the following functions. • Interval timer • External event counter • Square-wave output • PWM output Figures 8-1 and 8-2 show the block diagrams of 8-bit timer/event counters 50 and 51. Figure 8-1.
  • Page 213 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Figure 8-2. Block Diagram of 8-Bit Timer/Event Counter 51 Internal bus 8-bit timer compare Selector INTTM51 register 51 (CR51) TI51/TO51/P33/INTP4 Match Note 1 8-bit timer TO51/TI51/ counter 51 (TM51) P33/INTP4 Clear Note 2 Output latch PM33 (P33)
  • Page 214: Configuration Of 8-Bit Timer/Event Counters 50 And 51

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Configuration of 8-Bit Timer/Event Counters 50 and 51 8-bit timer/event counters 50 and 51 consist of the following hardware. Table 8-1. Configuration of 8-Bit Timer/Event Counters 50 and 51 Item Configuration Timer register 8-bit timer counter 5n (TM5n) Register 8-bit timer compare register 5n (CR5n)
  • Page 215 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 (2) 8-bit timer compare register 5n (CR5n) CR5n can be read and written by an 8-bit memory manipulation instruction. Except in PWM mode, the value set in CR5n is constantly compared with the 8-bit timer counter 5n (TM5n) count value, and an interrupt request (INTTM5n) is generated if they match.
  • Page 216: Registers Controlling 8-Bit Timer/Event Counters 50 And 51

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Registers Controlling 8-Bit Timer/Event Counters 50 and 51 The following four registers are used to control 8-bit timer/event counters 50 and 51. • Timer clock selection register 5n (TCL5n) • 8-bit timer mode control register 5n (TMC5n) •...
  • Page 217 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Figure 8-6. Format of Timer Clock Selection Register 51 (TCL51) Address: FF8CH After reset: 00H Symbol TCL51 TCL512 TCL511 TCL510 TCL512 TCL511 TCL510 Count clock selection TI51 falling edge TI51 rising edge (10 MHz) /2 (5 MHz) (625 kHz)
  • Page 218 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 (2) 8-bit timer mode control register 5n (TMC5n) TMC5n is a register that performs the following five types of settings. <1> 8-bit timer counter 5n (TM5n) count operation control <2> 8-bit timer counter 5n (TM5n) operating mode selection <3>...
  • Page 219 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Figure 8-8. Format of 8-Bit Timer Mode Control Register 51 (TMC51) Address: FF43H After reset: 00H Symbol <7> <3> <2> <0> TMC51 TCE51 TMC516 LVS51 LVR51 TMC511 TOE51 TCE51 TM51 count operation control After clearing to 0, count operation disabled (counter stopped) Count operation start TMC516...
  • Page 220 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 (3) Port mode registers 1 and 3 (PM1, PM3) These registers set port 1 and 3 input/output in 1-bit units. When using the P17/TO50/TI50 and P33/TO51/TI51 pins for timer output, clear PM17 and PM33 and the output latches of P17 and P33 to 0.
  • Page 221: Operations Of 8-Bit Timer/Event Counters 50 And 51

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Operations of 8-Bit Timer/Event Counters 50 and 51 8.4.1 Operation as interval timer 8-bit timer/event counter 5n operates as an interval timer that generates interrupt requests repeatedly at intervals of the count value preset to 8-bit timer compare register 5n (CR5n). When the count value of 8-bit timer counter 5n (TM5n) matches the value set to CR5n, counting continues with the TM5n value cleared to 0 and an interrupt request signal (INTTM5n) is generated.
  • Page 222 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Figure 8-11. Interval Timer Operation Timing (2/2) (b) When CR5n = 00H Count clock TM5n CR5n TCE5n INTTM5n Interval time (c) When CR5n = FFH Count clock TM5n CR5n TCE5n INTTM5n Interrupt acknowledged Interrupt acknowledged Interval time...
  • Page 223: Operation As External Event Counter

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 8.4.2 Operation as external event counter The external event counter counts the number of external clock pulses to be input to TI5n by 8-bit timer counter 5n (TM5n). TM5n is incremented each time the valid edge specified by timer clock selection register 5n (TCL5n) is input. Either the rising or falling edge can be selected.
  • Page 224: Square-Wave Output Operation

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 8.4.3 Square-wave output operation A square wave with any selected frequency is output at intervals determined by the value preset to 8-bit timer compare register 5n (CR5n). The TO5n pin output status is inverted at intervals determined by the count value preset to CR5n by setting bit 0 (TOE5n) of 8-bit timer mode control register 5n (TMC5n) to 1.
  • Page 225: Pwm Output Operation

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Figure 8-13. Square-Wave Output Operation Timing Count clock N − 1 N − 1 TM5n count value Count start CR5n Note TO5n Note The initial value of TO5n output can be set by bits 2 and 3 (LVR5n, LVS5n) of 8-bit timer mode control register 5n (TMC5n).
  • Page 226 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 (1) PWM output basic operation Setting <1> Set each register. • Clear the port output latch (P17 or P33) Note Note and port mode register (PM17 or PM33) to 0. • TCL5n: Select the count clock. •...
  • Page 227 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Figure 8-14. PWM Output Operation Timing (a) Basic operation (active level = H) Count clock TM5n 00H 01H FFH 00H 01H 02H N N + 1 FFH 00H 01H 02H CR5n TCE5n INTTM5n TO5n <5>...
  • Page 228 CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 (2) Operation with CR5n changed Figure 8-15. Timing of Operation with CR5n Changed (a) CR5n value is changed from N to M before clock rising edge of FFH → Value is transferred to CR5n at overflow immediately after change. Count clock TM5n N N + 1 N + 2...
  • Page 229: Cautions For 8-Bit Timer/Event Counters 50 And 51

    CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50 AND 51 Cautions for 8-Bit Timer/Event Counters 50 and 51 (1) Timer start error An error of up to one clock may occur in the time required for a match signal to be generated after timer start. This is because 8-bit timer counters 50 and 51 (TM50, TM51) are started asynchronously to the count clock.
  • Page 230: Chapter 9 8-Bit Timers H0 And H1

    CHAPTER 9 8-BIT TIMERS H0 AND H1 Functions of 8-Bit Timers H0 and H1 8-bit timers H0 and H1 have the following functions. • Interval timer • PWM output mode • Square-wave output • Carrier generator mode (8-bit timer H1 only) Configuration of 8-Bit Timers H0 and H1 8-bit timers H0 and H1 consist of the following hardware.
  • Page 231 Figure 9-1. Block Diagram of 8-Bit Timer H0 Internal bus 8-bit timer H mode control register 0 (TMHMD0) TMHE0 CKS02 CKS01 CKS00 TMMD01 TMMD00 TOLEV0 TOEN0 8-bit timer H 8-bit timer H compare register compare register 00 (CMP00) 10 (CMP10) Decoder TOH0/P15 Selector...
  • Page 232 Figure 9-2. Block Diagram of 8-Bit Timer H1 Internal bus 8-bit timer H mode control 8-bit timer H carrier register 1 (TMHMD1) control register 1 (TMCYC1) TMHE1 CKS12 CKS11 CKS10 TMMD11 TMMD10 TOLEV1 TOEN1 8-bit timer H 8-bit timer H RMC1 NRZB1 NRZ1 compare compare...
  • Page 233 CHAPTER 9 8-BIT TIMERS H0 AND H1 (1) 8-bit timer H compare register 0n (CMP0n) This register can be read or written by an 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 9-3. Format of 8-Bit Timer H Compare Register 0n (CMP0n) Address: FF18H (CMP00), FF1AH (CMP01) After reset: 00H Symbol...
  • Page 234: Registers Controlling 8-Bit Timers H0 And H1

    CHAPTER 9 8-BIT TIMERS H0 AND H1 Registers Controlling 8-Bit Timers H0 and H1 The following four registers are used to control 8-bit timers H0 and H1. • 8-bit timer H mode register n (TMHMDn) • 8-bit timer H carrier control register 1 (TMCYC1) Note •...
  • Page 235 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-5. Format of 8-Bit Timer H Mode Register 0 (TMHMD0) Address: FF69H After reset: 00H <7> <1> <0> TMHMD0 TMHE0 CKS02 CKS01 CKS00 TMMD01 TMMD00 TOLEV0 TOEN0 TMHE0 Timer operation enable Stops timer count operation (counter is cleared to 0) Enables timer count operation (count operation started by inputting clock) CKS02 CKS01...
  • Page 236 CHAPTER 9 8-BIT TIMERS H0 AND H1 Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer H0 is not guaranteed.
  • Page 237 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-6. Format of 8-Bit Timer H Mode Register 1 (TMHMD1) Address: FF6CH After reset: 00H <7> <1> <0> TMHMD1 TMHE1 CKS12 CKS11 CKS10 TMMD11 TMMD10 TOLEV1 TOEN1 TMHE1 Timer operation enable Stops timer count operation (counter is cleared to 0) Enables timer count operation (count operation started by inputting clock) CKS12 CKS11...
  • Page 238 CHAPTER 9 8-BIT TIMERS H0 AND H1 Remarks 1. f : X1 input clock oscillation frequency 2. f : Ring-OSC clock oscillation frequency 3. Figures in parentheses apply to operation at f = 10 MHz, f = 240 kHz (TYP.). (2) 8-bit timer H carrier control register 1 (TMCYC1) This register controls the remote control output and carrier pulse output status of 8-bit timer H1.
  • Page 239: Operation Of 8-Bit Timers H0 And H1

    CHAPTER 9 8-BIT TIMERS H0 AND H1 Operation of 8-Bit Timers H0 and H1 9.4.1 Operation as interval timer/square-wave output When 8-bit timer counter Hn and compare register 0n (CMP0n) match, an interrupt request signal (INTTMHn) is generated and 8-bit timer counter Hn is cleared to 00H. Compare register 1n (CMP1n) is not used in interval timer mode.
  • Page 240 CHAPTER 9 8-BIT TIMERS H0 AND H1 (2) Timing chart The timing of the interval timer/square-wave output operation is shown below. Figure 9-10. Timing of Interval Timer/Square-Wave Output Operation (1/2) (a) Basic operation Count clock Count start 01H 00H 8-bit timer counter Hn Clear Clear CMP0n...
  • Page 241 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-10. Timing of Interval Timer/Square-Wave Output Operation (2/2) (b) Operation when CMP0n = FFH Count clock Count start 8-bit timer counter Hn Clear Clear CMP0n TMHEn INTTMHn TOHn Interval time (c) Operation when CMP0n = 00H Count clock Count start 8-bit timer counter Hn...
  • Page 242: Operation As Pwm Output Mode

    CHAPTER 9 8-BIT TIMERS H0 AND H1 9.4.2 Operation as PWM output mode In PWM output mode, a pulse with an arbitrary duty and arbitrary cycle can be output. 8-bit timer compare register 0n (CMP0n) controls the cycle of timer output (TOHn). Rewriting the CMP0n register during timer operation is prohibited.
  • Page 243 CHAPTER 9 8-BIT TIMERS H0 AND H1 <4> When 8-bit timer counter Hn and the CMP1n register match, TOHn output becomes inactive and the compare register to be compared with 8-bit timer counter Hn is changed from the CMP1n register to the CMP0n register.
  • Page 244 CHAPTER 9 8-BIT TIMERS H0 AND H1 (2) Timing chart The operation timing in PWM output mode is shown below. Caution Make sure that the CMP1n register setting value (M) and CMP0n register setting value (N) are within the following range. 00H ≤...
  • Page 245 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-12. Operation Timing in PWM Output Mode (2/4) (b) Operation when CMP0n = FFH, CMP1n = 00H Count clock 8-bit timer counter Hn 00H 01H FFH 00H 01H 02H FFH 00H 01H 02H FFH 00H CMP0n CMP1n...
  • Page 246 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-12. Operation Timing in PWM Output Mode (3/4) (d) Operation when CMP0n = 01H, CMP1n = 00H Count clock 01H 00H 01H 00H 00H 01H 00H 01H 8-bit timer counter Hn CMP0n CMP1n TMHEn INTTMHn...
  • Page 247 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-12. Operation Timing in PWM Output Mode (4/4) (e) Operation by changing CMP1n (CMP1n = 01H → 03H, CMP0n = A5H) Count clock 8-bit timer counter Hn 00H 01H 02H A5H 00H 01H 02H 03H A5H 00H 01H 02H 03H A5H 00H CMP0n...
  • Page 248: Carrier Generator Mode Operation (8-Bit Timer H1 Only)

    CHAPTER 9 8-BIT TIMERS H0 AND H1 9.4.3 Carrier generator mode operation (8-bit timer H1 only) The carrier clock generated by 8-bit timer H1 is output in the cycle set by 8-bit timer/event counter 51. In carrier generator mode, the output of the 8-bit timer H1 carrier pulse is controlled by 8-bit timer/event counter 51, and the carrier pulse is output from the TOH1 output.
  • Page 249 CHAPTER 9 8-BIT TIMERS H0 AND H1 To control the carrier pulse output during a count operation, the NRZ1 and NRZB1 bits of the TMCYC1 register have a master and slave bit configuration. The NRZ1 bit is read-only but the NRZB1 bit can be read and written. The INTTM51 signal is synchronized with the 8-bit timer H1 count clock and output as the INTTM5H1 signal.
  • Page 250 CHAPTER 9 8-BIT TIMERS H0 AND H1 (3) Usage Outputs an arbitrary carrier clock from the TOH1 pin. <1> Set each register. Figure 9-14. Register Setting in Carrier Generator Mode Setting 8-bit timer H mode register 1 (TMHMD1) TMHE1 CKS12 CKS11 CKS10 TMMD11...
  • Page 251 CHAPTER 9 8-BIT TIMERS H0 AND H1 If the setting value of the CMP01 register is N, the setting value of the CMP11 register is M, and the count clock frequency is f , the carrier clock output cycle and duty are as follows. Carrier clock output cycle = (N + M + 2)/f Duty = High-level width : Carrier clock output width = ( M + 1) : (N + M + 2) Cautions 1.
  • Page 252 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-15. Carrier Generator Mode Operation Timing (1/3) (a) Operation when CMP01 = N, CMP11 = N 8-bit timer Hn count clock 8-bit timer counter N 00H N 00H N 00H N 00H N 00H Hn count value CMPn0...
  • Page 253 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-15. Carrier Generator Mode Operation Timing (2/3) (b) Operation when CMP01 = N, CMP11 = M 8-bit timer Hn count clock 8-bit timer counter N 00H 01H M 00H N 00H 01H M 00H Hn count value CMPn0...
  • Page 254 CHAPTER 9 8-BIT TIMERS H0 AND H1 Figure 9-15. Carrier Generator Mode Operation Timing (3/3) (c) Operation when CMP11 is changed 8-bit timer H1 count clock 8-bit timer counter 00H 01H 00H 01H H1 count value CMP01 <3> <3>’ CMP11 M (L) TMHE1 INTTMH1...
  • Page 255: Chapter 10 Watch Timer

    CHAPTER 10 WATCH TIMER 10.1 Functions of Watch Timer The watch timer has the following functions. • Watch timer • Interval timer The watch timer and the interval timer can be used simultaneously. Figure 10-1 shows the watch timer block diagram. Figure 10-1.
  • Page 256 CHAPTER 10 WATCH TIMER (1) Watch timer When the X1 input clock or subsystem clock is used, interrupt requests (INTWT) are generated at preset intervals. Table 10-1. Watch Timer Interrupt Time Interrupt Time When Operated at f = 32.768 kHz When Operated at f = 10 MHz µ...
  • Page 257: Configuration Of Watch Timer

    CHAPTER 10 WATCH TIMER 10.2 Configuration of Watch Timer The watch timer consists of the following hardware. Table 10-3. Watch Timer Configuration Item Configuration 5 bits × 1 Counter 11 bits × 1 Prescaler Control register Watch timer operation mode register (WTM) 10.3 Register Controlling Watch Timer The watch timer is controlled by the watch timer operation mode register (WTM).
  • Page 258 CHAPTER 10 WATCH TIMER Figure 10-2. Format of Watch Timer Operation Mode Register (WTM) Address: FF6FH After reset: 00H Symbol <1> <0> WTM7 WTM6 WTM5 WTM4 WTM3 WTM2 WTM1 WTM0 WTM7 Watch timer count clock selection (78.125 kHz) (32.768 kHz) WTM6 WTM5 WTM4...
  • Page 259: Watch Timer Operations

    CHAPTER 10 WATCH TIMER 10.4 Watch Timer Operations 10.4.1 Watch timer operation The watch timer generates an interrupt request (INTWT) at a specific time interval by using the X1 input clock or subsystem clock. When bit 0 (WTM0) and bit 1 (WTM1) of the watch timer operation mode register (WTM) are set to 1, the count operation starts.
  • Page 260: Interval Timer Operation

    CHAPTER 10 WATCH TIMER 10.4.2 Interval timer operation The watch timer operates as interval timer which generates interrupt requests (INTWTI) repeatedly at an interval of the preset count value. The interval time can be selected with bits 4 to 6 (WTM4 to WTM6) of the watch timer operation mode register (WTM).
  • Page 261: Cautions For Watch Timer

    CHAPTER 10 WATCH TIMER 10.5 Cautions for Watch Timer When operation of the watch timer and 5-bit counter is enabled by the watch timer mode control register (WTM) (by setting bits 0 (WTM0) and 1 (WTM1) of WTM to 1), the interval until the first interrupt request (INTWT) is generated after the register is set does not exactly match the specification made with bit 3 (WTM3) of WTM.