To our customers,
Old Company Name in Catalogs and Other Documents
On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.
Renesas Electronics website: http://www.renesas.com
April 1st, 2010
Renesas Electronics Corporation
Issued by: Renesas Electronics Corporation (http://www.renesas.com)
Send any inquiries to http://www.renesas.com/inquiry.
Notice
1. All information included in this document is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please
confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to
additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website.
2. Renesas 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 Renesas Electronics products or technical information described in this document.
No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights
of Renesas Electronics or others.
3. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
4. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software,
and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by
you or third parties arising from the use of these circuits, software, or information.
5. When exporting the products or technology described in this document, you should comply with the applicable export control
laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas
Electronics products or the technology described in this document for any purpose relating to military applications or use by
the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and
technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited
under any applicable domestic or foreign laws or regulations.
6. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics
does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages
incurred by you resulting from errors in or omissions from the information included herein.
7. Renesas Electronics products are classified according to the following three quality grades: “Standard”, “High Quality”, and
“Specific”. The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as
indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular
application. You may not use any Renesas Electronics product for any application categorized as “Specific” without the prior
written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for
which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way
liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an
application categorized as “Specific” or for which the product is not intended where you have failed to obtain the prior written
consent of Renesas Electronics. The quality grade of each Renesas Electronics product is “Standard” unless otherwise
expressly specified in a Renesas Electronics data sheets or data books, etc.
“Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots.
“High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-
crime systems; safety equipment; and medical equipment not specifically designed for life support.
“Specific”: Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or
systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare
intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life.
8. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or
damages arising out of the use of Renesas Electronics products beyond such specified ranges.
9. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have
specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further,
Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to
guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a
Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire
control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because
the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system
manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental
compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable
laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS
Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with
applicable laws and regulations.
11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
User’s Manual
µ
PD789405A
µ
PD789406A
µ
PD789407A
µ
PD789407A, 789417A
Subseries
8-Bit Single-Chip Microcontrollers
Printed in Japan
Document No. U13952EJ3V1UD00 (3rd edition)
Date Published October 2005 N CP(K)
µ
PD789415A
µ
PD789416A
µ
PD789417A
µ
PD78F9418A
1999, 2003
2 User’s Manual U13952EJ3V1UD
[MEMO]
User’s Manual U13952EJ3V1UD 3
1
2
3
4
VOLTAGE APPLICATION WAVEFORM AT INPUT PIN
Waveform distortion due to input noise or a reflected wave may cause malfunction. If the input of the
CMOS device stays in the area between V
IL
(MAX) and V
IH
(MIN) due to noise, etc., the device may
malfunction. Take care to prevent chattering noise from entering the device when the input level is
fixed, and also in the transition period when the input level passes through the area between V
IL
(MAX)
and V
IH
(MIN).
HANDLING OF UNUSED INPUT PINS
Unconnected CMOS device inputs can be cause of malfunction. If an input pin is unconnected, it is
possible that an internal input level may be generated due to noise, etc., causing malfunction. CMOS
devices behave differently than Bipolar or NMOS devices. Input levels of CMOS devices must be fixed
high or low by using pull-up or pull-down circuitry. Each unused pin should be connected to V
DD
or
GND via a resistor if there is a possibility that it will be an output pin. All handling related to unused pins
must be judged separately for each device and according to related specifications governing the device.
PRECAUTION AGAINST ESD
A 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 when it has occurred. Environmental control must be
adequate. When it is dry, a humidifier should be used. It is recommended to avoid using insulators that
easily build up static electricity. Semiconductor devices must be stored and transported in an anti-static
container, static shielding bag or conductive material. All test and measurement tools including work
benches and floors should be grounded. The operator should be grounded using a wrist strap.
Semiconductor devices must not be touched with bare hands. Similar precautions need to be taken for
PW boards with mounted semiconductor devices.
STATUS BEFORE INITIALIZATION
Power-on does not necessarily define the initial status of a MOS device. Immediately after the power
source is turned ON, devices with reset functions have not yet been initialized. Hence, power-on does
not guarantee output pin levels, I/O settings or contents of registers. A device is not initialized until the
reset signal is received. A reset operation must be executed immediately after power-on for devices
with reset functions.
POWER ON/OFF SEQUENCE
In the case of a device that uses different power supplies for the internal operation and external
interface, as a rule, switch on the external power supply after switching on the internal power supply.
When switching the power supply off, as a rule, switch off the external power supply and then the
internal power supply. Use of the reverse power on/off sequences may result in the application of an
overvoltage to the internal elements of the device, causing malfunction and degradation of internal
elements due to the passage of an abnormal current.
The correct power on/off sequence must be judged separately for each device and according to related
specifications governing the device.
INPUT OF SIGNAL DURING POWER OFF STATE
Do not input signals or an I/O pull-up power supply while the device is not powered. The current
injection that results from input of such a signal or I/O pull-up power supply may cause malfunction and
the abnormal current that passes in the device at this time may cause degradation of internal elements.
Input of signals during the power off state must be judged separately for each device and according to
related specifications governing the device.
NOTES FOR CMOS DEVICES
5
6
4 User’s Manual U13952EJ3V1UD
EEPROM and FIP are trademarks of NEC Electronics Corporation.
Windows and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the
United States and/or other countries.
PC/AT is a trademark of International Business Machines Corporation.
HP9000 series 700 and HP-UX are trademarks of Hewlett-Packard Company.
SPARCstation is a trademark of SPARC International, Inc.
Solaris and SunOS are trademarks of Sun Microsystems, Inc.
These commodities, technology or software, must be exported in accordance
with the export administration regulations of the exporting country.
Diversion contrary to the law of that country is prohibited.
The information in this document is current as of August, 2005. The information is subject to
change without notice. For actual design-in, refer to the latest publications of NEC Electronics data
sheets or data books, etc., for the most up-to-date specifications of NEC Electronics products. Not
all products and/or types are available in every country. Please check with an NEC Electronics sales
representative for availability and additional information.
No part of this document may be copied or reproduced in any form or by any means without the prior
written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may
appear in this document.
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.
Descriptions of circuits, software and other related information in this document are provided for illustrative
purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of a customer's equipment shall be done under the full
responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by
customers or third parties arising from the use of these circuits, software and information.
While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products,
customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To
minimize risks of damage to property or injury (including death) to persons arising from defects in NEC
Electronics products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment and anti-failure features.
NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and
"Specific".
The "Specific" quality grade applies only to NEC Electronics products developed based on a customer-
designated "quality assurance program" for a specific application. The recommended applications of an NEC
Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of
each NEC Electronics product before using it in a particular application.
The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC
Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications
not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to
determine NEC Electronics' willingness to support a given application.
(Note)
M8E 02. 11-1
(1)
(2)
"NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its
majority-owned subsidiaries.
"NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as
defined above).
Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots.
Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed
for life support).
Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life
support systems and medical equipment for life support, etc.
"Standard":
"Special":
"Specific":
User’s Manual U13952EJ3V1UD 5
Regional Information
Device availability
Ordering information
Product release schedule
Availability of related technical literature
Development environment specifications (for example, specifications for third-party tools and
components, host computers, power plugs, AC supply voltages, and so forth)
Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary
from country to country.
[GLOBAL SUPPORT]
http://www.necel.com/en/support/support.html
NEC Electronics America, Inc. (U.S.)
Santa Clara, California
Tel: 408-588-6000
800-366-9782
NEC Electronics Hong Kong Ltd.
Hong Kong
Tel: 2886-9318
NEC Electronics Hong Kong Ltd.
Seoul Branch
Seoul, Korea
Tel: 02-558-3737
NEC Electronics Shanghai Ltd.
Shanghai, P.R. China
Tel: 021-5888-5400
NEC Electronics Taiwan Ltd.
Taipei, Taiwan
Tel: 02-2719-2377
NEC Electronics Singapore Pte. Ltd.
Novena Square, Singapore
Tel: 6253-8311
J05.6
N
EC Electronics (Europe) GmbH
Duesseldorf, Germany
Tel: 0211-65030
Sucursal en España
Madrid, Spain
Tel: 091-504 27 87
Vélizy-Villacoublay, France
Tel: 01-30-67 58 00
Succursale Française
Filiale Italiana
Milano, Italy
Tel: 02-66 75 41
Branch The Netherlands
Eindhoven, The Netherlands
Tel: 040-265 40 10
Tyskland Filial
Taeby, Sweden
Tel: 08-63 87 200
United Kingdom Branch
Milton Keynes, UK
Tel: 01908-691-133
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:
6 User’s Manual U13952EJ3V1UD
Major Revisions in This Edition
Page Description
U13952EJ2V0UD00 U13952EJ3V0UD00
pp.38, 39, 41 Modification of pin handling of AVREF pin and VPP pin in CHAPTER 2 PIN FUNCTIONS
p.92 Addition of Note related to feedback resistor in Figure 5-3 Format of Suboscillation Mode Register
pp.112, 113 Addition of 6.5 Cautions on Using 16-Bit Timer 50
pp.151, 164 Addition of (8) Input impedance of ANI0 to ANI6 pins in 10.5 Cautions on Using 8-Bit A/D Converter and
11.5 Cautions on Using 10-Bit A/D Converter
p.154 Modification of description of (2) A/D conversion result register 0 (ADCR0) in 11.2 Configuration of 10-Bit
A/D Converter
p.196 Addition of description on reading receive data of UART in 13.4.2 Asynchronous serial interface (UART)
mode
p.232 Addition of Caution in Figure 15-2 Format of Interrupt Request Flag Register
p.237 Addition of Caution in Figure 15-7 Format of Key Return Mode Register 00
p.256 Addition of description on pull-up resistor and divider resistor for LCD driving in Table 18-1 Differences
Between
µ
PD78F9418A and Mask ROM Versions
pp.257 to 266 Overall revision of contents related to flash memory programming as 18.1 Flash Memory Characteristics
pp.278 to 292 Addition of CHAPTER 21 ELECTRICAL SPECIFICATIONS
pp.293 to 295 Addition of CHAPTER 22 CHARACTERISTICS CURVES (REFERENCE VALUES)
pp.296, 297 Addition of CHAPTER 23 PACKAGE DRAWINGS
pp.298, 299 Addition of CHAPTER 24 RECOMMENDED SOLDERING CONDITIONS
pp.301 to 310 Overall revision of contents of APPENDIX A DEVELOPMENT TOOLS
Deletion of embedded software
pp.311 to 314 Addition of APPENDIX B NOTES ON TARGET SYSTEM DESIGN
U13952EJ3V0UD00 U13952EJ3V1UD00
p. 24 Modification of 1.3 Ordering Information
p. 300 Addition of Table 24-1. Surface Mounting Type Soldering Conditions (3/3)
The mark shows major revised points.
User’s Manual U13952EJ3V1UD 7
INTRODUCTION
Target Readers This manual is intended for users who wish to understand the functions of the
µ
PD789407A and
µ
PD789417A Subseries and to design and develop application
systems and programs using these microcontrollers.
Target products:
µ
PD789407A Subseries:
µ
PD789405A,
µ
PD789406A, and
µ
PD789407A
µ
PD789417A Subseries:
µ
PD789415A,
µ
PD789416A,
µ
PD789417A, and
µ
PD78F9418A
Purpose This manual is intended to give users an understanding of the functions described in
the Organization below.
Organization The
µ
PD789407A and
µ
PD789417A Subseries User’s Manual is divided into two
parts: this manual and instructions (common to the 78K/0S Series).
µ
PD789407A and
µ
PD789417A
Subseries
User’s Manual
78K/0S Series
User’s Manual
Instructions
Pin functions
Internal block functions
Interrupt functions
Other on-chip peripheral functions
Electrical specifications
CPU function
Instruction set
Explanation of each
instruction
How to Read This Manual It is assumed that the reader of this manual has general knowledge in the fields of
electrical engineering, logic circuits, and microcontrollers.
To understand the functions in general:
Read this manual in the order of the CONTENTS.
How to interpret the register formats:
The name of a bit whose number is enclosed in brackets is reserved for the
assembler and is defined for the C compiler by the header file sfrbit.h.
When you know a register name and want to confirm its details:
Read APPENDIX C REGISTER INDEX.
To know the 78K/0S Series instructions functions in detail:
Refer to 78K/0S Series Instructions User’s Manual (U11047E).
To learn the electrical specifications of the
µ
PD789407A and
µ
PD789417A
Subseries
Refer to CHAPTER 21 ELECTRICAL SPECIFICATIONS.
8 User’s Manual U13952EJ3V1UD
Conventions Data significance: Higher digits on the left and lower digits on the right
Active low representation: xxx (overscore over pin or signal name)
Note: Footnote for item marked with Note in the text
Caution: Information requiring particular attention
Remark: Supplementary information
Numerical representation: Binary ... xxxx or xxxxB
Decimal ... xxxx
Hexadecimal ... xxxxH
Related Documents 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.
µ
PD789407A, 789417A Subseries User’s Manual This manual
78K/0S Series Instructions User’s Manual U11047E
Documents Related to Development Software Tools (User’s Manuals)
Document Name Document No.
Operation U14876E
Language U14877E
RA78K0S Assembler Package
Structured Assembly Language U11623E
Operation U14871E CC78K0S C Compiler
Language U14872E
Operation (WindowsTM Based) U15373E SM78K Series System Simulator Ver. 2.30 or Later
External Part User Open Interface Specifications U15802E
ID78K Series Integrated Debugger Ver. 2.30 or Later Operation (Windows Based) U15185E
Project Manager Ver. 3.12 or Later (Windows Based) U14610E
Documents Related to Development Hardware Tools (User’s Manuals)
Document Name Document No.
IE-78K0S-NS In-Circuit Emulator U13549E
IE-78K0S-NS-A In-Circuit Emulator U15207E
IE-789418-NS-EM1 Emulation Board U14364E
Caution The related documents listed above are subject to change without notice. Be sure to use the
latest version of each document for designing.
User’s Manual U13952EJ3V1UD 9
Documents Related to Flash Memory Writing
Document Name Document No.
PG-FP3 Flash Memory Programmer User’s Manual U13502E
PG-FP4 Flash Memory Programmer User’s Manual U15260E
Other Related Documents
Document Name 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” website (http://www.necel.com/pkg/en/mount/index.html)
Caution The related documents listed above are subject to change without notice. Be sure to use the
latest version of each document for designing.
10 User’s Manual U13952EJ3V1UD
CONTENTS
CHAPTER 1 GENERAL...........................................................................................................................23
1.1 Features.........................................................................................................................................23
1.2 Applications ..................................................................................................................................23
1.3 Ordering Information....................................................................................................................24
1.4 Pin Configuration (Top View) ......................................................................................................25
1.5 78K/0S Series Lineup ...................................................................................................................27
1.6 Block Diagram...............................................................................................................................30
1.7 Overview of Functions .................................................................................................................31
CHAPTER 2 PIN FUNCTIONS ...............................................................................................................33
2.1 List of Pin Functions ....................................................................................................................33
2.2 Description of Pin Functions.......................................................................................................36
2.2.1 P00 to P03 (Port 0)............................................................................................................................36
2.2.2 P20 to P27 (Port 2)............................................................................................................................36
2.2.3 P40 to P47 (Port 4)............................................................................................................................37
2.2.4 P50 to P53 (Port 5)............................................................................................................................37
2.2.5 P60 to P66 (Port 6)............................................................................................................................37
2.2.6 P80 to P87 (Port 8)............................................................................................................................38
2.2.7 P90 to P93 (Port 9)............................................................................................................................38
2.2.8 S0 to S15 ..........................................................................................................................................38
2.2.9 COM0 to COM3 ................................................................................................................................38
2.2.10 VLC0 to VLC2 .....................................................................................................................................38
2.2.11 BIAS................................................................................................................................................ 38
2.2.12 AVREF ..............................................................................................................................................38
2.2.13 AVDD ...............................................................................................................................................38
2.2.14 AVSS ...............................................................................................................................................39
2.2.15 RESET ............................................................................................................................................39
2.2.16 X1, X2 .............................................................................................................................................39
2.2.17 XT1, XT2 ......................................................................................................................................... 39
2.2.18 VDD0, VDD1 ....................................................................................................................................... 39
2.2.19 VSS0, VSS1 .......................................................................................................................................39
2.2.20 VPP (
µ
PD78F9418A only) ................................................................................................................39
2.2.21 IC (mask ROM version only) ...........................................................................................................40
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins ...........................................41
CHAPTER 3 CPU ARCHITECTURE......................................................................................................44
3.1 Memory Space ..............................................................................................................................44
3.1.1 Internal program memory space........................................................................................................48
3.1.2 Internal data memory space.............................................................................................................. 49
3.1.3 Special function register (SFR) area .................................................................................................49
3.1.4 Data memory addressing ..................................................................................................................50
3.2 Processor Registers.....................................................................................................................54
3.2.1 Control registers................................................................................................................................54
User’s Manual U13952EJ3V1UD 11
3.2.2 General-purpose registers................................................................................................................. 57
3.2.3 Special function registers (SFR)........................................................................................................ 58
3.3 Instruction Address Addressing.................................................................................................61
3.3.1 Relative addressing........................................................................................................................... 61
3.3.2 Immediate addressing....................................................................................................................... 62
3.3.3 Table indirect addressing .................................................................................................................. 63
3.3.4 Register addressing .......................................................................................................................... 63
3.4 Operand Address Addressing ....................................................................................................64
3.4.1 Direct addressing .............................................................................................................................. 64
3.4.2 Short direct addressing ..................................................................................................................... 65
3.4.3 Special function register (SFR) addressing ....................................................................................... 66
3.4.4 Register addressing .......................................................................................................................... 67
3.4.5 Register indirect addressing.............................................................................................................. 68
3.4.6 Based addressing ............................................................................................................................. 69
3.4.7 Stack addressing............................................................................................................................... 69
CHAPTER 4 PORT FUNCTIONS........................................................................................................... 70
4.1 Function of Port............................................................................................................................70
4.2 Configuration of Ports .................................................................................................................72
4.2.1 Port 0 ................................................................................................................................................ 72
4.2.2 Port 2 ................................................................................................................................................ 73
4.2.3 Port 4 ................................................................................................................................................ 78
4.2.4 Port 5 ................................................................................................................................................ 80
4.2.5 Port 6 ................................................................................................................................................ 81
4.2.6 Port 8 ................................................................................................................................................ 83
4.2.7 Port 9 ................................................................................................................................................ 84
4.3 Registers Controlling Ports.........................................................................................................85
4.4 Operation of Ports ........................................................................................................................88
4.4.1 Writing to I/O port.............................................................................................................................. 88
4.4.2 Reading from I/O port........................................................................................................................ 88
4.4.3 Arithmetic operation of I/O port ......................................................................................................... 88
CHAPTER 5 CLOCK GENERATOR ......................................................................................................89
5.1 Functions of Clock Generator.....................................................................................................89
5.2 Configuration of Clock Generator ..............................................................................................89
5.3 Registers Controlling Clock Generator...................................................................................... 91
5.4 System Clock Oscillators ............................................................................................................ 94
5.4.1 Main system clock oscillator.............................................................................................................. 94
5.4.2 Subsystem clock oscillator ................................................................................................................ 95
5.4.3 Examples of incorrect resonator connection ..................................................................................... 96
5.4.4 Divider............................................................................................................................................... 97
5.4.5 When no subsystem clock is used .................................................................................................... 97
5.5 Operation of Clock Generator ..................................................................................................... 98
5.6 Changing Setting of System Clock and CPU Clock..................................................................99
5.6.1 Time required for switching between system clock and CPU clock................................................... 99
5.6.2 Switching between system clock and CPU clock ............................................................................ 100
12 User’s Manual U13952EJ3V1UD
CHAPTER 6 16-BIT TIMER 50.............................................................................................................101
6.1 Function of 16-Bit Timer 50 .......................................................................................................101
6.2 Configuration of 16-Bit Timer 50...............................................................................................102
6.3 Registers Controlling 16-Bit Timer 50 ......................................................................................104
6.4 Operation of 16-Bit Timer 50 .....................................................................................................107
6.4.1 Operation as timer interrupt............................................................................................................. 107
6.4.2 Operation as timer output................................................................................................................ 109
6.4.3 Capture operation............................................................................................................................ 110
6.4.4 16-bit timer counter 50 readout .......................................................................................................111
6.5 Cautions on Using 16-Bit Timer 50 ...........................................................................................112
6.5.1 Restrictions when rewriting 16-bit compare register 50................................................................... 112
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02 .............................................................114
7.1 Function of 8-Bit Timer/Event Counters 00 to 02....................................................................114
7.2 Configuration of 8-Bit Timer/Event Counters 00 to 02 ...........................................................115
7.3 Registers Controlling 8-Bit Timer/Event Counters 00 to 02...................................................118
7.4 Operation of 8-Bit Timer/Event Counters 00 to 02 ..................................................................122
7.4.1 Operation as interval timer .............................................................................................................. 122
7.4.2 Operation as external event counter (timer 00 and timer 01 only)...................................................125
7.4.3 Operation as square-wave output (timer 02 only)............................................................................ 126
7.5 Cautions on Using 8-Bit Timer/Event Counters 00 to 02........................................................128
CHAPTER 8 WATCH TIMER ...............................................................................................................129
8.1 Functions of Watch Timer .........................................................................................................129
8.2 Configuration of Watch Timer ...................................................................................................130
8.3 Register Controlling Watch Timer ............................................................................................131
8.4 Operation of Watch Timer..........................................................................................................132
8.4.1 Operation as watch timer ................................................................................................................ 132
8.4.2 Operation as interval timer .............................................................................................................. 132
CHAPTER 9 WATCHDOG TIMER .......................................................................................................134
9.1 Functions of Watchdog Timer...................................................................................................134
9.2 Configuration of Watchdog Timer ............................................................................................135
9.3 Registers Controlling Watchdog Timer....................................................................................136
9.4 Operation of Watchdog Timer ...................................................................................................138
9.4.1 Operation as watchdog timer...........................................................................................................138
9.4.2 Operation as interval timer .............................................................................................................. 139
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES).............................................140
10.1 Function of 8-Bit A/D Converter..............................................................................................140
10.2 Configuration of 8-Bit A/D Converter .....................................................................................140
10.3 Registers Controlling 8-Bit A/D Converter.............................................................................143
10.4 Operation of 8-Bit A/D Converter............................................................................................145
10.4.1 Basic operation of 8-bit A/D converter........................................................................................... 145
10.4.2 Input voltage and conversion result............................................................................................... 146
10.4.3 Operation mode of 8-bit A/D converter.......................................................................................... 148
User’s Manual U13952EJ3V1UD 13
10.5 Cautions on Using 8-Bit A/D Converter ................................................................................. 149
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)...........................................153
11.1 Function of 10-Bit A/D Converter ...........................................................................................153
11.2 Configuration of 10-Bit A/D Converter ...................................................................................153
11.3 Registers Controlling 10-Bit A/D Converter ..........................................................................156
11.4 Operation of 10-Bit A/D Converter..........................................................................................158
11.4.1 Basic operation of 10-bit A/D converter......................................................................................... 158
11.4.2 Input voltage and conversion result............................................................................................... 160
11.4.3 Operation mode of 10-bit A/D converter........................................................................................ 161
11.5 Cautions on Using 10-Bit A/D Converter ...............................................................................162
CHAPTER 12 COMPARATOR..............................................................................................................166
12.1 Functions of Comparator ........................................................................................................166
12.2 Configuration of Comparator ..................................................................................................167
12.3 Register Controlling Comparator ...........................................................................................168
12.4 Operation of Comparator.........................................................................................................169
CHAPTER 13 SERIAL INTERFACE 00 ..............................................................................................171
13.1 Functions of Serial Interface 00 ..............................................................................................171
13.2 Configuration of Serial Interface 00 .......................................................................................172
13.3 Registers Controlling Serial Interface 00...............................................................................176
13.4 Operation of Serial Interface 00 .............................................................................................. 183
13.4.1 Operation stopped mode............................................................................................................... 183
13.4.2 Asynchronous serial interface (UART) mode ................................................................................ 185
13.4.3 3-wire serial I/O mode ................................................................................................................... 198
CHAPTER 14 LCD CONTROLLER/DRIVER.......................................................................................202
14.1 Functions of LCD Controller/Driver........................................................................................202
14.2 Configuration of LCD Controller/Driver .................................................................................203
14.3 Registers Controlling LCD Controller/Driver.........................................................................205
14.4 Setting LCD Controller/Driver .................................................................................................208
14.5 LCD Display Data Memory.......................................................................................................208
14.6 Common and Segment Signals ..............................................................................................209
14.7 Supplying LCD Drive Voltages VLC0, VLC1, and VLC2 .............................................................213
14.8 Display Modes .......................................................................................................................... 215
14.8.1 Static display example................................................................................................................... 215
14.8.2 Two-time-slice display example .................................................................................................... 218
14.8.3 Three-time-slice display example.................................................................................................. 221
14.8.4 Four-time-slice display example.................................................................................................... 225
CHAPTER 15 INTERRUPT FUNCTIONS ............................................................................................228
15.1 Interrupt Function Types .........................................................................................................228
15.2 Interrupt Sources and Configuration .....................................................................................228
15.3 Registers Controlling Interrupt Function...............................................................................231
15.4 Operation of Interrupt Servicing .............................................................................................238
15.4.1 Non-maskable interrupt acknowledgment operation ..................................................................... 238
14 User’s Manual U13952EJ3V1UD
15.4.2 Maskable interrupt acknowledgment operation ............................................................................. 240
15.4.3 Multiple interrupt servicing............................................................................................................. 241
15.4.4 Putting interrupt requests on hold.................................................................................................. 243
CHAPTER 16 STANDBY FUNCTION ..................................................................................................244
16.1 Standby Function and Configuration .....................................................................................244
16.1.1 Standby function............................................................................................................................ 244
16.1.2 Standby function control register ................................................................................................... 245
16.2 Operation of Standby Function...............................................................................................246
16.2.1 HALT mode ................................................................................................................................... 246
16.2.2 STOP mode .................................................................................................................................. 249
CHAPTER 17 RESET FUNCTION .......................................................................................................252
CHAPTER 18
µ
PD78F9418A ................................................................................................................256
18.1 Flash Memory Characteristics ................................................................................................257
18.1.1 Programming environment ............................................................................................................ 257
18.1.2 Communication mode ................................................................................................................... 258
18.1.3 On-board pin connections ............................................................................................................. 261
18.1.4 Connection when using flash memory writing adapter .................................................................. 264
CHAPTER 19 MASK OPTIONS ...........................................................................................................267
19.1 Mask Option for Pins................................................................................................................267
19.2 Mask Option for Voltage Division Resistor for LCD Driver..................................................267
CHAPTER 20 INSTRUCTION SET ......................................................................................................268
20.1 Operation...................................................................................................................................268
20.1.1 Operand identifiers and description methods ................................................................................ 268
20.1.2 Description of “Operation” column................................................................................................. 269
20.1.3 Description of “Flag” column.......................................................................................................... 269
20.2 Operation List ...........................................................................................................................270
20.3 Instructions Listed by Addressing Type................................................................................275
CHAPTER 21 ELECTRICAL SPECIFICATIONS.................................................................................278
CHAPTER 22 CHARACTERISTICS CURVES (REFERENCE VALUES).........................................293
22.1 Characteristics Curves for Mask ROM Versions...................................................................293
22.2 Characteristics Curves for
µ
PD78F9418A .............................................................................295
CHAPTER 23 PACKAGE DRAWINGS................................................................................................296
CHAPTER 24 RECOMMENDED SOLDERING CONDITIONS...........................................................298
APPENDIX A DEVELOPMENT TOOLS...............................................................................................301
A.1 Software Package ......................................................................................................................303
A.2 Language Processing Software ...............................................................................................303
A.3 Control Software ........................................................................................................................304
User’s Manual U13952EJ3V1UD 15
A.4 Flash Memory Writing Tools.....................................................................................................304
A.5 Debugging Tools (Hardware).................................................................................................... 305
A.6 Debugging Tools (Software).....................................................................................................306
A.7 Package Drawings of Conversion Socket and Conversion Adapter....................................307
A.7.1 Package drawing and recommended footprint of conversion socket (EV-9200GC-80) .................. 307
A.7.2 Package drawing of conversion adapter (TGK-080SDW)............................................................... 309
A.7.3 Package drawing of conversion adapter (TGC-080SBP)................................................................ 310
APPENDIX B NOTES ON TARGET SYSTEM DESIGN...................................................................311
APPENDIX C REGISTER INDEX.........................................................................................................315
C.1 Register Index (Alphabetic Order of Register Name) ............................................................315
C.2 Register Index (Alphabetic Order of Register Symbol) ......................................................... 317
APPENDIX D REVISION HISTORY .....................................................................................................319
16 User’s Manual U13952EJ3V1UD
LIST OF FIGURES (1/5)
Figure No. Title Page
2-1 Pin I/O Circuits .............................................................................................................................................42
3-1 Memory Map (
µ
PD789405A and
µ
PD789415A)...........................................................................................44
3-2 Memory Map (
µ
PD789406A and
µ
PD789416A)...........................................................................................45
3-3 Memory Map (
µ
PD789407A and
µ
PD789417A)...........................................................................................46
3-4 Memory Map (
µ
PD78F9418A)......................................................................................................................47
3-5 Data Memory Addressing (
µ
PD789405A and
µ
PD789415A) .......................................................................50
3-6 Data Memory Addressing (
µ
PD789406A and
µ
PD789416A) .......................................................................51
3-7 Data Memory Addressing (
µ
PD789407A and
µ
PD789417A) .......................................................................52
3-8 Data Memory Addressing (
µ
PD78F9418A) ..................................................................................................53
3-9 Program Counter Configuration....................................................................................................................54
3-10 Program Status Word Configuration.............................................................................................................54
3-11 Stack Pointer Configuration..........................................................................................................................56
3-12 Data Saved to Stack Memory.......................................................................................................................56
3-13 Data Restored from Stack Memory ..............................................................................................................56
3-14 General-Purpose Register Configuration......................................................................................................57
4-1 Port Types ....................................................................................................................................................70
4-2 Block Diagram of P00 to P03 .......................................................................................................................72
4-3 Block Diagram of P20...................................................................................................................................73
4-4 Block Diagram of P21...................................................................................................................................74
4-5 Block Diagram of P22 and P24 ....................................................................................................................75
4-6 Block Diagram of P23...................................................................................................................................76
4-7 Block Diagram of P25 to P27 .......................................................................................................................77
4-8 Block Diagram of P40 to P45 .......................................................................................................................78
4-9 Block Diagram of P46 and P47 ....................................................................................................................79
4-10 Block Diagram of P50 to P53 .......................................................................................................................80
4-11 Block Diagram of P60 and P61 ....................................................................................................................81
4-12 Block Diagram of P62 to P66 .......................................................................................................................82
4-13 Block Diagram of P80 to P87 .......................................................................................................................83
4-14 Block Diagram of P90 to P93 .......................................................................................................................84
4-15 Format of Port Mode Register ......................................................................................................................86
4-16 Format of Pull-Up Resistor Option Register 0 ..............................................................................................86
4-17 Format of Pull-Up Resistor Option Register 1 ..............................................................................................87
4-18 Format of Pull-Up Resistor Option Register 2 ..............................................................................................87
5-1 Block Diagram of Clock Generator ...............................................................................................................90
5-2 Format of Processor Clock Control Register ................................................................................................91
5-3 Format of Suboscillation Mode Register.......................................................................................................92
5-4 Format of Subclock Control Register............................................................................................................93
5-5 External Circuit of Main System Clock Oscillator..........................................................................................94
5-6 External Circuit of Subsystem Clock Oscillator.............................................................................................95
5-7 Examples of Incorrect Resonator Connection ..............................................................................................96
5-8 Switching Between System Clock and CPU Clock .....................................................................................100
User’s Manual U13952EJ3V1UD 17
LIST OF FIGURES (2/5)
Figure No. Title Page
6-1 Block Diagram of 16-Bit Timer 50...............................................................................................................102
6-2 Format of 16-Bit Timer Mode Control Register 50......................................................................................105
6-3 Format of Port Mode Register 2 .................................................................................................................106
6-4 Settings of 16-Bit Timer Mode Control Register 50 for Timer Interrupt Operation ......................................107
6-5 Timing of Timer Interrupt Operation ...........................................................................................................108
6-6 Settings of 16-Bit Timer Mode Control Register 50 for Timer Output Operation.........................................109
6-7 Timer Output Timing...................................................................................................................................109
6-8 Settings of 16-Bit Timer Mode Control Register 50 for Capture Operation.................................................110
6-9 Capture Operation Timing (Both Edges of CPT5 Pin Are Specified)..........................................................110
6-10 Readout Timing of 16-Bit Timer Counter 50...............................................................................................111
7-1 Block Diagram of 8-Bit Timer/Event Counter 00.........................................................................................116
7-2 Block Diagram of 8-Bit Timer/Event Counter 01.........................................................................................116
7-3 Block Diagram of 8-Bit Timer 02.................................................................................................................117
7-4 Format of 8-Bit Timer Mode Control Register 00........................................................................................118
7-5 Format of 8-Bit Timer Mode Control Register 01........................................................................................119
7-6 Format of 8-Bit Timer Mode Control Register 02........................................................................................120
7-7 Format of Port Mode Register 2 .................................................................................................................121
7-8 Interval Timer Operation Timing of Timer 00 and Timer 01........................................................................123
7-9 Interval Timer Operation Timing of Timer 02..............................................................................................124
7-10 External Event Counter Operation Timing (with Rising Edge Specified) ....................................................125
7-11 Square-Wave Output Timing......................................................................................................................127
7-12 Start Timing of 8-Bit Timer Counters 00, 01, and 02 ..................................................................................128
7-13 External Event Counter Operation Timing..................................................................................................128
8-1 Block Diagram of Watch Timer...................................................................................................................129
8-2 Format of Watch Timer Mode Control Register..........................................................................................131
8-3 Watch Timer/Interval Timer Operation Timing............................................................................................133
9-1 Block Diagram of Watchdog Timer.............................................................................................................135
9-2 Format of Timer Clock Selection Register 2...............................................................................................136
9-3 Format of Watchdog Timer Mode Register ................................................................................................137
10-1 Block Diagram of 8-Bit A/D Converter ........................................................................................................141
10-2 Format of A/D Converter Mode Register 0 .................................................................................................143
10-3 Format of A/D Input Selection Register 0 ...................................................................................................144
10-4 Basic Operation of 8-Bit A/D Converter......................................................................................................146
10-5 Relationship Between Analog Input Voltage and A/D Conversion Result...................................................147
10-6 Software-Started A/D Conversion ..............................................................................................................148
10-7 How to Reduce Current Consumption in Standby Mode ............................................................................149
10-8 Conversion Result Readout Timing (When Conversion Result Is Undefined Value) ..................................150
10-9 Conversion Result Readout Timing (When Conversion Result Is Normal Value).......................................150
10-10 Analog Input Pin Processing ......................................................................................................................151
10-11 A/D Conversion End Interrupt Request Generation Timing........................................................................152
18 User’s Manual U13952EJ3V1UD
LIST OF FIGURES (3/5)
Figure No. Title Page
10-12 AVDD Pin Processing ..................................................................................................................................152
11-1 Block Diagram of 10-Bit A/D Converter ......................................................................................................154
11-2 Format of A/D Converter Mode Register 0 .................................................................................................156
11-3 Format of A/D Input Selection Register 0 ...................................................................................................157
11-4 Basic Operation of 10-Bit A/D Converter ....................................................................................................159
11-5 Relationship Between Analog Input Voltage and A/D Conversion Result...................................................160
11-6 Software-Started A/D Conversion...............................................................................................................161
11-7 How to Reduce Current Consumption in Standby Mode ............................................................................162
11-8 Conversion Result Readout Timing (When Conversion Result Is Undefined Value) ..................................163
11-9 Conversion Result Readout Timing (When Conversion Result Is Normal Value).......................................163
11-10 Analog Input Pin Processing ......................................................................................................................164
11-11 A/D Conversion End Interrupt Request Generation Timing ........................................................................165
11-12 AVDD Pin Processing ..................................................................................................................................165
12-1 Block Diagram of Comparator ....................................................................................................................167
12-2 Format of Comparator Mode Register 0 .....................................................................................................168
12-3 Settings of Comparator Mode Register 0 for Comparator Operation..........................................................169
12-4 Settings of External Interrupt Mode Register 1 at INTCMP0 Occurrence...................................................169
12-5 Comparator Operation Timing ....................................................................................................................170
13-1 Block Diagram of Serial Interface 00 ..........................................................................................................173
13-2 Block Diagram of Baud Rate Generator .....................................................................................................174
13-3 Format of Serial Operation Mode Register 00 ............................................................................................176
13-4 Format of Asynchronous Serial Interface Mode Register 00 ......................................................................177
13-5 Format of Asynchronous Serial Interface Status Register 00 .....................................................................179
13-6 Format of Baud Rate Generator Control Register 00 .................................................................................180
13-7 Format of Asynchronous Serial Interface Transmit/Receive Data ..............................................................191
13-8 Asynchronous Serial Interface Transmission Completion Interrupt Timing.................................................193
13-9 Asynchronous Serial Interface Reception Completion Interrupt Timing......................................................194
13-10 Receive Error Timing..................................................................................................................................195
13-11 3-Wire Serial I/O Mode Timing ...................................................................................................................201
14-1 Block Diagram of LCD Controller/Driver .....................................................................................................204
14-2 Format of LCD Display Mode Register 0 ....................................................................................................205
14-3 Format of LCD Port Selector 0 ...................................................................................................................206
14-4 Format of LCD Clock Control Register 0 ....................................................................................................207
14-5 Relationship Between LCD Display Data Memory Contents and Segment/Common Outputs ...................208
14-6 Common Signal Waveforms.......................................................................................................................211
14-7 Voltages and Phases of Common and Segment Signals ...........................................................................212
14-8 Examples of LCD Drive Power Connections (with On-Chip Voltage Divider Resistors) .............................214
14-9 Static LCD Display Pattern and Electrode Connections .............................................................................215
14-10 Example of Connecting Static LCD Panel ..................................................................................................216
14-11 Static LCD Drive Waveform Examples .......................................................................................................217
User’s Manual U13952EJ3V1UD 19
LIST OF FIGURES (4/5)
Figure No. Title Page
14-12 Two-Time-Slice LCD Display Pattern and Electrode Connections .............................................................218
14-13 Example of Connecting Two-Time-Slice LCD Panel ..................................................................................219
14-14 Two-Time-Slice LCD Drive Waveform Examples (1/2 Bias Method)..........................................................220
14-15 Three-Time-Slice LCD Display Pattern and Electrode Connections...........................................................221
14-16 Example of Connecting Three-Time-Slice LCD Panel................................................................................222
14-17 Three-Time-Slice LCD Drive Waveform Examples (1/2 Bias Method) .......................................................223
14-18 Three-Time-Slice LCD Drive Waveform Examples (1/3 Bias Method) .......................................................224
14-19 Four-Time-Slice LCD Display Pattern and Electrode Connections.............................................................225
14-20 Example of Connecting Four-Time-Slice LCD Panel..................................................................................226
14-21 Four-Time-Slice LCD Drive Waveform Examples (1/3 Bias Method) .........................................................227
15-1 Basic Configuration of Interrupt Function ...................................................................................................230
15-2 Format of Interrupt Request Flag Register .................................................................................................232
15-3 Format of Interrupt Mask Flag Register......................................................................................................233
15-4 Format of External Interrupt Mode Register 0 ............................................................................................234
15-5 Format of External Interrupt Mode Register 1 ............................................................................................235
15-6 Configuration of Program Status Word.......................................................................................................236
15-7 Format of Key Return Mode Register 00....................................................................................................237
15-8 Block Diagram of Falling Edge Detector.....................................................................................................237
15-9 Flowchart of Non-Maskable Interrupt Request Acknowledgment ...............................................................239
15-10 Timing of Non-Maskable Interrupt Request Acknowledgment....................................................................239
15-11 Non-Maskable Interrupt Request Acknowledgment ...................................................................................239
15-12 Interrupt Acknowledgment Program Algorithm ...........................................................................................240
15-13 Interrupt Request Acknowledgment Timing (Example: MOV A, r)..............................................................241
15-14 Interrupt Request Acknowledgment Timing (When Interrupt Request Flag
Is Generated in Final Clock Under Execution)............................................................................................241
15-15 Example of Multiple Interrupt......................................................................................................................242
16-1 Format of Oscillation Stabilization Time Selection Register .......................................................................245
16-2 Releasing HALT Mode by Interrupt ............................................................................................................247
16-3 Releasing HALT Mode by RESET Input.....................................................................................................248
16-4 Releasing STOP Mode by Interrupt............................................................................................................250
16-5 Releasing STOP Mode by RESET Input ....................................................................................................251
17-1 Block Diagram of Reset Function...............................................................................................................252
17-2 Reset Timing by RESET Input ...................................................................................................................253
17-3 Reset Timing by Overflow in Watchdog Timer ...........................................................................................253
17-4 Reset Timing by RESET Input in STOP Mode ...........................................................................................253
18-1 Environment for Writing Program to Flash Memory....................................................................................257
18-2 Communication Mode Selection Format ....................................................................................................258
18-3 Example of Connection with Dedicated Flash Programmer .......................................................................259
18-4 VPP Pin Connection Example......................................................................................................................261
18-5 Signal Conflict (Serial Interface Input Pin)..................................................................................................262
20 User’s Manual U13952EJ3V1UD
LIST OF FIGURES (5/5)
Figure No. Title Page
18-6 Malfunction of Another Device....................................................................................................................262
18-7 Signal Conflict (RESET Pin) .......................................................................................................................263
18-8 Example of Flash Memory Writing Adapter Connection When Using 3-Wire Serial I/O Mode....................264
18-9 Example of Flash Memory Writing Adapter Connection When Using UART Mode ....................................265
18-10 Example of Flash Memory Writing Adapter Connection When Using Pseudo 3-Wire Mode
(When P0 Is Used) .....................................................................................................................................266
A-1 Development Tools.....................................................................................................................................302
A-2 Package Drawing of EV-9200GC-80 (for Reference) .................................................................................307
A-3 Recommended Footprint of EV-9200GC-80 (for Reference)......................................................................308
A-4 Package Drawing of TGK-080SDW (for Reference)...................................................................................309
A-5 Package Drawing of TGC-080SBP (for Reference)....................................................................................310
B-1 Distance Between In-Circuit Emulator and Conversion Socket (80GC) .....................................................311
B-2 Connection Condition of Target System (NP-80GC-TQ) ............................................................................312
B-3 Distance Between In-Circuit Emulator and Conversion Adapter (80GK) ....................................................313
B-4 Connection Condition of Target System (NP-80GK) ..................................................................................314
User’s Manual U13952EJ3V1UD 21
LIST OF TABLES (1/2)
Table No. Title Page
2-1 Types of Pin I/O Circuits...............................................................................................................................41
3-1 Internal ROM Capacity .................................................................................................................................48
3-2 Vector Table.................................................................................................................................................48
3-3 Special Function Register List......................................................................................................................59
4-1 Port Functions ..............................................................................................................................................71
4-2 Configuration of Port ....................................................................................................................................72
4-3 Port Mode Register and Output Latch Settings When Using Alternate Functions ........................................85
5-1 Configuration of Clock Generator .................................................................................................................89
5-2 Maximum Time Required for Switching CPU Clock .....................................................................................99
6-1 Configuration of 16-Bit Timer 50.................................................................................................................102
6-2 Interval Time of 16-Bit Timer 50 .................................................................................................................107
6-3 Settings of Capture Edge ...........................................................................................................................110
7-1 Interval Time of 8-Bit Timer/Event Counter 00 ...........................................................................................114
7-2 Interval Time of 8-Bit Timer/Event Counter 01 ...........................................................................................114
7-3 Interval Time of 8-Bit Timer 02 ...................................................................................................................114
7-4 Square-Wave Output Range of 8-Bit Timer 02...........................................................................................115
7-5 Configuration of 8-Bit Timer/Event Counters 00 to 02 ................................................................................115
7-6 Interval Time of 8-Bit Timer/Event Counter 00 ...........................................................................................122
7-7 Interval Time of 8-Bit Timer/Event Counter 01 ...........................................................................................122
7-8 Interval Time of 8-Bit Timer 02 ...................................................................................................................123
7-9 Square-Wave Output Range of 8-Bit Timer 02...........................................................................................126
8-1 Interval Time of Interval Timer....................................................................................................................130
8-2 Configuration of Watch Timer.....................................................................................................................130
8-3 Interval Time of Interval Timer....................................................................................................................132
9-1 Program Loop Detection Time of Watchdog Timer ....................................................................................134
9-2 Interval Time ..............................................................................................................................................134
9-3 Configuration of Watchdog Timer...............................................................................................................135
9-4 Program Loop Detection Time of Watchdog Timer ....................................................................................138
9-5 Interval Time of Interval Timer....................................................................................................................139
10-1 Configuration of 8-Bit A/D Converter ..........................................................................................................140
11-1 Configuration of 10-Bit A/D Converter ........................................................................................................153
12-1 INTCMP0 Valid Edges ...............................................................................................................................169
13-1 Configuration of Serial Interface 00 ............................................................................................................172
22 User’s Manual U13952EJ3V1UD
LIST OF TABLES (2/2)
Table No. Title Page
13-2 Operation Mode Settings of Serial Interface 00..........................................................................................178
13-3 Example of Relationship Between Main System Clock and Baud Rate......................................................181
13-4 Relationship Between ASCK Pin Input Frequency and Baud Rate (When BRGC00 Is Set to 80H)...........182
13-5 Example of Relationship Between Main System Clock and Baud Rate......................................................189
13-6 Relationship Between ASCK Pin Input Frequency and Baud Rate (When BRGC00 Is Set to 80H)...........190
13-7 Receive Error Causes ................................................................................................................................195
14-1 Maximum Number of Pixels........................................................................................................................202
14-2 Configuration of LCD Controller/Driver .......................................................................................................203
14-3 Frame Frequencies (Hz).............................................................................................................................207
14-4 COM Signals ..............................................................................................................................................209
14-5 LCD Drive Voltage......................................................................................................................................210
14-6 LCD Drive Voltages (with On-Chip Voltage Divider Resistors) ...................................................................213
14-7 Select and Deselect Voltages (COM0) .......................................................................................................215
14-8 Select and Deselect Voltages (COM0 and COM1).....................................................................................218
14-9 Select and Deselect Voltages (COM0 to COM2)........................................................................................221
14-10 Select and Deselect Voltages (COM0 to COM3)........................................................................................225
15-1 Interrupt Source List ...................................................................................................................................229
15-2 Flags Corresponding to Interrupt Request Signal Name ............................................................................231
15-3 Time from Generation of Maskable Interrupt Request to Servicing ............................................................240
16-1 HALT Mode Operating Status ....................................................................................................................246
16-2 Operation After Release of HALT Mode .....................................................................................................248
16-3 STOP Mode Operating Status....................................................................................................................249
16-4 Operation After Release of STOP Mode ....................................................................................................251
17-1 Hardware Status After Reset......................................................................................................................254
18-1 Differences Between
µ
PD78F9418A and Mask ROM Versions .................................................................256
18-2 Communication Mode List ..........................................................................................................................258
18-3 Pin Connection List.....................................................................................................................................260
19-1 Selection of Mask Option for Pins ..............................................................................................................267
19-2 Combination of Selectable Voltage Division Resistor .................................................................................267
20-1 Operand Identifiers and Description Methods.............................................................................................268
24-1 Surface Mounting Type Soldering Conditions.............................................................................................298
User’s Manual U13952EJ3V1UD 23
CHAPTER 1 GENERAL
1.1 Features
• ROM and RAM capacities
Item Program Memory Data Memory
Part Number
Internal High-Speed
RAM
LCD Data RAM
µ
PD789405A, 789415A ROM 12 KB 512 bytes 28 × 4 bits
µ
PD789406A, 789416A 16 KB
µ
PD789407A, 789417A 24 KB
µ
PD78F9418A Flash memory 32 KB
• Minimum instruction execution time can be changed from high speed (0.4
µ
s: @ 5.0 MHz operation with main
system clock) to ultra low speed (122
µ
s: @ 32.768 kHz operation with subsystem clock)
• 43 I/O ports
• Serial interface channel: Switchable between 3-wire serial I/O and UART modes
• LCD controller/driver:
Up to 28 segment signal outputs
Up to 4 common signal outputs
Bias switchable between 1/2 and 1/3
• Seven A/D converters with an 8-bit resolution (for
µ
PD789407A Subseries only)
• Seven A/D converters with a 10-bit resolution (for
µ
PD789417A Subseries only)
• Six timers:
16-bit timer
Two 8-bit timer/event counters
8-bit timer
Watch timer
Watchdog timer
• 17 vectored interrupt sources
• Power supply voltage: VDD = 1.8 to 5.5 V
• Operating ambient temperature: TA = –40 to +85°C
1.2 Applications
APS compact cameras, manometers, rice cookers, etc.
CHAPTER 1 GENERAL
24 User’s Manual U13952EJ3V1UD
1.3 Ordering Information
Part Number Package Internal ROM
µ
PD789405AGC-xxx-8BT 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789405AGK-xxx-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789406AGC-xxx-8BT 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789406AGK-xxx-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789407AGC-xxx-8BT 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789407AGK-xxx-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789415AGC-xxx-8BT 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789415AGK-xxx-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789416AGC-xxx-8BT 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789416AGK-xxx-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789417AGC-xxx-8BT 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789417AGK-xxx-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD78F9418AGC-8BT 80-pin plastic QFP (14 x 14) Flash memory
µ
PD78F9418AGK-9EU 80-pin plastic TQFP (fine pitch) (12 x 12) Flash memory
µ
PD789405AGC-xxx-8BT-A 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789405AGK-xxx-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789406AGC-xxx-8BT-A 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789406AGK-xxx-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789407AGC-xxx-8BT-A 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789407AGK-xxx-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789415AGC-xxx-8BT-A 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789415AGK-xxx-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789416AGC-xxx-8BT-A 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789416AGK-xxx-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD789417AGC-xxx-8BT-A 80-pin plastic QFP (14 x 14) Mask ROM
µ
PD789417AGK-xxx-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Mask ROM
µ
PD78F9418AGC-8BT-A 80-pin plastic QFP (14 x 14) Flash memory
µ
PD78F9418AGK-9EU-A 80-pin plastic TQFP (fine pitch) (12 x 12) Flash memory
Remarks 1. xxx indicates ROM code suffix.
2. Products that have the part numbers suffixed by "-A" are lead-free products.
CHAPTER 1 GENERAL
User’s Manual U13952EJ3V1UD 25
1.4 Pin Configuration (Top View)
80-pin plastic QFP (14 x 14)
80-pin plastic TQFP (fine pitch) (12 x 12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
V
DD1
BIAS
V
LC0
V
LC1
V
LC2
V
SS1
COM0
COM1
COM2
COM3
S0
S1
S2
S3
S4
S5
S6
S7
S8
S9
P50
P51
P52
P53
P20/SCK/ASCK
P21/SO/TxD
P22/SI/RxD
P23/CMPTOUT0/TO2
P24/INTP0/TI0
P25/INTP1/TI1
P26/INTP2/TO5
P27/INTP3/CPT5
AV
SS
P60/ANI0/CMPIN0
P61/ANI1/CMPREF0
P62/ANI2
P63/ANI3
P64/ANI4
P65/ANI5
P66/ANI6
S10
S11
S12
S13
S14
S15
P93/S16
P92/S17
P91/S18
P90/S19
P87/S20
P86/S21
P85/S22
P84/S23
P83/S24
P82/S25
P81/S26
P80/S27
AV
DD
AV
REF
P40/KR0
P41/KR1
P42/KR2
P43/KR3
P44/KR4
P45/KR5
IC (V
PP
)
XT1
XT2
V
DD0
V
SS0
X1
X2
RESET
P46
P47
P00
P01
P02
P03
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
Cautions 1. Connect the IC (Internally Connected) pin directly to VSS0 or VSS1.
2. Connect the AVDD pin to VDD0.
3. Connect the AVSS pin to VSS0.
Remark The parenthesized values apply to the
µ
PD78F9418A.
CHAPTER 1 GENERAL
26 User’s Manual U13952EJ3V1UD
ANI0 to ANI6: Analog input P60 to P66: Port 6
ASCK: Asynchronous serial input P80 to P87: Port 8
AVDD: Analog power supply P90 to P93: Port 9
AVREF: Analog reference voltage RESET: Reset
AVSS: Analog ground RxD: Receive data
BIAS: LCD power supply bias control S0 to S27: Segment output
CMPIN0: Comparator input SCK: Serial clock
CMPREF0: Comparator reference SI: Serial input
CMPTOUT0: Comparator output SO: Serial output
COM0 to COM3: Common output TI0, TI1: Timer input
CPT5: Capture trigger input TO2, TO5: Timer output
IC: Internally connected TxD: Transmit data
INTP0 to INTP3: Interrupt from peripherals VDD0, VDD1: Power supply
KR0 to KR5: Key return VLC0 to VLC2: LCD power supply
P00 to P03: Port 0 VPP: Programming power supply
P20 to P27: Port 2 VSS0, VSS1: Ground
P40 to P47: Port 4 X1, X2: Crystal (main system clock)
P50 to P53: Port 5 XT1, XT2: Crystal (subsystem clock)
CHAPTER 1 GENERAL
User’s Manual U13952EJ3V1UD 27
1.5 78K/0S Series Lineup
The products in the 78K/0S Series are listed below. The names enclosed in boxes are subseries names.
52-pin SIO + resistance division method LCD (24 × 4)
8-bit A/D + internal voltage boosting method LCD (23 × 4)
PD789327
LCD drive
80-pin
80-pin
PD789436
PD789446
PD789426
PD789456
PD789417A
PD789407A
PD789316
PD789467
PD789306
PD789426 with 10-bit A/D
PD789860 with enhanced timer function, SIO, and expanded ROM and RAM
PD789446 with 10-bit A/D
SIO + 8-bit A/D + resistance division method LCD (28 × 4)
SIO + 8-bit A/D + internal voltage boosting method LCD (15 × 4)
PD789407A with 10-bit A/D
SIO + 8-bit A/D + internal voltage boosting method LCD (5 × 4)
RC oscillation version of PD789306
SIO + internal voltage boosting method LCD (24 × 4)
64-pin
64-pin
52-pin
64-pin
64-pin
64-pin
SIO + 10-bit A/D + internal voltage boosting method LCD (28 × 4)
80-pin
SIO + 8-bit A/D + resistance division method LCD (28 × 4)
80-pin PD789479
PD789489
64-pin
Products under
development
Products in mass
production
Small-scale package, general-purpose applications
78K/0S
Series
28-pin
PD789014 with enhanced timer function and expanded ROM and RAM
On-chip UART and capable of low-voltage (1.8 V) operation
PD789074 with subsystem clock added
Inverter control
44-pin PD789842 On-chip inverter controller and UART
PD789146
PD789156
44-pin
Small-scale package, general-purpose applications and A/D function
44-pin
30-pin
30-pin
30-pin
30-pin
PD789124A
PD789134A
PD789177
PD789167
30-pin
30-pin
PD789104A
PD789114A
PD789167 with 10-bit A/D
PD789104A with enhanced timer function
PD789124A with 10-bit A/D
RC oscillation version of PD789104A
PD789104A with 10-bit A/D
PD789026 with 8-bit A/D and multiplier added
PD789104A with EEPROM
added
PD789146 with 10-bit A/D
PD789177Y
PD789167Y
Y subseries supports SMB.
USB
88-pin PD789830
PD789835
144-pin
UART + dot LCD (40 × 16)
UART + 8-bit A/D + dot LCD (total display outputs: 96)
42-/44-pin
44-pin
30-pin
20-pin
20-pin
PD789026 with enhanced timer function
RC oscillation version of PD789052
VFD drive
52-pin
64-pin
PD789871 On-chip VFD controller (total display outputs: 25)
Meter control
PD789881 UART + resistance division method LCD (26 × 4)
30-pin PD789074 with enhanced timer function and expanded ROM and RAM
44-pin PD789800 For PC keyboard. On-chip USB function
Keyless entry
20-pin
20-pin
30-pin
On-chip POC and key return circuit
RC oscillation version of PD789860
On-chip bus controller
30-pin PD789850 On-chip CAN controller
µµ
µ
µ
µ
µ
µ
µ
µ
µ
PD789074
PD789088
PD789062
PD789014
PD789046
PD789026
PD789052
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
PD789860
PD789861
PD789862
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
PD789860 without EEPROM
TM
, POC, and LVI
µµ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
µ
Remark VFD (Vacuum Fluorescent Display) is referred to as FIPTM (Fluorescent Indicator Panel) in some
documents, but the functions of the two are the same.
CHAPTER 1 GENERAL
28 User’s Manual U13952EJ3V1UD
The major functional differences between the subseries are listed below.
Series for general-purpose applications and LCD drive
Timer VDD Function
Subseries
ROM
Capacity
(Bytes) 8-Bit 16-Bit Watch WDT
8-Bit
A/D
10-Bit
A/D
Serial Interface I/O
MIN.Value
Remarks
µ
PD789046 16 K 1 ch
µ
PD789026 4 K to 16 K
1 ch 34
µ
PD789088
16 K to 32 K
3 ch
µ
PD789074 2 K to 8 K 1 ch
1 ch
24
µ
PD789014 2 K to 4 K 2 ch
1 ch 1 ch (UART: 1 ch)
22
1.8 V
µ
PD789062 4 K 14 RC-oscillation
version
Small-
scale
package,
general-
purpose
applica-
tions
µ
PD789052
µ
PD789177 8 ch
µ
PD789167
16 K to 24 K
3 ch 1 ch
8 ch
31
µ
PD789156 4 ch
µ
PD789146
8 K to 16 K
4 ch
On-chip
EEPROM
µ
PD789134A 4 ch
µ
PD789124A 4 ch
RC-oscillation
version
µ
PD789114A 4 ch
Small-
scale
package,
general-
purpose
applica-
tions +
A/D
converter
µ
PD789104A
2 K to 8 K
1 ch
1 ch
1 ch
4 ch
1 ch (UART: 1 ch)
20
1.8 V
µ
PD789835
24 K to 60 K
6 ch 3 ch 37 1.8 VNote
µ
PD789830 24 K 1 ch
1 ch (UART: 1 ch)
30 2.7 V
Dot LCD
supported
µ
PD789489
32 K to 48 K
8 ch
µ
PD789479
24 K to 48 K
8 ch
2 ch (UART: 1 ch) 45
µ
PD789417A 7 ch
µ
PD789407A
12 K to 24 K
3 ch
1 ch
1 ch 1 ch
7 ch
1 ch (UART: 1 ch) 43
1.8 V
µ
PD789456 6 ch
µ
PD789446 6 ch
30
µ
PD789436 6 ch
µ
PD789426
12 K to 16 K
6 ch
40
µ
PD789316 RC-oscillation
version
µ
PD789306
8 K to 16 K
2 ch (UART: 1 ch) 23
µ
PD789467 1 ch 18
LCD
drive
µ
PD789327
4 K to 24 K
2 ch
1 ch 21
Note Flash memory version: 3.0 V
CHAPTER 1 GENERAL
User’s Manual U13952EJ3V1UD 29
Series for ASSP
Timer VDD Function
Subseries
ROM
Capacity
(Bytes) 8-Bit 16-Bit Watch WDT
8-Bit
A/D
10-Bit
A/D
Serial Interface I/O
MIN.Value
Remarks
USB
µ
PD789800 8 K 2 ch 1 ch 2 ch (USB: 1 ch) 31 4.0 V
Inverter
control
µ
PD789842 8 K to 16 K 3 ch Note 1 1 ch 1 ch 8 ch 1 ch (UART: 1 ch) 30 4.0 V
On-chip
bus
controller
µ
PD789850 16 K 1 ch 1 ch 1 ch 4 ch 2 ch (UART: 1 ch) 18 4.0 V
µ
PD789861 1.8 V RC-oscillation
version,
on-chip
EEPROM
µ
PD789860
4 K 2 ch 1 ch 14
Keyless
entry
µ
PD789862 16 K 1 ch 2 ch 1 ch (UART: 1 ch) 22
On-chip
EEPROM
VFD
drive
µ
PD789871 4 K to 8 K 3 ch 1 ch 1 ch 1 ch 33 2.7 V
Meter
control
µ
PD789881 16 K
2 ch 1 ch 1 ch 1 ch (UART: 1 ch) 28 2.7 VNote 2
Notes 1. 10-bit timer: 1 channel
2. Flash memory version: 3.0 V
CHAPTER 1 GENERAL
30 User’s Manual U13952EJ3V1UD
1.6 Block Diagram
78K/0S
CPU core
ROM
(flash
memory)
RAM
V
DD0
V
DD1
V
SS0
V
SS1
IC
(V
PP
)
TI0/P24 8-bit timer
event/counter 00 P00 to P03
Port 0
P20 to P27
Port 2
P40 to P47Port 4
P50 to P53
Port 5
P60 to P66
Port 6
P80 to P87
Port 8
P90 to P93
Port 9
System control
TI1/P25 8-bit timer
event/counter 01
TO2/P23 8-bit timer 02
TO5/P26
CPT5/P27 16-bit timer 50
Watch timer
Watchdog timer
Serial
interface
SCK/ASCK/P20
SI/RxD/P22
SO/TxD/P21
Comparator
CMPTOUT0/P23
CMPREF0/P61
CMPIN0/P60
A/D converter
ANI0/P60
ANI2/P62 to
ANI6/P66
ANI1/P61
AV
DD
AV
SS
AV
REF
V
LC0
to V
LC2
BIAS
S0 to S15
S16/P93 to S19/P90
S20/P87 to S27/P80
COM0 to COM3
LCD
controller/driver
RESET
X1
X2
XT1
XT2
Interrupt
control
INTP0/P24
INTP1/P25
INTP2/P26
INTP3/P27
KR0/P40 to KR5/P45
Remarks 1. The internal ROM capacity varies depending on the product.
2. The parenthesized values apply to the
µ
PD78F9418A.
CHAPTER 1 GENERAL
User’s Manual U13952EJ3V1UD 31
1.7 Overview of Functions
Part Number
Item
µ
PD789405A
µ
PD789415A
µ
PD789406A
µ
PD789416A
µ
PD789407A
µ
PD789417A
µ
PD78F9418A
Internal memory ROM Mask ROM Flash memory
12 KB 16 KB 24 KB 32 KB
High-speed RAM 512 bytes
LCD data RAM 28 × 4 bits
Minimum instruction execution time • 0.4/1.6
µ
s (@ 5.0 MHz operation with main system clock)
• 122
µ
s (@ 32.768 kHz operation with subsystem clock)
General-purpose registers 8 bits × 8 registers
Instruction set 16-bit operations
Bit manipulation (set, reset, and test)
I/O ports Total of 43 port pins
7 CMOS input pins
32 CMOS I/O pins
4 N-ch open-drain pins (12 V withstanding voltage)
A/D converters Seven channels with 8-bit resolution (for
µ
PD789407A Subseries)
Seven channels with 10-bit resolution (for
µ
PD789417A Subseries)
Comparator With timer output control function
Serial interface Switchable between 3-wire serial I/O and UART modes
LCD controller/driver Up to 28 segment signal outputs
Up to 4 common signal outputs
Bias switchable between 1/2 and 1/3
Timers 16-bit timer: 1 channel
8-bit timer: 1 channel
8-bit timer/event counters: 2 channels
Watch timer: 1 channel
Watchdog timer: 1 channel
Timer output 2 outputs
Maskable Internal: 11, external: 5
Non-maskable Internal: 1
Power supply voltage VDD = 1.8 to 5.5 V
Operating ambient temperature TA = 40 to +85°C
Package 80-pin plastic QFP (14 x 14)
80-pin plastic TQFP (fine pitch) (12 x 12)
Vectored interrupt
sources
CHAPTER 1 GENERAL
32 User’s Manual U13952EJ3V1UD
An outline of the timer is shown below.
16-Bit
Timer 50
8-Bit
Timer/Event
Counters 00, 01
8-Bit
Timer 02
Watch Timer Watchdog
Timer
Interval timer 1 channel 1 channel 1 channelNote 1 1 channelNote 2 Operation
mode External event
counter
1 channel – – –
Timer outputs 1 – 1 – –
Square-wave
outputs
– – 1 – –
Capture 1 input – – – –
Function
Interrupt
sources
1 1 1 2 2
Notes 1. The watch timer can perform both watch timer and interval timer functions at the same time.
2. The watchdog timer has watchdog timer and interval timer functions. However, use the watchdog timer
by selecting either the watchdog timer function or interval timer function.
User’s Manual U13952EJ3V1UD 33
CHAPTER 2 PIN FUNCTIONS
2.1 List of Pin Functions
(1) Port pins
Pin Name I/O Function After Reset Alternate Function
P00 to P03 I/O Port 0.
4-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up resistor
can be specified by setting pull-up resistor option register 0
(PU0).
Input
P20 SCK/ASCK
P21 SO/TxD
P22 SI/RxD
P23 CMPTOUT0/TO2
P24 INTP0/TI0
P25 INTP1/TI1
P26 INTP2/TO5
P27
I/O Port 2.
8-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up resistor
can be specified by setting pull-up resistor option register 1
(PU1).
Input
INTP3/CPT5
P40 to P45 KR0 to KR5
P46, P47
I/O Port 4.
8-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up resistor
can be specified by setting pull-up resistor option register 0
(PU0).
Input
P50 to P53 I/O Port 5.
4-bit N-ch open-drain I/O port.
Input/output can be specified in 1-bit units.
For a mask ROM version, use of an on-chip pull-up resistor can
be specified by the mask option.
Input
P60 ANI0/CMPIN0
P61 ANI1/CMPREF0
P62 to P66
Input Port 6.
7-bit input port.
Input
ANI2 to ANI6
P80 to P87 I/O Port 8.
8-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up resistor
can be specified by setting pull-up resistor option register 2
(PU2).
Input S27 to S20
P90 to P93 I/O Port 9.
4-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up resistor
can be specified by setting pull-up resistor option register 2
(PU2).
Input S19 to S16
CHAPTER 2 PIN FUNCTIONS
34 User’s Manual U13952EJ3V1UD
(2) Non-port pins (1/2)
Pin Name I/O Function After Reset Alternate Function
INTP0 P24/TI0
INTP1 P25/TI1
INTP2 P26/TO5
INTP3
Input External interrupt input for which the valid edge (rising edge,
falling edge, or both rising and falling edges) can be specified
Input
P27/CPT5
KR0 to KR5 Input Key return signal detection Input P40 to P45
SI Input Serial interface serial data input Input P22/RxD
SO Output Serial interface serial data output Input P21/TxD
SCK I/O Serial interface serial clock input/output Input P20/ASCK
ASCK Input Serial clock input for asynchronous serial interface Input P20/SCK
RxD Input Serial data input for asynchronous serial interface Input P22/SI
TxD Output Serial data output for asynchronous serial interface Input P21/SO
TI0 Input External count clock input to 8-bit timer (TM00) Input P24/INTP0
TI1 Input External count clock input to 8-bit timer (TM01) Input P25/INTP1
TO2 Output 8-bit timer (TM02) output Input P23/CMPTOUT0
TO5 Output 16-bit timer (TM50) output Input P26/INTP2
CPT5 Input Capture edge input Input P27/INTP3
CMPTOUT0 Output Comparator output Input P23/TO2
CMPIN0 Input Comparator input Input P60/ANI0
CMPREF0 Input Comparator reference voltage input Input P61/ANI1
ANI0 Input A/D converter analog input Input P60/CMPIN0
ANI1 P61/CMPREF0
ANI2 to ANI6 P62 to P66
AVREF A/D converter reference voltage
AVSS A/D converter ground potential
AVDD A/D converter analog power supply
S0 to S15 Output LCD controller/driver segment signal output Output
S16 to S19 Input P93 to P90
S20 to S27 P87 to P80
COM0 to COM3 Output LCD controller/driver common signal output Output
VLC0 to VLC2 LCD driving voltage
BIAS Supply voltage for LCD driving
X1 Input Connecting crystal resonator for main system clock oscillation
X2
XT1 Input Connecting crystal resonator for subsystem clock oscillation
XT2
RESET Input System reset input Input
CHAPTER 2 PIN FUNCTIONS
User’s Manual U13952EJ3V1UD 35
(2) Non-port pins (2/2)
Pin Name I/O Function After Reset Alternate Function
VDD0 Positive power supply for ports
VDD1 Positive power supply for circuits other than ports
VSS0 Ground potential for ports
VSS1 Ground potential of circuits other than ports
IC Internally connected. Connect directly to VSS0 or VSS1.
VPP Sets flash memory programming mode.
Applies high voltage when a program is written or verified.
CHAPTER 2 PIN FUNCTIONS
36 User’s Manual U13952EJ3V1UD
2.2 Description of Pin Functions
2.2.1 P00 to P03 (Port 0)
These pins constitute a 4-bit I/O port and can be set to input or output port mode in 1-bit units by using port mode
register 0 (PM0). When these pins are used as input port pins, an on-chip pull-up resistor can be used by setting pull-
up resistor option register 0 (PU0).
2.2.2 P20 to P27 (Port 2)
These pins constitute an 8-bit I/O port. In addition to I/O port pins, these pins can also function as the data and
clock I/O of the serial interface, external interrupt input, and timer I/O.
The following operation modes can be specified in 1-bit units.
(1) Port mode
In this mode, P20 to P27 function as an 8-bit I/O port. These pins can be set to input or output mode in 1-bit
units by using port mode register 2 (PM2). When used as input port pins, an on-chip pull-up resistor can be
used by setting pull-up resistor option register 1 (PU1).
(2) Control mode
In this mode, P20 to P27 function as the data I/O and the clock I/O of the serial interface, the external
interrupt input, and timer I/O.
(a) SI, SO
These are the serial data I/O pins of the serial interface.
(b) SCK
This is the serial clock I/O pin of the serial interface.
(c) RxD, TxD
These are the serial data I/O pins of the asynchronous serial interface.
(d) ASCK
This is the serial clock input pin of the asynchronous serial interface.
(e) TI0, TI1
These are external clock input pins for the 8-bit timer/event counter.
(f) TO2
This is the output pin of the 8-bit timer.
(g) TO5
This is the output pin of the 16-bit timer.
(h) CPT5
This is the capture edge input pin.
CHAPTER 2 PIN FUNCTIONS
User’s Manual U13952EJ3V1UD 37
(i) INTP0 to INTP3
These are external interrupt input pins for which a valid edge (rising edge, falling edge, or both rising
and falling edges) can be specified.
(j) CMPTOUT0
This is the comparator output pin.
Caution When using P20 to P27 as serial interface pins, the I/O mode and output latch must be set
according to the function to be used. For details of the setting, refer to Table 13-2.
2.2.3 P40 to P47 (Port 4)
These pins constitute an 8-bit I/O port. In addition to I/O port pins, these pins can also function as key return
signal detection pins.
The following operation modes can be specified in 1-bit units.
(1) Port mode
In this mode, P40 to P47 function as an 8-bit I/O port. These pins can be set to input or output mode in 1-bit
units by using port mode register 4 (PM4). When used as input port pins, an on-chip pull-up resistor can be
used by setting pull-up resistor option register 0 (PU0).
(2) Control mode
In this mode, the pins function as key return signal detection pins (KR0 to KR5).
2.2.4 P50 to P53 (Port 5)
These pins constitute a 4-bit N-channel open-drain I/O port. In the mask ROM version, it is possible to specify that
pull-up resistors be used, via a mask option.
2.2.5 P60 to P66 (Port 6)
These pins constitute a 7-bit input-only port. In addition to general-purpose input port pins, these pins can also
function as A/D converter analog input pins and comparator input pins.
(1) Port mode
In this port mode, P60 to P66 function as a 7-bit input-only port.
(2) Control mode
In this mode, the pins can be used as A/D converter analog inputs and comparator inputs.
(a) ANI0 to ANI6
These are the A/D converter analog input pins.
(b) CMPIN0
This is the comparator input pin.
(c) CMPREF0
This is the comparator reference voltage input pin.
CHAPTER 2 PIN FUNCTIONS
38 User’s Manual U13952EJ3V1UD
2.2.6 P80 to P87 (Port 8)
These pins constitute an 8-bit I/O port. In addition to I/O port pins, these pins can also function as LCD
controller/driver segment signal.
The following operation modes can be specified in 1-bit units.
(1) Port mode
In this port mode, P80 to P87 function as an 8-bit I/O port. These pins can be set to input or output mode in
1-bit units by using port mode register 8 (PM8). When used as an input port pins, an on-chip pull-up resistor
can be used by setting pull-up resistor option register 2 (PU2).
(2) Control mode
In this mode, P80 to P87 function as segment signal output pins (S20 to S27) for the LCD controller/driver.
2.2.7 P90 to P93 (Port 9)
These pins constitute a 4-bit I/O port. In addition to I/O port pins, these pins can also function as LCD
controller/driver segment signal.
The following operation modes can be specified in 1-bit units.
(1) Port mode
In this mode, P90 to P93 function as a 4-bit I/O port. These pins can be set to input or output mode in 1-bit
units by using port mode register 9 (PM9). When used as input port pins, an on-chip pull-up resistor can be
used by setting pull-up resistor option register 2 (PU2).
(2) Control mode
In this mode, P90 to P93 function as segment signal output pins (S16 to S19) for the LCD controller/driver.
2.2.8 S0 to S15
These pins are segment signal output pins for the LCD controller/driver.
2.2.9 COM0 to COM3
These pins are common signal output pins for the LCD controller/driver.
2.2.10 VLC0 to VLC2
These pins are power supply voltage pins to drive the LCD.
2.2.11 BIAS
This pin supplies power to drive the LCD.
2.2.12 AVREF
This pin is the A/D converter reference voltage pin. Connect it to VDD0, VDD1, VSS0, or VSS1 when not using the A/D
converter.
2.2.13 AVDD
This pin is the A/D converter analog circuit power supply pin. Always keep it at the same potential as the VDD0 pin
(even when the A/D converter is not used).
CHAPTER 2 PIN FUNCTIONS
User’s Manual U13952EJ3V1UD 39
2.2.14 AVSS
This pin is the A/D converter ground potential pin. Always keep it at the same potential as the VSS0 pin (even when
the A/D converter is not used).
2.2.15 RESET
This pin inputs an active-low system reset signal.
2.2.16 X1, X2
These pins are used to connect a crystal resonator for main system clock oscillation.
To supply an external clock, input the clock to X1 and input the inverted signal to X2.
2.2.17 XT1, XT2
These pins are used to connect a crystal resonator for subsystem clock oscillation.
To supply an external clock, input the clock to XT1 and input the inverted signal to XT2.
2.2.18 VDD0, VDD1
VDD0 is the positive power supply pin for ports, while VDD1 is the positive power supply pin for other than ports.
2.2.19 VSS0, VSS1
VSS0 is the ground potential pin for ports, while the VSS1 is the ground potential pin for other than ports.
2.2.20 VPP (
µ
PD78F9418A only)
A high voltage should be applied to this pin when the flash memory programming mode is set and when the
program is written or verified.
Handle the pins in either of the following ways.
Independently connect a 10 k pull-down resistor.
Switch this pin to be directly connected to the dedicated flash programmer in programming mode or to VSS0 or
VSS1 in normal operation mode using a jumper on the board.
If the wiring between the VPP pin and VSS0 or VSS1 pin is long, or external noise is superimposed on the VPP pin, the
user program may not run correctly.
CHAPTER 2 PIN FUNCTIONS
40 User’s Manual U13952EJ3V1UD
2.2.21 IC (mask ROM version only)
The IC (internally connected) pin is used to set the
µ
PD789407A and
µ
PD789417A Subseries in the test mode
before shipment. In the normal operation mode, directly connect this pin to the VSS0 or VSS1 pin with as short a wiring
length as possible.
If a potential difference is generated between the IC pin and VSS0 or VSS1 pin due to a long wiring length between
these pin, or due to external noise superimposed on the IC pin, the user program may not run correctly.
Directly connect the IC pin to the VSS0 or VSS1 pin.
V
SS0
,
V
SS1
IC
Keep short
CHAPTER 2 PIN FUNCTIONS
User’s Manual U13952EJ3V1UD 41
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins
The I/O circuit type of each pin and recommended connection of unused pins are shown in Table 2-1.
For the I/O circuit configuration of each type, see Figure 2-1.
Table 2-1. Types of Pin I/O Circuits
Pin Name I/O Circuit
Type
I/O Recommended Connection of Unused Pins
P00 to P03 5-H
P20/SCK/ASCK
P21/SO/TxD
P22/SI/RxD
8-C
P23/CMPTOUT0/TO2 10-B
Input: Independently connect to VDD0, VDD1, VSS0, or VSS1 via a resistor.
Output: Leave open.
P24/INTP0/TI0
P25/INTP1/TI1
P26/INTP2/TO5
P27/INTP3/CPT5
Input: Independently connect to VSS0 or VSS1 via a resistor.
Output: Leave open.
P40/KR0 to P45/KR5
8-C
P46, P47 5-H
Input: Independently connect to VDD0, VDD1, VSS0, or VSS1 via a resistor.
Output: Leave open.
P50 to P53 (Mask ROM version) 13-U
P50 to P53 (
µ
PD78F9418A) 13-T
I/O
Input: Independently connect to VDD0 or VDD1 via a resistor.
Output: Leave open.
P60/ANI0/CMPIN0
P61/ANI1/CMPREF0
9-D
P62/ANI2 to P66/ANI6 9-C
Input Connect directly to VDD0, VDD1, VSS0, or VSS1.
P80/S27 to P87/S20
P90/S19 to P93/S16
17-F I/O Input: Independently connect to VDD0, VDD1, VSS0, or VSS1 via a resistor.
Output: Leave open.
S0 to S15 17-B
COM0 to COM3 18-A
Output
VLC0 to VLC2
Leave open.
BIAS Leave open. However, independently connect to VSS0 or VSS1 via a resistor
when none of VLC0 to VLC2 are used.
AVDD Connect directly to VDD0 or VDD1.
AVREF Connect directly to VDD0, VDD1, VSS0, or VSS1.
AVSS
Connect directly to VSS0 or VSS1.
XT1 Input Connect directly to VSS0 or VSS1.
XT2
Leave open.
RESET 2 Input
IC (Mask ROM version) Connect directly to VSS0 or VSS1.
VPP (
µ
PD78F9418A)
Independently connect to a 10 k pull-down resistor or connect directly
to VSS0 or VSS1.
CHAPTER 2 PIN FUNCTIONS
42 User’s Manual U13952EJ3V1UD
Figure 2-1. Pin I/O Circuits (1/2)
Type 2 Type 9-D
Schmitt-triggered input with hysteresis characteristics
IN
+
P-ch
N-ch
IN
Input
enable
Comparator
V
REF
AV
SS
(Threshold voltage)
Type 5-H Type 10-B
Pull-up
enable
Data
Output
disable
Input
enable
V
DD0
P-ch
V
DD0
P-ch
IN/OUT
N-ch
V
SS0
Pull-up
enable
Data
Open drain
Output disable
V
DD0
P-ch
V
DD0
P-ch
IN/OUT
N-ch
V
SS0
Type 8-C Type 13-T
Pull-up
enable
Data
Output
disable
VDD0
P-ch
VDD0
P-ch
IN/OUT
N-ch
VSS0
V
SS0
Data
Output disable
IN/OUT
N-ch
Middle-voltage
input buffer
Input
enable
Type 9-C Type 13-U
IN
Comparator
+
V
REF
(Threshold voltage)
AV
SS
P-ch
N-ch
Input
enable
V
SS0
Output data
Output disable
IN/OUT
V
DD0
N-ch
Middle-voltage
input buffer
Input enable
Pull-up resistor
(mask option)
CHAPTER 2 PIN FUNCTIONS
User’s Manual U13952EJ3V1UD 43
Figure 2-1. Pin I/O Circuits (2/2)
Type 17-B Type 17-F
P-ch
V
LC0
V
LC1
N-ch
P-ch
N-ch
V
LC2
V
SS1
SEG
data
P-ch
OUT
N-ch
Type 18-A
COM
data
OUT
P-ch
VLC0
VLC1 N-ch
VLC2
VSS1
P-ch
N-ch
P-ch
N-ch
N-ch
P-ch
P-ch
VLC0
VLC1
VLC2
VSS1
SEG
data P-ch
N-ch
N-ch
Data
Output
disable
P-ch
VDD0
VSS0
N-ch
SEG
output
disable
Input
enable
P-ch
VDD0
Pull-up
enable
IN/OUT
44 User’s Manual U13952EJ3V1UD
CHAPTER 3 CPU ARCHITECTURE
3.1 Memory Space
The
µ
PD789407A and
µ
PD789417A Subseries can access 64 KB of memory space. Figures 3-1 through 3-4
show the memory maps.
Figure 3-1. Memory Map (
µ
PD789405A and
µ
PD789415A)
Special function registers
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
Internal ROM
12288 × 8 bits
FFFFH
FF00H
FEFFH
FD00H
FCFFH
FA00H
F9FFH
0000H
Program
memory space
Data
memory space
2FFFH
0000H
Program area
0080H
007FH
Program area
0040H
003FH
CALLT table area
0024H
0023H
Vector table area
FA1CH
FA1BH
3000H
2FFFH
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 45
Figure 3-2. Memory Map (
µ
PD789406A and
µ
PD789416A)
Special function registers
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Internal ROM
16384 × 8 bits
FFFFH
FF00H
FEFFH
0000H
Program
memory space
Data
memory space
3FFFH
0000H
Program area
0080H
007FH
Program area
0040H
003FH
CALLT table area
0024H
0023H
Vector table area
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
FA1CH
FA1BH
4000H
3FFFH
CHAPTER 3 CPU ARCHITECTURE
46 User’s Manual U13952EJ3V1UD
Figure 3-3. Memory Map (
µ
PD789407A and
µ
PD789417A)
Special function registers
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Internal ROM
24576 × 8 bits
FFFFH
FF00H
FEFFH
0000H
Program
memory space
Data
memory space
5FFFH
0000H
Program area
0080H
007FH
Program area
0040H
003FH
CALLT table area
0024H
0023H
Vector table area
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
FA1CH
FA1BH
6000H
5FFFH
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 47
Figure 3-4. Memory Map (
µ
PD78F9418A)
Special function registers
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Flash memory
32768 × 8 bits
FFFFH
FF00H
FEFFH
0000H
Program
memory space
Data
memory space
7FFFH
0000H
Program area
0080H
007FH
Program area
0040H
003FH
CALLT table area
0024H
0023H
Vector table area
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
FA1CH
FA1BH
8000H
7FFFH
CHAPTER 3 CPU ARCHITECTURE
48 User’s Manual U13952EJ3V1UD
3.1.1 Internal program memory space
The internal program memory space stores programs and table data. This space is usually addressed by the
program counter (PC).
The products in the
µ
PD789407A and
µ
PD789417A Subseries contain the following internal ROM (or flash
memory) capacities.
Table 3-1. Internal ROM Capacity
Part Number Internal ROM
Structure Capacity
µ
PD789405A, 789415A Mask ROM 12288 × 8 bits
µ
PD789406A, 789416A 16384 × 8 bits
µ
PD789407A, 789417A 24576 × 8 bits
µ
PD78F9418A Flash memory 32768 × 8 bits
The following areas are allocated to the internal program memory space.
(1) Vector table area
The 36-byte area of addresses 0000H to 0023H is reserved as a vector table area. This area stores program
start addresses to be used when branching by RESET input or interrupt request generation. Of a 16-bit
program address, the lower 8 bits are stored in an even address, and the higher 8 bits are stored in an odd
address.
Table 3-2. Vector Table
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
0000H RESET input 0014H INTWTI
0004H INTWDT 0016H INTTM00
0006H INTP0 0018H INTTM01
0008H INTP1 001AH INTTM02
000AH INTP2 001CH INTTM50
000CH INTP3 001EH INTKR00
000EH INTSR00/INTCSI00 0020H INTAD0
0010H INTST00 0022H INTCMP0
0012H INTWT
(2) CALLT instruction table area
The subroutine entry address of a 1-byte call instruction (CALLT) can be stored in the 64-byte area of
addresses 0040H to 007FH.
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 49
3.1.2 Internal data memory space
The
µ
PD789407A and
µ
PD789417A Subseries products incorporate the following RAM:
(1) Internal high-speed RAM
An internal high-speed RAM is allocated to the area between FD00H and FEFFH.
The internal high-speed RAM is also used as a stack.
(2) LCD data RAM
An LCD data RAM is allocated to the area between FA00H and FA1BH.
The LCD display RAM can also be used as ordinary RAM.
3.1.3 Special function register (SFR) area
Special function registers (SFRs) of on-chip peripheral hardware are allocated to the area of FF00H to FFFFH (see
Table 3-3).
CHAPTER 3 CPU ARCHITECTURE
50 User’s Manual U13952EJ3V1UD
3.1.4 Data memory addressing
The
µ
PD789407A and
µ
PD789417A Subseries are provided with a variety of addressing modes to make memory
manipulation as efficient as possible. In the area that holds data memory (FD00H to FFFFH) especially, specific
modes of addressing that correspond to the particular function of an area, such as the special function registers (SFR)
or general-purpose registers, are available. Figures 3-5 through 3-8 show the data memory addressing modes.
Figure 3-5. Data Memory Addressing (
µ
PD789405A and
µ
PD789415A)
Special function registers (SFR)
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Internal ROM
12288 × 8 bits
FFFFH
0000H
Direct addressing
Register indirect
addressing
Based addressing
FF00H
FEFFH
FF20H
FF1FH
FE20H
FE1FH
SFR addressing
Short direct
addressing
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
3000H
2FFFH
FA1CH
FA1BH
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 51
Figure 3-6. Data Memory Addressing (
µ
PD789406A and
µ
PD789416A)
Special function registers (SFR)
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Internal ROM
16384 × 8 bits
FFFFH
0000H
Direct addressing
Register indirect
addressing
Based addressing
FF00H
FEFFH
FF20H
FF1FH
FE20H
FE1FH
SFR addressing
Short direct
addressing
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
4000H
3FFFH
FA1CH
FA1BH
CHAPTER 3 CPU ARCHITECTURE
52 User’s Manual U13952EJ3V1UD
Figure 3-7. Data Memory Addressing (
µ
PD789407A and
µ
PD789417A)
Special function registers (SFR)
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Internal ROM
24576 × 8 bits
FFFFH
0000H
Direct addressing
Register indirect
addressing
Based addressing
FF00H
FEFFH
FF20H
FF1FH
FE20H
FE1FH
SFR addressing
Short direct
addressing
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
6000H
5FFFH
FA1CH
FA1BH
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 53
Figure 3-8. Data Memory Addressing (
µ
PD78F9418A)
Special function registers (SFR)
256 × 8 bits
Internal high-speed RAM
512 × 8 bits
Flash memory
32768 × 8 bits
FFFFH
0000H
Direct addressing
Register indirect
addressing
Based addressing
FF00H
FEFFH
FF20H
FF1FH
FE20H
FE1FH
SFR addressing
Short direct
addressing
RAM space for LCD data
28 × 4 bits
Reserved
Reserved
FD00H
FCFFH
FA00H
F9FFH
8000H
7FFFH
FA1CH
FA1BH
CHAPTER 3 CPU ARCHITECTURE
54 User’s Manual U13952EJ3V1UD
3.2 Processor Registers
The
µ
PD789407A and
µ
PD789417A Subseries are provided with the following on-chip processor registers.
3.2.1 Control registers
The control registers contains special functions to control the program sequence statuses and stack memory. A
program counter, a program status word, and a stack pointer constitute the control registers.
(1) Program counter (PC)
The program counter is a 16-bit register that holds the address information of the next program to be
executed.
In normal operation, the PC is automatically incremented according to the number of bytes of the instruction
to be fetched. When a branch instruction is executed, immediate data or register contents are set.
RESET input sets the program counter to the reset vector table values at addresses 0000H and 0001H.
Figure 3-9. Program Counter Configuration
015
PC14PC15PC PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
(2) Program status word (PSW)
The program status word is an 8-bit register consisting of various flags to be set/reset by instruction
execution.
Program status word contents are automatically stacked upon interrupt request generation or PUSH PSW
instruction execution and are automatically restored upon execution of the RETI and POP PSW instructions.
RESET input sets the PSW to 02H.
Figure 3-10. Program Status Word Configuration
70
IE Z 0 AC 0 0 1 CY
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 55
(a) Interrupt enable flag (IE)
This flag controls the interrupt request acknowledgment operations of the CPU.
When 0, IE is set to the interrupt disable status (DI), and all interrupt requests other than non-maskable
interrupts are disabled.
When 1, IE is set to the interrupt enable status (EI). At this time, interrupt request acknowledgment is
controlled by an interrupt mask flag corresponding to the interrupt source.
IE is reset (0) upon DI instruction execution or interrupt acknowledgment and is set (1) upon EI
instruction execution.
(b) Zero flag (Z)
When the operation result is zero, this flag is set (1). It is reset (0) in all other cases.
(c) Auxiliary carry flag (AC)
If the operation result has a carry from bit 3 or a borrow at bit 3, this flag is set (1). It is reset (0) in all
other cases.
(d) Carry flag (CY)
This flag stores an overflow or underflow upon add/subtract instruction execution. It stores the shift-out
value upon rotate instruction execution and functions as a bit accumulator during bit manipulation
instruction execution.
CHAPTER 3 CPU ARCHITECTURE
56 User’s Manual U13952EJ3V1UD
(3) Stack pointer (SP)
This is a 16-bit register used to hold the start address of the memory stack area. Only the internal high-
speed RAM area can be set as the stack area.
Figure 3-11. Stack Pointer Configuration
015
SP14SP15SP SP13 SP12 SP11 SP10 SP9 SP8 SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0
The SP is decremented ahead of write (save) to the stack memory and is incremented after read (restore)
from the stack memory.
Each stack operation saves/restores data as shown in Figures 3-12 and 3-13.
Caution Since RESET input makes the SP contents undefined, be sure to initialize the SP before
instruction execution.
Figure 3-12. Data Saved to Stack Memory
Interrupt
PSW
PC15 to PC8
PC15 to PC8
PC7 to PC0
Lower
register pairs
SP SP _ 2
SP _ 2
CALL, CALLT
instructions
PUSH rp
instruction
SP _ 1
SP
SP SP _ 2
SP _ 2
SP _ 1
SP
PC7 to PC0
SP _ 3
SP _ 2
SP _ 1
SP
SP SP _ 3
Higher
register pairs
Figure 3-13. Data Restored from Stack Memory
RETI instruction
PSW
PC15 to PC8
PC15 to PC8
PC7 to PC0
Lower
register pairs
RET instructionPOP rp
instruction
SP PC7 to PC0
Higher
register pairs
SP + 1
SP SP + 2
SP
SP + 1
SP SP + 2
SP
SP + 1
SP + 2
SP SP + 3
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 57
3.2.2 General-purpose registers
The general-purpose registers consist 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 be used in pairs as a 16-bit register (AX,
BC, DE, and HL).
General-purpose registers can be described in terms of functional names (X, A, C, B, E, D, L, H, AX, BC, DE, and
HL) and absolute names (R0 to R7 and RP0 to RP3).
Figure 3-14. General-Purpose Register Configuration
(a) Absolute names
R0
15 0 7 0
16-bit processing 8-bit processing
RP3
RP2
RP1
RP0
R1
R2
R3
R4
R5
R6
R7
(b) Functional names
X
15 0 7 0
16-bit processing 8-bit processing
HL
DE
BC
AX
A
C
B
E
D
L
H
CHAPTER 3 CPU ARCHITECTURE
58 User’s Manual U13952EJ3V1UD
3.2.3 Special function registers (SFR)
Unlike a general-purpose register, each special function register has a special function.
SFRs are allocated in the 256-byte area FF00H to FFFFH.
A special function register can be manipulated, like a general-purpose register, using operation, transfer, and bit
manipulation instructions. The manipulatable bit unit (1, 8, or 16) differs depending on the special function register
type.
Each manipulation bit unit can be specified as follows.
• 1-bit manipulation
Describes a symbol reserved by assembler for the 1-bit manipulation instruction operand (sfr.bit). This
manipulation can also be specified by an address.
• 8-bit manipulation
Describes a symbol reserved by assembler for the 8-bit manipulation instruction operand (sfr). This
manipulation can also be specified by an address.
• 16-bit manipulation
Describes a symbol reserved by assembler for the 16-bit manipulation instruction operand. When addressing an
address, describe an even address.
Table 3-3 lists the special function registers. The meanings of the symbols in this table are as follows:
• Symbol
Indicates the address of the special function register. The symbols shown in this column are reserved words in
the assembler, and have been defined in the header file named “sfrbit.h” in the C compiler. Therefore, these
symbols can be used as instruction operands if an assembler or integrated debugger is used.
• R/W
Indicates whether the special function register in question can be read or written.
R/W: Read/write
R: Read only
W: Write only
Manipulatable bit unit
Indicates the bit units (1, 8, 16) in which the special function register in question can be manipulated.
After reset
Indicates the status of the special function register when the RESET signal is input.
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 59
Table 3-3. Special Function Register List (1/2)
Address Special Function Register (SFR) Name Symbol R/W Manipulatable Bit Unit After Reset
1 Bit 8 Bits 16 Bits
FF00H Port 0 P0 R/W 00H
FF02H Port 2 P2
FF04H Port 4 P4
FF05H Port 5 P5
FF06H Port 6 P6 R
FF08H Port 8 P8 R/W
FF09H Port 9 P9
FF10H Transmit shift register 00 TXS00 SIO00 W FFH
Receive buffer register 00 RXB00 R Undefined
FF14H A/D conversion result register 0 ADCR0 Note 1 Note 2
FF15H
FF16H 16-bit compare register 50 CR50L W Notes 2, 3 FFFFH
FF17H CR50H
CR50
FF18H 16-bit timer counter 50 TM50L Notes 2, 3 0000H
FF19H TM50H
TM50
FF1AH 16-bit capture register 50 TCP50L Notes 2, 3 Undefined
FF1BH TCP50H
TCP50
R
FF20H Port mode register 0 PM0 R/W FFH
FF22H Port mode register 2 PM2
FF24H Port mode register 4 PM4
FF25H Port mode register 5 PM5
FF28H Port mode register 8 PM8
FF29H Port mode register 9 PM9
FF42H Timer clock selection register 2 TCL2 00H
FF48H 16-bit timer mode control register 50 TMC50
FF4AH Watch timer mode control register WTM
FF4EH Comparator mode register 0 CMPRM0
Notes 1. If the A/D conversion result register is used for the 8-bit A/D converter (
µ
PD789407A Subseries), it can
be accessed only in 8-bit units. In this case, it is considered to have been mapped at address FF15H.
If the register is used for the 10-bit A/D converter (
µ
PD789417A Subseries), it can be accessed only in
16-bit units. If the
µ
PD78F9418A is used as the flash memory version of the
µ
PD789405A,
µ
PD789406A, or
µ
PD789407A, 8-bit access is also possible, provided that the object file has been
assembled using the
µ
PD789405A,
µ
PD789406A, or
µ
PD789407A.
2. 16-bit access is possible only in short direct addressing.
3. Although CR50, TM50, and TCP50 are 16-bit access dedicated registers, an 8-bit access is also
possible. When performing an 8-bit access, use direct addressing.
CHAPTER 3 CPU ARCHITECTURE
60 User’s Manual U13952EJ3V1UD
Table 3-3. Special Function Register List (2/2)
Address Special Function Register (SFR) Name Symbol R/W Manipulatable Bit Unit After Reset
1 Bit 8 Bits 16 Bits
FF50H 8-bit compare register 00 CR00 W Undefined
FF51H 8-bit timer counter 00 TM00 R 00H
FF53H 8-bit timer mode control register 00 TMC00 R/W
FF54H 8-bit compare register 01 CR01 W Undefined
FF55H 8-bit timer counter 01 TM01 R 00H
FF57H 8-bit timer mode control register 01 TMC01 R/W
FF58H 8-bit compare register 02 CR02 W Undefined
FF59H 8-bit timer counter 02 TM02 R
FF5BH 8-bit timer mode control register 02 TMC02 R/W
FF70H Asynchronous serial interface mode register
00
ASIM00
FF71H Asynchronous serial interface status register
00
ASIS00 R
FF72H Serial operation mode register 00 CSIM00 R/W
FF73H Baud rate generator control register 00 BRGC00
FF80H A/D converter mode register 0 ADM0
FF84H A/D input selection register 0 ADS0
FFB0H LCD display mode register 0 LCDM0
FFB1H LCD port selector 0 LPS0
FFB2H LCD clock control register 0 LCDC0
FFE0H Interrupt request flag register 0 IF0
FFE1H Interrupt request flag register 1 IF1
00H
FFE4H Interrupt mask flag register 0 MK0 FFH
FFE5H Interrupt mask flag register 1 MK1
FFECH External interrupt mode register 0 INTM0 00H
FFEDH External interrupt mode register 1 INTM1
FFF0H Suboscillation mode register SCKM
FFF2H Subclock control register CSS
FFF3H Pull-up resistor option register 1 PU1
FFF4H Pull-up resistor option register 2 PU2
FFF5H Key return mode register 00 KRM00
FFF7H Pull-up resistor option register 0 PU0
FFF9H Watchdog timer mode register WDTM
FFFAH Oscillation stabilization time selection
register
OSTS
04H
FFFBH Processor clock control register PCC 02H
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 61
3.3 Instruction Address Addressing
An instruction address is determined by program counter (PC) contents. PC contents are 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. When a branch instruction is executed, the branch destination information is set to the PC and
branched by the following addressing (for details of each instruction, refer to the 78K/0S Series Instructions User’s
Manual (U11047E)).
3.3.1 Relative addressing
[Function]
The value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to the
start address of the following instruction is transferred to the program counter (PC) and branched. The
displacement value is treated as signed two’s complement data (128 to +127) and bit 7 becomes a sign bit.
This means that information is relatively branched to a location between 128 and +127, from the start address
of the next instruction when relative addressing is used.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
15 0
PC
15 0
S
15 0
PC
+
876
α
jdisp8
When S = 0, α indicates all bits 0.
... PC is the start address of
the next instruction of
a BR instruction.
When S = 1, α indicates all bits 1.
CHAPTER 3 CPU ARCHITECTURE
62 User’s Manual U13952EJ3V1UD
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 instruction is executed.
The CALL !addr16 and BR !addr16 instructions can be branched to any location in the memory space.
[Illustration]
In case of CALL !addr16 and BR !addr16 instructions
15 0
PC
87
70
CALL or BR
Low addr.
High addr.
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 63
3.3.3 Table indirect addressing
[Function]
The table contents (branch destination address) of the particular location to be addressed by the lower 5-bit
immediate data of an instruction code from bit 1 to bit 5 are transferred to the program counter (PC) and
branched.
This function is carried out when the CALLT [addr5] instruction is executed. The instruction enables a branch
to any location in the memory space by referring to the addresses stored in the memory table at 40H to 7FH.
[Illustration]
15 1
15 0
PC
70
Low addr.
High addr.
Memory (table)
Effective address + 1
Effective address 01
00000000
87
87
65 0
0
001
765 10
ta4–0
Instruction code
3.3.4 Register addressing
[Function]
The register pair (AX) contents to be specified with an instruction word are transferred to the program counter
(PC) and branched.
This function is carried out when the BR AX instruction is executed.
[Illustration]
70
rp
07
AX
15 0
PC
87
CHAPTER 3 CPU ARCHITECTURE
64 User’s Manual U13952EJ3V1UD
3.4 Operand Address Addressing
The following methods are available to specify the register and memory (addressing) to undergo manipulation
during instruction execution.
3.4.1 Direct addressing
[Function]
The memory indicated with immediate data in an instruction word is directly addressed.
[Operand format]
Identifier Description
addr16 Label or 16-bit immediate data
[Description example]
MOV A, !FE00H; When setting !addr16 to FE00H
Instruction code 0 0 101001Opcode
00000000
11111110
00H
FEH
[Illustration]
70
Opcode
addr16 (low)
addr16 (high)
Memory
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 65
3.4.2 Short direct addressing
[Function]
The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word.
The fixed space is the 256-byte space FE20H to FF1FH where the addressing is applied. An internal high-
speed RAM and special function registers (SFR) are mapped at FE20H to FEFFH and FF00H to FF1FH,
respectively.
The SFR area (FF00H to FF1FH) where short direct addressing is applied is a part of the whole SFR area.
Ports that are frequently accessed in a program and a compare register of the timer/event counter are mapped
in this area, and these SFRs can be manipulated with a small number of bytes and clocks.
When 8-bit immediate data is at 20H to FFH, bit 8 of an effective address is set to 0. When it is at 00H to 1FH,
bit 8 is set to 1. See [Illustration] below.
[Operand format]
Identifier Description
saddr Label or FE20H to FF1FH immediate data
saddrp Label or FE20H to FF1FH immediate data (even address only)
[Description example]
MOV FE30H, #50H; When setting saddr to FE30H and the immediate data to 50H
Instruction code 1 1110101
00110000
01010000
Opcode
30H (saddr-offset)
50H (Immediate data)
[Illustration]
15 0
Short direct memory
Effective
address 1111111
8
07
Opcode
saddr-offset
α
When 8-bit immediate data is 20H to FFH, α = 0.
When 8-bit immediate data is 00H to 1FH, α = 1.
CHAPTER 3 CPU ARCHITECTURE
66 User’s Manual U13952EJ3V1UD
3.4.3 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 using short direct addressing.
[Operand format]
Identifier Description
sfr Special function register name
[Description example]
MOV PM0, A; When selecting PM0 for sfr
Instruction code 11100111
00100000
[Illustration]
15 0
SFR
Effective
Address 1111111
87
07
Opcode
sfr-offset
1
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 67
3.4.4 Register addressing
[Function]
In the register addressing mode, general-purpose registers are accessed as operands. The general-purpose
register to be accessed is specified by the register specification code or functional name in the instruction code.
Register addressing is carried out when an instruction with the following operand format is executed. When an
8-bit register is specified, one of the eight registers is specified with 3 bits in the instruction code.
[Operand format]
Identifier Description
r X, A, C, B, E, D, L, H
rp AX, BC, DE, HL
r and rp can be described using absolute names (R0 to R7 and RP0 to RP3) as well as functional names (X, A,
C, B, E, D, L, H, AX, BC, DE, and HL).
[Description example]
MOV A, C; When selecting the C register for r
Instruction code 00001010
00100101
Register specification code
INCW DE; When selecting the DE register pair for rp
Instruction code 10001000
Register specification code
CHAPTER 3 CPU ARCHITECTURE
68 User’s Manual U13952EJ3V1UD
3.4.5 Register indirect addressing
[Function]
In the register indirect addressing mode, memory is manipulated according to the contents of a register pair
specified as an operand. The register pair to be accessed is specified by the register pair specification code in
an instruction code.
This addressing can be carried out for all the memory spaces.
[Operand format]
Identifier Description
[DE], [HL]
[Description example]
MOV A, [DE]; When selecting register pair [DE]
Instruction code 0 0101011
[Illustration]
15 0
8
D
7
E
07
7 0
A
DE
Addressed memory
contents are
transferred.
Memory address
specified with
register pair DE.
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U13952EJ3V1UD 69
3.4.6 Based addressing
[Function]
8-bit immediate data is added to the contents of the base register, that is, the HL register pair, and the sum is
used to address the memory. Addition is performed by expanding the offset data as a positive number to 16
bits. A carry from the 16th bit is ignored. This addressing can be carried out for all the memory spaces.
[Operand format]
Identifier Description
[HL+byte]
[Description example]
MOV A, [HL+10H]; When setting byte to 10H
Instruction code 00101101
00010000
3.4.7 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/restored upon generation of an interrupt request.
Stack addressing can only be used to access the internal high-speed RAM area.
[Description example]
In the case of PUSH DE
Instruction code 10101010
70 User’s Manual U13952EJ3V1UD
CHAPTER 4 PORT FUNCTIONS
4.1 Function of Port
The
µ
PD789407A and
µ
PD789417A Subseries are provided with the ports shown in Figure 4-1, enabling various
methods of control.
Numerous other functions are provided that can be used in addition to the digital I/O port function. For more
information on these additional functions, see CHAPTER 2 PIN FUNCTIONS.
Figure 4-1. Port Types
P50
P53
P00
P03
P60
P66
P80
P87
P40
P47
P90
P93
Port 5
Port 6
Port 9
Port 8
Port 4
P20
P27
Port 2
Port 0
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 71
Table 4-1. Port Functions
Pin Name I/O Function After Reset Alternate Function
P00 to P03 I/O Port 0.
4-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up
resistor can be specified by setting pull-up resistor
option register 0 (PU0).
Input
P20 SCK/ASCK
P21 SO/TxD
P22 SI/RxD
P23 CMPTOUT0/TO2
P24 INTP0/TI0
P25 INTP1/TI1
P26 INTP2/TO5
P27
I/O Port 2.
8-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up
resistor can be specified by setting pull-up resistor
option register 1 (PU1).
Input
INTP3/CPT5
P40 to P45
Input KR0 to KR5
P46, P47
I/O Port 4.
8-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up
resistor can be specified by setting pull-up resistor
option register 0 (PU0).
P50 to P53 I/O Port 5.
4-bit N-ch open-drain I/O port.
Input/output can be specified in 1-bit units.
For a mask ROM version, use of an on-chip pull-up
resistor can be specified by the mask option.
Input
P60 Input ANI0/CMPIN0
P61 ANI1/CMPREF0
P62 to P66
Input Port 6.
7-bit input port.
ANI2 to ANI6
P80 to P87 I/O Port 8.
8-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up
resistor can be specified by setting pull-up resistor
option register 2 (PU2).
Input S27 to S20
P90 to P93 I/O Port 9.
4-bit I/O port.
Input/output can be specified in 1-bit units.
When used as an input port, use of an on-chip pull-up
resistor can be specified by setting pull-up resistor
option register 2 (PU2).
Input S19 to S16
CHAPTER 4 PORT FUNCTIONS
72 User’s Manual U13952EJ3V1UD
4.2 Configuration of Ports
The ports consist of the following hardware.
Table 4-2. Configuration of Port
Item Configuration
Control registers Port mode registers (PMm: m = 0, 2, 4, 5, 8, 9)
Pull-up resistor option registers (PUm: m = 0 to 2)
Ports Total: 43 (input: 7, I/O: 36)
Pull-up resistors Mask ROM version
Total: 36 (software control: 32, mask option control: 4)
Flash memory version
Total: 32 (software control only)
4.2.1 Port 0
This is a 4-bit I/O port with an output latch. Port 0 can be specified as input or output in 1-bit units by using port
mode register 0 (PM0). When the P00 to P03 pins are used as input port pins, on-chip pull-up resistors can be
connected in 4-bit units by setting pull-up resistor option register 0 (PU0).
Port 0 is set to input mode when the RESET signal is input.
Figure 4-2 shows a block diagram of port 0.
Figure 4-2. Block Diagram of P00 to P03
Internal bus
WR
PU0
RD
WR
PORT
WR
PM
PU00
Output latch
(P00 to P03)
PM00 to PM03
V
DD0
P-ch
P00 to P03
Selector
PU0: Pull-up resistor option register 0
PM: Port mode register
RD: Port 0 read signal
WR: Port 0 write signal
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 73
4.2.2 Port 2
This is an 8-bit I/O port with an output latch. Port 2 can be specified as input or output in 1-bit units by using port
mode register 2 (PM2). When using the P20 to P27 pins as input port pins, on-chip pull-up resistors can be connected
in 1-bit units by setting pull-up resistor option register 1 (PU1).
Port 2 is also used as a data I/O and clock I/O to and from the serial interface, timer I/O, and external interrupt.
Port 2 is set to input mode when the RESET signal is input.
Figures 4-3 through 4-7 show block diagrams of port 2.
Caution When using the pins of port 2 for the serial interface, the I/O or output latch must be set
according to the function to be used. For how to set the latches, see Table 13-2 Operation Mode
Settings of Serial Interface 00.
Figure 4-3. Block Diagram of P20
Internal bus
V
DD0
P-ch
P20/ASCK/
SCK
WR
PU1
RD
WR
PORT
WR
PM
PU120
Alternate
function
Output latch
(P20)
PM20
Alternate
function
Selector
PU1: Pull-up resistor option register 1
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
CHAPTER 4 PORT FUNCTIONS
74 User’s Manual U13952EJ3V1UD
Figure 4-4. Block Diagram of P21
Internal bus
V
DD0
P-ch
P21/TxD/
SO
WR
PU1
RD
WR
PORT
WR
PM
PU121
Output latch
(P21)
PM21
Alternate
function
Selector
PU1: Pull-up resistor option register 1
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 75
Figure 4-5. Block Diagram of P22 and P24
Internal bus
V
DD0
P-ch
P22/RxD/SI
P24/INTP0/TI0
WR
PU1
RD
WR
PORT
WR
PM
PU122, PU124
Alternate
function
Output latch
(P22, P24)
PM22, PM24
Selector
PU1: Pull-up resistor option register 1
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
CHAPTER 4 PORT FUNCTIONS
76 User’s Manual U13952EJ3V1UD
Figure 4-6. Block Diagram of P23
Internal bus
RD
WRPU1
OPDR
PM23
Alternate
function
Alternate
function
Output latch
(P23)
PU123 P-ch
WRPORT
WRPM
VDD0
VDD0
P-ch
N-ch
P23/TO2
/CMPTOUT0
Selector
OPDR: Bit 1 of comparator mode register 0, selection of N-ch open-drain output
PU1: Pull-up resistor option register 1
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 77
Figure 4-7. Block Diagram of P25 to P27
Internal bus
VDD0
P25/INTP1/TI1
P26/INTP2/TO5
P27/INTP3/CPT5
WRPU1
RD
WRPORT
WRPM
PU125 to PU127
Alternate
function
Alternate
function
Output latch
(P25 to P27)
PM25 to PM27
Selector
P-ch
PU1: Pull-up resistor option register 1
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
CHAPTER 4 PORT FUNCTIONS
78 User’s Manual U13952EJ3V1UD
4.2.3 Port 4
This is an 8-bit I/O port with an output latch. Port 4 can be specified as input or output in 1-bit units by using port
mode register 4 (PM4). When using the P40 to P47 pins as input port pins, on-chip pull-up resistors can be connected
in 8-bit units by setting pull-up resistor option register 0 (PU0).
Port 4 is also used as a key return input.
Port 4 is set to input mode when the RESET signal is input.
Figures 4-8 and 4-9 show block diagrams of port 4.
Caution When using the pins of port 4 as the key return, the key return mode register must be set
according to the function to be used. For how to set the registers, see 15.3 (6) Key return mode
register 00 (KRM00).
Figure 4-8. Block Diagram of P40 to P45
WRKRM
Internal bus
VDD0
P40/KR0 to
P45/KR5
WRPU0
RD
WRPORT
WRPM
PU04
Alternate
function
Output latch
(P40 to P45)
PM40 to PM45
KRM000 to
KRM005
Selector
P-ch
KRM00: Key return mode register 00
PU0: Pull-up resistor option register 0
PM: Port mode register
RD: Port 4 read signal
WR: Port 4 write signal
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 79
Figure 4-9. Block Diagram of P46 and P47
Internal bus
WR
PU0
RD
WR
PORT
WR
PM
PU04
Output latch
(P46, P47)
PM46, PM47
V
DD0
P-ch
P46, P47
Selector
PU0: Pull-up resistor option register 0
PM: Port mode register
RD: Port 4 read signal
WR: Port 4 write signal
CHAPTER 4 PORT FUNCTIONS
80 User’s Manual U13952EJ3V1UD
4.2.4 Port 5
This is a 4-bit N-ch open-drain I/O port with an output latch. Port 5 can be specified as input or output in 1-bit units
by using port mode register 5 (PM5). For a mask ROM version, whether a pull-up resistor is to be incorporated can be
specified by a mask option.
Port 5 is set to input mode when the RESET signal is input.
Figure 4-10 shows a block diagram of port 5.
Figure 4-10. Block Diagram of P50 to P53
Internal bus
Selector
RD
PM50 to PM53
P50 to P53
N-ch
WRPORT
Output latch
(P50 to P53)
WRPM
VDD0
Mask option resistor
Mask ROM version only.
For the flash memory version,
a pull-up resistor is not
incorporated.
PM: Port mode register
RD: Port 5 read signal
WR: Port 5 write signal
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 81
4.2.5 Port 6
This is a 7-bit input port.
Port 6 is also used as an analog input to the A/D converter or comparator input.
Port 6 is set to input mode when the RESET signal is input.
Figures 4-11 and 4-12 show block diagrams of port 6.
Figure 4-11. Block Diagram of P60 and P61
Internal bus
VREF
RD
A/D converter
P60/ANI0/CMPIN0
P61/ANI1/CMPREF0
Comparator
+
CHAPTER 4 PORT FUNCTIONS
82 User’s Manual U13952EJ3V1UD
Figure 4-12. Block Diagram of P62 to P66
Internal bus
V
REF
RD
+
A/D converter
P62/ANI2 to
P66/ANI6
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 83
4.2.6 Port 8
This is an 8-bit I/O port with an output latch. Port 8 can be specified as input or output in 1-bit units by using port
mode register 8 (PM8). When using the P80 to P87 pins as input port pins, internal pull-up resistors can be connected
in 2-bit units by using pull-up resistor option register 2 (PU2).
Port 8 is also used to output segment signals for the LCD controller/driver.
Port 8 is set to input mode when the RESET signal is input.
Figure 4-13 shows a block diagram of port 8.
Figure 4-13. Block Diagram of P80 to P87
Internal bus
WR
PU2
V
DD0
P-ch
WR
PORT
WR
PM
Output latch
(P8m)
PM8m
LPS0
Segment output
WR
LPS
RD
PU28n
P80/S27 to P87/S20
Selector
PU2: Pull-up resistor option register 2
PM: Port mode register
RD: Port 8 read signal
WR: Port 8 write signal
LPS0: LCD port selector 0
n = 0, 2, 4, 6, m = 0 to 7
CHAPTER 4 PORT FUNCTIONS
84 User’s Manual U13952EJ3V1UD
4.2.7 Port 9
This is a 4-bit I/O port with an output latch. Port 9 can be specified as input or output in 1-bit units by using port
mode register 9 (PM9). When using the P90 to P93 pins as input port pins, on-chip pull-up resistors can be connected
in 2-bit units by using pull-up resistor option register 2 (PU2).
Port 9 is also used to output segment signals for the LCD controller/driver.
Port 9 is set to input mode when the RESET signal is input.
Figure 4-14 shows a block diagram of port 9.
Figure 4-14. Block Diagram of P90 to P93
Internal bus
WR
PU2
V
DD0
P-ch
WR
PORT
WR
PM
Output latch
(P9m)
PM9m
LPS0
Segment output
WR
LPS
RD
PU29n
P90/S19 to P93/S16
Selector
PU2: Pull-up resistor option register 2
PM: Port mode register
RD: Port 9 read signal
WR: Port 9 write signal
LPS0: LCD port selector 0
n = 0, 2, m = 0 to 3
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 85
4.3 Registers Controlling Ports
The following two registers control the ports.
Port mode registers (PM0, PM2, PM4, PM5, PM8, and PM9)
Pull-up resistor option registers (PU0 to PU2)
(1) Port mode registers (PM0, PM2, PM4, PM5, PM8, and PM9)
These registers are used to set port input/output in 1-bit units.
The port mode registers are independently set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets these registers to FFH.
When port pins are used as alternate-function pins, set the port mode register and output latch according to
Table 4-3.
Caution As port 2 has an alternate function as the external interrupt input, when the port function
output mode is specified and the output level is changed, the interrupt request flag is set.
When the output mode is used, therefore, the interrupt mask flag should be set to 1
beforehand.
Table 4-3. Port Mode Register and Output Latch Settings When Using Alternate Functions
Alternate Function Pin Name
Name I/O
PMxx Pxx
CMPTOUT0 Output 0 0 P23
TO2 Output 0 0
INTP0 Input 1 x P24
TI0 Input 1 x
INTP1 Input 1 x P25
TI1 Input 1 x
INTP2 Input 1 x P26
TO5 Output 0 0
INTP3 Input 1 x P27
CPT5 Input 1 x
P40 to P45Note KR0 to KR5 Input 1 x
P80 to P87 S27 to S20 Output 0 0
P90 to P93 S19 to S16 Output 0 0
Note Set key return mode register 00 (KRM00) to 1 when using the alternate function (see 15.3 (6) Key return
mode register 00 (KRM00)).
Caution When port 2 is used for the serial interface, the I/O or output latch must be set according to the
function used. For the setting method, see Table 13-2 Operation Mode Settings of Serial
Interface 00.
Remark x: Don’t care
PMxx: Port mode register
Pxx: Port output latch
CHAPTER 4 PORT FUNCTIONS
86 User’s Manual U13952EJ3V1UD
Figure 4-15. Format of Port Mode Register
PMmn
0 Output mode (output buffer on)
Input mode (output buffer off) 1
1
PM27
PM87
1
1
PM26
PM86
1
1
PM25
PM85
1
1
PM24
PM84
1
PM03
PM23
PM83
PM93
PM02
PM22
PM82
PM92
PM01
PM21
PM81
PM91
PM00
PM20
PM80
PM90
PM0
PM2
PM8
PM9
7
Symbol Address After reset
6543210 R/W
FF20H
FF22H
FF28H
FF29H
FFH
FFH
FFH
FFH
R/W
R/W
R/W
R/W
PM47
1
PM46
1
PM45
1
PM44
1
PM43
PM53
PM42
PM52
PM41
PM51
PM40
PM50
PM4
PM5
FF24H
FF25H
FFH
FFH
R/W
R/W
Pmn pin I/O mode selection
m = 0, 5, 9: n = 0 to 3
m = 2, 4, 8: n = 0 to 7
(2) Pull-up resistor option registers (PU0 to PU2)
The pull-up resistor option registers (PU0 to PU2) set whether an on-chip pull-up resistor is used on each
port.
On a port specified by PU0 to PU2 to use an on-chip pull-up resistor, the pull-up resistor can be internally
used only for the bits set in the input mode. No on-chip pull-up resistors can be used for the bits set in the
output mode regardless of the setting of PU0 to PU2. This also applies when using the pins for alternate
functions.
PU0 to PU2 are set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PU0 to PU2 to 00H.
Figure 4-16. Format of Pull-Up Resistor Option Register 0
Pm on-chip pull-up resistor selection
Note
(m = 0 or 4)
0 0 0 PU04 0 0 0 PU00PU0
Address After reset R/W
FFF7H 00H R/W
765<4>321<0>
PU0m
0
1
On-chip pull-up resistor not used
On-chip pull-up resistor used
Symbol
Note PU0 selects whether on-chip pull-up resistors are to be used in 8-bit units, except for port 0, for which on-
chip pull-up resistors can be used only for four bits (P00 to P03).
Caution Bits 1, 2, 3, 5, 6, and 7 must be fixed to 0.
CHAPTER 4 PORT FUNCTIONS
User’s Manual U13952EJ3V1UD 87
Figure 4-17. Format of Pull-Up Resistor Option Register 1
P2 on-chip pull-up resistor selectionNote
(m = 0 to 7)
PU127 PU126 PU125 PU124 PU123 PU122 PU121 PU120
PU1
Address After reset R/W
FFF3H 00H R/W
<7> <6> <5> <4> <3> <2> <1> <0>
PU12m
0
1
On-chip pull-up resistor not used
On-chip pull-up resistor used
Symbol
Note PU1 selects whether on-chip pull-up resistors are to be used in 1-bit units.
Figure 4-18. Format of Pull-Up Resistor Option Register 2
Pm on-chip pull-up resistor selection
Note
(m = 8 or 9; n = 0, 2, 4, or 6)
00
PU292 PU290 PU286 PU284 PU282 PU280
PU2
Address After reset R/W
FFF4H 00H R/W
7 6 <5> <4> <3> <2> <1> <0>
PU2mn
0
1
On-chip pull-up resistor not used
On-chip pull-up resistor used
Symbol
Note PU2 selects whether on-chip pull-up resistors are to be used in 2-bit units (bit n and bit n+1).
Caution Bits 6 and 7 must be fixed to 0.
CHAPTER 4 PORT FUNCTIONS
88 User’s Manual U13952EJ3V1UD
4.4 Operation of Ports
The operation of a port differs depending on whether the port is set in the input or output mode, as described
below.
4.4.1 Writing to I/O port
(1) In output mode
A value can be written to the output latch of a port by using a transfer instruction. The contents of the output
latch can be output from the pins of the port.
Once data is written to the output latch, it is retained until new data is written to the output latch.
(2) In input mode
A value can be written to the output latch by using a transfer instruction. However, the status of the port pin
is not changed because the output buffer is off.
Once data is written to the output latch, it is retained until new data is written to the output latch.
Caution A 1-bit memory manipulation instruction is executed to manipulate 1 bit of a port.
However, this instruction accesses the port in 8-bit units. When this instruction is
executed to manipulate a bit of an I/O port, therefore, the contents of the output latch of the
pin that is set in the input mode and not subject to manipulation become undefined.
4.4.2 Reading from I/O port
(1) In output mode
The contents of the output latch can be read by using a transfer instruction. The contents of the output latch
are not changed.
(2) In input mode
The status of a pin can be read by using a transfer instruction. The contents of the output latch are not
changed.
4.4.3 Arithmetic operation of I/O port
(1) In output mode
An arithmetic operation can be performed on the contents of the output latch. The result of the operation is
written to the output latch. The contents of the output latch are output from the port pins.
Once data is written to the output latch, it is retained until new data is written to the output latch.
(2) In input mode
The contents of the output latch become undefined. However, the status of the pin is not changed because
the output buffer is off.
Caution A 1-bit memory manipulation instruction is executed to manipulate 1 bit of a port.
However, this instruction accesses the port in 8-bit units. When this instruction is
executed to manipulate a bit of an I/O port, therefore, the contents of the output latch of the
pin that is set in the input mode and not subject to manipulation become undefined.
User’s Manual U13952EJ3V1UD
89
CHAPTER 5 CLOCK GENERATOR
5.1 Functions of Clock Generator
The clock generator generates the clock to be supplied to the CPU and peripheral hardware.
The following two types of system clock oscillators are used.
Main system clock oscillator
This circuit oscillates at 1.0 to 5.0 MHz. Oscillation can be stopped by executing the STOP instruction or setting
the processor clock control register (PCC).
Subsystem clock oscillator
This circuit oscillates at 32.768 kHz. Oscillation can be stopped by the suboscillation mode register (SCKM).
5.2 Configuration of Clock Generator
The clock generator consists of the following hardware.
Table 5-1. Configuration of Clock Generator
Item Configuration
Control registers Processor clock control register (PCC)
Suboscillation mode register (SCKM)
Subclock control register (CSS)
Oscillators Main system clock oscillator
Subsystem clock oscillator
CHAPTER 5 CLOCK GENERATOR
90 User’s Manual U13952EJ3V1UD
Figure 5-1. Block Diagram of Clock Generator
f
XT
f
X
Prescaler
f
X
2
2
f
XT
2
1/2
Prescaler
Watch timer
LCD controller/driver
Clock to
peripheral
hardware
CPU clock
(f
CPU
)
Standby
controller
Wait
controller
Selector
STOP MCC PCC1 CLS CSS0
Internal bus
Suboscillation mode register
(SCKM)
FRC SCC
Internal bus
Subclock control
register (CSS)
Processor clock
control register
(PCC)
Subsystem
clock
oscillator
X1
X2
XT1
XT2
Main system
clock
oscillator
CHAPTER 5 CLOCK GENERATOR
User’s Manual U13952EJ3V1UD 91
5.3 Registers Controlling Clock Generator
The clock generator is controlled by the following registers.
Processor clock control register (PCC)
Suboscillation mode register (SCKM)
Subclock control register (CSS)
(1) Processor clock control register (PCC)
PCC selects the CPU clock and sets the division ratio.
PCC is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PCC to 02H.
Figure 5-2. Format of Processor Clock Control Register
0.4 s
1.6 s
122 s
Control of main system clock oscillator operation
MCC00000PCC1 0PCC
Symbol Address After reset R/W
FFFBH 02H R/W
76543210
MCC
0
1
Operation enabled
Operation disabled
Selection of CPU clock (f
CPU
)
Note
CSS0
0
0
1
1
PCC1
0
1
0
1
f
X
f
X
/2
2
f
XT
/2
µ
µ
µ
Minimum instruction execution time: 2/f
CPU
f
X
= 5.0 MHz or f
XT
= 32.768 kHz operation
Note The CPU clock is selected according to a combination of the PCC1 flag in the processor clock control
register (PCC) and the CSS0 flag in the subclock control register (CSS). See 5.3 (3) Subclock control
register (CSS).
Cautions 1. Bits 0 and 2 to 6 must be fixed to 0.
2. The MCC bit can be set only when the subsystem clock has been selected as the CPU clock.
Remarks 1. fX: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
CHAPTER 5 CLOCK GENERATOR
92 User’s Manual U13952EJ3V1UD
(2) Suboscillation mode register (SCKM)
SCKM selects whether a feedback resistor is used for the subsystem clock, and controls the oscillation of the
clock.
SCKM is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets SCKM to 00H.
Figure 5-3. Format of Suboscillation Mode Register
Feedback resistor selection
Note
000000FRCSCCSCKM
Symbol Address After reset R/W
FFF0H 00H R/W
76543210
FRC
0
1
On-chip feedback resistor used
On-chip feedback resistor not used
Control of subsystem clock oscillator operation
SCC
0
1
Operation enabled
Operation disabled
Note The feedback resistor is necessary to adjust the bias point of the oscillation waveform to close to the mid
point of the supply voltage. Only when the subclock is not used, the power consumption in STOP mode
can be further reduced by setting FRC = 1.
Cautions 1. Bits 2 to 7 must be fixed to 0.
2. Do not set the SCC bit when an external clock pulse is input, because the XT2 pin is pulled
up to VDD0 or VDD1.
CHAPTER 5 CLOCK GENERATOR
User’s Manual U13952EJ3V1UD 93
(3) Subclock control register (CSS)
CSS specifies whether the main system or subsystem clock oscillator is to be selected. It also specifies how
the CPU clock operates.
CSS is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets CSS to 00H.
Figure 5-4. Format of Subclock Control Register
CPU clock operation status
0 0 CLS CSS0 0000CSS
Address After reset R/W
FFF2H 00H R/W
76543210
CLS
0
1
Operation based on the output of the divided main system clock
Operation based on the subsystem clock
Selection of main system or subsystem clock oscillatorCSS0
0
1
Divided output from the main system clock oscillator
Output from the subsystem clock oscillator
Symbol
Note
Note Bit 5 is read only.
Caution Bits 0, 1, 2, 3, 6, and 7 must be fixed to 0.
CHAPTER 5 CLOCK GENERATOR
94 User’s Manual U13952EJ3V1UD
5.4 System Clock Oscillators
5.4.1 Main system clock oscillator
The main system clock oscillator is oscillated by a crystal or ceramic resonator (5.0 MHz TYP.) connected across
the X1 and X2 pins.
An external clock can also be input to the circuit. In this case, input the clock signal to the X1 pin, and input the
inverted signal to the X2 pin.
Figure 5-5 shows the external circuit of the main system clock oscillator.
Figure 5-5. External Circuit of Main System Clock Oscillator
(a) Crystal or ceramic oscillation (b) External clock
Crystal
or
ceramic resonator
VSS0, VSS1
X2
X1
External
clock X1
X2
Caution When using the main system or subsystem clock oscillator, wire as follows in the area enclosed
by the broken lines in Figures 5-5 and 5-6 to avoid an adverse effect from wiring capacitance.
Keep the wiring length as short as possible.
Do not cross the wiring with the other signal lines. Do not route the wiring near a signal line
through which a high fluctuating current flows.
Always make the ground point of the oscillator capacitor the same potential as VSS0 and VSS1.
Do not ground the capacitor to a ground pattern through which a high current flows.
Do not fetch signals from the oscillator.
CHAPTER 5 CLOCK GENERATOR
User’s Manual U13952EJ3V1UD 95
5.4.2 Subsystem clock oscillator
The subsystem clock oscillator is oscillated by a crystal resonator (32.768 kHz TYP.) connected across the XT1
and XT2 pins.
An external clock can also be input to the circuit. In this case, input the clock signal to the XT1 pin, and input the
inverted signal to the XT2 pin.
Figure 5-6 shows the external circuit of the subsystem clock oscillator.
Figure 5-6. External Circuit of Subsystem Clock Oscillator
(a) Crystal oscillation (b) External clock
XT2
V
SS0
,V
SS1
XT1
32.768
kHz
Crystal resonator
External
clock XT1
XT2
Caution When using the main system or subsystem clock oscillator, wire as follows in the area enclosed
by the broken lines in Figures 5-5 and 5-6 to avoid an adverse effect from wiring capacitance.
Keep the wiring length as short as possible.
Do not cross the wiring with the other signal lines. Do not route the wiring near a signal line
through which a high fluctuating current flows.
Always make the ground point of the oscillator capacitor the same potential as VSS0 and VSS1.
Do not ground the capacitor to a ground pattern through which a high current flows.
Do not fetch signals from the oscillator.
When using the subsystem clock oscillator, pay special attention because the subsystem clock
oscillator has low amplification to minimize current consumption.
CHAPTER 5 CLOCK GENERATOR
96 User’s Manual U13952EJ3V1UD
5.4.3 Examples of incorrect resonator connection
Figure 5-7 shows examples of incorrect resonator connection.
Figure 5-7. Examples of Incorrect Resonator Connection (1/2)
(a) Too long wiring (b) Crossed signal line
VSS0,
VSS1 X1 X2
VSS0,
VSS1 X1 X2
PORTn
(n = 0, 2, 4, 5, 6, 8, 9)
(c) Wiring near high fluctuating current (d) Current flowing through ground line of oscillator
(potential at points A, B, and C fluctuates)
VSS0,
VSS1 X1 X2
High current
VSS0,
VSS1 X1
AB C
Pmn
VDD0, VDD1
High current
X2
Remark When using the subsystem clock, read X1 and X2 as XT1 and XT2, respectively, and connect resistors
to the XT2 side in series.
CHAPTER 5 CLOCK GENERATOR
User’s Manual U13952EJ3V1UD 97
Figure 5-7. Examples of Incorrect Resonator Connection (2/2)
(e) Signal is fetched (f) Signal lines of main system clock and subsystem
clock are parallel and close together
VSS0,
VSS1 X1 X2
VSS0,
VSS1 X2
XT2 is wired parallel to X1.
X1 XT2 XT1
Remark When using the subsystem clock, read X1 and X2 as XT1 and XT2, respectively, and connect resistors
to the XT2 side in series.
Caution If the X1 wire is parallel with the XT2 wire, crosstalk noise may occur between X1 and XT2,
resulting in a malfunction.
To avoid this, do not place the X1 and XT2 wires in parallel.
5.4.4 Divider
The divider divides the output of the main system clock oscillator (fX) to generate various clocks.
5.4.5 When no subsystem clock is used
If a subsystem clock is not necessary, for example, for low-power consumption operation or clock operation,
handle the XT1 and XT2 pins as follows:
XT1: Connect directly to VSS0 or VSS1
XT2: Leave open
In this case, however, a small current leaks via the on-chip feedback resistor in the subsystem clock oscillator
when the main system clock is stopped. To avoid this, set bit 1 (FRC) of the suboscillation mode register (SCKM) so
that the on-chip feedback resistor will not be used. Also in this case, handle the XT1 and XT2 pins as stated above.
CHAPTER 5 CLOCK GENERATOR
98 User’s Manual U13952EJ3V1UD
5.5 Operation of Clock Generator
The clock generator generates the following clocks and controls the operation modes of the CPU, such as the
standby mode.
Main system clock fX
Subsystem clock fXT
CPU clock fCPU
Clock to peripheral hardware
The operation of the clock generator is determined by the processor clock control register (PCC), suboscillation
mode register (SCKM), and subclock control register (CSS), as follows.
(a) The slow mode (1.6
µ
s at 5.0 MHz operation) of the main system clock is selected when the RESET
signal is generated (PCC = 02H). While a low level is being input to the RESET pin, oscillation of the
main system clock is stopped.
(b) Three types of minimum instruction execution time (0.4
µ
s and 1.6
µ
s main system clock (at 5.0 MHz
operation), 122
µ
s subsystem clock (at 32.768 kHz operation)) can be selected by the PCC, SCKM, and
CSS settings.
(c) Two standby modes, STOP and HALT, can be used with the main system clock selected. In a system
where no subsystem clock is used, setting bit 1 (FRC) of SCKM so that the on-chip feedback resistor
cannot be used reduces current consumption in the STOP mode. In a system where a subsystem clock
is used, setting bit 0 of SCKM to 1 can cause the subsystem clock to stop oscillation.
(d) Bit 4 (CSS0) of CSS can be used to select the subsystem clock so that low current consumption
operation is used (at 122
µ
s, 32.768 kHz operation).
(e) With the subsystem clock selected, it is possible to cause the main system clock to stop oscillating by
setting bit 7 (MCC) of PCC. The HALT mode can be used, but the STOP mode cannot.
(f) The clock pulse for the peripheral hardware is generated by dividing the frequency of the main system
clock. The subsystem clock pulse is supplied to 8-bit timer 02, the watch timer, and the LCD
controller/driver only. As a result, 8-bit timer 02 (when watch timer output is selected for the count clock
when the subsystem clock is running) and the watch function can continue running even in the standby
mode. The other hardware stops when the main system clock stops, because it runs based on the main
system clock (except for external input clock pulses).
CHAPTER 5 CLOCK GENERATOR
User’s Manual U13952EJ3V1UD 99
5.6 Changing Setting of System Clock and CPU Clock
5.6.1 Time required for switching between system clock and CPU clock
The CPU clock can be selected by using bit 1 (PCC1) of the processor clock control register (PCC) and bit 4
(CSS0) of the subclock control register (CSS).
Actually, the specified clock is not selected immediately after the setting of PCC has been changed; the old clock
is used for the duration of several instructions after that (see Table 5-2).
Table 5-2. Maximum Time Required for Switching CPU Clock
Set Value Before Switching Set Value After Switching
CSS0 PCC1 CSS0 PCC1 CSS0 PCC1 CSS0 PCC1
0 0 0 1 1 x
0 0 4 clocks 2fX/fXT clocks
(306 clocks)
1 2 clocks fX/2fXT clocks
(76 clocks)
1 x 2 clocks 2 clocks
Remarks 1. Two clocks is the minimum instruction execution time of the CPU clock before switching.
2. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
3. x: Don’t care
CHAPTER 5 CLOCK GENERATOR
100 User’s Manual U13952EJ3V1UD
5.6.2 Switching between system clock and CPU clock
The following figure illustrates how the CPU clock and system clock are switched.
Figure 5-8. Switching Between System Clock and CPU Clock
System clock
CPU clock
Interrupt request signal
RESET
V
DD
f
X
f
X
f
XT
f
X
Low-speed
operation
High-speed
operation
Subsystem clock
operation
High-speed
operation
Wait (6.55 ms: at 5.0 MHz operation)
Internal reset operation
<1> The CPU is reset when the RESET pin is made low on power application. Reset is released when the
RESET pin is later made high, and the main system clock starts oscillating. At this time, the oscillation
stabilization time (215/fX) is automatically secured.
After that, the CPU starts instruction execution at the low speed of the main system clock (1.6
µ
s at
5.0 MHz operation).
<2> After the time required for the VDD voltage to rise to the level at which the CPU can operate at the high speed
has elapsed, bit 1 (PCC1) of the processor clock control register (PCC) and bit 4 (CSS0) of the subclock
control register (CSS) are rewritten so that the high-speed operation can be selected.
<3> A drop of the VDD voltage is detected by an interrupt request signal. The clock is switched to the subsystem
clock (at this moment, the subsystem clock must be in the stable oscillation status).
<4> Recovery of the VDD voltage is detected by an interrupt request signal. Bit 7 (MCC) of PCC is set to 0, and
the main system clock starts oscillating. After the time required for the oscillation to stabilize has elapsed,
PCC1 and CSS0 are rewritten so that high-speed operation can be selected again.
Caution When the main system clock is stopped and the device is operating on the subsystem
clock, wait until the oscillation stabilization time has been secured by the program before
switching back to the main system clock.
User’s Manual U13952EJ3V1UD
101
CHAPTER 6 16-BIT TIMER 50
16-bit timer 50 references the free-running counter and provides functions such as timer interrupt and timer output.
In addition, the count value can be captured by a trigger pin.
6.1 Function of 16-Bit Timer 50
16-bit timer 50 has the following functions.
Timer interrupt
Timer output
Count value capture
(1) Timer interrupt
An interrupt is generated when the count value and compare value match.
(2) Timer output
Timer output control is possible when the count value and compare value match.
(3) Count value capture
The count value of 16-bit timer counter 50 (TM50) is latched to the capture register in synchronization with
the capture trigger and retained.
CHAPTER 6 16-BIT TIMER 50
102 User’s Manual U13952EJ3V1UD
6.2 Configuration of 16-Bit Timer 50
16-bit timer 50 consists of the following hardware.
Table 6-1. Configuration of 16-Bit Timer 50
Item Configuration
Timer counter 16 bits × 1 (TM50)
Registers Compare register: 16 bits × 1 (CR50)
Capture register: 16 bits × 1 (TCP50)
Timer outputs 1 (TO5)
Control registers 16-bit timer mode control register 50 (TMC50)
Port mode register 2 (PM2)
Figure 6-1. Block Diagram of 16-Bit Timer 50
CPT5/P27/
INTP3
Internal bus
Internal bus
16-bit timer mode
control register 50
(TMC50)
16-bit timer mode
control register 50
TOF50
CPT501 CPT500
TOC50
TCL501 TCL500
TOE50
fX
fX/25
Edge
detector
16-bit capture
register 50 (TCP50)
16-bit counter
read buffer
16-bit timer counter 50 (TM50)
16-bit compare register 50 (CR50)
Match
Selector
OVF
F/F
TOD50
TO5/P26/
INTP2
INTTM50
P26
output latch
PM26
CHAPTER 6 16-BIT TIMER 50
User’s Manual U13952EJ3V1UD 103
(1) 16-bit compare register 50 (CR50)
This register compares the value set to CR50 with the count value of 16-bit timer counter 50 (TM50), and
when they match, generates an interrupt request (INTTM50).
CR50 is set using a 16-bit memory manipulation instruction. Values from 0000H to FFFFH can be set.
RESET input sets CR50 to FFFFH.
Cautions 1. Although this register is manipulated by a 16-bit memory manipulation instruction, an 8-
bit memory manipulation instruction can also be used. When manipulated by an 8-bit
memory manipulation instruction, the accessing method should be direct addressing.
2. When rewriting CR50 during a count operation, preset CR50 to interrupt disabled using
interrupt mask flag register 1 (MK1). Also, set the timer output data to inversion
disabled using 16-bit timer mode control register 50 (TMC50).
If CR50 is rewritten while interrupts are enabled, an interrupt request may be generated
at the time of the rewrite.
(2) 16-bit timer counter 50 (TM50)
This is a 16-bit register that counts count pulses.
TM50 is read using a 16-bit memory manipulation instruction.
TM50 is in free-running mode during count clock input.
RESET input sets TM50 to 0000H, after which it enters free-running mode again.
Cautions 1. The count value after releasing stop becomes undefined because the count operation is
executed during the oscillation stabilization time.
2. Although this register is manipulated by a 16-bit memory manipulation instruction, an 8-
bit memory manipulation instruction can also be used. When manipulated by an 8-bit
memory manipulation instruction, the accessing method should be direct addressing.
3. When manipulated by an 8-bit memory manipulation instruction, readout should be
performed in order from lower byte to higher byte and must be in pairs.
(3) 16-bit capture register 50 (TCP50)
This is a 16-bit register that captures the contents of 16-bit timer counter 50 (TM50).
TCP50 is set using a 16-bit memory manipulation instruction.
RESET input makes TCP50 undefined.
Caution Although this register is manipulated by a 16-bit memory manipulation instruction, an 8-bit
memory manipulation instruction can also be used. When manipulated by an 8-bit memory
manipulation instruction, the accessing method should be direct addressing.
(4) 16-bit counter read buffer
This buffer latches the counter value of 16-bit timer counter 50 (TM50) and retains the count value.
CHAPTER 6 16-BIT TIMER 50
104 User’s Manual U13952EJ3V1UD
6.3 Registers Controlling 16-Bit Timer 50
The following two registers are used to control 16-bit timer 50.
16-bit timer mode control register 50 (TMC50)
Port mode register 2 (PM2)
(1) 16-bit timer mode control register 50 (TMC50)
16-bit timer mode control register 50 (TMC50) controls the setting of the count clock, capture edge, etc.
TMC50 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets TMC50 to 00H.
CHAPTER 6 16-BIT TIMER 50
User’s Manual U13952EJ3V1UD 105
Figure 6-2. Format of 16-Bit Timer Mode Control Register 50
TOC50
0
1
TOD50 TOF50 CPT501 CPT500 TOC50 TCL501 TCL500 TOE50
TMC50
R/W
FF48H 00H R/W
<6>54321
CPT501
0
0
1
1
CPT500
0
1
0
1
Capture operation disabled
Rising edge of CPT5
Falling edge of CPT5
Both edges of CPT5
TOF50
0
1
7 <0>
Set by overflow of 16-bit timer
Symbol Address After reset
Timer output data inverse control
Inverse disabled
Inverse enabled
Capture edge selection
TOE50
0
1
TCL501
0
0
Other than
above
TCL500
0
1
f
X
(5.0 MHz)
f
X
/2
5
(156.3 kHz)
Setting prohibited
16-bit timer 50 output control
Output disabled (port mode)
Output enabled
TOD50
0
1
Timer output data
Timer output is “0”
Timer output is “1”
16-bit timer 50 count clock selection
Overflow flag set
Clear by reset and software
Note 1
Note 2
Note 3
Notes 1. Bit 7 is read-only.
2. If the count clock is set to fX (TCL501 = 0, TCL500 = 0), the capture function cannot be used. When
reading, set the CPU clock to the main system clock high-speed mode (PCC1 = 0, CSS0 = 0) (see
Figure 5-2).
3. When reading, specify the main system clock as the CPU clock (PCC1 = 0, CSS0 = 0 or PCC1 = 1,
CSS0 = 0) (see Figure 5-2).
Remarks 1. fX: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 6 16-BIT TIMER 50
106 User’s Manual U13952EJ3V1UD
(2) Port mode register 2 (PM2)
This register sets input/output of port 2 in 1-bit units.
To use the P26/INTP2/TO5 pin for timer output, set PM26 and the output latch of P26 to 0.
PM2 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 to FFH.
Figure 6-3. Format of Port Mode Register 2
PM27 PM26
PM25 PM24
PM23 PM22 PM21 PM20PM2
R/W
FF22H FFH R/W
654321
PM26
0
1
70
Input mode (output buffer off)
Symbol Address After reset
P26 pin I/O mode selection
Output mode (output buffer on)
CHAPTER 6 16-BIT TIMER 50
User’s Manual U13952EJ3V1UD 107
6.4 Operation of 16-Bit Timer 50
6.4.1 Operation as timer interrupt
In the timer interrupt function, interrupts are repeatedly generated at the count value set to 16-bit compare register
50 (CR50) in advance at the interval set in TCL501 and TCL500.
To operate the 16-bit timer as a timer interrupt, the following settings are required.
Set the count value to CR50
Set 16-bit timer mode control register 50 (TMC50) as shown in Figure 6-4.
Figure 6-4. Settings of 16-Bit Timer Mode Control Register 50 for Timer Interrupt Operation
0/1 0/1 0/1 0/1 0 0/1 0/1
TOD50 TOF50
CPT501 CPT500
TOC50
TCL501 TCL500
TOE50
TMC50
Setting of count clock (see Table 6-2)
Caution If both the CPT501 flag and CPT500 flag are set to 0, the capture edge becomes operation
prohibited.
When the count value of 16-bit timer counter 50 (TM50) matches the value set to CR50, counting of TM50
continues and an interrupt request signal (INTTM50) is generated.
Table 6-2 shows the interval time, and Figure 6-5 shows the timing of the timer interrupt operation.
Caution Be sure to process as follows when rewriting CR50 during a count operation.
<1> Set interrupts to disabled (TMMK50 (bit 4 of interrupt mask flag register 1 (MK1)) = 1)
<2> Set the inversion control of timer output data to disabled (TOC50 = 0)
If CR50 is rewritten while interrupts are enabled, an interrupt request may be generated at the
time of rewrite.
Table 6-2. Interval Time of 16-Bit Timer 50
TCL501 TCL500 Count Clock Interval Time
0 0
1/fX (0.2
µ
s) 216/fX (13.1 ms)
0 1
25/fX (6.4
µ
s) 221/fX (419.4 ms)
Other than above Setting prohibited
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 6 16-BIT TIMER 50
108 User’s Manual U13952EJ3V1UD
Figure 6-5. Timing of Timer Interrupt Operation
Count clock
TM50 count value
CR50
INTTM50
TO5
TOF50
0000H
0001H
N
FFFFH 0000H 0001H
N
FFFFH
NN N NN
Interrupt acknowledged Interrupt acknowledged
Overflow flag set
t
Remark N = 0000H to FFFFH
CHAPTER 6 16-BIT TIMER 50
User’s Manual U13952EJ3V1UD 109
6.4.2 Operation as timer output
Timer outputs are repeatedly generated at the count value set to 16-bit compare register 50 (CR50) in advance at
the interval set in TCL501 and TCL500.
To operate 16-bit timer as a timer output, the following settings are required.
Set P26 to output mode (PM26 = 0)
Set the output latch of P26 to 0
Set the count value to CR50
Set 16-bit timer mode control register 50 (TMC50) as shown in Figure 6-6
Figure 6-6. Settings of 16-Bit Timer Mode Control Register 50 for Timer Output Operation
0/1 0/1 0/1 10 0/1 1
TOD50 TOF50
CPT501 CPT500
TOC50
TCL501 TCL500
TOE50
TMC50
Setting of count clock (see Table 6-2)
Inverse enable of timer output data
TO5 output enable
Caution If both the CPT501 flag and CPT500 flag are set to 0, the capture edge becomes operation
prohibited.
When the count value of 16-bit timer counter 50 (TM50) matches the value set in CR50, the output status of the
TO5/INTP2/P26 pin is inverted. This enables timer output. At that time, TM50 counting continues and an interrupt
request signal (INTTM50) is generated.
Figure 6-7 shows the timing of timer output (see Table 6-2 for the interval time of 16-bit timer 50).
Figure 6-7. Timer Output Timing
Note The TO5 initial value becomes low level when output is enabled (TOE50 = 1).
Remark N = 0000H to FFFFH
Count clock
TM50 count value
CR50
INTTM50
TO5
Note
TOF50
0000H
0001H
N
FFFFH 0000H 0001H
N
FFFFH
NN N NN
Interrupt acknowledged Interrupt acknowledged
Overflow flag set
t
CHAPTER 6 16-BIT TIMER 50
110 User’s Manual U13952EJ3V1UD
6.4.3 Capture operation
In a capture operation, the count value of 16-bit timer counter 50 (TM50) is captured and latched to the capture
register in synchronization with a capture trigger.
Set as shown in Figure 6-8 to allow the 16-bit timer to start a capture operation.
Figure 6-8. Settings of 16-Bit Timer Mode Control Register 50 for Capture Operation
0/1 0/1 0/1
0/1 0 0/1 0/1
TOD
50
TOF
50
CPT501 CPT500
TOC
50
TCL501 TCL500
TOE
50
TMC50
Count clock selection
Capture edge selection (see Table 6-3)
16-bit capture register 50 (TCP50) starts a capture operation after the CPT5 capture trigger edge is defected, and
latches and retains the count value of 16-bit timer counter 50 (TM50). TCP50 fetches the count value within 2 clocks
and retains the count value until the next capture edge detection.
Table 6-3 and Figure 6-9 shows the settings of the capture edge and the capture operation timing, respectively.
Table 6-3. Settings of Capture Edge
CPT501 CPT500 Capture Edge Selection
0 0 Capture operation prohibited
0 1 CPT5 pin rising edge
1 0 CPT5 pin falling edge
1 1 CPT5 pin both edges
Caution Because TCP50 is rewritten when a capture trigger edge is detected during TCP50 read, disable
capture trigger edge detection during TCP50 read.
Figure 6-9. Capture Operation Timing (Both Edges of CPT5 Pin Are Specified)
Count clock
TM50
16-bit counter read buffer
TCP50
CPT5
0000H
0000H
0001H
0001H
Undefined
N
N
N
M – 1 M
M
M
Capture start Capture start
Capture edge detection Capture edge detection
CHAPTER 6 16-BIT TIMER 50
User’s Manual U13952EJ3V1UD 111
6.4.4 16-bit timer counter 50 readout
The count value of 16-bit timer counter 50 (TM50) is read out by a 16-bit manipulation instruction.
TM50 readout is performed via a 16-bit counter read buffer. The 16-bit counter read buffer latches the TM50 count
value, the buffer operation is held pending at the CPU clock falling edge after the read signal of the TM50 lower byte
rises, and the count value is retained. The 16-bit counter read buffer value in the retention state can be read out as
the count value.
Cancellation of pending is performed at the CPU clock falling edge after the read signal of the TM50 higher byte
falls.
RESET input sets TM50 to 0000H and then to free-running mode again.
Figure 6-10 shows the timing of 16-bit timer counter 50 readout.
Cautions 1. The count value after releasing stop becomes undefined because the count operation is
executed during the oscillation stabilization time.
2. AIthough TM50 is manipulated by a 16-bit transfer instruction, 8-bit transfer instruction can
also be used.
When using an 8-bit transfer instruction, execute by direct addressing.
3. When using an 8-bit transfer instruction, execute in order from lower byte to higher byte in
pairs. If the only lower byte is read, the pending state of the 16-bit counter read buffer is not
canceled, and if the only higher byte is read, an undefined count value is read.
Figure 6-10. Readout Timing of 16-Bit Timer Counter 50
CPU clock
Count clock
TM50
16-bit counter read buffer
TM50 read signal
0000H
0000H
0001H
0001H
N
N
N + 1
Read signal latch
prohibited period
CHAPTER 6 16-BIT TIMER 50
112 User’s Manual U13952EJ3V1UD
6.5 Cautions on Using 16-Bit Timer 50
6.5.1 Restrictions when rewriting 16-bit compare register 50
(1) Disable interrupts (TMMK50 = 1) and the inversion control of timer output (TOC50 = 0) before rewriting the
compare register (CR50).
If CR50 is rewritten with interrupts enabled, an interrupt request may be generated immediately.
(2) Depending on the timing of rewriting the compare register (CR50), the interval time may become twice as
long as the intended time. Similarly, a shorter waveform or twice-longer waveform than the intended timer
output waveform may be output.
To avoid this problem, rewrite the compare register using either of the following procedures.
<Countermeasure A> When rewriting using 8-bit access
<1> Disable interrupts (TMMK50 = 1) and the inversion control of timer output (TOC50 = 0).
<2> First rewrite the higher 1 byte of CR50 (16 bits).
<3> Then rewrite the lower 1 byte of CR50 (16 bits).
<4> Clear the interrupt request flag (TMIF50).
<5> Enable timer interrupts/timer output inversion after half a cycle or more of the count clock has elapsed from
the beginning of the interrupt.
<Program example A> (count clock = 32/fX, CPU clock = fX)
TM50_VCT: SET1 TMMK50 ; Disable timer interrupts (6 clocks)
CLR1 TMC50.3 ; Disable timer output inversion (6 clocks)
MOV A,#xxH ; Set the rewrite value of higher byte (6 clocks)
MOV !0FF17H,A ; Rewrite CR50 higher byte (8 clocks)
MOV A,#yyH ; Set the rewrite value of lower byte (6 clocks)
MOV !0FF16H,A ; Rewrite CR50 lower byte (8 clocks)
CLR1 TMIF50 ; Clear interrupt request flag (6 clocks)
CLR1 TMMK50 ; Enable timer interrupts (6 clocks)
SET1 TMC50.3 ; Enable timer output inversion
Note Because the INTTM50 signal becomes high level for half a cycle of the count clock after an interrupt is
generated, the output is inverted if TOC50 is set to 1 during this period.
Total: 16 clocks or
moreNote
CHAPTER 6 16-BIT TIMER 50
User’s Manual U13952EJ3V1UD 113
<Countermeasure B> When rewriting using 16-bit access
<1> Disable interrupts (TMMK50 = 1) and the inversion control of timer output (TOC50 = 0).
<2> Rewrite CR50 (16 bits).
<3> Wait for one cycle or more of the count clock.
<4> Clear the interrupt request flag (TMIF50).
<5> Enable timer interrupts/timer output inversion.
<Program example B> (count clock = 32/fX, CPU clock = fX)
TM50_VCT SET1 TMMK50 ; Disable timer interrupts
CLR1 TMC50.3 ; Disable timer output inversion
MOVW AX,#xxyyH ; Set the rewrite value of CR50
MOVW CR50,AX ; Rewrite CR50
NOP
NOP
: ; 16 NOP instructions (wait for 32/fX)Note
NOP
NOP
CLR1 TMIF50 ; Clear interrupt request flag
CLR1 TMMK50 ; Enable timer interrupts
SET1 TMC50.3 ; Enable timer output inversion
Note Clear the interrupt request flag (TMIF50) after waiting for one cycle or more of the count clock from the
instruction rewriting CR50 (MOVW CR50, AX).
User’s Manual U13952EJ3V1UD
114
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
7.1 Function of 8-Bit Timer/Event Counters 00 to 02
8-bit timer/event counters 00 to 02 have the following functions.
Interval timer (timer 00, timer 01, and timer 02)
External event counter (timer 00 and timer 01 only)
Square-wave output (timer 02 only)
The
µ
PD789407A and
µ
PD789417A Subseries are provided with two 8-bit timer/event counter channels (timer 00
and timer 01) and one 8-bit timer channel (timer 02). When reading the description of timer 02, timer/event counter
should be read as a timer.
(1) 8-bit interval timer
When the 8-bit timer/event counter is used as an interval timer, it generates an interrupt at an arbitrary time
interval set in advance.
Table 7-1. Interval Time of 8-Bit Timer/Event Counter 00
Minimum Interval Time Maximum Interval Time Resolution
26/fX (12.8
µ
s) 214/fX (3.28 ms) 26/fX (12.8
µ
s)
29/fX (102.4
µ
s) 217/fX (26.2 ms) 29/fX (102.4
µ
s)
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
Table 7-2. Interval Time of 8-Bit Timer/Event Counter 01
Minimum Interval Time Maximum Interval Time Resolution
24/fX (3.2
µ
s) 212/fX (819.2
µ
s) 24/fX (3.2
µ
s)
28/fX (51.2
µ
s) 216/fX (13.1 ms) 28/fX (51.2
µ
s)
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
Table 7-3. Interval Time of 8-Bit Timer 02
Minimum Interval Time Maximum Interval Time Resolution
23/fX (1.6
µ
s) 211/fX (409.6
µ
s) 23/fX (1.6
µ
s)
27/fX (25.6
µ
s) 215/fX (6.55 ms) 27/fX (25.6
µ
s)
1/fXT (30.5
µ
s) 28/fXT (7.81 ms) 1/fXT (30.5
µ
s)
Remarks 1. f
X: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 115
(2) External event counter
The number of pulses of an externally input signal can be measured.
(3) Square-wave output
A square wave of any frequency can be output.
Table 7-4. Square-Wave Output Range of 8-Bit Timer 02
Minimum Pulse Width Maximum Pulse Width Resolution
23/fX (1.6
µ
s) 211/fX (409.6
µ
s) 23/fX (1.6
µ
s)
27/fX (25.6
µ
s) 215/fX (6.55 ms) 27/fX (25.6
µ
s)
1/fXT (30.5
µ
s) 28/fXT (7.81 ms) 1/fXT (30.5
µ
s)
Remarks 1. f
X: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
7.2 Configuration of 8-Bit Timer/Event Counters 00 to 02
8-bit timer/event counters 00 to 02 consist of the following hardware.
Table 7-5. Configuration of 8-Bit Timer/Event Counters 00 to 02
Item Configuration
Timer counter 8 bits × 3 (TM00, TM01, and TM02)
Register Compare register: 8 bits × 3 (CR00, CR01, and CR02)
Timer output 1 (TO2)
Control registers 8-bit timer mode control registers 00, 01, and 02 (TMC00, TMC01, and TMC02)
Port mode register 2 (PM2)
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
116 User’s Manual U13952EJ3V1UD
Figure 7-1. Block Diagram of 8-Bit Timer/Event Counter 00
Internal bus
8-bit compare register 00
(CR00)
Match INTTM00
f
X
/2
6
f
X
/2
9
TI0/P24/INTP0
Selector
Clear
8-bit timer counter 00
(TM00)
2
Internal bus
TCE00
TCL001 TCL000
8-bit timer mode
control register 00 (TMC00)
Selector
Figure 7-2. Block Diagram of 8-Bit Timer/Event Counter 01
Internal bus
8-bit compare register 01
(CR01)
Match INTTM01
Selector
Selector
Clear
8-bit timer counter 01 (TM01)
2
TCE01
TCL011 TCL010
8-bit timer mode
control register 01 (TMC01)
Internal bus
fX/24
fX/28
TI1/P25/INTP1
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 117
Figure 7-3. Block Diagram of 8-Bit Timer 02
Internal bus
Internal bus
8-bit compare register 02
(CR02)
Match INTTM02
f
X
/2
3
f
X
/2
7
f
XT
Clear
8-bit timer counter 02
(TM02)
TO2/CMPTOUT0/
P23
2
TCE02 TCL021 TCL020 TOE02
8-bit timer mode
control register 02 (TMC02)
F/F
P23 output
latch PM23
ComparatorNote
Selector
Selector
Selector
Internal bus
Note See CHAPTER 12 COMPARATOR for details of the comparator.
(1) 8-bit compare register 0n (CR0n)
This is an 8-bit register that compares the value set to CR0n with the 8-bit timer counter 0n (TM0n) count
value, and if they match, an interrupt request (INTTM0n) is generated.
CR0n is set using an 8-bit memory manipulation instruction. Values from 00H to FFH can be set.
RESET input makes CR0n undefined.
Caution Be sure to stop the operation of the timer before rewriting CR0n. If CR0n is rewritten while
the timer is operation-enabled, an interrupt request match signal may be generated at the
time of the rewrite.
Remark n = 0 to 2
(2) 8-bit timer counter 0n (TM0n)
This is an 8-bit register that counts pulses.
TM0n is read using an 8-bit memory manipulation instruction.
RESET input sets TM0n to 00H.
Remark n = 0 to 2
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
118 User’s Manual U13952EJ3V1UD
7.3 Registers Controlling 8-Bit Timer/Event Counters 00 to 02
The following two registers are used to control 8-bit timer/event counters 00 to 02.
8-bit timer mode control registers 00, 01, and 02 (TMC00, TMC01, and TMC02)
Port mode register 2 (PM2)
(1) 8-bit timer mode control register 00 (TMC00)
TMC00 enables/stops operation of 8-bit timer counter 00 (TM00) and sets the count clock of TM00.
TMC00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets TMC00 to 00H.
Figure 7-4. Format of 8-Bit Timer Mode Control Register 00
TCE00
0000
TCL001 TCL000
0TMC00
R/W
FF53H 00H R/W
654321
TCL001
0
0
1
1
TCL000
0
1
0
1
f
X
/2
6
f
X
/2
9
TCE00
0
1
(78.1 kHz)
(9.76 kHz)
<7> 0
Operation enabled
Symbol Address After reset
Count clock selection of 8-bit timer/event counter 00
Rising edge of TI0
Falling edge of TI0
Operation control of 8-bit timer counter 00
Operation stopped (TM00 is cleared to 00H)
Caution Be sure to stop the operation of the timer before setting TMC00.
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 119
(2) 8-bit timer mode control register 01 (TMC01)
TMC01 determines whether to enable or stop operation of 8-bit timer counter 01 (TM01) and specifies the
count clock for 8-bit timer/event counter 01.
TMC01 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets TMC01 to 00H.
Figure 7-5. Format of 8-Bit Timer Mode Control Register 01
TCE01
0000
TCL011 TCL010
0TMC01
Symbol Address After reset R/W
FF57H 00H R/W
6<7> 543210
TCL011
0
0
1
1
Count clock selection of 8-bit timer/event counter 01
TCL010
0
1
0
1
f
X
/2
4
f
X
/2
8
Rising edge of TI1
Falling edge of TI1
TCE01
0
1
Operation control of 8-bit timer counter 01
Operation stopped (TM01 is cleared to 00H)
Operation enabled
(312.5 kHz)
(19.5 kHz)
Caution Be sure to stop the operation of the timer before setting TMC01.
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
120 User’s Manual U13952EJ3V1UD
(3) 8-bit timer mode control register 02 (TMC02)
TMC02 determines whether to enable or stop operation of 8-bit timer counter 02 (TM02) and specifies the
count clock for 8-bit timer 02. It also controls the operation of the output controller.
TMC02 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets TMC02 to 00H.
Figure 7-6. Format of 8-Bit Timer Mode Control Register 02
TCE02
0000
TCL021 TCL020
TOE02
TMC02
Symbol Address After reset R/W
FF5BH 00H R/W
6<7> <0>54321
TOE02
0
1
Output control of 8-bit timer 02
Output disabled (port mode)
Output enabled
TCL021
0
0
1
1
Count clock selection of 8-bit timer 02
TCL020
0
1
0
1
f
X
/23
f
X
/27
f
XT
(32.768 kHz)
Setting prohibited
TCE02
0
1
Operation control of 8-bit timer counter 02
Operation stopped (TM02 is cleared to 00H)
Operation enabled
(625 kHz)
(39.1 kHz)
Caution Be sure to stop the operation of the timer before setting TMC02.
Remarks 1. f
X: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 121
(4) Port mode register 2 (PM2)
This register sets port 2 to input/output in 1-bit units.
When using the P23/COMPTOUT0/TO2 pin for timer output, set PM23 and the output latch of P23 to 0.
PM2 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 to FFH.
Figure 7-7. Format of Port Mode Register 2
PM23
0
1
PM27 PM26 PM25 PM24 PM23 PM22 PM21 PM20PM2
7654 R/W
R/W
3210
Input mode (output buffer off)
Symbol Address
FF22H FFH
After reset
P23 pin I/O mode selection
Output mode (output buffer on)
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
122 User’s Manual U13952EJ3V1UD
7.4 Operation of 8-Bit Timer/Event Counters 00 to 02
7.4.1 Operation as interval timer
The interval timer repeatedly generates an interrupt at time intervals specified by the count value set to 8-bit
compare registers 00, 01, and 02 (CR00, CR01, and CR02) in advance.
To operate the 8-bit timer/event counter as an interval timer, make the settings in the following order.
<1> Set 8-bit timer counter 0n (TM0n) to operation-disabled (TCE0n (bit 7 of 8-bit timer mode control register 0n
(TMC0n)) = 0)
<2> Select the count clock of the 8-bit timer/event counter (see Tables 7-6 to 7-8)
<3> Set the count value to CR0n
<4> Set TM0n to operation-enabled (TCE0n = 1)
When the count value of 8-bit timer counter 0n (TM0n) matches the value set to CR0n, the value of TM0n is
cleared to 00H and TM0n continues counting. At the same time, an interrupt request signal (INTTM0n) is generated.
Tables 7-6 through 7-8 show the interval time, and Figures 7-8 and 7-9 show the timing of interval timer operation.
Caution When the setting of the count clock using TMC0n and the setting of the TM0n to operation-
enable using an 8-bit memory manipulation instruction are performed at the same time, an error
of one clock or more may occur in the first cycle after the timer is started. Because of this,
when the 8-bit timer/event counter operates as an interval timer, be sure to make the settings in
the order described above.
Remark n = 0 to 2
Table 7-6. Interval Time of 8-Bit Timer/Event Counter 00
TCL001 TCL000 Minimum Interval Time Maximum Interval Time Resolution
0 0
26/fX (12.8
µ
s) 214/fX (3.28 ms) 26/fX (12.8
µ
s)
0 1
29/fX (102.4
µ
s) 217/fX (26.2 ms) 29/fX (102.4
µ
s)
1 0 TI0 input cycle 28 × TI0 input cycle TI0 input edge cycle
1 1 TI0 input cycle 28 × TI0 input cycle TI0 input edge cycle
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
Table 7-7. Interval Time of 8-Bit Timer/Event Counter 01
TCL011 TCL010 Minimum Interval Time Maximum Interval Time Resolution
0 0
24/fX (3.2
µ
s) 212/fX (819.2
µ
s) 24/fX (3.2
µ
s)
0 1
28/fX (51.2
µ
s) 216/fX (13.1 ms) 28/fX (51.2
µ
s)
1 0 TI1 input cycle 28 × TI1 input cycle TI1 input edge cycle
1 1 TI1 input cycle 28 × TI1 input cycle TI1 input edge cycle
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 123
Table 7-8. Interval Time of 8-Bit Timer 02
TCL021 TCL020 Minimum Interval Time Maximum Interval Time Resolution
0 0
23/fX (1.6
µ
s) 211/fX (409.6
µ
s) 23/fX (1.6
µ
s)
0 1
27/fX (25.6
µ
s) 215/fX (6.55 ms) 27/fX (25.6
µ
s)
1 0
1/fXT (30.5
µ
s) 28/fXT (7.81 ms) 1/fXT (30.5
µ
s)
1 1 Setting prohibited
Remarks 1. f
X: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
Figure 7-8. Interval Timer Operation Timing of Timer 00 and Timer 01
Clear Clear
Interrupt acknowledged Interrupt acknowledged
Count start
Interval time Interval time Interval time
Count clock
TM0n count value
CR0n
TCE0n
INTTM0n
N0100N0100N00 01
NN NN
t
Remarks 1. Interval time = (N + 1) × t where N = 00H to FFH
2. n = 0, 1
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
124 User’s Manual U13952EJ3V1UD
Figure 7-9. Interval Timer Operation Timing of Timer 02
Clear Clear
Interrupt acknowledged Interrupt acknowledged
Count start
Interval time Interval time Interval time
Count clock
TM02 count value
CR02
TCE02
INTTM02
TO2
N0100N0100N00 01
NN NN
t
Remark Interval time = (N + 1) × t where N = 00H to FFH
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 125
7.4.2 Operation as external event counter (timer 00 and timer 01 only)
The external event counter counts the number of external clock pulses input to the TI0/P24/INTP0 and
TI1/P25/INTP1 pins by using 8-bit timer counters 00 and 01 (TM00 and TM01).
To operate 8-bit timer/event counters 00 and 01 as an external event counter, make the settings in the following
order.
<1> Set P24 and P25 to input mode (PM24 = 1, PM25 = 1)
<2> Set 8-bit timer counter 0n (TM0n) to operation-disabled (TCE0n (bit 7 of 8-bit timer mode control register 0n
(TMC0n)) = 0)
<3> Specify the rising edge/falling edge of TIn (see Tables 7-6 and 7-7)
<4> Set the count value to CR0n
<5> Set TM0n to operation-enabled (TCE0n = 1)
Each time the valid edge specified by bit 1 (TCL0n0) of TMC0n is input, the value of 8-bit timer counter 0n (TM0n)
is incremented.
When the count value of TM0n matches the value set to CR0n, the value of TM0n is cleared to 00H and TM0n
continues counting. At the same time, an interrupt request signal (INTTM0n) is generated.
Figure 7-10 shows the timing of external event counter operation (with rising edge specified).
Caution When the setting of the count clock using TMC0n and the setting of the TM0n to operation-
enable using an 8-bit memory manipulation instruction are performed at the same time, an error
of one clock or more may occur in the first cycle after the timer is started. Because of this,
when the 8-bit timer/event counter operates as an external event counter, be sure to make the
settings in the order described above.
Remark n = 0, 1
Figure 7-10. External Event Counter Operation Timing (with Rising Edge Specified)
TIn pin input
TM0n count value
CR0n
TCE0n
INTTM0n
00 01 02 03 04 05
N – 1
N 00010203
N
Remarks 1. N = 00H to FFH
2. n = 0, 1
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
126 User’s Manual U13952EJ3V1UD
7.4.3 Operation as square-wave output (timer 02 only)
The 8-bit timer can generate a square-wave output of any frequency at intervals specified by the count value
preset to 8-bit compare register 02 (CR02).
To operate 8-bit timer 02 as a square-wave output, make the settings in the following order.
<1> Set P23 to output mode (PM23 = 0), and set the output latch of P23 to 0
<2> Disable 8-bit timer counter 02 (TM02) operation (TCE02 (bit 0 of 8-bit timer mode control register 02
(TMC02)) = 1)
<3> Set the count clock of 8-bit timer 02 (see Table 7-9), and enable TO2 to output (TOE02 (bit 0 of TMC02) = 1)
<4> Set the count value to CR02
<5> Enable TM02 operation (TCE02 = 1)
When the count value of 8-bit timer counter 02 (TM02) matches the value set in CR02, the TO2/P23/CMPTOUT0
pin output is inverted. Through application of this mechanism, square waves of any frequency can be output. As
soon as a match occurs, the TM02 value is cleared to 00H, then counting continues count and an interrupt request
signal (INTTM02) is generated.
Setting bit 7 of TMC02 (TCE02) to 0 clears the square-wave output to 0.
Table 7-9 lists the square-wave output range, and Figure 7-11 shows the timing of square-wave output.
Caution When the setting of the count clock using TMC02 and the setting of the TM02 to operation-
enable using an 8-bit memory manipulation instruction are performed at the same time, an error
of one clock or more may occur in the first cycle after the timer is started. Because of this,
when the 8-bit timer operates as a square-wave output, be sure to make the settings in the order
described above.
Table 7-9. Square-Wave Output Range of 8-Bit Timer 02
TCL021 TCL020 Minimum Pulse Width Maximum Pulse Width Resolution
0 0
23/fX (1.6
µ
s) 211/fX (409.6
µ
s) 23/fX (1.6
µ
s)
0 1
27/fX (25.6
µ
s) 215/fX (6.55 ms) 27/fX (25.6
µ
s)
1 0
1/fXT (30.5
µ
s) 28/fXT (7.81 ms) 1/fXT (30.5
µ
s)
1 1 Setting prohibited
Remarks 1. f
X: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
User’s Manual U13952EJ3V1UD 127
Figure 7-11. Square-Wave Output Timing
Clear Clear
Interrupt acknowledged Interrupt acknowledged
Count start
Count clock
TM02 count value
CR02
TCE02
INTTM02
TO2
Note
N0100N0100N00 01
NN NN
Note The initial value of TO2 when output is enabled (TOE02 = 1) becomes low level.
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 00 TO 02
128 User’s Manual U13952EJ3V1UD
7.5 Cautions on Using 8-Bit Timer/Event Counters 00 to 02
(1) Error on starting timer
An error of up to 1 clock occurs after the timer has been started until a match signal is generated. This is
because 8-bit timer counters 00, 01, and 02 (TM00, TM01, and TM02) are started asynchronous to the count
pulse.
Figure 7-12. Start Timing of 8-Bit Timer Counters 00, 01, and 02
Count pulse
TM00, TM01, TM02
count value
Timer starts
00H 01H 02H 03H 04H
(2) Setting of 8-bit compare register
8-bit compare registers 00, 01, and 02 (CR00, CR01, and CR02) can be set to 00H.
Therefore, one pulse can be counted when an 8-bit timer/event counter operates as an event counter.
Figure 7-13. External Event Counter Operation Timing
TI0, TI1 input
CR00, CR01 00H
TM00, TM01
count value
00H 00H 00H 00H
Interrupt request flag
User’s Manual U13952EJ3V1UD 129
CHAPTER 8 WATCH TIMER
8.1 Functions of Watch Timer
The watch timer has the following functions.
• Watch timer
• Interval timer
The watch and interval timers can be used at the same time.
Figure 8-1 is a block diagram of the watch timer.
Figure 8-1. Block Diagram of Watch Timer
f
X
/2
7
f
XT
f
W
f
W
2
4
f
W
2
5
f
W
2
6
f
W
2
7
f
W
2
8
f
W
2
9
Clear
9-bit prescaler
Selector
Clear
5-bit counter INTWT
INTWTI
WTM7 WTM6 WTM5 WTM4 WTM1 WTM0
Watch timer mode
control register (WTM)
Internal bus
Selector
CHAPTER 8 WATCH TIMER
130 User’s Manual U13952EJ3V1UD
(1) Watch timer
The 4.19 MHz main system clock or 32.768 kHz subsystem clock is used to issue an interrupt request
(INTWT) at 0.5-second intervals.
Caution When the main system clock is operating at 5.0 MHz, it cannot be used to generate a
0.5-second interval. In this case, the subsystem clock, which operates at 32.768 kHz,
should be used instead.
(2) Interval timer
The interval timer is used to generate an interrupt request (INTWT) at specified intervals.
Table 8-1. Interval Time of Interval Timer
Interval Operation at fX = 5.0 MHz Operation at fX = 4.19 MHz Operation at fXT = 32.768 kHz
24 × 1/fW 409.6
µ
s 489
µ
s 488
µ
s
25 × 1/fW 819.2
µ
s 978
µ
s 977
µ
s
26 × 1/fW 1.64 ms 1.96 ms 1.95 ms
27 × 1/fW 3.28 ms 3.91 ms 3.91 ms
28 × 1/fW 6.55 ms 7.82 ms 7.81 ms
29 × 1/fW 13.1 ms 15.6 ms 15.6 ms
Remark f
W: Watch timer clock frequency (fX/27 or fXT)
f
X: Main system clock oscillation frequency
fXT: Subsystem clock oscillation frequency
8.2 Configuration of Watch Timer
The watch timer consists of the following hardware.
Table 8-2. Configuration of Watch Timer
Item Configuration
Counter 5 bits × 1
Prescaler 9 bits × 1
Control register Watch timer mode control register (WTM)
CHAPTER 8 WATCH TIMER
User’s Manual U13952EJ3V1UD 131
8.3 Register Controlling Watch Timer
The watch timer mode control register (WTM) is used to control the watch timer.
Watch timer mode control register (WTM)
WTM selects a count clock for the watch timer and specifies whether to enable operation of the timer. It also
specifies the prescaler interval and how the 5-bit counter is controlled.
WTM is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets WTM to 00H.
Figure 8-2. Format of Watch Timer Mode Control Register
Watch timer count clock selection
WTM7 WTM6 WTM5 WTM4 0 0 WTM1 WTM0WTM
Symbol Address After reset R/W
FF4AH 00H R/W
76543210
WTM7
0
1
Prescaler interval selectionWTM6
0
0
0
0
1
1
2
4
/f
W
2
5
/f
W
2
6
/f
W
2
7
/f
W
2
8
/f
W
2
9
/f
W
WTM5
0
0
1
1
0
0
(488 s)
(977 s)
(1.95 ms)
(3.91 ms)
(7.81 ms)
(15.6 ms)
µ
µ
WTM4
0
1
0
1
0
1
Control of 5-bit counter operation
WTM1
0
1
Cleared after stop
Started
Watch timer operationWTM0
0
1
Operation stopped (both prescaler and timer cleared)
Operation enabled
Other than above
f
X
/2
7
f
XT
(32.768 kHz)
(39.1 kHz)
Setting prohibited
Remarks 1. fW: Watch timer clock frequency (fX/27 or fXT)
2. f
X: Main system clock oscillation frequency
3. f
XT: Subsystem clock oscillation frequency
4. The parenthesized values apply to operation at fW = 32.768 kHz.
CHAPTER 8 WATCH TIMER
132 User’s Manual U13952EJ3V1UD
8.4 Operation of Watch Timer
8.4.1 Operation as watch timer
The main system clock (4.19 MHz) or subsystem clock (32.768 kHz) is used as a watch timer that generates
interrupts at 0.5-second intervals.
By setting bits 0 and 1 (WTM0 and WTM1) of the watch timer mode control register (WTM) to 1, the watch timer
starts counting. By setting them to 0, the 5-bit counter is cleared and the watch timer stops counting.
When the interval timer also operates at the same time by setting WTM1 to 0, only the watch timer can be started
from 0 seconds. However, an error of up to 29 × 1/fW seconds may occur for the first overflow of the watch timer
(INTWT) after a 0-second start, because the 9-bit prescaler is not cleared in this case.
8.4.2 Operation as interval timer
The interval timer is used to repeatedly generate an interrupt request at the interval specified by a preset count
value.
The interval time can be selected by bits 4 to 6 (WTM4 to WTM6) of the watch timer mode control register (WTM).
Table 8-3. Interval Time of Interval Timer
WTM6 WTM5 WTM4 Interval Operation at
fX = 5.0 MHz
Operation at
fX = 4.19 MHz
Operation at
fXT = 32.768 kHz
0 0 0
24 × 1/fW 409.6
µ
s 489
µ
s 488
µ
s
0 0 1
25 × 1/fW 819.2
µ
s 978
µ
s 977
µ
s
0 1 0
26 × 1/fW 1.64 ms 1.96 ms 1.95 ms
0 1 1
27 × 1/fW 3.28 ms 3.91 ms 3.91 ms
1 0 0
28 × 1/fW 6.55 ms 7.82 ms 7.81 ms
1 0 1
29 × 1/fW 13.1 ms 15.6 ms 15.6 ms
Other than above Setting prohibited
Remark f
X: Main system clock oscillation frequency
f
XT: Subsystem clock oscillation frequency
f
W: Watch timer clock frequency
CHAPTER 8 WATCH TIMER
User’s Manual U13952EJ3V1UD 133
Figure 8-3. Watch Timer/Interval Timer Operation Timing
0H
Start Overflow Overflow
5-bit counter
Count clock
f
W
/2
9
Watch timer
interrupt
INTWT
Interval timer
interrupt
INTWTI
Watch timer interrupt time (0.5 s) Watch timer interrupt time (0.5 s)
Interval
timer (T)
T
Remark fW: Watch timer clock frequency
The parenthesized values apply to operation at fW = 32.768 kHz.
134 User’s Manual U13952EJ3V1UD
CHAPTER 9 WATCHDOG TIMER
9.1 Functions of Watchdog Timer
The watchdog timer has the following functions.
Watchdog timer
Interval timer
Caution Select the watchdog timer mode or interval timer mode by using the watchdog timer mode
register (WDTM).
(1) Watchdog timer
The watchdog timer is used to detect an inadvertent program loop. When the program loop is detected, a
non-maskable interrupt or the RESET signal can be generated.
Table 9-1. Program Loop Detection Time of Watchdog Timer
Program Loop Detection Time Operation at fX = 5.0 MHz
211 × 1/fX 410
µ
s
213 × 1/fX 1.64 ms
215 × 1/fX 6.55 ms
217 × 1/fX 26.2 ms
fX: Main system clock oscillation frequency
(2) Interval timer
The interval timer generates an interrupt at any intervals set in advance.
Table 9-2. Interval Time
Interval Time Operation at fX = 5.0 MHz
211 × 1/fX 410
µ
s
213 × 1/fX 1.64 ms
215 × 1/fX 6.55 ms
217 × 1/fX 26.2 ms
fX: Main system clock oscillation frequency
CHAPTER 9 WATCHDOG TIMER
User’s Manual U13952EJ3V1UD 135
9.2 Configuration of Watchdog Timer
The watchdog timer consists of the following hardware.
Table 9-3. Configuration of Watchdog Timer
Item Configuration
Control registers Timer clock selection register 2 (TCL2)
Watchdog timer mode register (WDTM)
Figure 9-1. Block Diagram of Watchdog Timer
Internal bus
Internal bus
Prescaler
Selector
Controller
f
X
2
6
f
X
2
8
f
X
2
10
3
7-bit counter
Clear
TMIF4
TMMK4
TCL22 TCL21 TCL20
Timer clock selection register 2
(TCL2)
Watchdog timer mode register
(WDTM)
WDTM4
RUN
WDTM3
INTWDT
maskable
interrupt request
RESET
INTWDT
non-maskable
interrupt request
f
X
2
4
CHAPTER 9 WATCHDOG TIMER
136 User’s Manual U13952EJ3V1UD
9.3 Registers Controlling Watchdog Timer
The following two registers are used to control the watchdog timer.
Timer clock selection register 2 (TCL2)
Watchdog timer mode register (WDTM)
(1) Timer clock selection register 2 (TCL2)
This register sets the watchdog timer count clock.
TCL2 is set using an 8-bit memory manipulation instruction.
RESET input sets TCL2 to 00H.
Figure 9-2. Format of Timer Clock Selection Register 2
TCL22
0
0
1
1
00000TCL22 TCL21 TCL20TCL2
R/W
R/W
76543210
TCL21
0
1
0
1
fX/24
fX/26
fX/28
fX/210
211/fX
213/fX
215/fX
217/fX
TCL20
0
0
0
0
Setting prohibited
Symbol Address
FF42H 00H
After reset
Other than above
Watchdog timer count clock selection Interval time
(410 s)
(1.64 ms)
(6.55 ms)
(26.2 ms)
µ
(312.5 kHz)
(78.1 kHz)
(19.5 kHz)
(4.88 kHz)
Remarks 1. fX: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 9 WATCHDOG TIMER
User’s Manual U13952EJ3V1UD 137
(2) Watchdog timer mode register (WDTM)
This register sets the operation mode of the watchdog timer, and enables/disables counting of the watchdog
timer.
WDTM is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets WDTM to 00H.
Figure 9-3. Format of Watchdog Timer Mode Register
RUN
0
1
Selection of operation of watchdog timer
Note 1
RUN 0 0
WDTM4 WDTM3
000WDTM
Symbol Address After reset R/W
FFF9H 00H R/W
<7>6543210
Stop counting
Clear counter and start counting
WDTM4
Selection of operation mode of watchdog timer
Note 2
WDTM3
01
10
11
Operation stopped
Interval timer mode (overflow and maskable interrupt occur)
Note 3
Watchdog timer mode 1 (overflow and non-maskable interrupt occur)
Watchdog timer mode 2 (overflow occurs and reset operation started)
00
Notes 1. Once RUN has been set to (1), it cannot be cleared to (0) by software. Therefore, when counting is
started, it cannot be stopped by any means other than RESET input.
2. Once WDTM3 and WDTM4 have been set to (1), they cannot be cleared to (0) by software.
3. The watchdog timer starts operation as an interval timer when RUN is set to 1.
Cautions 1. When the watchdog timer is cleared by setting RUN to 1, the actual overflow time is up to
0.8% shorter than the time set by timer clock selection register 2 (TCL2).
2. In watchdog timer mode 1 or 2, set WDTM4 to 1 after confirming that TMIF4 (bit 0 of interrupt
request flag register 0 (IF0)) is set to 0. While TMIF4 is 1, a non-maskable interrupt is
generated upon write completion if watchdog timer mode 1 or 2 is selected.
CHAPTER 9 WATCHDOG TIMER
138 User’s Manual U13952EJ3V1UD
9.4 Operation of Watchdog Timer
9.4.1 Operation as watchdog timer
The watchdog timer detects an inadvertent program loop when bit 4 (WDTM4) of the watchdog timer mode register
(WDTM) is set to 1.
The count clock (program loop detection time interval) of the watchdog timer can be selected by bits 0 to 2 (TCL20
to TCL22) of timer clock selection register 2 (TCL2). By setting bit 7 (RUN) of WDTM to 1, the watchdog timer is
started. Set RUN to 1 within the set program loop detection time interval after the watchdog timer has been started.
By setting RUN to 1, the watchdog timer can be cleared and start counting. If RUN is not set to 1, and the program
loop detection time is exceeded, the system is reset or a non-maskable interrupt is generated by the value of bit 3
(WDTM3) of WDTM.
The watchdog timer continues operation in the HALT mode, but stops in the STOP mode. Therefore, set RUN to 1
before entering the STOP mode to clear the watchdog timer, and then execute the STOP instruction.
Cautions 1. The actual program loop detection time may be up to 0.8% shorter than the set time.
2. When the subsystem clock is selected as the CPU clock, the watchdog timer stops counting.
Table 9-4. Program Loop Detection Time of Watchdog Timer
TCL22 TCL21 TCL20 Program Loop Detection Time Operation at fX = 5.0 MHz
0 0 0
211 × 1/fX 410
µ
s
0 1 0
213 × 1/fX 1.64 ms
1 0 0
215 × 1/fX 6.55 ms
1 1 0
217 × 1/fX 26.2 ms
fX: Main system clock oscillation frequency
CHAPTER 9 WATCHDOG TIMER
User’s Manual U13952EJ3V1UD 139
9.4.2 Operation as interval timer
When bit 4 (WDTM4) and bit 3 (WDTM3) of the watchdog timer mode register (WDTM) are set to 0 and 1,
respectively, the watchdog timer also operates as an interval timer that repeatedly generates an interrupt at time
intervals specified by a preset count value.
Select the count clock (or interval time) by setting bits 0 to 2 (TCL20 to TCL22) of timer clock selection register 2
(TCL2). The watchdog timer starts operation as an interval timer when the RUN bit (bit 7 of WDTM) is set to 1.
In the interval timer mode, the interrupt mask flag (TMMK4) is valid, and a maskable interrupt (INTWDT) can be
generated. The priority of INTWDT is set as the highest of all the maskable interrupts.
The interval timer continues operation in the HALT mode, but stops in the STOP mode. Therefore, set RUN to 1
before entering the STOP mode to clear the interval timer, and then execute the STOP instruction.
Cautions 1. Once bit 4 (WDTM4) of WDTM is set to 1 (when the watchdog timer mode is selected), the
interval timer mode is not set, unless the RESET signal is input.
2. The interval time immediately after the setting by WDTM may be up to 0.8% shorter than the
set time.
Table 9-5. Interval Time of Interval Timer
TCL22 TCL21 TCL20 Interval Time Operation at fX = 5.0 MHz
0 0 0
211 × 1/fX 410
µ
s
0 1 0
213 × 1/fX 1.64 ms
1 0 0
215 × 1/fX 6.55 ms
1 1 0
217 × 1/fX 26.2 ms
fX: Main system clock oscillation frequency
User’s Manual U13952EJ3V1UD
140
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
10.1 Function of 8-Bit A/D Converter
The 8-bit A/D converter converts input analog voltages to digital signals with an 8-bit resolution. It can control up
to seven analog input channels (ANI0 to ANI6).
A/D conversion can be started only by software.
One of analog inputs ANI0 to ANI6 is selected for A/D conversion. A/D conversion is performed repeatedly, with
an interrupt request (INTAD0) being issued each time an A/D conversion is completed.
10.2 Configuration of 8-Bit A/D Converter
The 8-bit A/D converter consists of the following hardware.
Table 10-1. Configuration of 8-Bit A/D Converter
Item Configuration
Analog inputs 7 channels (ANI0 to ANI6)
Registers Successive approximation register (SAR)
A/D conversion result register 0 (ADCR0)
Control registers A/D converter mode register 0 (ADM0)
A/D input selection register 0 (ADS0)
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
User’s Manual U13952EJ3V1UD 141
Figure 10-1. Block Diagram of 8-Bit A/D Converter
ANI0/P60
ANI1/P61
ANI2/P62
ANI3/P63
ANI4/P64
ANI5/P65
ANI6/P66
Selector
Sample & hold circuit
Voltage comparator
Series resistor string
Successive
approximation
register (SAR)
Controller
3
A/D conversion result
register 0 (ADCR0)
Tap selector
AV
SS
INTAD0
A/D converter mode
register 0 (ADM0)
A/D input selection
register 0 (ADS0)
Internal bus
AV
SS
ADCS0
FR02 FR01 FR00
ADS02 ADS01 ADS00
AV
REF
P-ch
AV
DD
(1) Successive approximation register (SAR)
The SAR receives the result of comparing an analog input voltage and a voltage at a voltage tap (comparison
voltage), received from the series resistor string, starting from the most significant bit (MSB).
Upon receiving all the bits, down to the least significant bit (LSB), that is, upon the completion of A/D
conversion, the SAR sends its contents to A/D conversion result register 0 (ADCR0).
(2) A/D conversion result register 0 (ADCR0)
ADCR0 holds the result of A/D conversion. Each time A/D conversion ends, the conversion result received
from the successive approximation register is loaded into ADCR0, which is an 8-bit register that holds the
result of A/D conversion.
ADCR0 is read using an 8-bit memory manipulation instruction.
RESET input makes ADCR0 undefined.
(3) Sample & hold circuit
The sample & hold circuit samples consecutive analog inputs from the input circuit, one by one, and sends
them to the voltage comparator. The sampled analog input voltage is held during A/D conversion.
(4) Voltage comparator
The voltage comparator compares an analog input with the voltage output by the series resistor string.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
142 User’s Manual U13952EJ3V1UD
(5) Series resistor string
The series resistor string is configured between AVREF and AVSS. It generates the reference voltages against
which analog inputs are compared.
(6) ANI0 to ANI6 pins
The ANI0 to ANI6 pins are analog input pins for the seven-channel A/D converter. They are used to receive
the analog signals to be subject to A/D conversion.
Caution Do not supply the ANI0 to ANI6 pins with voltages that fall outside the rated range. If a
voltage greater than AVREF or less than AVSS (even if within the absolute maximum rating) is
supplied to any of these pins, the conversion value for the corresponding channel will be
undefined. Furthermore, the conversion values for the other channels may also be
affected.
(7) AVREF pin
The AVREF pin is a reference voltage pin for the A/D converter.
Signals received at the ANI0 to ANI6 pins are converted to digital signals based on the voltage across the
AVREF and AVSS pins.
(8) AVSS pin
The AVSS pin is a ground potential pin for the A/D converter. This pin must be held at the same potential as
the VSS0 pin, even while the A/D converter is not being used.
(9) AVDD pin
The AVDD pin is an analog power supply pin for the A/D converter. This pin must be held at the same
potential as the VDD0 pin, even while the A/D converter is not being used.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
User’s Manual U13952EJ3V1UD 143
10.3 Registers Controlling 8-Bit A/D Converter
The following two registers are used to control the 8-bit A/D converter.
• A/D converter mode register 0 (ADM0)
• A/D input selection register 0 (ADS0)
(1) A/D converter mode register 0 (ADM0)
ADM0 specifies the conversion time for analog inputs. It also specifies whether to enable conversion.
ADM0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ADM0 to 00H.
Figure 10-2. Format of A/D Converter Mode Register 0
A/D conversion control
ADCS0
0 FR02 FR01 FR00 0 0 0ADM0
Symbol Address After reset R/W
FF80H 00H R/W
<7>6543210
ADCS0
0
1
A/D conversion time selection
Note 1
FR02
0
0
0
1
1
1
144/fx
120/fx
96/fx
72/fx
60/fx
48/fx
FR01
0
0
1
0
0
1
(28.8 s)
(24 s)
(19.2 s)
(14.4 s)
(Setting prohibited
Note 2
)
(Setting prohibited
Note 2
)
µ
µ
µ
FR00
0
1
0
0
1
0
Other than above
Conversion stopped
Conversion enabled
Setting prohibited
µ
Notes 1. The specifications of FR02, FR01, and FR00 must be such that the A/D conversion time is at least
14
µ
s.
2. These bit combinations must not be used, as the A/D conversion time will fall below 14
µ
s.
Cautions 1. The result of conversion performed immediately after bit 7 (ADCS0) is set is undefined.
2. The result of conversion performed after ADCS0 is cleared may be undefined (see 10.5 (5)
Timing that makes the A/D conversion result undefined for details).
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
144 User’s Manual U13952EJ3V1UD
(2) A/D input selection register 0 (ADS0)
ADS0 register specifies the port used to input the analog voltages to be converted to a digital signal.
ADS0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ADS0 to 00H.
Figure 10-3. Format of A/D Input Selection Register 0
00000
ADS02 ADS01 ADS00
ADS0
Symbol Address After reset R/W
FF84H 00H R/W
76543210
Analog input channel specification
ADS02
0
0
0
0
1
1
1
1
ANI0
ANI1
ANI2
ANI3
ANI4
ANI5
ANI6
Setting prohibited
ADS01
0
0
1
1
0
0
1
1
ADS00
0
1
0
1
0
1
0
1
Caution Bits 3 to 7 must be fixed to 0.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
User’s Manual U13952EJ3V1UD 145
10.4 Operation of 8-Bit A/D Converter
10.4.1 Basic operation of 8-bit A/D converter
<1> Select a channel for A/D conversion, using A/D input selection register 0 (ADS0).
<2> The voltage supplied to the selected analog input channel is sampled using the sample & hold circuit.
<3> After sampling continues for a certain period of time, the sample & hold circuit is put on hold to keep the input
analog voltage until A/D conversion is completed.
<4> Bit 7 of the successive approximation register (SAR) is set. The series resistor string voltage tap at the tap
selector is set to half of AVREF.
<5> The series resistor string tap voltage is compared with the analog input voltage using the voltage comparator.
If the analog input voltage is higher than half of AVREF, the MSB of the SAR remains set. If it is lower than
half of AVREF, the MSB is reset.
<6> Bit 6 of the SAR is set automatically, and comparison shifts to the next stage. The next voltage tap of the
series resistor string is selected according to bit 7, which reflects the previous comparison result, as follows:
Bit 7 = 1: Three quarters of AVREF
Bit 7 = 0: One quarter of AVREF
The tap voltage is compared with the analog input voltage. Bit 6 is set or reset according to the result of
comparison.
Analog input voltage tap voltage: Bit 6 = 1
Analog input voltage < tap voltage: Bit 6 = 0
<7> Comparison is repeated until bit 0 of the SAR is reached.
<8> When comparison is completed for all of the 8 bits, a significant digital result is left in the SAR. This value is
sent to and latched in A/D conversion result register 0 (ADCR0). At the same time, it is possible to generate
an A/D conversion end interrupt request (INTAD0).
Cautions 1. The first A/D conversion value immediately following the start of A/D conversion may be
undefined.
2. When the A/D converter enters the standby mode, it stops operating.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
146 User’s Manual U13952EJ3V1UD
Figure 10-4. Basic Operation of 8-Bit A/D Converter
Conversion
time
Sampling
time
Sampling A/D conversion
Undefined 80H C0H
or 40H
Conversion
result
Conversion
result
A/D converter
operation
SAR
ADCR0
INTAD0
A/D conversion continues until bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) is reset (0) by software.
If an attempt is made to write to ADM0 or A/D input selection register 0 (ADS0) during A/D conversion, the current
A/D conversion is canceled. In this case, A/D conversion is restarted from the beginning, if the ADCS0 bit is set (1).
RESET makes A/D conversion result register 0 (ADCR0) undefined.
10.4.2 Input voltage and conversion result
The relationship between the analog input voltage at the analog input pins (ANI0 to ANI6) and the A/D conversion
result (A/D conversion result register 0 (ADCR0)) is represented by:
ADCR0 = INT ( × 256 + 0.5)
or
(ADCR0 – 0.5) × VIN < (ADCR0 + 0.5) ×
INT( ): Function that returns the integer part of a parenthesized value
VIN: Analog input voltage
AVREF: AVREF pin voltage
ADCR0: Value in A/D conversion result register 0 (ADCR0)
Figure 10-5 shows the relationship between the analog input voltage and the A/D conversion result.
VIN
AVREF
AVREF
256
AVREF
256
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
User’s Manual U13952EJ3V1UD 147
Figure 10-5. Relationship Between Analog Input Voltage and A/D Conversion Result
255
254
253
3
2
1
0
A/D conversion
result (ADCR0)
1
512
1
256
3
512
2
256
5
512
3
256
507
512
254
256
509
512
255
256
511
512
1
Input voltage/AVREF
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
148 User’s Manual U13952EJ3V1UD
10.4.3 Operation mode of 8-bit A/D converter
The 8-bit A/D converter is initially in the select mode. In this mode, A/D input selection register 0 (ADS0) is used
to select an analog input channel from ANI0 to ANI6 for A/D conversion.
A/D conversion can be started only by software, that is, by setting A/D converter mode register 0 (ADM0).
The A/D conversion result is saved to A/D conversion result register 0 (ADCR0). At the same time, an interrupt
request signal (INTAD0) is generated.
Software-started A/D conversion
Setting bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) triggers A/D conversion for a voltage applied to
the analog input pin specified in A/D input selection register 0 (ADS0). Upon completion of A/D conversion, the
conversion result is saved to A/D conversion result register 0 (ADCR0). At the same time, an interrupt request
signal (INTAD0) is generated. Once A/D conversion is activated, and completed, another session of A/D
conversion is started. A/D conversion is repeated until new data is written to ADM0. If data where the ADCS0
bit is 1 is written to ADM0 again during A/D conversion, the current session of A/D conversion is discontinued,
and a new session of A/D conversion begins for the new data. If data where the ADCS0 bit is 0 is written to
ADM0 again during A/D conversion, A/D conversion is stopped immediately.
Figure 10-6. Software-Started A/D Conversion
Rewriting ADM0
ADCS0 = 1
Rewriting ADM0
ADCS0 = 1 ADCS0 = 0
A/D conversion
ADCR0
INTAD0
ANIn ANIn ANIn ANIm ANIm
Stop
ANIn ANIn ANIm
Conversion is
discontinued;
no conversion
result is preserved.
Remarks 1. n = 0, 1, ..., 6
2. m = 0, 1, ..., 6
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
User’s Manual U13952EJ3V1UD 149
10.5 Cautions on Using 8-Bit A/D Converter
(1) Current consumption in the standby mode
When the A/D converter enters the standby mode, it stops operating. Stopping conversion (bit 7 (ADCS0) of
A/D converter mode register 0 (ADM0) = 0) can reduce the current consumption.
Figure 10-7 shows how to reduce the current consumption in the standby mode.
Figure 10-7. How to Reduce Current Consumption in Standby Mode
AV
REF
AV
SS
P-ch
Series resistor string
ADCS0
(2) Input range for the ANI0 to ANI6 pins
Be sure to keep the input voltage at ANI0 to ANI6 within the rated range. If a voltage greater than AVREF or
less than AVSS (even within the absolute maximum rating) is input to a conversion channel, the conversion
output of the channel becomes undefined, and the conversion output of the other channels may also be
affected.
(3) Conflict
<1> Conflict between writing to A/D conversion result register 0 (ADCR0) at the end of conversion and reading
from the ADCR0 bit
Reading from the ADCR0 bit takes precedence. After reading, the new conversion result is written to the
ADCR0 bit.
<2> Conflict between writing to the ADCR0 bit at the end of conversion and writing to A/D converter mode
register 0 (ADM0) or A/D input selection register 0 (ADS0)
Writing to ADM0 or ADS0 takes precedence. A request to write to the ADCR0 bit is ignored. No A/D
conversion end interrupt request signal (INTAD0) is generated.
(4) Conversion results immediately following start of A/D conversion
The first A/D conversion value immediately following the start of A/D conversion may be undefined. Be sure
to poll the A/D conversion end interrupt request (INTAD0) and perform processing such as discarding the first
conversion result.
(5) Timing that makes the A/D conversion result undefined
If the timing of the end of A/D conversion and the timing of the stop of operation of the A/D converter conflict,
the A/D conversion value may be undefined. Because of this, be sure to read out the A/D conversion result
while the A/D converter is in operation. Furthermore, when reading out an A/D conversion result after A/D
conversion has stopped, be sure to have done so by the time the next conversion result is complete.
The conversion result readout timing is shown in Figures 10-8 and 10-9.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
150 User’s Manual U13952EJ3V1UD
Figure 10-8. Conversion Result Readout Timing (When Conversion Result Is Undefined Value)
A/D conversion end A/D conversion end
Normal conversion result Undefined value
Normal conversion result read out A/D operation stopped Undefined
value read out
ADCR0
INTAD0
ADCS0
Figure 10-9. Conversion Result Readout Timing (When Conversion Result Is Normal Value)
Normal conversion result
A/D conversion end
Normal conversion
result read out
A/D operation stopped
ADCR0
INTAD0
ADCS0
(6) Noise elimination
To maintain a resolution of 8 bits, it is necessary to avoid noise at the AVREF and ANI0 to ANI6 pins. The
higher the output impedance of the analog input source, the larger the effect by noise. To eliminate noise,
attach an external capacitor to the relevant pins as shown in Figure 10-10.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
User’s Manual U13952EJ3V1UD 151
Figure 10-10. Analog Input Pin Processing
Reference voltage
input
C = 100 to 1000 pF
If noise greater than AV
REF
or less than
AV
SS
is likely to come to the AV
REF
pin, clamp
the voltage at the pin by attaching a diode with a
small V
F
(0.3 V or lower).
AV
SS
AV
DD
V
DD0
V
SS0
AV
REF
(7) ANI0 to ANI6
The analog input pins (ANI0 to ANI6) are alternate-function pins. They are also used as port pins (P60 to
P66).
If any of ANI0 to ANI6 has been selected for A/D conversion, do not execute input instructions for the ports.
Otherwise, the conversion resolution may become lower.
If a digital pulse is applied to a pin adjacent to the analog input pins during A/D conversion, coupling noise
may occur which prevents an A/D conversion result from being attained as expected. Avoid applying a digital
pulse to pins adjacent to the analog input pins during A/D conversion.
(8) Input impedance of ANI0 to ANI6 pins
This A/D converter charges the internal sampling capacitor for about 1/10 of the conversion time, and
performs sampling.
Therefore at times other than sampling, only the leak current is output. During sampling, the current for
charging the capacitor is also output, so the input impedance fluctuates and has no meaning.
However, to ensure adequate sampling, it is recommended that the output impedance of the analog input
source be set to below 10 k, or a 100 pF capacitor be connected to the ANI0 to ANI6 pins (see Figure 10-
10).
(9) Input impedance of the AVREF pin
A series resistor string of several tens of k is connected across the AVREF and AVSS pins.
If the output impedance of the reference voltage source is high, this high impedance is eventually connected
in parallel with the series resistor string across the AVREF and AVSS pins, leading to a higher reference
voltage error.
CHAPTER 10 8-BIT A/D CONVERTER (
µ
PD789407A SUBSERIES)
152 User’s Manual U13952EJ3V1UD
(10) Interrupt request flag (ADIF0)
Changing the contents of A/D converter mode register 0 (ADM0) does not clear the interrupt request flag
(ADIF0).
If the voltage at the analog input pins is changed during A/D conversion, therefore, the A/D conversion result
and the conversion end interrupt request flag may reflect the previous analog input just before writing to
ADM0. In this case, the ADIF0 may appear to be set if it is read-accessed just after ADM0 is write-accessed,
even when A/D conversion has not been completed for the new analog input.
In addition, ADIF0 must be cleared before A/D conversion is restarted.
Figure 10-11. A/D Conversion End Interrupt Request Generation Timing
Rewriting to ADM0
(to begin conversion
for ANIn)
A/D conversion
ADCR0
INTAD0
ANIn ANIn ANIm
ANIn ANIn ANIm
ANIm
ANIm
Rewriting to ADM0
(to begin conversion
for ANIm)
ADIF0 has been set, but conversion
for ANIm has not been completed.
Remarks 1. n = 0, 1, ..., 6
2. m = 0, 1, ..., 6
(11) AVDD pin
The AVDD pin is used to supply power to the analog circuit. It is also used to supply power to the ANI0 to
ANI6 input circuit.
If your application is designed to be switched to backup power, the AVDD pin must be supplied with the same
voltage level as for the VDD0 pin, as shown in Figure 10-12.
Figure 10-12. AVDD Pin Processing
Main power
source Backup
capacitor
VDD0
AVDD
VSS0
AVSS
User’s Manual U13952EJ3V1UD
153
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
11.1 Function of 10-Bit A/D Converter
The 10-bit A/D converter converts input analog voltages to digital signals with a 10-bit resolution. It can control up
to seven analog input channels (ANI0 to ANI6).
A/D conversion can be started only by software.
One of analog inputs ANI0 to ANI6 is selected for A/D conversion. A/D conversion is performed repeatedly, with
an interrupt request (INTAD0) being issued each time an A/D conversion is completed.
11.2 Configuration of 10-Bit A/D Converter
The A/D converter consists of the following hardware.
Table 11-1. Configuration of 10-Bit A/D Converter
Item Configuration
Analog inputs 7 channels (ANI0 to ANI6)
Registers Successive approximation register (SAR)
A/D conversion result register 0 (ADCR0)
Control registers A/D converter mode register 0 (ADM0)
A/D input selection register 0 (ADS0)
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
154 User’s Manual U13952EJ3V1UD
Figure 11-1. Block Diagram of 10-Bit A/D Converter
ANI0/P60
ANI1/P61
ANI2/P62
ANI3/P63
ANI4/P64
ANI5/P65
ANI6/P66
Selector
Sample & hold circuit
Series resistor string
Voltage comparator
Successive
approximation
register (SAR)
Controller
3
A/D conversion result
register 0 (ADCR0)
Tap selector
AVSS
INTAD0
A/D converter mode
register 0 (ADM0)
A/D input selection
register 0 (ADS0)
Internal bus
AVSS
ADCS0
FR02 FR01 FR00
ADS02 ADS01 ADS00
AVREF
P-ch
AVDD
(1) Successive approximation register (SAR)
The SAR receives the result of comparing an analog input voltage and a voltage at a voltage tap (comparison
voltage), received from the series resistor string, starting from the most significant bit (MSB).
Upon receiving all the bits, down to the least significant bit (LSB), that is, upon the completion of A/D
conversion, the SAR sends its contents to A/D conversion result register 0 (ADCR0).
(2) A/D conversion result register 0 (ADCR0)
ADCR0 is a 16-bit register that holds the result of A/D conversion. Lower 6 bits are fixed to 0. Each time A/D
conversion ends, the conversion result in the successive approximation register is loaded into ADCR0. The
conversion results are stored in ADCR0 starting from the most significant bit (MSB). The higher 8 bits of the
conversion results are stored in FF15H and the lower 2 bits of the conversion results are stored in FF14H.
ADCR0 is read using a 16-bit memory manipulation instruction.
RESET input makes ADCR0 undefined.
Symbol
ADCR0
FF15H
0
0
0
000
FF14H
FF14H,
FF15H
Address After reset
Undefined
R/W
R
Caution When the
µ
PD78F9418A is used as the flash memory version of the
µ
PD789405A, 789406A,
and 789407A, 8-bit access is possible, providing an object file has been assembled in the
µ
PD789405A, 789406A, and 789407A.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
User’s Manual U13952EJ3V1UD 155
(3) Sample & hold circuit
The sample & hold circuit samples consecutive analog inputs from the input circuit, one by one, and sends
them to the voltage comparator. The sampled analog input voltage is held during A/D conversion.
(4) Voltage comparator
The voltage comparator compares an analog input with the voltage output by the series resistor string.
(5) Series resistor string
The series resistor string is configured between AVREF and AVSS. It generates the reference voltages against
which analog inputs are compared.
(6) ANI0 to ANI6 pins
The ANI0 to ANI6 pins are analog input pins for the seven-channel A/D converter. They are used to receive
the analog signals to be subject to A/D conversion.
Caution Do not supply the ANI0 to ANI6 pins with voltages that fall outside the rated range. If a
voltage greater than AVREF or less than AVSS (even if within the absolute maximum rating) is
supplied to any of these pins, the conversion value for the corresponding channel will be
undefined. Furthermore, the conversion values for the other channels may also be
affected.
(7) AVREF pin
The AVREF pin is a reference voltage pin for the A/D converter.
Signals received at the ANI0 to ANI6 pins are converted to digital signals based on the voltage across the
AVREF and AVSS pins.
(8) AVSS pin
The AVSS pin is a ground potential pin for the A/D converter. This pin must be held at the same potential as
the VSS0 pin, even while the A/D converter is not being used.
(9) AVDD pin
The AVDD pin is an analog power supply pin for the A/D converter. This pin must be held at the same
potential as the VDD0 pin, even while the A/D converter is not being used.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
156 User’s Manual U13952EJ3V1UD
11.3 Registers Controlling 10-Bit A/D Converter
The following two registers are used to control the 10-bit A/D converter.
• A/D converter mode register 0 (ADM0)
• A/D input selection register 0 (ADS0)
(1) A/D converter mode register 0 (ADM0)
ADM0 specifies the conversion time for analog inputs. It also specifies whether to enable conversion.
ADM0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ADM0 to 00H.
Figure 11-2. Format of A/D Converter Mode Register 0
A/D conversion control
ADCS0
0 FR02 FR01 FR00 0 0 0ADM0
Symbol Address After reset R/W
FF80H 00H R/W
<7>6543210
ADCS0
0
1
A/D conversion time selection
Note 1
FR02
0
0
0
1
1
1
144/fx
120/fx
96/fx
72/fx
60/fx
48/fx
FR01
0
0
1
0
0
1
(28.8 s)
(24 s)
(19.2 s)
(14.4 s)
(Setting prohibited
Note 2
)
(Setting prohibited
Note 2
)
µ
µ
µ
FR00
0
1
0
0
1
0
Other than above
Conversion stopped
Conversion enabled
Setting prohibited
µ
Notes 1. The specifications of FR02, FR01, and FR00 must be such that the A/D conversion time is at least
14
µ
s.
2. These bit combinations must not be used, as the A/D conversion time will fall below 14
µ
s.
Cautions 1. The result of conversion performed immediately after bit 7 (ADCS0) is set is undefined.
2. The result of conversion performed after ADCS0 is cleared may be undefined (see 11.5 (5)
Timing that makes the A/D conversion result undefined for details).
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
User’s Manual U13952EJ3V1UD 157
(2) A/D input selection register 0 (ADS0)
ADS0 register specifies the port used to input the analog voltages to be converted to a digital signal.
ADS0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ADS0 to 00H.
Figure 11-3. Format of A/D Input Selection Register 0
00000
ADS02 ADS01 ADS00
ADS0
Symbol Address After reset R/W
FF84H 00H R/W
76543210
Analog input channel specification
ADS02
0
0
0
0
1
1
1
1
ANI0
ANI1
ANI2
ANI3
ANI4
ANI5
ANI6
Setting prohibited
ADS01
0
0
1
1
0
0
1
1
ADS00
0
1
0
1
0
1
0
1
Caution Bits 3 to 7 must be fixed to 0.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
158 User’s Manual U13952EJ3V1UD
11.4 Operation of 10-Bit A/D Converter
11.4.1 Basic operation of 10-bit A/D converter
<1> Select a channel for A/D conversion, using A/D input selection register 0 (ADS0).
<2> The voltage supplied to the selected analog input channel is sampled using the sample & hold circuit.
<3> After sampling continues for a certain period of time, the sample & hold circuit is put on hold to keep the input
analog voltage until A/D conversion is completed.
<4> Bit 9 of the successive approximation register (SAR) is set. The series resistor string voltage tap at the tap
selector is set to half of AVREF.
<5> The series resistor string tap voltage is compared with the analog input voltage using the voltage comparator.
If the analog input voltage is higher than half of AVREF, the MSB of the SAR remains set. If it is lower than
half of AVREF, the MSB is reset.
<6> Bit 8 of the SAR is set automatically, and comparison shifts to the next stage. The next voltage tap of the
series resistor string is selected according to bit 9, which reflects the previous comparison result, as follows:
Bit 9 = 1: Three quarters of AVREF
Bit 9 = 0: One quarter of AVREF
The tap voltage is compared with the analog input voltage. Bit 8 is set or reset according to the result of
comparison.
Analog input voltage tap voltage: Bit 8 = 1
Analog input voltage < tap voltage: Bit 8 = 0
<7> Comparison is repeated until bit 0 of the SAR is reached.
<8> When comparison is completed for all of the 10 bits, a significant digital result is left in the SAR. This value is
sent to and latched in A/D conversion result register 0 (ADCR0). At the same time, it is possible to generate
an A/D conversion end interrupt request (INTAD0).
Cautions 1. The first A/D conversion value immediately following the start of A/D conversion may be
undefined.
2. When the A/D converter enters the standby mode, it stops operating.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
User’s Manual U13952EJ3V1UD 159
Figure 11-4. Basic Operation of 10-Bit A/D Converter
Conversion
time
Sampling
time
Sampling A/D conversion
Undefined Conversion
result
Conversion
result
A/D converter
operation
SAR
ADCR0
INTAD0
80H C0H
or 40H
A/D conversion continues until bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) is reset (0) by software.
If an attempt is made to write to ADM0 or A/D input selection register 0 (ADS0) during A/D conversion, the current
A/D conversion is canceled. In this case, A/D conversion is restarted from the beginning, if the ADCS0 bit is set (1).
RESET makes A/D conversion result register 0 (ADCR0) undefined.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
160 User’s Manual U13952EJ3V1UD
11.4.2 Input voltage and conversion result
The relationship between the analog input voltage at the analog input pins (ANI0 to ANI6) and the A/D conversion
result (A/D conversion result register 0 (ADCR0)) is represented by:
ADCR0 = INT ( × 1024 + 0.5)
or
(ADCR0 – 0.5) × VIN < (ADCR0 + 0.5) ×
INT( ): Function that returns the integer part of a parenthesized value
VIN: Analog input voltage
AVREF: AVREF pin voltage
ADCR0: Value in A/D conversion result register 0 (ADCR0)
Figure 11-5 shows the relationship between the analog input voltage and the A/D conversion result.
Figure 11-5. Relationship Between Analog Input Voltage and A/D Conversion Result
1023
1022
1021
3
2
1
0
A/D conversion
result (ADCR0)
1
2048
1
1024
3
2048
2
1024
5
2048
3
1024
2043
2048
1022
1024
2045
2048
1023
1024
2047
2048
1
Input voltage/AV
REF
VIN
AVREF
AVREF
1024
AVREF
1024
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
User’s Manual U13952EJ3V1UD 161
11.4.3 Operation mode of 10-bit A/D converter
The 10-bit A/D converter is initially in the select mode. In this mode, A/D input selection register 0 (ADS0) is used
to select an analog input channel from ANI0 to ANI6 for A/D conversion.
A/D conversion can be started only by software, that is, by setting A/D converter mode register 0 (ADM0).
The A/D conversion result is saved to A/D conversion result register 0 (ADCR0). At the same time, an interrupt
request signal (INTAD0) is generated.
Software-started A/D conversion
Setting bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) triggers A/D conversion for a voltage applied to
the analog input pin specified in A/D input selection register 0 (ADS0). Upon completion of A/D conversion, the
conversion result is saved to A/D conversion result register 0 (ADCR0). At the same time, an interrupt request
signal (INTAD0) is generated. Once A/D conversion is activated, and completed, another session of A/D
conversion is started. A/D conversion is repeated until new data is written to ADM0. If data where the ADCS0
bit is 1 is written to ADM0 again during A/D conversion, the current session of A/D conversion is discontinued,
and a new session of A/D conversion begins for the new data. If data where the ADCS0 bit is 0 is written to
ADM0 again during A/D conversion, A/D conversion is stopped immediately.
Figure 11-6. Software-Started A/D Conversion
Rewriting ADM0
ADCS0 = 1
Rewriting ADM0
ADCS0 = 1 ADCS0 = 0
A/D conversion
ADCR0
INTAD0
ANIn ANIn ANIn ANIm ANIm
Stop
ANIn ANIn ANIm
Conversion is
discontinued;
no conversion
result is preserved.
Remarks 1. n = 0, 1, ..., 6
2. m = 0, 1, ..., 6
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
162 User’s Manual U13952EJ3V1UD
11.5 Cautions on Using 10-Bit A/D Converter
(1) Current consumption in the standby mode
When the A/D converter enters the standby mode, it stops operating. Setting the bit 7 (ADCS0) of A/D
converter mode register 0 (ADM0) = 0 can reduce the current consumption.
Figure 11-7 shows how to reduce the current consumption in the standby mode.
Figure 11-7. How to Reduce Current Consumption in Standby Mode
AV
REF
AV
SS
P-ch
Series resistor string
ADCS0
(2) Input range for the ANI0 to ANI6 pins
Be sure to keep the input voltage at ANI0 to ANI6 within the rated range. If a voltage greater than AVREF or
less than AVSS (even within the absolute maximum rating) is input a conversion channel, the conversion
output of the channel becomes undefined, and the conversion output of the other channels may be affected.
(3) Conflict
<1> Conflict between writing to A/D conversion result register 0 (ADCR0) at the end of conversion and reading
from the ADCR0 bit
Reading from the ADCR0 bit takes precedence. After reading, the new conversion result is written to
ADCR0 bit.
<2> Conflict between writing to the ADCR0 bit at the end of conversion and writing to A/D converter mode
register 0 (ADM0) or A/D input selection register 0 (ADS0)
Writing to ADM0 or ADS0 takes precedence. A request to write to the ADCR0 bit is ignored. No A/D
conversion end interrupt request signal (INTAD0) is generated.
(4) Conversion results immediately following start of A/D conversion
The first A/D conversion value immediately following the start of A/D conversion may be undefined. Be sure
to poll the A/D conversion end interrupt request (INTAD0) and perform processing such as discarding the first
conversion result.
(5) Timing that makes the A/D conversion result undefined
If the timing of the end of A/D conversion and the timing of the stop of operation of the A/D converter conflict,
the A/D conversion value may be undefined. Because of this, be sure to read out the A/D conversion result
while the A/D converter is in operation. Furthermore, when reading out an A/D conversion result after A/D
conversion has stopped, be sure to have done so by the time the next conversion result is complete.
The conversion result readout timing is shown in Figures 11-8 and 11-9.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
User’s Manual U13952EJ3V1UD 163
Figure 11-8. Conversion Result Readout Timing (When Conversion Result Is Undefined Value)
A/D conversion end A/D conversion end
Normal conversion result Undefined value
Normal conversion result read out A/D operation
stopped
Undefined value
read out
ADCR0
INTAD0
ADCS0
Figure 11-9. Conversion Result Readout Timing (When Conversion Result Is Normal Value)
Normal conversion result
A/D conversion end
Normal conversion
result read out
A/D operation stopped
ADCR0
INTAD0
ADCS0
(6) Noise elimination
To maintain a resolution of 10 bits, it is necessary to avoid for noise at the AVREF and ANI0 to ANI6 pins. The
higher the output impedance of the analog input source, the larger the effect by noise. To eliminate noise,
attach an external capacitor to the relevant pins as shown in Figure 11-10.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
164 User’s Manual U13952EJ3V1UD
Figure 11-10. Analog Input Pin Processing
Reference voltage
input
C = 100 to 1000 pF
If noise greater than AV
REF
or less than
AV
SS
is likely to come to the AV
REF
pin, clamp
the voltage at the pin by attaching a diode with
a small V
F
(0.3 V or lower).
AV
SS
AV
DD
V
DD0
V
SS0
AV
REF
(7) ANI0 to ANI6
The analog input pins (ANI0 to ANI6) are alternate-function pins. They are also used as port pins (P60 to
P66).
If any of ANI0 to ANI6 has been selected for A/D conversion, do not execute input instructions for the ports.
Otherwise, the conversion resolution may become lower.
If a digital pulse is applied to a pin adjacent to the analog input pins during A/D conversion, coupling noise
may occur which prevents an A/D conversion result from being attained as expected. Avoid applying a digital
pulse to pins adjacent to the analog input pins during A/D conversion.
(8) Input impedance of ANI0 to ANI6 pins
This A/D converter charges the internal sampling capacitor for about 1/10 of the conversion time, and
performs sampling.
Therefore at times other than sampling, only the leak current is output. During sampling, the current for
charging the capacitor is also output, so the input impedance fluctuates and has no meaning.
However, to ensure adequate sampling, it is recommended that the output impedance of the analog input
source be set to below 10 k, or a 100 pF capacitor be connected to the ANI0 to ANI6 pins (see Figure 11-
10).
(9) Input impedance of the AVREF pin
A series resistor string of 10 k is connected across the AVREF and AVSS pins.
If the output impedance of the reference voltage source is high, this high impedance is eventually connected
in parallel with the series resistor string across the AVREF and AVSS pins, leading to a higher reference
voltage error.
CHAPTER 11 10-BIT A/D CONVERTER (
µ
PD789417A SUBSERIES)
User’s Manual U13952EJ3V1UD 165
(10) Interrupt request flag (ADIF0)
Changing the contents of A/D converter mode register 0 (ADM0) does not clear the interrupt request flag
(ADIF0).
If the voltage at the analog input pins is changed during A/D conversion, therefore, the A/D conversion result
and the conversion end interrupt request flag may reflect the previous analog input just before writing to
ADM0. In this case, the ADIF0 may appear to be set if it is read-accessed just after ADM0 is write-accessed,
even when A/D conversion has not been completed for the new analog input.
In addition, ADIF0 must be cleared before A/D conversion is restarted.
Figure 11-11. A/D Conversion End Interrupt Request Generation Timing
Rewriting to ADM0
(to begin conversion
for ANIn)
A/D conversion
ADCR0
INTAD0
ANIn ANIn ANIm
ANIn ANIn ANIm
ANIm
ANIm
Rewriting to ADM0
(to begin conversion
for ANIm)
ADIF0 has been set, but conversion
for ANIm has not been completed.
Remarks 1. n = 0, 1, ..., 6
2. m = 0, 1, ..., 6
(11) AVDD pin
The AVDD pin is used to supply power to the analog circuit. It is also used to supply power to the ANI0 to
ANI6 input circuit.
If your application is designed to be changed to backup power, the AVDD pin must be supplied with the same
voltage level as for the VDD0 pin, as shown in Figure 11-12.
Figure 11-12. AVDD Pin Processing
Main power
source
Backup
capacitor
V
DD0
AV
DD
V
SS0
AV
SS
User’s Manual U13952EJ3V1UD
166
CHAPTER 12 COMPARATOR
12.1 Functions of Comparator
The comparator has the following functions.
(1) Input voltage comparison by comparator
The comparator compares an input voltage at the reference voltage input pin (CMPREF0) with an input
voltage at the comparator input pin (CMPIN0). The comparison result can be read using memory
manipulation instructions.
(2) Interrupt generation by comparator output
The comparator output is used to generate an interrupt request signalNote (INTCMP0).
Note The rising edge, falling edge, or both rising and falling edges can be specified by setting external
interrupt mode register 1 (INTM1).
(3) Clock output
When CMPREF0 > CMPIN0, the output of 8-bit timer counter 02 (TM02) is directed to the CMPTOUT0 pin.
(4) Open-drain output selection
Comparator mode register 0 (CMPRM0) is used to specify a port as an N-ch open-drain output.
CHAPTER 12 COMPARATOR
User’s Manual U13952EJ3V1UD 167
12.2 Configuration of Comparator
The comparator consists of the following hardware.
(1) CMPIN0
This is the comparator input pin.
(2) CMPTOUT0
This is the comparator output pin.
(3) CMPREF0
This is the comparator reference voltage input pin.
Figure 12-1 is a block diagram of the comparator.
Figure 12-1. Block Diagram of Comparator
Internal bus
P23
output latch PM23
Selector
Timing control
CMPTOUT0/P23/
TO2
_
+
CMPIN0
CMPREF0
INTCMP0
8-bit timer 02
(TM02) output
Edge selector
Internal bus
Comparator mode
register 0 (CMPRM0)
ES61
External interrupt mode
register 1 (INTM1)
CMPON0 CMPOUT0
SELCMP0 OPDR0
ES60
CHAPTER 12 COMPARATOR
168 User’s Manual U13952EJ3V1UD
12.3 Register Controlling Comparator
The comparator is controlled by the following register.
(1) Comparator mode register 0 (CMPRM0)
CMPRM0 controls the power supply and clock output of the comparator. It also selects an open-drain output
for the comparator.
CMPRM0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets CMPRM0 to 00H.
Figure 12-2. Format of Comparator Mode Register 0
CMPON0
0
1
Comparator power supply on/off control
000
CMPON0
SELCMP0
OPDR0
CMPOUT0
CMPRM0
Symbol Address After reset R/W
FF4EH 00H R/W
Note
67 543210
SELCMP0
0
1
Clock output control
OPDR0
0
1
Open-drain output selection
CMPOUT0
0
Comparator power supply off
Comparator power supply on
8-bit timer 02 (TM02) output
8-bit timer counter 02 (TM02) output if CMPREF0 > CMPIN0
CMOS output
N-ch open-drain output
The comparator output is read.
Note Bit 0 is read-only.
Cautions 1. Bits 4 to 7 must be fixed to 0.
2. If the comparator is enabled (CMPON0 = 1), noise may be induced. If it is necessary to
generate an interrupt request signal (INTCMP0) from the output of the comparator, enable the
comparator (CMPON0 = 1), then clear the interrupt request flag (CMPIF0) to 0, before
enabling interrupts.
3. Similarly, if it is necessary to direct the output of the comparator to the port, enable the
comparator (CMPON0 = 1) in advance.
CHAPTER 12 COMPARATOR
User’s Manual U13952EJ3V1UD 169
12.4 Operation of Comparator
The output of 8-bit timer 02 (TM02) can be controlled and directed to the CMPTOUT0/P23/TO2 pin via the
comparator.
To run the comparator, set as follows:
Set P23 to output mode (PM23 = 0).
Set comparator mode register 0 (CMPRM0) as shown in Figure 12-3.
Set external interrupt mode register 1 (INTM1) as shown in Figure 12-4 and select the valid edge of INTCMP0.
Figure 12-3. Settings of Comparator Mode Register 0 for Comparator Operation
Figure 12-4. Settings of External Interrupt Mode Register 1 at INTCMP0 Occurrence
0/1 0/1 0 0 1 1 0/1 0/1
ES61
INTM1
ES60 ES31
Selects the valid edge
(see Table 12-1).
ES30
Table 12-1 lists the selection of INTCMP0 valid edges, and Figure 12-5 shows the timing chart of the comparator.
Table 12-1. INTCMP0 Valid Edges
ES61 ES60 INTCMP0 Valid Edge Selection
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
1 1 Both rising and falling edges
0
CMPRM0 000110/1
CMPON0 SELCMP0 OPDR0 CMPOUT0
Outputs TM02.
Switches on the
comparator power.
CHAPTER 12 COMPARATOR
170 User’s Manual U13952EJ3V1UD
Figure 12-5. Comparator Operation Timing (1/2)
Timer (TM02)
output
CMPOUT0
CMPTOUT0
SELCMP0
Timer (TM02)
output enable
signal
<1> CMPOUT0 is latched on the rising edge of the TM02 output to generate a signal to enable output to the
CMPTOUT0/P23/TO2 pin. If CMPOUT0 is high, the TM02 output waveform is output to the
CMPTOUT0/P23/TO2 pin on the rising edge of the TM02 output. If CMPOUT0 is low, CMPTOUT0 is not
output.
<2> If SELCMP0 is low, the TM02 output is sent to the CMPTOUT0/P23/TO2 pin no matter which level
CMPOUT0 is on.
Figure 12-5. Comparator Operation Timing (2/2)
Timer (TM02)
output
CMPOUT0
CMPTOUT0
SELCMP0
Timer (TM02)
output enable
signal
<3> If the high level of CMPOUT0 is latched on the rising edge of the TM02 output, CMPTOUT0 is output to the
CMPTOUT0/P23/TO2 pin for at least two clock pulses even if it falls immediately.
<4> Switching SELCMP0 from high to low during CMPTOUT0 output may disturb the output waveform of
CMPTOUT0.
User’s Manual U13952EJ3V1UD
171
CHAPTER 13 SERIAL INTERFACE 00
13.1 Functions of Serial Interface 00
Serial interface 00 has the following three modes.
Operation stopped mode
Asynchronous serial interface (UART) mode
3-wire serial I/O mode
(1) Operation stopped mode
This mode is used to reduce power consumption when serial transfer is not carried out.
(2) Asynchronous serial interface (UART) mode
In this mode, one byte of data following the start bit is transmitted/received, and full-duplex operation is
possible.
A dedicated UART baud rate generator is incorporated, allowing communication over a wide range of baud
rates. In addition, the baud rate can be defined by dividing the clock input to the ASCK pin.
(3) 3-wire serial I/O mode (MSB/LSB start bit switchable)
In this mode, 8-bit data transfer is carried out using three lines, one for the serial clock (SCK) and two for
serial data (SI, SO).
The 3-wire serial I/O mode supports simultaneous transmit and receive operations, reducing data transfer
processing time.
It is possible to switch the start bit of 8-bit data to be transmitted between the MSB and the LSB, thus
allowing connection to devices with either start bit.
The 3-wire serial I/O mode is effective for connecting display controllers and peripheral I/Os such as the
75XL Series, 78K Series, and 17K Series, which have conventional clock synchronous serial interfaces.
CHAPTER 13 SERIAL INTERFACE 00
172 User’s Manual U13952EJ3V1UD
13.2 Configuration of Serial Interface 00
Serial interface 00 consists of the following hardware.
Table 13-1. Configuration of Serial Interface 00
Item Configuration
Registers Transmit shift register 00 (TXS00)
Receive shift register 00 (RXS00)
Receive buffer register 00 (RXB00)
Control registers Serial operation mode register 00 (CSIM00)
Asynchronous serial interface mode register 00 (ASIM00)
Asynchronous serial interface status register 00 (ASIS00)
Baud rate generator control register 00 (BRGC00)
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 173
PE00 FE00
OVE00
INTSR00/INTCSI00
RxD/SI/P22
TxD/SO/P21
PM21
PM20
TXE00 RXE00 PS001 PS000 CL00 SL00
INTST00
CSIE00
DIR00
CSCK00
TPS003 TPS002 TPS001 TPS000
4
CSIE00
TXE00
RXE00
CSCK00
ASCK/SCK/P20
f
X
/2 to f
X
/2
8
Internal bus
Internal bus
Receive buffer
register 00 (RXB00/SIO00)
Direction controller
Receive shift
register 00 (RXS00)
Receive
controller
Asynchronous serial interface
status register 00 (ASIS00)
Direction controller
Asynchronous serial interface
mode register 00 (ASIM00)
Transmit
controller
SCK output controller
Baud rate generator
Note
Baud rate generator
control register 00 (BRGC00)
Serial operation mode
register 00 (CSIM00)
Transmit shift
register 00 (TXS00/SIO00)
Figure 13-1. Block Diagram of Serial Interface 00
Note For the baud rate generator configuration, see Figure 13-2.
CHAPTER 13 SERIAL INTERFACE 00
174 User’s Manual U13952EJ3V1UD
f
X
2
f
X
2
2
f
X
2
3
f
X
2
4
f
X
2
5
f
X
2
6
f
X
2
7
f
X
2
8
TPS003 TPS002 TPS001 TPS000
4
CSIE00
TXE00
RXE00
ASCK/SCK/P20
1/2
1/2
CSIE00
RXE00
CSIE00
Internal bus
BRGC00 write
TXE00
CSCK00
RXE00
Transmit clock
Receive clock
Selector
Clear
Clear
3-bit counter
Clear 3-bit counter
Clear
Stop
Prescaler
Baud rate generator
control register 00 (BRGC00)
Selector
Selector
Start bit detection
BRGC00 write
Figure 13-2. Block Diagram of Baud Rate Generator
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 175
(1) Transmit shift register 00 (TXS00)
This register is used to specify data to be transmitted. Data written to TXS00 is transmitted as serial data.
If the data length is specified as 7 bits, bits 0 to 6 of the data written to TXS00 are transferred as the transmit
data. The transmit operation is started by writing data to TXS00.
TXS00 is written to using an 8-bit memory manipulation instruction. It cannot be read.
RESET input sets TXS00 to FFH.
Caution Do not write to TXS00 during a transmit operation.
TXS00 and receive buffer register 00 (RXB00) are allocated to the same address, and when
reading is performed, RXB00 values are read.
(2) Receive shift register 00 (RXS00)
This register is used to convert serial data input to the RxD pin into parallel data. Each time one byte of data
is received, it is transferred to receive buffer register 00 (RXB00).
RXS00 cannot be manipulated directly by program.
(3) Receive buffer register 00 (RXB00)
This register is used to hold received data. Each time one byte of data is received, a new byte of data is
transferred from receive shift register 00 (RXS00).
If the data length is specified as 7 bits, receive data is transferred to bits 0 to 6 of RXB00, and the MSB of
RXB00 always becomes 0.
RXB00 can be read using an 8-bit memory manipulation instruction. It cannot be written to.
RESET input makes RXB00 undefined.
Caution RXB00 and transmit shift register 00 (TXS00) are allocated to the same address, and when
writing is performed, the values are written to TXS00.
(4) Transmit controller
This circuit controls transmit operations by adding a start bit, parity bit, and stop bit to data written to transmit
shift register 00 (TXS00), according to the data set to asynchronous serial interface mode register 00
(ASIM00).
(5) Receive controller
This circuit controls receive operations according to the data set to asynchronous serial interface mode
register 00 (ASIM00). It also performs a parity error check, etc., during receive operations, and when an error
is detected, it sets a value to asynchronous serial interface status register 00 (ASIS00) in accordance with
the nature of the error.
CHAPTER 13 SERIAL INTERFACE 00
176 User’s Manual U13952EJ3V1UD
13.3 Registers Controlling Serial Interface 00
The following four registers are used to control serial interface 00.
Serial operation mode register 00 (CSIM00)
Asynchronous serial interface mode register 00 (ASIM00)
Asynchronous serial interface status register 00 (ASIS00)
Baud rate generator control register 00 (BRGC00)
(1) Serial operation mode register 00 (CSIM00)
This register is set when using serial interface 00 in the 3-wire serial I/O mode.
CSIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets CSIM00 to 00H.
Figure 13-3. Format of Serial Operation Mode Register 00
CSIE00
0
1
Operation control in 3-wire serial I/O mode
CSIE00
0000DIR00
CSCK00
0CSIM00
Symbol Address After reset R/W
FF72H 00H R/W
<7>6543210
Operation stopped
Operation enabled
DIR00
0
1
Start bit specification
MSB
LSB
CSCK00
0
1
Clock selection in 3-wire serial I/O mode
Clock input to SCK pin from external
Dedicated baud rate generator output
Cautions 1. Bits 0 and 3 to 6 must be fixed to 0.
2. Set CSIM00 to 00H in the UART mode.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 177
(2) Asynchronous serial interface mode register 00 (ASIM00)
This register is set when using serial interface 00 in the asynchronous serial interface mode.
ASIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ASIM00 to 00H.
Figure 13-4. Format of Asynchronous Serial Interface Mode Register 00
TXE00
0
1
Transmit operation control
TXE00 RXE00 PS001 PS000
CL00 SL00 0 0ASIM00
Symbol Address After reset R/W
FF70H 00H R/W
<7><6>543210
Transmit operation stopped
Transmit operation enabled
Receive operation stopped
Receive operation enabled
RXE00
0
1
0
1
0
0
0
1
0
1
1
1
No parity
0 parity always added at transmission
Parity check is not performed at reception (no parity error occurs)
Odd parity
Even parity
Receive operation control
PS001
Parity bit specification
PS000
CL00
0
1
SL00
Character length specification
7 bits
8 bits
1 bit
2 bits
Transmit data stop bit length specification
Cautions 1. Bits 0 and 1 must be fixed to 0.
2. Set ASIM00 to 00H in the 3-wire serial I/O mode.
3. Switching operation modes must be performed after the serial transmit/receive operation is
stopped.
CHAPTER 13 SERIAL INTERFACE 00
178 User’s Manual U13952EJ3V1UD
Table 13-2. Operation Mode Settings of Serial Interface 00
(1) Operation stopped mode
P22/SI/RxD P21/SO/TxD
P20/SCK/ASCK
P22 P21 P20
ASIM00
TXE00
0
RXE00
0
CSIE00
0
CSIM00
DIR00
x
CSCK00
x
PM22
x
Note 1
P22
x
Note 1
PM21
x
Note 1
P21
x
Note 1
PM20
x
Note 1
P20
x
Note 1
Other than above Setting prohibited
Start
Bit
Shift
Clock Pin Function Pin Function Pin Function
(2) Asynchronous serial interface mode
P22/SI/RxD P21/SO/TxD
P20/SCK/ASCK
LSB P22
RxD
TxD
(CMOS output)
P21
TxD
(CMOS output)
ASCK input
P20
ASCK input
P20
ASCK input
P20
ASIM00
TXE00
1
0
1
RXE00
0
1
1
CSIE00
0
0
0
CSIM00
DIR00
0
0
0
CSCK00
0
0
0
PM22
x
Note 1
1
1
P22
x
Note 1
x
x
PM21
0
x
Note 1
0
P21
1
x
Note 1
1
PM20
1
x
Note 1
1
x
Note 1
1
x
Note 1
P20
x
x
Note 1
x
x
Note 1
x
x
Note 1
Other than above
Start
Bit
Shift
Clock Pin Function Pin Function Pin Function
External
clock
External
clock
External
clock
Internal
clock
Internal
clock
Internal
clock
Setting prohibited
(3) 3-wire serial I/O mode
MSB
LSB
SI
Note 2
SO
(CMOS output)
SCK input
SCK output
001
1
0
1
0
1
0
1
1
Note 2
x
Note 2
011
0
1
0
x
1
x
1
External
clock
External
clock
Internal
clock
Internal
clock
Other than above Setting prohibited
P22/SI/RxD P21/SO/TxD
P20/SCK/ASCK
ASIM00
TXE00 RXE00 CSIE00
CSIM00
DIR00
CSCK00
PM22
P22
PM21
P21
PM20
P20 Start
Bit
Shift
Clock Pin Function Pin Function Pin Function
SCK input
SCK output
Notes 1. Can be used as port function.
2. If used only for transmission, can be used as P22 (CMOS I/O).
Remark x: Don’t care
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 179
(3) Asynchronous serial interface status register 00 (ASIS00)
This register indicates the type of error when a reception error occurs in the asynchronous serial interface
mode.
ASIS00 is read using a 1-bit or 8-bit memory manipulation instruction.
The contents of ASIS00 become undefined in the 3-wire serial I/O mode.
RESET input sets ASIS00 to 00H.
Figure 13-5. Format of Asynchronous Serial Interface Status Register 00
PE00
0
1
Parity error flag
00000PE00 FE00
OVE00
ASIS00
Symbol Address After reset R/W
FF71H 00H R
76543210
Parity error did not occur
Parity error occurred (when the transmit parity and receive parity did not match)
Framing error did not occur
Framing error occurred (when stop bit was not detected)Note 1
Overrun error did not occur
Overrun error occurredNote 2
(when the next receive operation was completed before the data was read from receive buffer register 00)
FE00
0
1
0
1
Framing error flag
Overrun error flag
OVE00
Notes 1. Even when the stop bit length is set to 2 bits by setting bit 2 (SL00) of asynchronous serial interface
mode register 00 (ASIM00), only one stop bit is detected during reception.
2. Be sure to read receive buffer register 00 (RXB00) when an overrun error occurs. If not, an overrun
error will occur every time the data is received.
CHAPTER 13 SERIAL INTERFACE 00
180 User’s Manual U13952EJ3V1UD
(4) Baud rate generator control register 00 (BRGC00)
This register is used to set the serial clock of serial interface 00.
BRGC00 is set using an 8-bit memory manipulation instruction.
RESET input sets BRGC00 to 00H.
Figure 13-6. Format of Baud Rate Generator Control Register 00
TPS003
0
0
0
0
0
0
0
0
1
TPS003 TPS002 TPS001 TPS000
0000BRGC00
R/W
FF73H 00H R/W
76543210
TPS002
0
0
0
0
1
1
1
1
0
fX/2
fX/22
fX/23
fX/24
fX/25
fX/26
fX/27
fX/28
(2.5 MHz)
(1.25 MHz)
(625 kHz)
(313 kHz)
(156 kHz)
(78.1 kHz)
(39.1 kHz)
(19.5 kHz)
TPS001
0
0
1
1
0
0
1
1
0
TPS000
0
1
0
1
0
1
0
1
0
n
1
2
3
4
5
6
7
8
Setting prohibited
Symbol Address After reset
3-bit counter source clock selection
Clock input from external to ASCK pinNote
Other than above
Note Only used in the UART mode.
Cautions 1. When BRGC00 is written during a communication operation, the output of the baud rate
generator is disrupted and communications cannot be performed normally. Be sure not to
write to BRGC00 during a communication operation.
2. Do not select n = 1 during fX = 5.0 MHz operation because the baud rate rating is exceeded.
Remarks 1. f
X: Main system clock oscillation frequency
2. n: Value determined in the settings of TPS000 to TPS003 (1 n 8)
3. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 181
The baud rate transmit/receive clock to be generated is either a signal divided from the main system clock, or
a signal divided from the clock input from the ASCK pin.
(a) Generation of baud rate transmit/receive clock from main system clock
The transmit/receive clock is generated by dividing the main system clock. The baud rate generated
from the main system clock is estimated by using the following expression.
[Baud rate] = [Hz]
fX: Main system clock oscillation frequency
n: Value in Figure 13-6 that is determined in the settings of TPS000 to TPS003 (2 n 8)
Table 13-3. Example of Relationship Between Main System Clock and Baud Rate
Baud Rate BRGC00 Set Value Error (%)
(bps) fX = 5.0 MHz fX = 4.9152 MHz
1200 70H 1.73 0
2400 60H
4800 50H
9600 40H
19200 30H
38400 20H
76800 10H
fX
2n + 1 ×8
CHAPTER 13 SERIAL INTERFACE 00
182 User’s Manual U13952EJ3V1UD
(b) Generation of baud rate transmit/receive clock from external clock of ASCK pin
The transmit/receive clock is generated by dividing the clock input from the ASCK pin. The baud rate
generated from the clock input from the ASCK pin is estimated by using the following expression.
[Baud rate] = [Hz]
fASCK: Frequency of clock input to the ASCK pin
Table 13-4. Relationship Between ASCK Pin Input Frequency
and Baud Rate (When BRGC00 Is Set to 80H)
Baud Rate (bps) ASCK Pin Input Frequency (kHz)
75 1.2
150 2.4
300 4.8
600 9.6
1200 19.2
2400 38.4
4800 76.8
9600 153.6
19200 307.2
31250 500.0
38400 614.4
fASCK
16
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 183
13.4 Operation of Serial Interface 00
Serial interface 00 has the following three modes.
Operation stopped mode
Asynchronous serial interface (UART) mode
3-wire serial I/O mode
13.4.1 Operation stopped mode
Serial transfer is not executed in the operation stopped mode, therefore the power consumption can be reduced.
The P20/SCK/ASCK, P21/SO/TxD, and P22/SI/RxD pins can be used as normal I/O port pins.
(1) Register setting
Operation stopped mode is set by serial operation mode register 00 (CSIM00) and asynchronous serial
interface mode register 00 (ASIM00).
(a) Serial operation mode register 00 (CSIM00)
CSIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets CSIM00 to 00H.
CSIE00
0
1
Operation control in 3-wire serial I/O mode
CSIE00
0000DIR00
CSCK00
0CSIM00
Symbol Address After reset R/W
FF72H 00H R/W
<7>6543210
Operation stopped
Operation enabled
Caution Bits 0 and 3 to 6 must be fixed to 0.
CHAPTER 13 SERIAL INTERFACE 00
184 User’s Manual U13952EJ3V1UD
(b) Asynchronous serial interface mode register 00 (ASIM00)
ASIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ASIM00 to 00H.
TXE00
0
1
Transmit operation control
TXE00 RXE00
PS001 PS000 CL00 SL00 0 0ASIM00
Symbol Address After reset R/W
FF70H 00H R/W
<7><6>543210
Transmit operation stopped
Transmit operation enabled
Receive operation stopped
Receive operation enabled
RXE00
0
1
Receive operation control
Caution Bits 0 and 1 must be fixed to 0.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 185
13.4.2 Asynchronous serial interface (UART) mode
In this mode, the one-byte data following the start bit is transmitted/received and thus full-duplex communications
are possible.
This device incorporates a UART-dedicated baud rate generator, enabling communication at the desired baud
rate. In addition, the baud rate can also be defined by dividing the clock input to the ASCK pin.
The UART-dedicated baud rate generator can also output a 31.25 kbps baud rate, which complies with the MIDI
standard.
(1) Register setting
UART mode is set by serial operation mode register 00 (CSIM00), asynchronous serial interface mode
register 00 (ASIM00), asynchronous serial interface status register 00 (ASIS00), and baud rate generator
control register 00 (BRGC00).
(a) Serial operation mode register 00 (CSIM00)
CSIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets CSIM00 to 00H.
Set CSIM00 to 00H in the UART mode.
CSIE00
0
1
Operation control in 3-wire serial I/O mode
CSIE00
0000DIR00
CSCK00
0CSIM00
Symbol Address After reset R/W
FF72H 00H R/W
<7>6543210
Operation stopped
Operation enabled
DIR00
0
1
Start bit specification
MSB
LSB
CSCK00
0
1
Clock selection in 3-wire serial I/O mode
Clock input to SCK pin from external
Dedicated baud rate generator output
Caution Bits 0 and 3 to 6 must be fixed to 0.
CHAPTER 13 SERIAL INTERFACE 00
186 User’s Manual U13952EJ3V1UD
(b) Asynchronous serial interface mode register 00 (ASIM00)
ASIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ASIM00 to 00H.
TXE00
0
1
Transmit operation control
TXE00 RXE00
PS001 PS000
CL00 SL00 0 0ASIM00
Symbol Address After reset R/W
FF70H 00H R/W
<7><6>543210
Transmit operation stopped
Transmit operation enabled
Receive operation stopped
Receive operation enabled
RXE00
0
1
0
1
0
0
0
1
0
1
1
1
No parity
0 parity always added at transmission
Parity check is not performed at reception (no parity error occurs)
Odd parity
Even parity
Receive operation control
PS001
Parity bit specification
PS000
CL00
0
1
SL00
Character length specification
7 bits
8 bits
1 bit
2 bits
Transmit data stop bit length specification
Cautions 1. Bits 0 and 1 must be fixed to 0.
2. Switching operation modes must be performed after the serial transmit/receive
operation is stopped.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 187
(c) Asynchronous serial interface status register 00 (ASIS00)
ASIS00 is read using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ASIS00 to 00H.
PE00
0
1
Parity error flag
00000PE00 FE00
OVE00
ASIS00
Symbol Address After reset R/W
FF71H 00H R
76543210
Parity error did not occur
Parity error occurred (when the transmit parity and receive parity did not match)
Framing error did not occur
Framing error occurred (when stop bit was not detected)Note 1
Overrun error did not occur
Overrun error occurredNote 2
(when the next receive operation was completed before the data was read from receive buffer register 00)
FE00
0
1
0
1
Framing error flag
Overrun error flag
OVE00
Notes 1. Even when the stop bit length is set to 2 bits by setting bit 2 (SL00) of asynchronous serial
interface mode register 00 (ASIM00), only one stop bit will be detected during reception.
2. Be sure to read receive buffer register 00 (RXB00) when an overrun error occurs. If not,
every time the data is received an overrun error occurs.
CHAPTER 13 SERIAL INTERFACE 00
188 User’s Manual U13952EJ3V1UD
(d) Baud rate generator control register 00 (BRGC00)
BRGC00 is set using an 8-bit memory manipulation instruction.
RESET input sets BRGC00 to 00H.
TPS003
0
0
0
0
0
0
0
0
1
TPS003 TPS002 TPS001 TPS000
0000BRGC00
R/W
FF73H 00H R/W
76543210
TPS002
0
0
0
0
1
1
1
1
0
fX/2
fX/22
fX/23
fX/24
fX/25
fX/26
fX/27
fX/28
(2.5 MHz)
(1.25 MHz)
(625 kHz)
(313 kHz)
(156 kHz)
(78.1 kHz)
(39.1 kHz)
(19.5 kHz)
TPS001
0
0
1
1
0
0
1
1
0
TPS000
0
1
0
1
0
1
0
1
0
n
1
2
3
4
5
6
7
8
Setting prohibited
Symbol Address After reset
3-bit counter source clock selection
Clock input from external to ASCK pin
Other than above
Cautions 1. When BRGC00 is written during a communication operation, the output of the baud
rate generator is disrupted and communications cannot be performed normally.
Be sure not to write to BRGC00 during a communication operation.
2. Do not select n = 1 during fX = 5.0 MHz operation because the baud rate rating is
exceeded.
Remarks 1. f
X: Main system clock oscillation frequency
2. n: Value determined in the settings of TPS000 to TPS003 (1 n 8)
3. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 189
The baud rate transmit/receive clock to be generated is either a signal divided from the main system
clock, or a signal divided from the clock input from the ASCK pin.
(i) Generation of baud rate transmit/receive clock from main system clock
The transmit/receive clock is generated by dividing the main system clock. The baud rate
generated from the main system clock is estimated by using the following expression.
[Baud rate] = [Hz]
fX: Main system clock oscillation frequency
n: Value in the above table that is determined in the settings of TPS000 to TPS003 (2 n
8)
Table 13-5. Example of Relationship Between Main System Clock and Baud Rate
Baud Rate BRGC00 Set Value Error (%)
(bps) fX = 5.0 MHz fX = 4.9152 MHz
1200 70H 1.73 0
2400 60H
4800 50H
9600 40H
19200 30H
38400 20H
76800 10H
fX
2n + 1 ×8
CHAPTER 13 SERIAL INTERFACE 00
190 User’s Manual U13952EJ3V1UD
(ii) Generation of baud rate transmit/receive clock from external clock of ASCK pin
The transmit/receive clock is generated by dividing the clock input from the ASCK pin. The baud
rate generated from the clock input from the ASCK pin is estimated by using the following
expression.
[Baud rate] = [Hz]
fASCK: Frequency of clock input to the ASCK pin
Table 13-6. Relationship Between ASCK Pin Input Frequency
and Baud Rate (When BRGC00 Is Set to 80H)
Baud Rate (bps) ASCK Pin Input Frequency (kHz)
75 1.2
150 2.4
300 4.8
600 9.6
1200 19.2
2400 38.4
4800 76.8
9600 153.6
19200 307.2
31250 500.0
38400 614.4
fASCK
16
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 191
(2) Communication operation
(a) Data format
The transmit/receive data format is as shown in Figure 13-7. One data frame consists of a start bit,
character bits, parity bit and stop bit(s).
The specification of character bit length, parity selection, and specification of stop bit length for each
data frame is carried out using asynchronous serial interface mode register 00 (ASIM00).
Figure 13-7. Format of Asynchronous Serial Interface Transmit/Receive Data
D0 D1 D2 D3 D4 D5 D6 D7
Parity
bit Stop bit
Start
bit
One data frame
Start bit ...................... 1 bit
Character bits............. 7 bits/8 bits
Parity bits ................... Even parity/odd parity/0 parity/no parity
Stop bit(s)................... 1 bit/2 bits
When 7 bits are selected as the number of character bits, only the lower 7 bits (bits 0 to 6) are valid; the
most significant bit (bit 7) is ignored in transmission, and the most significant bit (bit 7) is always 0 in
reception.
The serial transfer rate is selected using ASIM00 and baud rate generator control register 00
(BRGC00).
If a serial data receive error occurs, the receive error contents can be determined by reading the status
of asynchronous serial interface status register 00 (ASIS00).
CHAPTER 13 SERIAL INTERFACE 00
192 User’s Manual U13952EJ3V1UD
(b) Parity types and operation
The parity bit is used to detect a bit error in the communication data. Normally, the same kind of parity
bit is used on the transmitting side and the receiving side. With even parity and odd parity, a “1” bit (odd
number) error can be detected. With 0 parity and no parity, an error cannot be detected.
(i) Even parity
At transmission
The transmission operation is controlled so that the number of bits with a value of 1 in the
transmit data including the parity bit may be even. The parity bit value should be as follows.
The number of bits with a value of 1 is an odd number in transmit data: 1
The number of bits with a value of 1 is an even number in transmit data: 0
At reception
The number of bits with a value of 1 in the receive data including the parity bit is counted, and if
the number is odd, a parity error occurs.
(ii) Odd parity
At transmission
Conversely to even parity, the transmission operation is controlled so that the number of bits with
a value of 1 in the transmit data including the parity bit may be odd. The parity bit value should
be as follows.
The number of bits with a value of 1 is an odd number in transmit data: 0
The number of bits with a value of 1 is an even number in transmit data: 1
At reception
The number of bits with a value of 1 in the receive data including the parity bit is counted, and if
the number is even, a parity error occurs.
(iii) 0 Parity
When transmitting, the parity bit is set to 0 irrespective of the transmit data.
At reception, a parity bit check is not performed. Therefore, a parity error does not occur,
irrespective of whether the parity bit is set to 0 or 1.
(iv) No parity
A parity bit is not added to the transmit data. At reception, data is received assuming that there is
no parity bit. Since there is no parity bit, a parity error does not occur.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 193
(c) Transmission
A transmit operation is started by writing transmit data to transmit shift register 00 (TXS00). The start
bit, parity bit and stop bit(s) are added automatically.
When the transmit operation starts, the data in TXS00 is shifted out, and when TXS00 is empty, a
transmission completion interrupt (INTST00) is generated.
Figure 13-8. Asynchronous Serial Interface Transmission Completion Interrupt Timing
(a) Stop bit length: 1
Stop
ParityD7D6D2D1D0
Start
TxD (Output)
INTST00
(b) Stop bit length: 2
Stop
ParityD7D6D2D1D0
Start
TxD (Output)
INTST00
Caution Do not rewrite asynchronous serial interface mode register 00 (ASIM00) during a
transmit operation. If ASIM00 is rewritten during transmission, subsequent
transmission may not operate correctly (the normal state is restored by RESET input).
Whether transmission is in progress or not can be judged by software using a
transmission completion interrupt (INTST00) or the interrupt request flag (STIF00) set
by INTST00.
CHAPTER 13 SERIAL INTERFACE 00
194 User’s Manual U13952EJ3V1UD
(d) Reception
When bit 6 (RXE00) of asynchronous serial interface mode register 00 (ASIM00) is set (1), a receive
operation is enabled and sampling of the RxD pin input is performed.
RxD pin input sampling is performed using the serial clock specified by ASIM00.
When the RxD pin input becomes low, the 3-bit counter starts counting, and when half the time
determined by the specified baud rate has passed, the data sampling start timing signal is output. If the
RxD pin input sampled again as a result of this start timing signal is low, it is identified as a start bit, the
3-bit counter is initialized and starts counting, and data sampling is performed. When character data, a
parity bit and one stop bit are detected after the start bit, reception of one frame of data ends.
When one frame of data has been received, the receive data in the shift register is transferred to receive
buffer register 00 (RXB00), and a reception completion interrupt (INTSR00) is generated.
If an error occurs, the receive data in which the error occurred is still transferred to RXB00, and
INTSR00 is generated.
If the RXE00 bit is reset (0) during the receive operation, the receive operation is stopped immediately.
In this case, the contents of RXB00 and asynchronous serial interface status register 00 (ASIS00) are
not changed, and INTSR00 is not generated.
Figure 13-9. Asynchronous Serial Interface Reception Completion Interrupt Timing
Stop
ParityD7D6D2D1D0
Start
RxD (Input)
INTSR00
Caution Be sure to read receive buffer register 00 (RXB00) even if a receive error occurs. If
RXB00 is not read, an overrun error will occur when the next data is received, and the
receive error state will continue indefinitely.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 195
(e) Receive errors
The following three errors may occur during a receive operation: a parity error, framing error, or overrun
error. The data reception result error flag is set in asynchronous serial interface status register 00
(ASIS00). Receive error causes are shown in Table 13-7.
What kind of error occurred during reception can be judged by reading the contents of ASIS00 in the
receive error interrupt servicing (see Figures 13-9 and 13-10).
The contents of ASIS00 are reset (0) by reading receive buffer register 00 (RXB00) or receiving the next
data (if there is an error in the next data, the corresponding error flag is set).
Table 13-7. Receive Error Causes
Receive Errors Cause
Parity error The parity specified at transmission and the reception data parity do not match.
Framing error A stop bit is not detected.
Overrun error Reception of the next data is completed before data is read from the receive buffer register.
Figure 13-10. Receive Error Timing
(a) Parity error occurs
Stop
ParityD7D6D2D1D0
Start
RxD (input)
INTSR00
(b) Framing error or overrun error occurs
Stop
ParityD7D6D2D1D0
Start
RxD (input)
INTSR00
Cautions 1. The contents of the ASIS00 register are reset (0) by reading receive buffer register
00 (RXB00) or receiving the next data. To ascertain the error contents, read ASIS00
before reading RXB00.
2. Be sure to read receive buffer register 00 (RXB00) even if a receive error occurs. If
RXB00 is not read, an overrun error will occur when the next data is received, and
the receive error state will continue indefinitely.
CHAPTER 13 SERIAL INTERFACE 00
196 User’s Manual U13952EJ3V1UD
(f) Reading receive data
When the reception completion interrupt (INTSR00) is generated, receive data can be read by reading
the value of receive buffer register 00 (RXB00).
To read the receive data stored in receive buffer register 00 (RXB00), read while reception is enabled
(RXE00 = 1).
Remark However, if it is necessary to read receive data after reception has stopped (RXE00 = 0),
read using either of the following methods.
(a) Read after setting RXE00 = 0 after waiting for one cycle or more of the source clock
selected by BRGC00.
(b) Read after bit 2 (DIR00) of serial operation mode register 00 (CSIM00) is set (1).
Program example of (a) (BRGC00 = 00H (source clock = fx/2))
INTRXE: ;<Reception completion interrupt routine>
NOP ;2 clocks
CLR1 RXE00 ;Reception stopped
MOV A, RXB00 ;Read receive data
Program example of (b)
INTRXE: ;<Reception completion interrupt routine>
SET1 CSIM00.2 ;DIR00 flag is set to LSB first
CLR1 RXE00 ;Reception stopped
MOV A, RXB00 ;Read receive data
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 197
(3) Cautions on UART mode
(a) When bit 7 (TXE00) of asynchronous serial interface mode register 00 (ASIM00) is cleared during
transmission, be sure to set transmit shift register 00 (TXS00) to FFH, then set the TXE00 bit to 1
before executing the next transmission.
(b) When bit 6 (RXE00) of asynchronous serial interface mode register 00 (ASIM00) is cleared during
reception, receive buffer register 00 (RXB00) and the reception completion interrupt (INTSR00) are as
follows.
ParityRxD pin
RXB00
INTSR00
<3><1>
<2>
When RXE00 is set to 0 at the timing indicated by <1>, RXB00 holds the previous data and does not
generate INTSR00.
When RXE00 is set to 0 at the timing indicated by <2>, RXB00 renews the data and does not generate
INTSR00.
When RXE00 is set to 0 at the timing indicated by <3>, RXB00 renews the data and generates INTSR00.
CHAPTER 13 SERIAL INTERFACE 00
198 User’s Manual U13952EJ3V1UD
13.4.3 3-wire serial I/O mode
The 3-wire serial I/O mode is useful for connection of peripheral I/Os and display controllers, etc., which
incorporate a conventional synchronous serial interface, such as the 75XL Series, 78K Series, and 17K Series.
Communication is performed using three lines: the serial clock (SCK), serial output (SO), and serial input (SI).
(1) Register setting
3-wire serial I/O mode settings are performed using serial operation mode register 00 (CSIM00),
asynchronous serial interface mode register 00 (ASIM00), and baud rate generator control register 00
(BRGC00).
(a) Serial operation mode register 00 (CSIM00)
CSIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets CSIM00 to 00H.
CSIE00
0
1
Operation control in 3-wire serial I/O mode
CSIE00
0000DIR00
CSCK00
0CSIM00
Symbol Address After reset R/W
FF72H 00H R/W
<7>6543210
Operation stopped
Operation enabled
DIR00
0
1
Start bit specification
MSB
LSB
CSCK00
0
1
Clock selection in 3-wire serial I/O mode
Clock input to SCK pin from external
Dedicated baud rate generator output
Caution Bits 0 and 3 to 6 must be fixed to 0.
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 199
(b) Asynchronous serial interface mode register 00 (ASIM00)
ASIM00 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets ASIM00 to 00H.
ASIM00 must be set to 00H in the 3-wire serial I/O mode.
TXE00
0
1
Transmit operation control
TXE00 RXE00
PS001 PS000
CL00 SL00 0 0ASIM00
Symbol Address After reset R/W
FF70H 00H R/W
<7><6>543210
Transmit operation stopped
Transmit operation enabled
Receive operation stopped
Receive operation enabled
RXE00
0
1
0
1
0
0
0
1
0
1
1
1
No parity
0 parity always added at transmission
Parity check is not performed at reception (no parity error occurs.)
Odd parity
Even parity
Receive operation control
PS001
Parity bit specification
PS000
CL00
0
1
SL00
Character length specification
7 bits
8 bits
1 bit
2 bits
Transmit data stop bit length specification
Cautions 1. Bits 0 and 1 must be fixed to 0.
2. Switching operation modes must be performed after the serial transmit/receive
operation is stopped.
CHAPTER 13 SERIAL INTERFACE 00
200 User’s Manual U13952EJ3V1UD
(c) Baud rate generator control register 00 (BRGC00)
BRGC00 is set using an 8-bit memory manipulation instruction.
RESET input sets BRGC00 to 00H.
TPS003
0
0
0
0
0
0
0
0
TPS003 TPS002 TPS001 TPS000
0000BRGC00
R/W
FF73H 00H R/W
76543210
TPS002
0
0
0
0
1
1
1
1
f
X
/2
f
X
/2
2
f
X
/2
3
f
X
/2
4
f
X
/2
5
f
X
/2
6
f
X
/2
7
f
X
/2
8
(2.5 MHz)
(1.25 MHz)
(625 kHz)
(313 kHz)
(156 kHz)
(78.1 kHz)
(39.1 kHz)
(19.5 kHz)
TPS001
0
0
1
1
0
0
1
1
TPS000
0
1
0
1
0
1
0
1
n
1
2
3
4
5
6
7
8
Setting prohibited
Symbol Address After reset
3-bit counter source clock selection
Other than above
Cautions 1. When BRGC00 is written during a communication operation, the output of the baud
rate generator is disrupted and communications cannot be performed normally.
Be sure not to write to BRGC00 during a communication operation.
2. Do not select n = 1 during fX = 5.0 MHz operation because the baud rate rating is
exceeded.
Remarks 1. f
X: Main system clock oscillation frequency
2. n: Value in the above table that is determined in the settings of TPS000 to TPS003 (1
n 8)
3. The parenthesized values apply to operation at fX = 5.0 MHz.
If the internal clock is used as the serial clock for the 3-wire serial I/O mode, set the TPS000 to TPS003
bits to set the frequency of the serial clock. To obtain the frequency to be set, use the following formula.
When the serial clock is input from off-chip, setting BRGC00 is unnecessary.
Serial clock frequency = [Hz]
fX: Main system clock oscillation frequency
n: Value in the above table that is determined in the settings of TPS000 to TPS003 (1 n 8)
fX
2n + 1
CHAPTER 13 SERIAL INTERFACE 00
User’s Manual U13952EJ3V1UD 201
(2) Communication operation
In the 3-wire serial I/O mode, data transmission/reception is performed in 8-bit units. Data is
transmitted/received bit by bit in synchronization with the serial clock.
Transmit shift register 00 (TXS00/SIO00) and receive shift register 00 (RXS00) shift operations are
performed in synchronization with the fall of the serial clock (SCK). Then transmit data is held in the SO latch
and output from the SO pin. Also, receive data input to the SI pin is latched in receive buffer register 00
(RXB00/SIO00) on the rise of SCK.
At the end of an 8-bit transfer, the operation of TXS00/SIO00 or RXS00 stops automatically, and the interrupt
request signal (INTCSI00) is generated.
Figure 13-11. 3-Wire Serial I/O Mode Timing
12345678
DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
End of transfer
Transfer start at the falling edge of SCK
SCK
SI
SO
INTCSI00
(3) Transfer start
Serial transfer is started by setting transfer data to transmit shift register 00 (TXS00/SIO00) when the
following two conditions are satisfied.
Bit 7 (CSIE00) of serial operation mode register 00 (CSIM00) = 1
Internal serial clock is stopped or SCK is a high level after 8-bit serial transfer.
Caution If CSIE00 is set to 1 after data is written to TXS00/SIO00, transfer does not start.
Termination of 8-bit transfer stops the serial transfer automatically and generates the interrupt request signal
(INTCSI00).
User’s Manual U13952EJ3V1UD
202
CHAPTER 14 LCD CONTROLLER/DRIVER
14.1 Functions of LCD Controller/Driver
The functions of the LCD controller/driver of the
µ
PD789407A and 789417A Subseries are as follows.
(1) Automatic output of segment and common signals based on automatic display data memory read
(2) Five different display modes:
• Static
• 1/2 duty (1/2 bias)
• 1/3 duty (1/2 bias)
• 1/3 duty (1/3 bias)
• 1/4 duty (1/3 bias)
(3) Four different frame frequencies, selectable in each display mode
(4) Up to 28 segment signal outputs (S0 to S27) and four common signal outputs (COM0 to COM3)
Of these segment signal outputs, 12 outputs can be switched to I/O ports in 2-output units (P80/S27 to
P87/S20 and P90/S19 to P93/S16).
(5) Voltage divider resistors (for LCD drive voltage generation) that a port itself can contain if so specified with a
mask option
(6) Operation with a subsystem clock
Table 14-1 lists the maximum number of pixels that can be displayed in each display mode.
Table 14-1. Maximum Number of Pixels
Bias Mode Number of Time Slices Common Signals
Used
Maximum Number of Pixels
Static COM0 (COM1 to
COM3)
28 (28 segment signals, 1 common signal)Note 1
1/2 2 COM0, COM1 56 (28 segment signals, 2 common signals)Note 2
3 COM0 to COM2 84 (28 segment signals, 3 common signals)Note 3
1/3 3 COM0 to COM2
4 COM0 to COM3 112 (28 segment signals, 4 common signals)Note 4
Notes 1. Three-digit LCD panel, each digit having an 8-segment
configuration.
2. Seven-digit LCD panel, each digit having a 4-segment configuration.
3. Nine-digit LCD panel, each digit having a 3-segment
configuration.
4. Fourteen-digit LCD panel, each digit having a 2-segment
configuration.
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 203
14.2 Configuration of LCD Controller/Driver
The LCD controller/driver consists of the following hardware.
Table 14-2. Configuration of LCD Controller/Driver
Item Configuration
Display outputs 28 segment signals (16 dedicated segment signals and 12 segment and I/O port signals)
4 common signals (COM0 to COM3)
Control registers LCD display mode register 0 (LCDM0)
LCD port selector 0 (LPS0)
LCD clock control register 0 (LCDC0)
CHAPTER 14 LCD CONTROLLER/DRIVER
204 User’s Manual U13952EJ3V1UD
Internal bus
LCD clock control register 0
(LCDC0)
LCDC03 LCDC02 LCDC01 LCDC00
22
LCD display mode
register 0 (LCDM0) LCD port selector 0
(LPS0)
3
Selector
Prescaler
Segment selector
LCD
clock
selector
Selector Selector Selector
LCD drive
voltage controller
Common driver
LCDCL
f
LCD
f
LCD
2
6
f
LCD
2
7
f
LCD
2
8
f
LCD
2
9
LPS05
LCDON0
VAON0
LIPS0
LCDM02 LCDM01 LCDM00
LPS04 LPS03 LPS02 LPS01 LPS00
6
V
LC2
S×/P8×V
LC1
V
LC0
BIAS
P8
×
output
buffer
Segment
driver
Segment
driver
Segment
driver
P9
×
output
buffer
COM0 COM1 COM2 COM3
3210
32106574
F×××H
Display data
memory
LCDON
S×/P9×
3210
32106574
F×××H
LCDON
3210
32106574
F×××HP8×
Output latch
LCDON
S×
P9×
Output latch
Timing
controller
f
X
/2
3
f
X
/2
5
f
X
/2
7
f
XT
Figure 14-1. Block Diagram of LCD Controller/Driver
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 205
14.3 Registers Controlling LCD Controller/Driver
The following three registers are used to control the LCD controller/driver.
• LCD display mode register 0 (LCDM0)
• LCD port selector 0 (LPS0)
• LCD clock control register 0 (LCDC0)
(1) LCD display mode register 0 (LCDM0)
LCDM0 specifies whether to enable display operation. It also specifies the operation mode, LCD drive power
supply, and display mode.
LCDM0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets LCDM0 to 00H.
Figure 14-2. Format of LCD Display Mode Register 0
LCDON0
VAON0
0 LIPS0 0
LCDM02 LCDM01 LCDM00
LCDM0
Symbol Address After reset R/W
FFB0H 00H R/W
76543210
LCD controller/driver display mode selection
LCDM02
0
0
0
0
1
4
3
2
3
Static
Setting prohibited
LCDM01
0
0
1
1
0
LCDM00
0
1
0
1
0
Control of LCD display
LCDON0
0
1
Display off (all segment outputs are deselected.)
Display on
LCD drive power supply selectionLIPS0
0
1
LCD controller/driver operation mode
Note
VAON0
0
1
Normal operation
Low-voltage operation
LCD drive power is not supplied.
LCD drive power is supplied to the BIAS pin.
Number of time slices Bias mode
1/3
1/3
1/2
1/2
Other than above
Note When the LCD display panel is not used, VAON0 and LIPS0 must be fixed to 0 to conserve power.
Caution Before attempting to manipulate VAON0, set LIPS0 and LCDON0 to 0 to turn off the LCD.
CHAPTER 14 LCD CONTROLLER/DRIVER
206 User’s Manual U13952EJ3V1UD
(2) LCD port selector 0 (LPS0)
LPS0 controls port and segment signal output switching.
LPS0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets LPS0 to 00H.
Figure 14-3. Format of LCD Port Selector 0
Cautions 1. Bits 6 and 7 must be fixed to 0.
2. Be sure to use segments in sequence from the smallest segment value (LPS05 LPS04
LPS00).
Remark m = 8 n = 0 to 7
m = 9 n = 0 to 3
× = 16 to 27
0
LPS00
LPS0
Symbol Address After reset R/W
FFB1H 00H R/W
76543210
0
1
Used as ports (Pmn)
LPS04 LPS03 LPS02 LPS01 LPS00
P93/S16, P92/S17 P91/S18, P90/S19 P87/S20, P86/S21 P85/S22, P84/S23 P83/S24, P82/S25 P81/S26, P80/S27
Used as segments (S×)
LPS05
LPS01LPS02LPS04LPS05
0
LPS03
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 207
(3) LCD clock control register 0 (LCDC0)
LCDC0 specifies the LCD source clock and LCD clock.
The frame frequency is determined according to the LCD clock and the number of time slices.
LCDC0 is set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets LCDC0 to 00H.
Figure 14-4. Format of LCD Clock Control Register 0
LCDC03 LCDC02 LCDC01 LCDC00
LCDC0
Symbol Address After reset R/W
FFB2H 00H R/W
76543210
Selection of LCD source clock frequency (fLCD)
Note
LCDC03
0
0
1
1
LCDC02
0
1
0
1
Selection of LCD clock (LCDCL) frequency
LCDC01
0
0
1
1
LCDC00
0
1
0
1
0000
fLCD/26
fLCD/27
fLCD/28
fLCD/29
fX/27 (39.1 kHz)
fXT (32.768 kHz)
fX/25 (156.3 kHz)
fX/23 (625 kHz)
Note Specify an LCD source clock (fLCD) frequency of at least 32 kHz.
Remarks 1. f
X: Main system clock oscillation frequency
2. f
XT: Subsystem clock oscillation frequency
3. The parenthesized values apply to operation at fX = 5.0 MHz or fXT = 32.768 kHz.
For example, Table 14-3 lists the frame frequencies used when fXT (32.768 kHz) is supplied to the LCD
source clock (fLCD).
Table 14-3. Frame Frequencies (Hz)
LCD Clock (LCDCL)
Frequency
Number of Time Slices
fXT/29
(64 Hz)
fXT/28
(128 Hz)
fXT/27
(256 Hz)
fXT/26
(512 Hz)
Static 64 128 256 512
2 32 64 128 256
3 21 43 85 171
4 16 32 64 128
CHAPTER 14 LCD CONTROLLER/DRIVER
208 User’s Manual U13952EJ3V1UD
14.4 Setting LCD Controller/Driver
Set the LCD controller/driver using the following procedure.
<1> Set the initial values in the LCD display data memory (FA00H to FA1BH).
<2> Set the pins to be used for segment output in LCD port selector 0 (LPS0).
<3> Set the display and operation modes in LCD display mode register 0 (LCDM0).
<4> Set the LCD clock in LCD clock control register 0 (LCDC0).
Subsequent to this procedure, set the data to be displayed in the data memory.
14.5 LCD Display Data Memory
The LCD display data memory is mapped at addresses FA00H to FA1BH. Data in the LCD display data memory
can be displayed on the LCD panel using the LCD controller/driver.
Figure 14-5 shows the relationship between the contents of the LCD display data memory and the
segment/common outputs.
The part of the display data memory not used for display can be used as ordinary RAM.
Figure 14-5. Relationship Between LCD Display Data Memory Contents and Segment/Common Outputs
S0FA00H
S1FA01H
S2FA02H
S3FA03H
S25/P82FA09H
S26/P81FA1AH
S27/P80FA1BH
COM3 COM2 COM1 COM0
b7b6b5b4b3b2b1b0
Address
Caution No memory is allocated to the higher 4 bits of the LCD display data memory. Be sure to fix there
bits to 0.
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 209
14.6 Common and Segment Signals
Each pixel of the LCD panel turns on when the potential difference between the corresponding common and
segment signals becomes higher than a specific voltage (LCD drive voltage, VLCD). The pixels turn off when the
potential difference becomes lower than VLCD.
Applying DC voltage to the common and segment signals of an LCD panel causes deterioration. To avoid this
problem, this LCD panel is driven by AC voltage.
(1) Common signals
Each common signal is selected sequentially according to a specified number of time slices at the timing
listed in Table 14-4. In the static display mode, the same signal is output to COM0 to COM3.
In the two-time-slice mode, leave the COM2 and COM3 pins open. In the three-time-slice mode, leave the
COM3 pin open.
Table 14-4. COM Signals
COM0 COM1 COM2 COM3COM Signal
Number of Time Slices
Static display mode
Two-time-slice mode
Three-time-slice mode
Four-time-slice mode
Open Open
Open
(2) Segment signals
The segment signals correspond to 28 bytes of LCD display data memory (FA00H to FA1BH). Bits 0, 1, 2,
and 3 of each byte are read in synchronization with COM0, COM1, COM2, and COM3, respectively. If a bit
is 1, it is converted to the select voltage, and if it is 0, it is converted to the deselect voltage. The conversion
results are output to the segment pins (S0 to S27). Note that S16 to S27 can also be used as I/O port pins.
Check, with the information given above, what combination of front-surface electrodes (corresponding to the
segment signals) and rear-surface electrodes (corresponding to the common signals) forms display patterns
in the LCD display data memory, and write the bit data that corresponds to the desired display pattern on a
one-to-one basis.
LCD display data memory bits 1 and 2, bits 2 and 3, and bit 3 are not used for LCD display in the static
display, two-time slot, and three-time slot modes, respectively. So these bits can be used for purposes other
than display.
LCD display data memory bits 4 to 7 are fixed to 0.
CHAPTER 14 LCD CONTROLLER/DRIVER
210 User’s Manual U13952EJ3V1UD
(3) Output waveforms of common and segment signals
The voltages listed in Table 14-5 are output as common and segment signals.
When both common and segment signals are at the select voltage, a display on-voltage of ±VLCD is obtained.
The other combinations of the signals correspond to the display off-voltage.
Table 14-5. LCD Drive Voltage
(a) Static display mode
Segment Signal Select Signal Level Deselect Signal Level
Common Signal VSS0/VLC0 VLC0/VSS0
VLC0/VSS0 –VLCD/+VLCD 0 V/0 V
(b) 1/2 bias method
Segment Signal Select Signal Level Deselect Signal Level
Common Signal VSS0/VLC0 VLC0/VSS0
Select signal level VLC0/VSS0 –VLCD/+VLCD 0 V/0 V
Deselect signal level VLC1 = VLC2 – VLCD/+ VLCD + VLCD/– VLCD
(c) 1/3 bias method
Segment Signal Select Signal Level Deselect Signal Level
Common Signal VSS0/VLC0 VLC1/VLC2
Select signal level VLC0/VSS0 –VLCD/+VLCD – VLCD/+ VLCD
Deselect signal level VLC2/VLC1 – VLCD/+ VLCD – VLCD/+ VLCD
1
2
1
2
1
2
1
2
1
3
1
3
1
3
1
3
1
3
1
3
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 211
Figure 14-6 shows the common signal waveforms, and Figure 14-7 shows the voltages and phases of the common
and segment signals.
Figure 14-6. Common Signal Waveforms
(a) Static display mode
COMn
(Static display)
T
F
= T
V
LC0
V
SS0
V
LCD
T: One LCD clock period TF: Frame frequency
(b) 1/2 bias method
COMn
(Two-time slot mode)
TF = 2 × T
VLC0
VSS0
VLCDVLC2
COMn
(Three-time slot mode)
TF = 3 × T
VLC0
VSS0
VLCDVLC2
T: One LCD clock period TF: Frame frequency
(c) 1/3 bias method
COMn
(Three-time slot mode)
T
F
= 3 × T
V
LC0
V
SS0
V
LCD
V
LC1
V
LC2
T
F
= 4 × T
COMn
(Four-time slot mode)
V
LC0
V
LCD
V
LC1
V
LC2
V
SS0
T: One LCD clock period TF: Frame frequency
CHAPTER 14 LCD CONTROLLER/DRIVER
212 User’s Manual U13952EJ3V1UD
Figure 14-7. Voltages and Phases of Common and Segment Signals
(a) Static display mode
Select Deselect
Common signal
Segment signal
V
LC0
V
SS0
V
LCD
V
LC0
V
SS0
V
LCD
TT
T: One LCD clock period
(b) 1/2 bias method
Select Deselect
Common signal
Segment signal
VLC0
VSS0
VLCD
VLC0
VSS0
VLCD
TT
VLC2
VLC2
T: One LCD clock period
(c) 1/3 bias method
Select Deselect
Common signal
Segment signal
V
LC0
V
SS0
V
LCD
V
LC0
V
SS0
V
LCD
TT
V
LC2
V
LC2
V
LC1
V
LC1
T: One LCD clock period
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 213
14.7 Supplying LCD Drive Voltages VLC0, VLC1, and VLC2
The mask ROM versions (except the
µ
PD78F9418A) of the LCD display can incorporate voltage divider resistors
for generating LCD drive power as specified using a mask option. Incorporating voltage divider resistors can generate
LCD drive voltages that meet each bias method listed in Table 14-6, without using external voltage divider resistors.
The LCD drive voltage can be supplied to the BIAS pin to support various LCD drive voltage levels.
Table 14-6. LCD Drive Voltages (with On-Chip Voltage Divider Resistors)
Bias Method No Bias (Static) 1/2 Bias Method 1/3 Bias Method
LCD Drive Voltage Pin
VLC0 VLCD VLCD VLCD
VLC1 VLCD VLCDNote VLCD
VLC2 VLCD VLCD
Note For the 1/2 bias method, it is necessary to connect the VLC1 and VLC2 pins externally.
Remarks 1. If the BIAS and VLC0 pins are open, VLCD = VDD (if voltage divider resistors are included).
2. If the BIAS and VLC0 pins are connected, VLCD = VDD.
Figure 14-8 shows examples of generating LCD drive voltages internally according to Table 14-6.
2
3
2
3
1
2
1
3
1
3
3
5
CHAPTER 14 LCD CONTROLLER/DRIVER
214 User’s Manual U13952EJ3V1UD
Figure 14-8. Examples of LCD Drive Power Connections (with On-Chip Voltage Divider Resistors)
(a) 1/3 bias method and static display mode
(VDD = 5 V and VLCD = 3 V)
(b) 1/2 bias method
(VDD = 5 V and VLCD = 5 V)
LIPS0
V
LC0
V
DD
P-ch
BIAS pin
2 R
R
R
R
V
LC1
V
LC2
V
LCD
V
LCD
= 3/5 V
DD
V
SS
V
SS0
LIPS0
V
LC0
V
DD
P-ch
BIAS pin
2 R
R
R
R
V
LC1
V
LC2
V
LCD
V
LCD
= V
DD
V
SS
V
SS0
(c) 1/3 bias method and static display mode
(VDD = 5 V and VLCD = 5 V)
LIPS0
V
LC0
V
DD
P-ch
BIAS pin
2 R
R
R
R
V
LC1
V
LC2
V
LCD
V
LCD
= V
DD
V
SS
V
SS0
LIPS0: Bit 4 of LCD display mode register 0 (LCDM0)
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 215
14.8 Display Modes
14.8.1 Static display example
Figure 14-10 shows how the three-digit LCD panel having the display pattern shown in Figure 14-9 is connected to
the segment signals (S0 to S23) and the common signal (COM0) of the
µ
PD789407A or 789417A Subseries chip.
This example displays data "12.3" in the LCD panel. The contents of the display data memory (addresses FA00H to
FA17H) correspond to this display.
The following description focuses on numeral "2." ( ) displayed in the second digit. To display "2." in the LCD
panel, it is necessary to apply the select or deselect voltage to the S8 to S15 pins according to Table 14-7 at the
timing of the common signal COM0; see Figure 14-9 for the relationship between the segment signals and LCD
segments.
Table 14-7. Select and Deselect Voltages (COM0)
Segment S8 S9 S10 S11 S12 S13 S14 S15
Common
COM0 Select Deselect Select Select Deselect Select Select Select
According to Table 14-7, it is determined that the bit-0 pattern of the display data memory locations (FA08H to
FA0FH) must be 10110111.
Figure 14-11 shows the LCD drive waveforms of S11 and S12, and COM0. When the select voltage is applied to
S11 at the timing of COM0, an alternate rectangle waveform, +VLCD/VLCD, is generated to turn on the corresponding
LCD segment.
COM1 to COM3 are supplied with the same waveform as for COM0. So, COM0 to COM3 may be connected
together to increase the driving capacity.
Figure 14-9. Static LCD Display Pattern and Electrode Connections
S
8n+3
S
8n+2
S
8n+5
S
8n+1
S
8n
S
8n+4
S
8n+6
S
8n+7
COM0
Remark n = 0 to 2
CHAPTER 14 LCD CONTROLLER/DRIVER
216 User’s Manual U13952EJ3V1UD
Figure 14-10. Example of Connecting Static LCD Panel
000001101110110110101110
××××××××××××××××××××××××
××××××××××××××××××××××××
××××××××××××××××××××××××
Bit 0
Bit 1
Bit 2
Bit 3
Timing strobe
Data memory address
LCD panel
FA00H
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
FA10H
1
2
3
4
5
6
7
S 0
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12
S 13
S 14
S 15
S 16
S 17
S 18
S 19
S 20
S 21
S 22
S 23
COM 3
Can be connected
together
COM 2
COM 1
COM 0
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 217
Figure 14-11. Static LCD Drive Waveform Examples
T
F
V
LC0
V
SS0
COM0
V
LC0
V
SS0
S11
V
LC0
V
SS0
S12
+V
LCD
0COM0 to S12
–V
LCD
+V
LCD
0COM0 to S11
–V
LCD
CHAPTER 14 LCD CONTROLLER/DRIVER
218 User’s Manual U13952EJ3V1UD
14.8.2 Two-time-slice display example
Figure 14-13 shows how the seven-digit LCD panel having the display pattern shown in Figure 14-12 is connected
to the segment signals (S0 to S27) and the common signals (COM0 and COM1) of the
µ
PD789407A or 789417A
Subseries chip. This example displays data "123456.7" in the LCD panel. The contents of the display data memory
(addresses FA00H to FA1BH) correspond to this display.
The following description focuses on numeral "3" ( ) displayed in the fifth digit. To display "3" in the LCD panel, it
is necessary to apply the select or deselect voltage to the S16 to S19 pins according to Table 14-8 at the timing of the
common signals COM0 and COM1; see Figure 14-12 for the relationship between the segment signals and LCD
segments.
Table 14-8. Select and Deselect Voltages (COM0 and COM1)
Segment S16 S17 S18 S19
Common
COM0 Select Select Deselect Deselect
COM1 Deselect Select Select Select
According to Table 14-8, it is determined that the display data memory location (FA13H) that corresponds to S19
must contain xx10.
Figure 14-14 shows examples of LCD drive waveforms between the S19 signal and each common signal. When
the select voltage is applied to S19 at the timing of COM1, an alternate rectangle waveform, +VLCD/VLCD, is generated
to turn on the corresponding LCD segment.
Figure 14-12. Two-Time-Slice LCD Display Pattern and Electrode Connections
;;
;;;
;;
;;
;;;
;
;;
;;
;;
;;
S
4n+2
S
4n+3
S
4n+1
S
4n
COM0
COM1
Remark n = 0 to 6
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 219
Figure 14-13. Example of Connecting Two-Time-Slice LCD Panel
×: Can always be used to store any data because the two-time-slice mode is being used.
0011101000110111010111010111
0000111011100010111011110100
××××××××××××××××××××××××××××
××××××××××××××××××××××××××××
Bit 0
Bit 1
Bit 2
Bit 3
Timing strobe
Data memory address
LCD panel
FA00H
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
FA10H
1
2
3
4
5
6
7
8
9
A
B
S 0
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12
S 13
S 14
S 15
S 16
S 17
S 18
S 19
S 20
S 21
S 22
S 23
S 24
S 25
S 26
S 27
COM 3
COM 2
COM 1
COM 0
Open
Open
CHAPTER 14 LCD CONTROLLER/DRIVER
220 User’s Manual U13952EJ3V1UD
Figure 14-14. Two-Time-Slice LCD Drive Waveform Examples (1/2 Bias Method)
TF
VLC0
VSS0
COM0
VLC0
VSS0
VLC0
VSS0
S19
+VLCD
0COM1 to S19
–VLCD
+VLCD
0COM0 to S19
–VLCD
VLC1,2
VLC1,2
VLC1,2
COM1
+1/2VLCD
+1/2VLCD
–1/2VLCD
–1/2VLCD
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 221
14.8.3 Three-time-slice display example
Figure 14-16 shows how the nine-digit LCD panel having the display pattern shown in Figure 14-15 is connected to
the segment signals (S0 to S26) and the common signals (COM0 to COM2) of the
µ
PD789407A or 789417A
Subseries chip. This example displays data "123456.789" in the LCD panel. The contents of the display data memory
(addresses FA00H to FA1AH) correspond to this display.
The following description focuses on numeral "6." ( ) displayed in the fourth digit. To display "6." in the LCD
panel, it is necessary to apply the select or deselect voltage to the S9 to S11 pins according to Table 14-9 at the
timing of the common signals COM0 to COM2; see Figure 14-15 for the relationship between the segment signals and
LCD segments.
Table 14-9. Select and Deselect Voltages (COM0 to COM2)
Segment S9 S10 S11
Common
COM0 Deselect Select Select
COM1 Select Select Select
COM2 Select Select
According to Table 14-9, it is determined that the display data memory location (FA09H) that corresponds to S9
must contain x110.
Figures 14-17 and 14-18 show examples of LCD drive waveforms between the S9 signal and each common signal
in the 1/2 and 1/3 bias methods, respectively. When the select voltage is applied to S9 at the timing of COM1 or
COM2, an alternate rectangle waveform, +VLCD/VLCD, is generated to turn on the corresponding LCD segment.
Figure 14-15. Three-Time-Slice LCD Display Pattern and Electrode Connections
;;
;;
;
;
;;;
;;;
;;
;;
;;
S
3n+2
S
3n
COM0
COM2
S
3n+1
COM1
Remark n = 0 to 8
CHAPTER 14 LCD CONTROLLER/DRIVER
222 User’s Manual U13952EJ3V1UD
Figure 14-16. Example of Connecting Three-Time-Slice LCD Panel
x’: Can be used to store any data because there is no corresponding segment in the LCD panel.
×: Can always be used to store any data because the three-time-slice mode is being used.
001011011101110110111111111
001110011011011111001111011
00 10 10 00 10 11 00 10 00
×××××××××××××××××××××××××××
Bit 0
Bit 1
Bit 2
Bit 3
Timing strobe
Data memory address
LCD panel
FA00H
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
FA10H
1
2
3
4
5
6
7
8
9
A
S 0
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12
S 13
S 14
S 15
S 16
S 17
S 18
S 19
S 20
S 21
S 22
S 23
S 24
S 25
S 26
COM 3
COM 2
COM 1
COM 0
Open
x’ x’ x’ x’ x’ x’ x’ x’ x’
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 223
Figure 14-17. Three-Time-Slice LCD Drive Waveform Examples (1/2 Bias Method)
TF
VLC0
VSS0
COM0
VLC0
VSS0
VLC0
VSS0
COM2
+VLCD
0COM1 to S9
–VLCD
+VLCD
0COM0 to S9
–VLCD
VLC1,2
VLC1,2
VLC1,2
COM1
+1/2VLCD
+1/2VLCD
–1/2VLCD
–1/2VLCD
VLC0
VSS0
S9 VLC1,2
+VLCD
0COM2 to S9
–VLCD
+1/2VLCD
–1/2VLCD
CHAPTER 14 LCD CONTROLLER/DRIVER
224 User’s Manual U13952EJ3V1UD
Figure 14-18. Three-Time-Slice LCD Drive Waveform Examples (1/3 Bias Method)
V
LC0
V
LC2
COM0
+V
LCD
0
COM0 to S9
–V
LCD
V
LC1
+1/3V
LCD
–1/3V
LCD
V
SS0
V
LC0
V
LC2
COM1 V
LC1
V
SS0
V
LC0
V
LC2
COM2 V
LC1
V
SS0
V
LC0
V
LC2
S9 V
LC1
V
SS0
+V
LCD
0
COM1 to S9
–V
LCD
+1/3V
LCD
–1/3V
LCD
+V
LCD
0
COM2 to S9
–V
LCD
+1/3V
LCD
–1/3V
LCD
T
F
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 225
14.8.4 Four-time-slice display example
Figure 14-20 shows how the 14-digit LCD panel having the display pattern shown in Figure 14-19 is connected to
the segment signals (S0 to S27) and the common signals (COM0 to COM3) of the
µ
PD789407A or 789417A
Subseries chip. This example displays data "123456.78901234" in the LCD panel. The contents of the display data
memory (addresses FA00H to FA1BH) correspond to this display.
The following description focuses on numeral "6." ( ) displayed in the ninth digit. To display "6." in the LCD panel,
it is necessary to apply the select or deselect voltage to the S16 and S17 pins according to Table 14-10 at the timing
of the common signals COM0 to COM3; see Figure 14-19 for the relationship between the segment signals and LCD
segments.
Table 14-10. Select and Deselect Voltages (COM0 to COM3)
Segment S16 S17
Common
COM0 Select Select
COM1 Deselect Select
COM2 Select Select
COM3 Select Select
According to Table 14-10, it is determined that the display data memory location (FA16H) that corresponds to S16
must contain 1101.
Figure 14-21 shows examples of LCD drive waveforms between the S16 signal and each common signal. When
the select voltage is applied to S16 at the timing of COM0, an alternate rectangle waveform, +VLCD/VLCD, is generated
to turn on the corresponding LCD segment.
Figure 14-19. Four-Time-Slice LCD Display Pattern and Electrode Connections
Remark n = 0 to 13
;;
;;
;;
;;
;
;
;;
;;
COM0
S
2n
COM1
S
2n+1
COM2
COM3
CHAPTER 14 LCD CONTROLLER/DRIVER
226 User’s Manual U13952EJ3V1UD
Figure 14-20. Example of Connecting Four-Time-Slice LCD Panel
0001011011111111111100010110
0111111110100111110101111111
0110010101110111011101100101
0010100010110010001000101000
Bit 0
Bit 1
Bit 2
Bit 3
Timing strobe
Data memory address
LCD panel
FA00H
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
FA10H
1
2
3
4
5
6
7
8
9
A
B
S 0
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12
S 13
S 14
S 15
S 16
S 17
S 18
S 19
S 20
S 21
S 22
S 23
S 24
S 25
S 26
S 27
COM 3
COM 2
COM 1
COM 0
CHAPTER 14 LCD CONTROLLER/DRIVER
User’s Manual U13952EJ3V1UD 227
Figure 14-21. Four-Time-Slice LCD Drive Waveform Examples (1/3 Bias Method)
;
;
;
;
T
F
V
LC0
V
LC2
COM0
+V
LCD
0
COM0 to S16
–V
LCD
V
LC1
+1/3V
LCD
–1/3V
LCD
V
SS0
V
LC0
V
LC2
COM1 V
LC1
V
SS0
V
LC0
V
LC2
COM2 V
LC1
V
SS0
V
LC0
V
LC2
COM3 V
LC1
V
SS0
+V
LCD
0
COM1 to S16
–V
LCD
+1/3V
LCD
–1/3V
LCD
V
LC0
V
LC2
S16 V
LC1
V
SS0
Remark The waveforms for COM2 to S16 and COM3 to S16 are omitted.
User’s Manual U13952EJ3V1UD
228
CHAPTER 15 INTERRUPT FUNCTIONS
15.1 Interrupt Function Types
The following two types of interrupt functions are used.
(1) Non-maskable interrupt
This interrupt is acknowledged unconditionally. It does not undergo interrupt priority control and is given top
priority over all other interrupt requests.
A standby release signal is generated.
One interrupt source from the watchdog timer is incorporated as a non-maskable interrupt.
(2) Maskable interrupt
These interrupts undergo mask control. If two or more interrupts with the same priority are simultaneously
generated, each interrupt has a predetermined priority as shown in Table 15-1.
A standby release signal is generated.
Five external interrupt and 11 internal interrupt sources are incorporated as maskable interrupts.
15.2 Interrupt Sources and Configuration
A total of 17 non-maskable and maskable interrupts are incorporated as interrupt sources (see Table
15-1).
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 229
Table 15-1. Interrupt Source List
Interrupt Type PriorityNote 1 Interrupt Source Internal/
External
Vector
Table
Basic
Configuration
Name Trigger Address TypeNote 2
Non-maskable INTWDT Watchdog timer overflow (with
watchdog timer mode 1 selected)
Internal 0004H (A)
Maskable 0 INTWDT Watchdog timer overflow (with interval
timer mode selected)
(B)
1 INTP0 Pin input edge detection External 0006H (C)
2 INTP1 0008H
3 INTP2 000AH
4 INTP3 000CH
5 INTSR00 End of serial interface 00 UART
reception
Internal 000EH
INTCSI00 End of serial interface 00 3-wire SIO
transfer reception
6 INTST00 End of serial interface 00 UART
transmission
0010H
7 INTWT Watch timer interrupt 0012H
8 INTWTI Interval timer interrupt 0014H
9 INTTM00 Generation of matching signal of 8-bit
timer/event counter 00
0016H
10 INTTM01 Generation of matching signal of 8-bit
timer/event counter 01
0018H
11 INTTM02 Generation of matching signal of 8-bit
timer 02
001AH
12 INTTM50 Generation of matching signal of 16-bit
timer 50
001CH
(B)
13 INTKR00 Key return signal detection External 001EH (C)
14 INTAD0 A/D conversion completion signal Internal 0020H
15 INTCMP0 Comparator signal 0022H
(B)
Notes 1. “Priority” is the priority order when several maskable interrupts are generated at the same time. 0 is the
highest and 15 is the lowest.
2. Basic configuration types (A) to (C) correspond to (A) to (C) in Figure 15-1.
CHAPTER 15 INTERRUPT FUNCTIONS
230 User’s Manual U13952EJ3V1UD
Figure 15-1. Basic Configuration of Interrupt Function
(A) Internal non-maskable interrupt
Internal bus
Interrupt request Vector table
address generator
Standby release signal
(B) Internal maskable interrupt
MK
IF
IE
Internal bus
Interrupt request
Vector table
address generator
Standby release signal
(C) External maskable interrupt
MK
IF
IE
Internal bus
External interrupt mode
register (INTM0, INTM1)
Interrupt
request
Edge
detector
Vector table
address generator
Standby
release signal
IF: Interrupt request flag
IE: Interrupt enable flag
MK: Interrupt mask flag
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 231
15.3 Registers Controlling Interrupt Function
The following five registers are used to control the interrupt functions.
Interrupt request flag registers 0, 1 (IF0 and IF1)
Interrupt mask flag registers 0, 1 (MK0 and MK1)
External interrupt mode registers 0, 1 (INTM0 and INTM1)
Program status word (PSW)
Key return mode register 00 (KRM00)
Table 15-2 lists the interrupt request flag and interrupt mask flag names corresponding to interrupt requests.
Table 15-2. Flags Corresponding to Interrupt Request Signal Name
Interrupt Request Signal Name Interrupt Request Flag Interrupt Mask Flag
INTWDT
INTP0
INTP1
INTP2
INTP3
INTSR00/INTCSI00
INTST00
INTWT
INTWTI
INTTM00
INTTM01
INTTM02
INTTM50
INTKR00
INTAD0
INTCMP0
TMIF4
PIF0
PIF1
PIF2
PIF3
SRIF00
STIF00
WTIF
WTIIF
TMIF00
TMIF01
TMIF02
TMIF50
KRIF00
ADIF0
CMPIF0
TMMK4
PMK0
PMK1
PMK2
PMK3
SRMK00
STMK00
WTMK
WTIMK
TMMK00
TMMK01
TMMK02
TMMK50
KRMK00
ADMK0
CMPMK0
CHAPTER 15 INTERRUPT FUNCTIONS
232 User’s Manual U13952EJ3V1UD
(1) Interrupt request flag registers 0, 1 (IF0 and IF1)
The interrupt request flag is set to 1 when the corresponding interrupt request is generated or an instruction
is executed. It is cleared to 0 when an instruction is executed upon acknowledgment of an interrupt request
or upon RESET input.
IF0 and IF1 are set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets IF0 and IF1 to 00H.
Figure 15-2. Format of Interrupt Request Flag Register
0
1
CMPIF0
ADIF0
KRIF00 TMIF50 TMIF02 TMIF01 TMIF00
WTIIFIF1 FFE1H 00H R/W
Interrupt request flag
No interrupt request signal is generated
Interrupt request signal is generated; Interrupt request state
XXIFX
<6> <5> <4> <3> <2> <1><7> <0>
WTIF
STIF00 SRIF00
PIF3 PIF2 PIF1 PIF0 TMIF4IF0
R/W
FFE0H 00H R/W
Symbol Address After reset
<6> <5> <4> <3> <2> <1><7> <0>
Cautions 1. The TMIF4 flag is R/W enabled only when the watchdog timer is used as an interval timer. If
watchdog timer mode 1 or 2 is used, set the TMIF4 flag to 0.
2. Because port 2 has an alternate function as an external interrupt input, when the output level
is changed by specifying the output mode of the port function, an interrupt request flag is
set. Therefore, the interrupt mask flag should be set to 1 before using the output mode.
3. If an interrupt is acknowledged, the interrupt request flag is automatically cleared before the
interrupt routine is entered.
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 233
(2) Interrupt mask flag registers 0, 1 (MK0 and MK1)
The interrupt mask flag is used to enable/disable the corresponding maskable interrupt service.
MK0 and MK1 are set using a 1-bit or 8-bit memory manipulation instruction.
RESET input sets MK0 and MK1 to FFH.
Figure 15-3. Format of Interrupt Mask Flag Register
0
1
CMPMK0
ADMK0
KRMK00 TMMK50 TMMK02 TMMK01 TMMK00
WTIMK
MK1 FFE5H FFH R/W
Interrupt servicing control
Interrupt servicing enabled
Interrupt servicing disabled
<6> <5> <4> <3> <2> <1><7> <0>
XXMKX
WTMK
STMK00 SRMK00
PMK3 PMK2 PMK1 PMK0
TMMK4
MK0
R/W
FFE4H FFH R/W
Symbol Address After reset
<6> <5> <4> <3> <2> <1><7> <0>
Cautions 1. If the TMMK4 flag is read when the watchdog timer is used in watchdog timer mode 1 or 2, its
value becomes undefined.
2. Because port 2 has an alternate function as an external interrupt input, when the output level
is changed by specifying the output mode of the port function, an interrupt request flag is
set. Therefore, the interrupt mask flag should be set to 1 before using the output mode.
CHAPTER 15 INTERRUPT FUNCTIONS
234 User’s Manual U13952EJ3V1UD
(3) External interrupt mode register 0 (INTM0)
This register is used to specify a valid edge for INTP0 to INTP2.
INTM0 is set using an 8-bit memory manipulation instruction.
RESET input sets INTM0 to 00H.
Figure 15-4. Format of External Interrupt Mode Register 0
0
0
1
1
ES21 ES20 ES11 ES10 ES01 ES00 0 0INTM0
R/W
FFECH 00H R/W
76543210
0
1
0
1
0
0
1
1
0
1
0
1
0
0
1
1
0
1
0
1
Symbol Address After reset
INTP0 valid edge selection
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
INTP1 valid edge selection
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
INTP2 valid edge selection
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
ES00
ES01
ES11 ES10
ES20ES21
Cautions 1. Bits 0 and 1 must be fixed to 0.
2. Before setting the INTM0 register, be sure to set xxMKx of the relevant interrupt mask flag to
1 to disable interrupts. After that, clear the interrupt mask flag (xxMKx = 0) to enable
interrupts after clearing the interrupt request flag (xxIFx = 0).
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 235
(4) External interrupt mode register 1 (INTM1)
INTM1 is used to specify a valid edge for INTP3 and INTCMP0.
INTM1 is set using an 8-bit memory manipulation instruction.
RESET input sets INTM1 to 00H.
Figure 15-5. Format of External Interrupt Mode Register 1
ES61 ES60 0000ES31 ES30INTM1
76543210
ES31
0
0
1
1
INTP3 valid edge selection
ES30
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
ES61
0
0
1
1
INTCMP0 valid edge selection
ES60
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
Symbol Address After reset R/W
FFEDH 00H R/W
Cautions 1. Bits 2 to 5 must be fixed to 0.
2. Before setting INTM1, set the corresponding interrupt mask flag register to 1 to disable
interrupts. After that, clear (0) the corresponding interrupt request flag to enable interrupts,
then clear the corresponding interrupt mask flag register.
CHAPTER 15 INTERRUPT FUNCTIONS
236 User’s Manual U13952EJ3V1UD
(5) Program status word (PSW)
The program status word is a register used to hold the instruction execution result and the current status for
interrupt requests. The IE flag to set maskable interrupt enable/disable is mapped to the PSW.
Besides 8-bit unit read/write, this register can carry out operations via bit manipulation instructions and
dedicated instructions (EI, DI). When a vectored interrupt is acknowledged, the PSW is automatically saved
into a stack, and the IE flag is reset to 0.
RESET input sets the PSW to 02H.
Figure 15-6. Configuration of Program Status Word
IE Z 0 AC 0 0 1 CYPSW
76543210
IE
0
1
02H
Symbol After reset
Used when normal instruction is executed
Interrupt acknowledge enable/disable
Disabled
Enabled
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 237
(6) Key return mode register 00 (KRM00)
This register sets the pin that detects a key return signal (falling edge of port 4).
KRM00 is set using a 1-bit or 8-bit memory manipulation instruction.
Bit 0 (KRM000) is set in 4-bit units for KR0/P40 to KR3/P43 pins. Bits 4 and 5 (KRM004 and KRM005) are
set in 1-bit units for KR4/P44 and KR5/P45 pins, respectively.
RESET input sets KRM00 to 00H.
Figures 15-7 and 15-8 show the format of key return mode register 00 and the block diagram of the falling
edge detector, respectively.
Figure 15-7. Format of Key Return Mode Register 00
0
1
00
KRM005 KRM004
000
KRM000
KRM00 FFF5H 00H R/W
Address After reset R/W
Key return signal detection selection
No detection
Detection (detecting falling edge of port 4)
65432170
KRM00n
Symbol
Cautions 1. Bits 1 to 3, 6, and 7 must be fixed to 0.
2. When the KRM00 register is set to 1, a pull-up resistor is connected automatically. However,
the pull-up resistor is cut if the pin is in output mode.
3. Before setting KRM00, always set bit 5 of MK1 (KRMK00 = 1) to disable interrupts in advance.
After setting KRM00, clear bit 5 of MK1 (KRMK00 = 0) after clearing bit 5 of IF1 (KRIF00 = 0) to
enable interrupts.
4. The key return signal cannot be detected while even one of the pins that specify detection of
the key return signal is low, even if a falling edge is generated at other key return pins.
Remark n = 0, 4, 5
Figure 15-8. Block Diagram of Falling Edge Detector
P40/KR0
P41/KR1
P42/KR2
P43/KR3
P44/KR4
P45/KR5
Falling edge detector
KRMK
KRIF00 set signal
Standby release
signal
Key return mode register 00 (KRM00)
Note
Selector
Note Selector that selects the pin used for falling edge input
CHAPTER 15 INTERRUPT FUNCTIONS
238 User’s Manual U13952EJ3V1UD
15.4 Operation of Interrupt Servicing
15.4.1 Non-maskable interrupt acknowledgment operation
The non-maskable interrupt is unconditionally acknowledged even when interrupts are disabled. It is not subject to
interrupt priority control and takes precedence over all other interrupts.
When the non-maskable interrupt request is acknowledged, the PSW and PC are saved to the stack in that order,
the IE flag is reset to 0, the contents of the vector table are loaded to the PC, and then program execution branches.
Caution During non-maskable interrupt servicing program execution, do not input another non-maskable
interrupt request; if it is input, the servicing program will be interrupted and the new non-
maskable interrupt request will be acknowledged.
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 239
Figure 15-9. Flowchart of Non-Maskable Interrupt Request Acknowledgment
Start
WDTM4 = 1
(watchdog timer mode
is selected)
Interval timer
No
WDT
overflows
No
Yes
Reset processing
No
Yes
Yes
Interrupt request is generated
Interrupt servicing is started
WDTM3 = 0
(non-maskable interrupt
is selected)
WDTM: Watchdog timer mode register
WDT: Watchdog timer
Figure 15-10. Timing of Non-Maskable Interrupt Request Acknowledgment
Instruction Instruction
Saving PSW and PC, and
jump to interrupt servicing Interrupt servicing program
CPU processing
TMIF4
Figure 15-11. Non-Maskable Interrupt Request Acknowledgment
Second interrupt servicing
First interrupt servicing
NMI request
(second)
NMI request
(first)
Main routine
CHAPTER 15 INTERRUPT FUNCTIONS
240 User’s Manual U13952EJ3V1UD
15.4.2 Maskable interrupt acknowledgment operation
A maskable interrupt can be acknowledged when the interrupt request flag is set to 1 and the corresponding
interrupt mask flag is cleared to 0. A vectored interrupt is acknowledged in the interrupt enabled status (when the IE
flag is set to 1).
The time required to start the interrupt servicing after a maskable interrupt request has been generated is as
follows:
Table 15-3. Time from Generation of Maskable Interrupt Request to Servicing
Minimum Time Maximum TimeNote
9 clocks 19 clocks
Note The wait time is maximum when an interrupt request is generated immediately before
the BT or BF instruction.
Remark 1 clock: (fCPU: CPU clock)
When two or more maskable interrupt requests are generated at the same time, they are acknowledged starting
from the one assigned the highest priority by the priority specification flag.
An interrupt held pending is acknowledged when the status in which it can be acknowledged is set.
Figure 15-12 shows the algorithm of acknowledging interrupts.
When a maskable interrupt request is acknowledged, the PSW and PC are saved to the stack in that order, the IE
flag is reset to 0, and the data in the vector table determined for each interrupt request is loaded to the PC, and
execution branches.
To restore from interrupt servicing, use the RETI instruction.
Figure 15-12. Interrupt Acknowledgment Program Algorithm
Start
xxIF = 1 ?
xxMK = 0 ?
IE = 1 ?
Vectored interrupt
servicing
Yes (interrupt request generated)
Yes
Yes
No
No
No
Interrupt request pending
Interrupt request pending
1
fCPU
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 241
Figure 15-13. Interrupt Request Acknowledgment Timing (Example: MOV A, r)
Clock
CPU MOV A, r
Saving PSW and PC, and
jump to interrupt servicing
8 clocks
Interrupt servicing program
Interrupt request
If the interrupt request has generated an interrupt request flag (XXIF) by the time the instruction clocks under
execution, n clocks (n = 4 to 10), are n 1, interrupt request acknowledgment processing will start following the
completion of the instruction under execution. Figure 15-13 shows an example using the 8-bit data transfer instruction
MOV A, r. Because this instruction is executed in 4 clocks, if an interrupt request is generated between the start of
execution and the 3rd clock, interrupt request acknowledgment processing will take place following the completion of
MOV A, r.
Figure 15-14. Interrupt Request Acknowledgment Timing
(When Interrupt Request Flag Is Generated in Final Clock Under Execution)
Clock
CPU NOP MOV A, r Saving PSW and PC, and
jump to interrupt servicing
Interrupt
servicing
program
Interrupt request
8 clocks
If the interrupt request flag (XXIF) is generated in the final clock of the instruction, interrupt request
acknowledgment processing will begin after execution of the next instruction is complete.
Figure 15-14 shows an example whereby an interrupt request was generated in the 2nd clock of NOP (a 2-clock
instruction). In this case, the interrupt request will be processed after execution of MOV A, r, which follows NOP, is
complete.
Caution When interrupt request flag registers 0 and 1 (IF0 and IF1) or interrupt mask flag registers 0 and
1 (MK0 and MK1) are being accessed, interrupt requests will be held pending.
15.4.3 Multiple interrupt servicing
Processing in which another interrupt request is acknowledged while an interrupt request is serviced is called
multiple interrupt servicing.
Multiple interrupts are not performed unless an interrupt request is enabled (IE = 1) (except non-maskable interrupt
request). The other interrupt request is disabled (IE = 0) at the time when an interrupt request is acknowledged.
Therefore, it is necessary to set (1) the IE flag to realize the interrupt enable state using an EI instruction during
interrupt request servicing in order to enable multiple interrupt servicing.
CHAPTER 15 INTERRUPT FUNCTIONS
242 User’s Manual U13952EJ3V1UD
Figure 15-15. Example of Multiple Interrupt
Example 1. Acknowledging multiple interrupts
INTyy
EI
Main processing
EI
INTyy processingINTxx processing
RETI
IE = 0
INTxx
RETI
IE = 0
The interrupt request INTyy is acknowledged and multiple interrupts are performed during the interrupt INTxx
processing. Before each interrupt request is acknowledged, the EI instruction is issued and the interrupt request is
enabled.
Example 2. Multiple interrupts are not performed because interrupts are disabled
INTyy
EI
Main processing
RETI
INTyy processingINTxx processing
IE = 0
INTxx
RETI
INTyy is held pending
IE = 0
Interrupt requests are disabled (the EI instruction is not issued) in the interrupt INTxx processing. The interrupt
request INTyy is not acknowledged and multiple interrupts are not performed. INTyy is held pending and is
acknowledged after INTxx servicing is completed.
IE = 0: Interrupt request disabled
CHAPTER 15 INTERRUPT FUNCTIONS
User’s Manual U13952EJ3V1UD 243
15.4.4 Putting interrupt requests on hold
If an interrupt (such as a maskable, non-maskable, or external interrupt) is requested when a certain type of
instruction is being executed, the interrupt request will not be acknowledged until the instruction is completed. Such
instructions include:
Instructions that manipulate interrupt request flag registers 0, 1 (IF0 and IF1)
Instructions that manipulate interrupt mask flag registers 0, 1 (MK0 and MK1)
User’s Manual U13952EJ3V1UD
244
CHAPTER 16 STANDBY FUNCTION
16.1 Standby Function and Configuration
16.1.1 Standby function
The standby function is used to reduce the power consumption of the system and can be effected in the following
two modes:
(1) HALT mode
This mode is set when the HALT instruction is executed. The HALT mode stops the operation clock of the
CPU. The system clock oscillator continues oscillating. This mode does not reduce the power consumption
as much as the STOP mode, but is useful for resuming processing immediately when an interrupt request is
generated, or for intermittent operations.
(2) STOP mode
This mode is set when the STOP instruction is executed. The STOP mode stops the main system clock
oscillator and stops the entire system. The power consumption of the CPU can be substantially reduced in
this mode.
The data memory can be retained at the low voltage (VDD = 1.8 V). Therefore, this mode is useful for
retaining the contents of the data memory at an extremely low current.
The STOP mode can be released by an interrupt request, so that this mode can be used for intermittent
operation. However, some time is required until the system clock oscillator stabilizes after the STOP mode
has been released. If processing must be resumed immediately by using an interrupt request, therefore, use
the HALT mode.
In both modes, the previous contents of the registers, flags, and data memory before setting the standby mode are
all retained. In addition, the statuses of the output latch of the I/O ports and output buffer are also retained.
Caution To set the STOP mode, be sure to stop the operations of the peripheral hardware, and then
execute the STOP instruction.
CHAPTER 16 STANDBY FUNCTION
User’s Manual U13952EJ3V1UD 245
16.1.2 Standby function control register
The wait time after the STOP mode is released upon interrupt request until oscillation stabilizes is controlled by the
oscillation stabilization time selection register (OSTS).
OSTS is set using an 8-bit memory manipulation instruction.
RESET input sets OSTS to 04H. However, it takes 215/fX, not 217/fX, until the STOP mode is released by RESET
input.
Figure 16-1. Format of Oscillation Stabilization Time Selection Register
OSTS2
0
0
1
00000
OSTS2 OSTS1 OSTS0
OSTS
R/W
FFFAH 04H R/W
76543210
OSTS1
0
1
0
212/f
X
215/f
X
217/f
X
(819 s)
(6.55 ms)
(26.2 ms)
OSTS0
0
0
0
Setting prohibited
Symbol Address After reset
Oscillation stabilization time selection
Other than above
µ
Caution The wait time after the STOP mode is released does not include the time from STOP mode
release to clock oscillation start (“a” in the figure below), regardless of release by RESET input
or by interrupt generation.
V
SS0
, V
SS1
a
STOP mode release
X1 pin voltage
waveform
Remarks 1. f
X: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
CHAPTER 16 STANDBY FUNCTION
246 User’s Manual U13952EJ3V1UD
16.2 Operation of Standby Function
16.2.1 HALT mode
(1) HALT mode
The HALT mode is set by executing the HALT instruction.
The operation status in the HALT mode is shown in the following table.
Table 16-1. HALT Mode Operating Status
Item HALT Mode Operation Status While
Main System Clock Is Running
HALT Mode Operation Status While
Subsystem Clock Is Running
While the subsystem
clock is running
While the subsystem
clock is not running
While the main system
clock is running
While the main system
clock is not running
Main system clock
generator
Oscillation enabled Does not run.
CPU Operation stopped
Port (output latch) Remains in the state existing before the selection of HALT mode.
16-bit timer (TM50) Operation enabled Operation stopped
8-bit timer/event counters
(TM00 and TM01)
Operation enabled Operation enabledNote 1
8-bit timer (TM02) Operation enabled Operation enabledNote 2 Operation enabled Operation enabledNote 3
Watch timer Operation enabled Operation enabledNote 2 Operation enabled Operation enabledNote 3
Watchdog timer Operation enabled Operation stopped
Serial interface Operation enabled Operation enabledNote 4
A/D converter Operation stopped
LCD controller/driver Operation enabled Operation enabledNote 2 Operation enabled Operation enabledNote 3
Comparator Operation enabledNote 5
External interrupt Operation enabledNote 6
Notes 1. Operation is enabled only when TI0 or TI1 is selected as the count clock.
2. Operation is enabled while the main system clock is selected.
3. Operation is enabled while the subsystem clock is selected.
4. Operation is enabled in both 3-wire serial I/O and UART modes while an external clock is being used.
5. Operation is enabled while TM02 is operating, or as an external interrupt.
6. Maskable interrupt that is not masked
CHAPTER 16 STANDBY FUNCTION
User’s Manual U13952EJ3V1UD 247
(2) Releasing HALT mode
The HALT mode can be released by the following three types of sources:
(a) Releasing by unmasked interrupt request
The HALT mode is released by an unmasked interrupt request. In this case, if interrupts are enabled to
be acknowledged, vectored interrupt servicing is performed. If interrupts are disabled, the instruction at
the next address is executed.
Figure 16-2. Releasing HALT Mode by Interrupt
HALT
instruction
Standby
release signal
Wait
WaitHALT mode
Operation
mode Operation mode
Clock Oscillation
Remarks 1. The broken lines indicate the case where the interrupt request that has released the standby mode
is acknowledged.
2. The wait time is as follows:
When vectored interrupt servicing is performed: 9 to 10 clocks
When vectored interrupt servicing is not performed: 1 to 2 clocks
(b) Releasing by non-maskable interrupt request
The HALT mode is released regardless of whether interrupts are enabled or disabled, and vectored
interrupt servicing is performed.
CHAPTER 16 STANDBY FUNCTION
248 User’s Manual U13952EJ3V1UD
(c) Releasing by RESET input
When the HALT mode is released by the RESET signal, execution branches to the reset vector address
in the same manner as the ordinary reset operation, and program execution is started.
Figure 16-3. Releasing HALT Mode by RESET Input
HALT
instruction
RESET
signal
Wait
(2
15
/f
X
: 6.55 ms)
Reset
period
HALT mode
Operation
mode
Oscillation
stabilization
wait status
Clock
Operation
mode
Oscillation
stops
Oscillation Oscillation
Remarks 1. fX: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
Table 16-2. Operation After Release of HALT Mode
Releasing Source MKxx IE Operation
Maskable interrupt request 0 0 Executes next address instruction
0 1 Executes interrupt servicing
1 x Retains HALT mode
Non-maskable interrupt request x Executes interrupt servicing
RESET input -- Reset processing
x: Don’t care
CHAPTER 16 STANDBY FUNCTION
User’s Manual U13952EJ3V1UD 249
16.2.2 STOP mode
(1) Setting and operation status of STOP mode
The STOP mode is set by executing the STOP instruction.
Caution Because the standby mode can be released by an interrupt request signal, the standby
mode is released as soon as it is set if there is an interrupt source whose interrupt request
flag is set and interrupt mask flag is reset. When the STOP mode is set, therefore, the
HALT mode is set immediately after the STOP instruction has been executed, the wait time
set by the oscillation stabilization time selection register (OSTS) elapses, and then an
operation mode is set.
The operation status in the STOP mode is shown in the following table.
Table 16-3. STOP Mode Operating Status
Item STOP Mode Operation Status While Main System Clock Is Running
While the subsystem clock is running While the subsystem clock is not running
Main system clock generator Oscillation stopped
CPU Operation stopped
Port (output latch) Remains in the state existing before the selection of STOP mode.
16-bit timer (TM50) Operation stopped
8-bit timer/event counter
(TM00 and TM01)
Operation enabledNote 1
8-bit timer (TM02) Operation enabledNote 2 Operation stopped
Watch timer Operation enabledNote 2 Operation stopped
Watchdog timer Operation stopped
Serial interface Operation enabledNote 3
A/D converter Operation stopped
LCD controller/driver Operation enabledNote 2 Operation stopped
Comparator Operation enabledNotes 5, 6 Operation enabledNote 6
External interrupt Operation enabledNote 4
Notes 1. Operation is enabled only when TI0 or TI1 is selected as the count clock.
2. Operation is enabled while the subsystem clock is selected.
3. Operation is enabled in both 3-wire serial I/O and UART modes while an external clock is being used.
4. Maskable interrupt that is not masked
5. Operation is enabled while TM02 is running.
6. Operation is enabled as an external interrupt.
CHAPTER 16 STANDBY FUNCTION
250 User’s Manual U13952EJ3V1UD
(2) Releasing STOP mode
The STOP mode can be released by the following two types of sources:
(a) Releasing by unmasked interrupt request
The STOP mode can be released by an unmasked interrupt request. In this case, if interrupts are
enabled to be acknowledged, vectored interrupt servicing is performed, after the oscillation stabilization
time has elapsed. If interrupts are disabled, the instruction at the next address is executed.
Figure 16-4. Releasing STOP Mode by Interrupt
STOP
instruction
Standby
release signal
Wait
(set time by OSTS)
STOP mode
Operation
mode
Oscillation stabilization
wait status
Clock
Operation
mode
Oscillation
stops Oscillation
Oscillation
Remark The broken lines indicate the case where the interrupt request that has released the standby mode is
acknowledged.
CHAPTER 16 STANDBY FUNCTION
User’s Manual U13952EJ3V1UD 251
(b) Releasing by RESET input
When the STOP mode is released by the RESET signal, the reset operation is performed after the
oscillation stabilization time has elapsed.
Figure 16-5. Releasing STOP Mode by RESET Input
STOP
instruction
RESET
signal
Wait
(2
15
/f
X
: 6.55 ms)
STOP mode
Operation
mode
Oscillation
stabilization
wait status
Clock
Operation
mode
Oscillation
stops Oscillation
Oscillation
Reset
period
Remarks 1. fX: Main system clock oscillation frequency
2. The parenthesized values apply to operation at fX = 5.0 MHz.
Table 16-4. Operation After Release of STOP Mode
Releasing Source MKxx IE Operation
Maskable interrupt request 0 0 Executes next address instruction
0 1 Executes interrupt servicing
1 x Retains STOP mode
RESET input -- Reset processing
x: Don’t care
User’s Manual U13952EJ3V1UD
252
CHAPTER 17 RESET FUNCTION
The following two operations are available to generate reset signals.
(1) External reset input via RESET pin
(2) Internal reset by program loop time detected by the watchdog timer
The external and internal resets have no functional differences. In both cases, program execution starts at the
address at 0000H and 0001H by RESET input.
When a low level is input to the RESET pin or the watchdog timer overflows, a reset is applied and each hardware
item is set to the status shown in Table 17-1. Each pin is high impedance during reset input or during the oscillation
stabilization time just after reset release.
When a high level is input to the RESET pin, the reset is released and program execution is started after the
oscillation stabilization time (215/fx) has elapsed. The reset applied by the watchdog timer overflow is automatically
released after reset, and program execution is started after the oscillation stabilization time (215/fx) has elapsed (see
Figures 17-2 through 17-4).
Cautions 1. For an external reset, input a low level for 10
µ
s or more to the RESET pin.
2. When the STOP mode is released by reset, the STOP mode contents are held during reset
input. However, the port pins become high impedance.
Figure 17-1. Block Diagram of Reset Function
RESET
Interrupt function
Count clock
Reset controller
Watchdog timer
Over-
flow
Reset signal
Stop
CHAPTER 17 RESET FUNCTION
User’s Manual U13952EJ3V1UD 253
Figure 17-2. Reset Timing by RESET Input
X1
RESET
Internal
reset signal
Port pin
During normal
operation
Delay Delay
Hi-Z
Reset period
(oscillation stops)
Normal operation
(reset processing)
Oscillation
stabilization
time wait
Figure 17-3. Reset Timing by Overflow in Watchdog Timer
X1
Overflow in
watchdog timer
Internal
reset signal
Port pin Hi-Z
During normal
operation
Reset period
(oscillation
continues)
Normal operation
(reset processing)
Oscillation
stabilization
time wait
Figure 17-4. Reset Timing by RESET Input in STOP Mode
X1
RESET
Internal
reset signal
Port pin
Delay Delay
Hi-Z
STOP instruction execution
During normal
operation
Reset period
(oscillation stops)
Stop status
(oscillation stops)
Normal operation
(reset processing)
Oscillation
stabilization
time wait
CHAPTER 17 RESET FUNCTION
254 User’s Manual U13952EJ3V1UD
Table 17-1. Hardware Status After Reset (1/2)
Hardware Status After Reset
Program counter (PC)Note 1
The contents of reset
vector tables (0000H
and 0001H) are set.
Stack pointer (SP) Undefined
Program status word (PSW) 02H
RAM Data memory UndefinedNote 2
General-purpose registers UndefinedNote 2
Ports (P0, P2, P4, P5, P8, and P9) (Output latch) 00H
Port mode registers (PM0, PM2, PM4, PM5, PM8, and PM9) FFH
Pull-up resistor option registers (PU0 to PU2) 00H
Processor clock control register (PCC) 02H
Suboscillation mode register (SCKM) 00H
Subclock control register (CSS) 00H
Oscillation stabilization time selection register (OSTS) 04H
16-bit timer Timer counter (TM50) 0000H
Compare register (CR50) FFFFH
Capture register (TCP50) Undefined
Mode control register (TMC50) 00H
8-bit timer/event counter Timer counters (TM00, TM01, and TM02) 00H
Compare registers (CR00, CR01, and CR02) Undefined
Mode control registers (TMC00, TMC01, and TMC02) 00H
Watch timer Mode control register (WTM) 00H
Watchdog timer Timer clock selection register (TCL2) 00H
Mode register (WDTM) 00H
A/D converter Mode register (ADM0) 00H
A/D input selection register (ADS0) 00H
A/D conversion result register (ADCR0) Undefined
Comparator Mode register (CMPRM0) 00H
Notes 1. During reset input and oscillation stabilization time wait, only the PC contents among the hardware
statuses become undefined.
All other hardware remains unchanged after reset.
2. The post-reset values are retained in the standby mode.
CHAPTER 17 RESET FUNCTION
User’s Manual U13952EJ3V1UD 255
Table 17-1. Hardware Status After Reset (2/2)
Hardware Status After Reset
Mode register (CSIM00) 00H
Asynchronous serial interface mode register (ASIM00) 00H
Asynchronous serial interface status register (ASIS00) 00H
Baud rate generator control register (BRGC00) 00H
Transmit shift register (TXS00) FFH
Serial interface
Receive buffer register (RXB00) Undefined
LCD display mode register (LCDM0) 00H
LCD port selector (LPS0) 00H
LCD controller/driver
LCD clock control register (LCDC0) 00H
Request flag registers (IF0 and IF1) 00H
Mask flag registers (MK0 and MK1) FFH
External interrupt mode registers (INTM0 and INTM1) 00H
Interrupts
Key return mode register (KRM00) 00H
User’s Manual U13952EJ3V1UD
256
CHAPTER 18
µ
PD78F9418A
The
µ
PD78F9418A is a version with the internal ROM of the mask ROM version replaced by flash memory. The
differences between the
µ
PD78F9418A and the mask ROM versions are shown in Table 18-1.
Table 18-1. Differences Between
µ
PD78F9418A and Mask ROM Versions
Flash Memory Version Mask ROM Version Item
µ
PD78F9418A
µ
PD789405A
µ
PD789415A
µ
PD789406A
µ
PD789416A
µ
PD789407A
µ
PD789417A
ROM 32 KB (Flash memory) 12 KB 16 KB 24 KB
High-speed RAM 512 bytes
Internal memory
LCD data RAM 28 bytes
Pull-up resistor 32 (software control only) 36 (software control: 32, mask option control: 4)
Divider resistor for LCD driving Not provided Can be specified on-chip by mask option
IC pin Not provided Provided
VPP pin Provided Not provided
Electrical specifications Refer to CHAPTER 21 ELECTRICAL SPECIFICATIONS.
Cautions 1. There are differences in noise immunity and noise radiation between the flash memory and
mask ROM versions. When pre-producing an application set with the flash memory version
and then mass-producing it with the mask ROM version, be sure to conduct sufficient
evaluations for the commercial samples (not engineering samples) of the mask ROM version.
2. When A/D conversion result register 0 (ADCR0) is used as the 8-bit A/D converter
(
µ
PD789407A Subseries), ADCR0 will be manipulated by an 8-bit memory manipulation
instruction. When used as the 10-bit A/D converter (
µ
PD789417A Subseries), ADCR0 will be
manipulated by a 16-bit memory manipulation instruction.
However, when the
µ
PD78F9418A is used as the flash memory version of the
µ
PD789405A,
789406A, and 789407A, ADCR0 can be manipulated by an 8-bit memory manipulation
instruction. In this case, use the object file assembled in the
µ
PD789405A, 789406A, and
789407A.
CHAPTER 18
µ
PD78F9418A
User’s Manual U13952EJ3V1UD 257
18.1 Flash Memory Characteristics
Flash memory programming is performed by connecting a dedicated flash programmer (Flashpro III (part no. FL-
PR3, PG-FP3)/Flashpro IV (part no. FL-PR4, PG-FP4)) to the target system with the
µ
PD78F9418A mounted on the
target system (on-board). A flash memory program adapter (FA adapter), which is a target board used exclusively for
programming, is also provided.
Remark FL-PR3, FL-PR4, and the program adapter are products made by Naito Densei Machida Mfg. Co., Ltd.
(TEL +81-45-475-4191).
Programming using flash memory has the following advantages.
Software can be modified after the microcontroller is solder-mounted on the target system.
Distinguishing software facilities small-quantity, varied model production
Easy data adjustment when starting mass production
18.1.1 Programming environment
The following shows the environment required for
µ
PD78F9418A flash memory programming.
When Flashpro III (part no. FL-PR3, PG-FP3) or Flashpro IV (part no. FL-PR4, PG-FP4) is used as a dedicated
flash programmer, a host machine is required to control the dedicated flash programmer. Communication between the
host machine and flash programmer is performed via RS-232C/USB (Rev. 1.1).
For details, refer to the manuals for Flashpro III/Flashpro IV.
Remark USB is supported by Flashpro IV only.
Figure 18-1. Environment for Writing Program to Flash Memory
Host machine
RS-232C
USB
Dedicated flash
programmer
PD78F9418A
V
PP
V
DD
V
SS
RESET
3-wire serial I/O,
UART
or pseudo 3-wire
µ
CHAPTER 18
µ
PD78F9418A
258 User’s Manual U13952EJ3V1UD
18.1.2 Communication mode
Use the communication mode shown in Table 18-2 to perform communication between the dedicated flash
programmer and
µ
PD78F9418A.
Table 18-2. Communication Mode List
TYPE SettingNote 1
CPU Clock
Communication
Mode COMM PORT SIO Clock
In Flashpro On Target Board
Multiple
Rate
Pins Used Number of VPP
Pulses
3-wire serial
I/O
SIO ch-0
(3-wire, sync.)
100 Hz to
1.25 MHzNote 2
1, 2, 4, 5
MHzNotes 2, 3
1 to 5 MHzNote 2 1.0 SI/RxD/P22
SO/TxD/P21
SCK/ASCK/P20
0
UART UART ch-0
(Async.)
4,800 to
76,800 bps
Notes 2, 4
5 MHzNote 5 4.91 or
5 MHzNote 2
1.0 RxD/SI/P22
TxD/SO/P21
8
Port A
(Pseudo-
3 wire)
P01
P02
P00
12
Pseudo 3-wire
Port B
(Pseudo-
3 wire)
100 Hz to
1 kHz
1, 2, 4, 5
MHzNotes 2, 3
1 to 5 MHzNote 2 1.0
P40/KR0
P41/KR1
P42/KR2
13
Notes 1. Selection items for TYPE settings on the dedicated flash programmer (Flashpro III (part no. FL-PR3,
PG-FP3)/Flashpro IV (part no. FL-PR4, PG-FP4)).
2. The possible setting range differs depending on the voltage. For details, refer to CHAPTER 21
ELECTRICAL SPECIFICATIONS.
3. 2 or 4 MHz only for Flashpro III
4. Because signal wave slew also affects UART communication, in addition to the baud rate error,
thoroughly evaluate the slew and baud rate error.
5. Only for Flashpro IV. However, when using Flashpro III, be sure to select the clock of the resonator on
the board. UART cannot be used with the clock supplied by Flashpro III.
Figure 18-2. Communication Mode Selection Format
10 V
VSS
VDDVPP
VDD
VSS
RESET
12 n
VPP pulses
CHAPTER 18
µ
PD78F9418A
User’s Manual U13952EJ3V1UD 259
Figure 18-3. Example of Connection with Dedicated Flash Programmer
(a) 3-wire serial I/O
Dedicated flash programmer
VPP1
VDD
RESET
SCK
SO
SI
CLK
Note 1
GND
V
PP
V
DD0
, V
DD1
RESET
SCK
SI
SO
X1
V
SS0
, V
SS1
PD78F9418A
µ
(b) UART
Dedicated flash programmer
VPP1
VDD
RESET
SO
SI
CLK
Notes 1, 2
GND
VPP
VDD0, VDD1
RESET
RXD
TXD
X1
VSS0, VSS1
PD78F9418A
µ
(c) Pseudo 3-wire (when P0 is used)
Dedicated flash programmer
VPP1
VDD
RESET
SCK
SO
SI
GND
VPP
VDD0, VDD1
RESET
P00 (serial clock)
P02 (serial input)
P01 (serial output)
CLKNote 1 X1
VSS0, VSS1
PD78F9418A
µ
Notes 1. Connect this pin when the system clock is supplied from the dedicated flash programmer. If a resonator
is already connected to the X1 pin, do not connect to the CLK pin.
2. When using UART with Flashpro III, the clock of the resonator connected to the X1 pin must be used,
so do not connect to the CLK pin.
Caution The VDD pin, if already connected to the power supply, must be connected to the VDD pin of the
dedicated flash programmer. When using the power supply connected to the VDD pin, supply
voltage before starting programming.
CHAPTER 18
µ
PD78F9418A
260 User’s Manual U13952EJ3V1UD
If Flashpro III (part no. FL-PR3, PG-FP3)/Flashpro IV (part no. FL-PR4, PG-FP4) is used as a dedicated flash
programmer, the following signals are generated for the
µ
PD78F9418A. For details, refer to the manual of Flashpro
III/Flashpro IV.
Table 18-3. Pin Connection List
Signal Name I/O Pin Function Pin Name 3-Wire Serial I/O UART Pseudo
3-Wire
VPP1 Output Write voltage VPP
VPP2 × × ×
VDD I/O VDD voltage generation/
voltage monitoring
VDD0, VDD1 Note Note Note
GND Ground VSS0, VSS1
CLK Output Clock output X1
RESET Output Reset signal RESET
SI Input Receive signal SO/TxD/P01/P41
SO Output Transmit signal SI/RxD/P02/P42
SCK Output Transfer clock SCK/P00/P40 ×
HS Input Handshake signal × × ×
Note VDD voltage must be supplied before programming is started.
Remark : Pin must be connected.
: If the signal is supplied on the target board, pin does not need to be connected.
×: Pin does not need to be connected.
CHAPTER 18
µ
PD78F9418A
User’s Manual U13952EJ3V1UD 261
18.1.3 On-board pin connections
When programming on the target system, provide a connector on the target system to connect to the dedicated
flash programmer.
There may be cases in which an on-board function that switches from the normal operation mode to flash memory
programming mode is required.
<VPP pin>
Input 0 V to the VPP pin in the normal operation mode. A write voltage of 10.0 V (TYP.) is supplied to the VPP
pin in the flash memory programming mode. Therefore, connect the VPP pin using method (1) or (2) below.
(1) Connect a pull-down resistor of RVPP = 10 k to the VPP pin.
(2) Set the jumper on the board to switch the input of VPP pin to the programmer side or directly to GND.
The following shows an example of VPP pin connection.
Figure 18-4. VPP Pin Connection Example
PD78F9418A
V
PP
µ
Pull-down resistor (RV
PP
)
Connection pin of dedicated flash programmer
<Serial interface pins>
The following shows the pins used by each serial interface.
Serial Interface Pins Used
3-wire serial I/O SI, SO, SCK
UART RxD, TxD
P00, P01, P02 Pseudo 3-wire
P40, P41, P42
Note that signal conflict or malfunction of other devices may occur when an on-board serial interface pin that is
connected to another device is connected to the dedicated flash programmer.
CHAPTER 18
µ
PD78F9418A
262 User’s Manual U13952EJ3V1UD
(1) Signal conflict
A signal conflict occurs if the dedicated flash programmer (output) is connected to a serial interface pin
(input) connected to another device (output). To prevent this signal conflict, isolate the connection with the
other device or put the other device in the output high impedance status.
Figure 18-5. Signal Conflict (Serial Interface Input Pin)
PD78F9418A
Signal conflict
Output pin
In the flash memory programming mode, the signal
output by another device and the signal sent by the
dedicated flash programmer conflict. To prevent this,
isolate the signal on the device side.
Connection pin of dedicated flash
programmer
Other device
Input pin
µ
(2) Malfunction of another device
When the dedicated flash programmer (output or input) is connected to a serial interface pin (input or output)
connected to another device (input), a signal may be output to the device, causing a malfunction. To prevent
such malfunction, isolate the connection with other device or set so that the input signal to the device is
ignored.
Figure 18-6. Malfunction of Another Device
PD78F9418A
Input pin
Input pin
Pin
Pin
Other device
Other device
Connection pin of dedicated flash
programmer
Connection pin of dedicated flash
programmer
If the signal output by the PD78F9418A affects another device in the
flash memory programming mode, isolate the signal on the device side.
If the signal output by the dedicated flash programmer affects another
device, isolate the signal on the device side.
PD78F9418A
µ
µ
µ
CHAPTER 18
µ
PD78F9418A
User’s Manual U13952EJ3V1UD 263
<RESET pin>
When the reset signal of the dedicated flash programmer is connected to the RESET pin connected to the reset
signal generator on the board, a signal conflict occurs. To prevent this signal conflict, isolate the connection with
the reset signal generator.
If a reset signal is input from the user system in the flash memory programming mode, a normal programming
operation will not be performed. Do not input signals other than reset signals from the dedicated flash programmer
during this period.
Figure 18-7. Signal Conflict (RESET Pin)
RESET
PD78F9418A
Signal conflict
Output pin
Reset signal generator
In the flash memory programming mode, the signal output
by the reset signal generator and the signal output by the
dedicated flash programmer conflict, therefore, isolate the
signal on the reset signal generator side.
Connection pin of dedicated
flash programmer
µ
<Port pins>
Shifting to the flash memory programming mode sets all the pins except those used for flash memory
programming communication to the status immediately after reset.
Therefore, if the external device does not acknowledge an initial status such as the output high impedance
status, connect the external device to VDD0, VDD1, VSS0, or VSS1 via a resistor.
<Oscillation pins>
When using an on-board clock, connection of X1, X2, XT1, and XT2 must conform to the methods in the normal
operation mode.
When using the clock output of the flash programmer, directly connect it to the X1 pin with the on-board main
oscillator disconnected, and leave the X2 pin open. For the subclock, connection conforms to that in the normal
operation mode.
<Power supply>
To use the power output of the flash programmer, connect the VDD0 and VDD1 pins to VDD of the flash
programmer, and the VSS0 and VSS1 pins to GND of the flash programmer.
To use the on-board power supply, connection must conform to that in the normal operation mode. However,
because the voltage is monitored by the flash programmer, therefore, VDD of the flash programmer must be
connected.
For the other power supply pins (AVDD, AVREF, AVSS), supply the same power supply as in the normal operation
mode.
<Other pins>
Handle the other pins (S0 to S15, COM0 to COM3, VLC0 to VLC2, BIAS) in the same way as in the normal
operation mode.
CHAPTER 18
µ
PD78F9418A
264 User’s Manual U13952EJ3V1UD
18.1.4 Connection when using flash memory writing adapter
The following shows an example of the recommended connection when using the flash memory writing adapter.
Figure 18-8. Example of Flash Memory Writing Adapter Connection When Using 3-Wire Serial I/O Mode
PD78F9418A
GND
VDD
VDD2 (LVDD)
SI SO SCK CLKOUT RESET VPP RESERVE/HS
Writer interface
VDD (2.7 to 5.5 V)
GND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
µ
CHAPTER 18
µ
PD78F9418A
User’s Manual U13952EJ3V1UD 265
Figure 18-9. Example of Flash Memory Writing Adapter Connection When Using UART Mode
PD78F9418A
GND
VDD
VDD2 (LVDD)
SI SO SCK CLKOUT RESET VPP RESERVE/HS
Writer interface
VDD (2.7 to 5.5 V)
GND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
µ
CHAPTER 18
µ
PD78F9418A
266 User’s Manual U13952EJ3V1UD
Figure 18-10. Example of Flash Memory Writing Adapter Connection When Using Pseudo 3-Wire Mode
(When P0 Is Used)
PD78F9418A
GND
VDD
VDD2 (LVDD)
SI SO SCK CLKOUT RESET VPP RESERVE/HS
Writer interface
VDD (2.7 to 5.5 V)
GND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
µ
User’s Manual U13952EJ3V1UD
267
CHAPTER 19 MASK OPTIONS
The mask ROM versions of the
µ
PD789407A and
µ
PD789417A Subseries have the following mask options.
Caution The flash memory version does not have a mask option.
19.1 Mask Option for Pins
Table 19-1. Selection of Mask Option for Pins
Pin Mask Option
P50 to P53 Whether a pull-up resistor is to be incorporated can be specified in 1-bit units.
For P50 to P53 (port 5), a mask option is used to specify whether a pull-up resistor is to be incorporated. The
mask option is selectable in 1-bit units.
19.2 Mask Option for Voltage Division Resistor for LCD Driver
A mask option is used to specify whether a voltage division resistor is to be incorporated for the LCD driver, as
listed below:
Table 19-2. Combination of Selectable Voltage Division Resistor
RLC1 (2 × RLC2)
None
20 k 200 k
RLC2 None {
10 k { {
100 k { {
{: Selectable
: Not selectable
LIPS0
LIPS0: Bit 4 of LCD display mode register 0 (LCDM0)
P-ch
VDD
VLC0
VLC1
VLCD
VLC2
VSS
RLC2
RLC2
RLC2
RLC1
BIAS
User’s Manual U13952EJ3V1UD
268
CHAPTER 20 INSTRUCTION SET
This chapter lists the instruction set of the
µ
PD789407A and 789417A Subseries. For details of the operation and
machine language (instruction code) of each instruction, refer to 78K/0S Series Instructions User’s Manual
(U11047E).
20.1 Operation
20.1.1 Operand identifiers and description methods
Operands are described in the Operands column of each instruction in accordance with the description method of
the instruction operand identifier (refer to the assembler specifications for details). When there are two or more
description methods, select one of them. Uppercase letters and the symbols #, !, $, and [ ] are keywords and are
described as they are. Each symbol has the following meaning.
#: Immediate data specification $: Relative address specification
!: Absolute address specification [ ]: Indirect address specification
In the case of immediate data, describe an appropriate numeric value or a label. When using a label, be sure to
describe the #, !, $ and [ ] symbols.
For operand register identifiers r and rp, either functional names (X, A, C, etc.) or absolute names (names in
parentheses in the table below, R0, R1, R2, etc.) can be used for description.
Table 20-1. Operand Identifiers and Description Methods
Identifier Description Method
r
rp
sfr
X (R0), A (R1), C (R2), B (R3), E (R4), D (R5), L (R6), H (R7)
AX (RP0), BC (RP1), DE (RP2), HL (RP3)
Special function register symbol
saddr
saddrp
FE20H to FF1FH Immediate data or label
FE20H to FF1FH Immediate data or label (even addresses only)
addr16
addr5
0000H to FFFFH Immediate data or label (only even addresses for 16-bit data transfer instructions)
0040H to 007FH Immediate data or label (even addresses only)
word
byte
bit
16-bit immediate data or label
8-bit immediate data or label
3-bit immediate data or label
Remark See Table 3-3 for symbols of special function registers.
CHAPTER 20 INSTRUCTION SET
User’s Manual U13952EJ3V1UD 269
20.1.2 Description of “Operation” column
A: A register; 8-bit accumulator
X: X register
B: B register
C: C register
D: D register
E: E register
H: H register
L: L register
AX: AX register pair; 16-bit accumulator
BC: BC register pair
DE: DE register pair
HL: HL register pair
PC: Program counter
SP: Stack pointer
PSW: Program status word
CY: Carry flag
AC: Auxiliary carry flag
Z: Zero flag
IE: Interrupt request enable flag
NMIS: Flag indicating non-maskable interrupt servicing in progress
( ): Memory contents indicated by address or register contents in parenthesis
XH, XL: Higher 8 bits and lower 8 bits of 16-bit register
: Logical product (AND)
: Logical sum (OR)
V: Exclusive logical sum (exclusive OR)
: Inverted data
addr16: 16-bit immediate data or label
jdisp8: Signed 8-bit data (displacement value)
20.1.3 Description of “Flag” column
(Blank): Unchanged
0: Cleared to 0
1: Set to 1
x: Set/cleared according to the result
R: Previously saved value is restored
CHAPTER 20 INSTRUCTION SET
270 User’s Manual U13952EJ3V1UD
20.2 Operation List
Mnemonic Operands Bytes Clocks Operation Flag
Z AC CY
MOV r, #byte 3 6
r byte
saddr, #byte 3 6
(saddr) byte
sfr, #byte 3 6
sfr byte
A, rNote 1 2 4
A r
r, ANote 1 2 4
r A
A, saddr 2 4
A (saddr)
saddr, A 2 4
(saddr) A
A, sfr 2 4
A sfr
sfr, A 2 4
sfr A
A, !addr16 3 8
A (addr16)
!addr16, A 3 8
(addr16) A
PSW, #byte 3 6
PSW byte x x x
A, PSW 2 4
A PSW
PSW, A 2 4
PSW A x x x
A, [DE] 1 6
A (DE)
[DE], A 1 6
(DE) A
A, [HL] 1 6
A (HL)
[HL], A 1 6
(HL) A
A, [HL+byte] 2 6
A (HL + byte)
[HL+byte], A 2 6
(HL + byte) A
XCH A, X 1 4
A X
A, rNote 2 2 6
A r
A, saddr 2 6
A (saddr)
A, sfr 2 6
A sfr
A, [DE] 1 8
A (DE)
A, [HL] 1 8
A (HL)
A, [HL+byte] 2 8
A (HL + byte)
Notes 1. Except r = A.
2. Except r = A, X.
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
CHAPTER 20 INSTRUCTION SET
User’s Manual U13952EJ3V1UD 271
Mnemonic Operands Bytes Clocks Operation Flag
Z AC CY
MOVW rp, #word 3 6
rp word
AX, saddrp 2 6
AX (saddrp)
saddrp, AX 2 8
(saddrp) AX
AX, rpNote 1 4
AX rp
rp, AXNote 1 4
rp AX
XCHW AX, rpNote 1 8
AX rp
ADD A, #byte 2 4
A, CY A + byte x x x
saddr, #byte 3 6
(saddr), CY (saddr) + byte x x x
A, r 2 4
A, CY A + r x x x
A, saddr 2 4
A, CY A + (saddr) x x x
A, !addr16 3 8
A, CY A + (addr16) x x x
A, [HL] 1 6
A, CY A + (HL) x x x
A, [HL+byte] 2 6
A, CY A + (HL + byte) x x x
ADDC A, #byte 2 4
A, CY A + byte + CY x x x
saddr, #byte 3 6
(saddr), CY (saddr) + byte + CY x x x
A, r 2 4
A, CY A + r + CY x x x
A, saddr 2 4
A, CY A + (saddr) + CY x x x
A, !addr16 3 8
A, CY A + (addr16) + CY x x x
A, [HL] 1 6
A, CY A + (HL) + CY x x x
A, [HL+byte] 2 6
A, CY A + (HL + byte) + CY x x x
SUB A, #byte 2 4
A, CY A byte x x x
saddr, #byte 3 6
(saddr), CY (saddr) byte x x x
A, r 2 4
A, CY A r x x x
A, saddr 2 4
A, CY A (saddr) x x x
A, !addr16 3 8
A, CY A (addr16) x x x
A, [HL] 1 6
A, CY A (HL) x x x
A, [HL+byte] 2 6
A, CY A (HL + byte) x x x
Note Only when rp = BC, DE, or HL.
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
CHAPTER 20 INSTRUCTION SET
272 User’s Manual U13952EJ3V1UD
Mnemonic Operands Bytes Clocks Operation Flag
Z AC CY
SUBC A, #byte 2 4
A, CY A byte CY x x x
saddr, #byte 3 6
(saddr), CY (saddr) byte CY x x x
A, r 2 4
A, CY A r CY x x x
A, saddr 2 4
A, CY A (saddr) CY x x x
A, !addr16 3 8
A, CY A (addr16) CY x x x
A, [HL] 1 6
A, CY A (HL) CY x x x
A, [HL+byte] 2 6
A, CY A (HL + byte) CY x x x
AND A, #byte 2 4
A A byte x
saddr, #byte 3 6
(saddr) (saddr) byte x
A, r 2 4
A A r x
A, saddr 2 4
A A (saddr) x
A, !addr16 3 8
A A (addr16) x
A, [HL] 1 6
A A (HL) x
A, [HL+byte] 2 6
A A (HL + byte) x
OR A, #byte 2 4
A A byte x
saddr, #byte 3 6
(saddr) (saddr) byte x
A, r 2 4
A A r x
A, saddr 2 4
A A (saddr) x
A, !addr16 3 8
A A (addr16) x
A, [HL] 1 6
A A (HL) x
A, [HL+byte] 2 6
A A (HL + byte) x
XOR A, #byte 2 4
A A V byte x
saddr, #byte 3 6
(saddr) (saddr) V byte x
A, r 2 4
A A V r x
A, saddr 2 4
A A V (saddr) x
A, !addr16 3 8
A A V (addr16) x
A, [HL] 1 6
A A V (HL) x
A, [HL+byte] 2 6
A A V (HL + byte) x
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
CHAPTER 20 INSTRUCTION SET
User’s Manual U13952EJ3V1UD 273
Mnemonic Operands Bytes Clocks Operation Flag
Z AC CY
CMP A, #byte 2 4
A byte x x x
saddr, #byte 3 6
(saddr) byte x x x
A, r 2 4
A r x x x
A, saddr 2 4
A (saddr) x x x
A, !addr16 3 8
A (addr16) x x x
A, [HL] 1 6
A (HL) x x x
A, [HL+byte] 2 6
A (HL + byte) x x x
ADDW AX, #word 3 6
AX, CY AX + word x x x
SUBW AX, #word 3 6
AX, CY AX word x x x
CMPW AX, #word 3 6
AX word x x x
INC r 2 4
r r + 1 x x
saddr 2 4
(saddr) (saddr) + 1 x x
DEC r 2 4
r r 1 x x
saddr 2 4
(saddr) (saddr) 1 x x
INCW rp 1 4
rp rp + 1
DECW rp 1 4
rp rp 1
ROR A, 1 1 2
(CY, A7 A0, Am1 Am) × 1 x
ROL A, 1 1 2
(CY, A0 A7, Am+1 Am) × 1 x
RORC A, 1 1 2
(CY A0, A7 CY, Am1 Am) × 1 x
ROLC A, 1 1 2
(CY A7, A0 CY, Am+1 Am) × 1 x
SET1 saddr.bit 3 6
(saddr.bit) 1
sfr.bit 3 6
sfr.bit 1
A.bit 2 4
A.bit 1
PSW.bit 3 6
PSW.bit 1 x x x
[HL].bit 2 10
(HL).bit 1
CLR1 saddr.bit 3 6
(saddr.bit) 0
sfr.bit 3 6
sfr.bit 0
A.bit 2 4
A.bit 0
PSW.bit 3 6
PSW.bit 0 x x x
[HL].bit 2 10
(HL).bit 0
SET1 CY 1 2
CY 1 1
CLR1 CY 1 2
CY 0 0
NOT1 CY 1 2
CY CY x
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
CHAPTER 20 INSTRUCTION SET
274 User’s Manual U13952EJ3V1UD
Mnemonic Operands Bytes Clocks Operation Flag
Z AC CY
CALL !addr16 3 6
(SP 1) (PC + 3)H, (SP 2) (PC + 3)L,
PC addr16, SP SP 2
CALLT [addr5] 1 8
(SP 1) (PC + 1)H, (SP 2) (PC + 1)L,
PCH (00000000, addr5 + 1),
PCL (00000000, addr5), SP SP 2
RET 1 6
PCH (SP + 1), PCL (SP), SP SP + 2
RETI 1 8
PCH (SP + 1), PCL (SP),
PSW (SP + 2), SP SP + 3, NMIS 0
RRR
PUSH PSW 1 2
(SP 1) PSW, SP SP 1
rp 1 4
(SP 1) rpH, (SP 2) rpL, SP SP 2
POP PSW 1 4
PSW (SP), SP SP + 1 RRR
rp 1 6
rpH (SP + 1), rpL (SP), SP SP + 2
MOVW SP, AX 2 8
SP AX
AX, SP 2 6
AX SP
BR !addr16 3 6
PC addr16
$addr16 2 6
PC PC + 2 + jdisp8
AX 1 6
PCH A, PCL X
BC $saddr16 2 6
PC PC + 2 + jdisp8 if CY = 1
BNC $saddr16 2 6
PC PC + 2 + jdisp8 if CY = 0
BZ $saddr16 2 6
PC PC + 2 + jdisp8 if Z = 1
BNZ $saddr16 2 6
PC PC + 2 + jdisp8 if Z = 0
BT saddr.bit, $addr16 4 10
PC PC + 4 + jdisp8 if (saddr.bit) = 1
sfr.bit, $addr16 4 10
PC PC + 4 + jdisp8 if sfr.bit = 1
A.bit, $addr16 3 8
PC PC + 3 + jdisp8 if A.bit = 1
PSW.bit, $addr16 4 10
PC PC + 4 + jdisp8 if PSW.bit = 1
BF saddr.bit, $addr16 4 10
PC PC + 4 + jdisp8 if (saddr.bit) = 0
sfr.bit, $addr16 4 10
PC PC + 4 + jdisp8 if sfr.bit = 0
A.bit, $addr16 3 8
PC PC + 3 + jdisp8 if A.bit = 0
PSW.bit, $addr16 4 10
PC PC + 4 + jdisp8 if PSW.bit = 0
DBNZ B, $addr16 2 6
B B1, then PC PC + 2 + jdisp8 if B 0
C, $addr16 2 6
C C1, then PC PC + 2 + jdisp8 if C 0
saddr, $addr16 3 8
(saddr) (saddr) 1, then
PC PC + 3 + jdisp8 if (saddr) 0
NOP 1 2 No Operation
EI 3 6
IE 1 (Enable interrupt)
DI 3 6
IE 0 (Disable interrupt)
HALT 1 2 Set HALT mode
STOP 1 2 Set STOP mode
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
CHAPTER 20 INSTRUCTION SET
User’s Manual U13952EJ3V1UD 275
20.3 Instructions Listed by Addressing Type
(1) 8-bit instructions
MOV, XCH, ADD, ADDC, SUB, SUBC, AND, OR, XOR, CMP, INC, DEC, ROR, ROL, RORC, ROLC, PUSH,
POP, DBNZ
2nd Operand
1st Operand
#byte A r sfr saddr
!addr16 PSW [DE] [HL]
[HL+byte]
$addr1
6
1 None
A ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
MOVNote
XCHNote
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
MOV
XCH
MOV
XCH
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
MOV
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
MOV
MOV
XCH
MOV
XCH
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
MOV
XCH
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
ROR
ROL
RORC
ROLC
r MOV
MOV INC
DEC
B, C DBNZ
sfr MOV MOV
saddr MOV
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
MOV DBNZ INC
DEC
!addr16 MOV
PSW MOV MOV PUSH
POP
[DE] MOV
[HL] MOV
[HL+byte] MOV
Note Except r = A.
CHAPTER 20 INSTRUCTION SET
276 User’s Manual U13952EJ3V1UD
(2) 16-bit instructions
MOVW, XCHW, ADDW, SUBW, CMPW, PUSH, POP, INCW, DECW
2nd Operand
1st Operand
#word AX rpNote saddrp SP None
AX ADDW
SUBW
CMPW
MOVW
XCHW
MOVW MOVW
rp MOVW MOVWNote INCW
DECW
PUSH
POP
saddrp MOVW
SP MOVW
Note Only when rp = BC, DE, or HL.
(3) Bit manipulation instructions
SET1, CLR1, NOT1, BT, BF
2nd Operand
1st Operand
$addr16 None
A.bit BT
BF
SET1
CLR1
sfr.bit BT
BF
SET1
CLR1
saddr.bit BT
BF
SET1
CLR1
PSW.bit BT
BF
SET1
CLR1
[HL].bit SET1
CLR1
CY SET1
CLR1
NOT1
CHAPTER 20 INSTRUCTION SET
User’s Manual U13952EJ3V1UD 277
(4) Call instructions/branch instructions
CALL, CALLT, BR, BC, BNC, BZ, BNZ, DBNZ
2nd Operand
1st Operand
AX !addr16 [addr5] $addr16
Basic Instructions BR CALL
BR
CALLT BR
BC
BNC
BZ
BNZ
Compound Instructions DBNZ
(5) Other instructions
RET, RETI, NOP, EI, DI, HALT, STOP
User’s Manual U13952EJ3V1UD
278
CHAPTER 21 ELECTRICAL SPECIFICATIONS
Absolute Maximum Ratings (TA = 25°C)
Parameter Symbol Conditions Ratings Unit
VDD
AVDD
AVREF
AVDD 0.3 V VDD AVDD + 0.3 V
AVREF VDD + 0.3 V
AVREF AVDD + 0.3 V
0.3 to +6.5 V
Supply voltage
VPP
µ
PD78F9418A only Note –0.3 to +10.5 V
VI1 Pins other than P50 to P53 0.3 to VDD + 0.3 V
Input voltage
VI2 P50 to P53 N-ch open drain 0.3 to +13 V
Output voltage VO 0.3 to VDD + 0.3 V
1 pin 10 mA Output current, high IOH
Total for all pins 30 mA
1 pin 30 mA Output current, low IOL
Total for all pins 160 mA
In normal operation mode 40 to +85 °C
Operating ambient
temperature
TA
During flash memory programming 10 to 40 °C
Mask ROM version –65 to +150 °C
Storage temperature Tstg
µ
PD78F9418A –40 to +125 °C
Note Make sure that the following conditions of the VPP voltage application timing are satisfied when the flash
memory is written.
When supply voltage rises
VPP must exceed VDD 10
µ
s or more after VDD has reached the lower-limit value (1.8 V) of the operating
voltage range (see a in the figure below).
When supply voltage drops
VDD must be lowered 10
µ
s or more after VPP falls below the lower-limit value (1.8 V) of the operating
voltage range of VDD (see b in the figure below).
1.8 V
VDD
0 V
0 V
VPP
1.8 V
ab
Caution Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any
parameter. That is, the absolute maximum ratings are rated values at which the product is on the
verge of suffering physical damage, and therefore the product must be used under conditions
that ensure that the absolute maximum ratings are not exceeded.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port
pins.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 279
Main System Clock Oscillator Characteristics (TA = 40 to +85°C, VDD = 1.8 to 5.5 V)
Resonator Recommended Circuit Parameter Conditions MIN. TYP. MAX. Unit
Oscillation frequency
(fX)Note 1
VDD = Oscillation voltage
range
1.0 5.0 MHz Ceramic
resonator
X2X1
V
SS0
C2C1
Oscillation stabilization
timeNote 2
After VDD has reached MIN. of
oscillation start voltage
4 ms
Oscillation frequency
(fX)Note 1
1.0 5.0 MHz
VDD = 4.5 to 5.5 V 10 ms
Crystal
resonator
X2X1V
SS0
C2C1
Oscillation stabilization
timeNote 2 VDD = 1.8 to 5.5 V 30 ms
X1 input frequency
(fX)Note 1
1.0 5.0 MHz
X1 X2
X1 input high-/low-level
widths (tXH, tXL)
85 500 ns
X1 input frequency
(fX)Note 1
VDD = 2.7 to 5.5 V 1.0 5.0 MHz
External
clock
X1 X2
OPEN
X1 input high-/low-level
widths (tXH, tXL)
VDD = 2.7 to 5.5 V 85 500 ns
Notes 1. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
2. Time required to stabilize oscillation after reset or STOP mode release. Use a resonator whose
oscillation is stabilized within the oscillation wait time.
Cautions 1. When using the main system clock oscillator, wire as follows in the area enclosed by the
broken lines in the above figures to avoid an adverse effect from wiring capacitance.
Keep the wiring length as short as possible.
Do not cross the wiring with the other signal lines.
Do not route the wiring near a signal line through which a high fluctuating current flows.
Always make the ground point of the oscillator capacitor the same potential as VSS0.
Do not ground the capacitor to a ground pattern through which a high current flows.
Do not fetch signals from the oscillator.
2. When the main system clock is stopped and the device is operating on the subsystem clock,
wait until the oscillation stabilization time has been secured by the program before switching
back to the main system clock.
Remark For the resonator selection and oscillator constant, customers are requested to either evaluate the
oscillation themselves or apply to the resonator manufacturer for evaluation.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
280 User’s Manual U13952EJ3V1UD
Subsystem Clock Oscillator Characteristics (TA = 40 to +85°C, VDD = 1.8 to 5.5 V)
Resonator Recommended Circuit Parameter Conditions MIN. TYP. MAX. Unit
Oscillation frequency
(fXT)Note 1
32 32.768 35 kHz
VDD = 4.5 to 5.5 V 1.2 2 s
Crystal
resonator
XT2XT1V
SS0
C4
C3
R
Oscillation stabilization
timeNote 2 VDD = 1.8 to 5.5 V 10 s
XT1 input frequency
(fXT)Note 1
32 35 kHz
External
clock
XT1 XT2
XT1 input high-/low-
level widths (tXTH, tXTL)
14.3 15.6
µ
s
Notes 1. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
2. Time required to stabilize oscillation after reset or STOP mode release. Use a resonator whose
oscillation is stabilized within the oscillation wait time.
Cautions 1. When using the subsystem clock oscillator, wire as follows in the area enclosed by the broken
lines in the above figure to avoid an adverse effect from wiring capacitance.
Keep the wiring length as short as possible.
Do not cross the wiring with the other signal lines.
Do not route the wiring near a signal line through which a high fluctuating current flows.
Always make the ground point of the oscillator capacitor the same potential as VSS0.
Do not ground the capacitor to a ground pattern through which a high current flows.
Do not fetch signals from the oscillator.
2. The subsystem clock oscillator is designed as a low-amplitude circuit for reducing current
consumption, and is more prone to malfunction due to noise than the main system clock
oscillator. Particular care is therefore required with the wiring method when the subsystem
clock is used.
Remark For the resonator selection and oscillator constant, customers are requested to either evaluate the
oscillation themselves or apply to the resonator manufacturer for evaluation.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 281
DC Characteristics (TA = 40 to +85°C, VDD = 1.8 to 5.5 V) (1/3)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Per pin 1 mA Output current,
high
IOH
Total for all pins 15 mA
Per pin 10 mA Output current,
low
IOL
Total for all pins 80 mA
VDD = 2.7 to 5.5 V 0.7VDD VDD V VIH1 P00 to P03, P46, P47, P60 to P66,
P80 to P87, P90 to P93 VDD = 1.8 to 5.5 V 0.9VDD VDD V
VDD = 2.7 to 5.5 V 0.7VDD 12 V N-ch open drain
VDD = 1.8 to 5.5 V 0.9VDD 12 V
VDD = 2.7 to 5.5 V 0.7VDD VDD V
VIH2 P50 to P53
On-chip pull-up
resistor VDD = 1.8 to 5.5 V 0.9VDD VDD V
VDD = 2.7 to 5.5 V 0.8VDD VDD V VIH3 RESET, P20 to P27, P40 to P45
VDD = 1.8 to 5.5 V 0.9VDD VDD V
Input voltage,
high
VIH4 X1, X2, XT1, XT2 VDD = 1.8 to 5.5 V VDD 0.1 V
DD V
VDD = 2.7 to 5.5 V 0 0.3VDD V VIL1 P00 to P03, P46, P47, P60 to P66,
P80 to P87, P90 to P93 VDD = 1.8 to 5.5 V 0 0.1VDD V
VDD = 2.7 to 5.5 V 0 0.3VDD V VIL2 P50 to P53
VDD = 1.8 to 5.5 V 0 0.1VDD V
VDD = 2.7 to 5.5 V 0 0.2VDD V VIL3 RESET, P20 to P27, P40 to P45
VDD = 1.8 to 5.5 V 0 0.1VDD V
Input voltage,
low
VIL4 X1, X2, XT1, XT2 VDD = 1.8 to 5.5 V 0 0.1 V
IOH = 1 mA VDD = 4.5 to 5.5 V VDD 1.0 V
Output voltage,
high
VOH
IOH = 100
µ
A VDD = 1.8 to 5.5 V VDD 0.5 V
VDD = 4.5 to 5.5 V
IOL = 10 mA
1.0 V
VOL1 Pins other than P50 to P53
VDD = 1.8 to 5.5 V
IOL = 400
µ
A
0.5 V
VDD = 4.5 to 5.5 V
IOL = 10 mA
1.0 V
Output voltage,
low
VOL2 P50 to P53
VDD = 1.8 to 5.5 V
IOL = 1.6 mA
0.4 V
ILIH1 Pins other than P50 to P53
(N-ch open drain), X1, X2,
XT1, and XT2
3
µ
A
ILIH2
VIN = VDD
X1, X2, XT1, XT2 20
µ
A
Input leakage
current, high
ILIH3 VIN = 12 V P50 to P53 (N-ch open drain) 20
µ
A
ILIL1 Pins other than P50 to P53
(N-ch open drain), X1, X2,
XT1, and XT2
3
µ
A
ILIL2 X1, X2, XT1, XT2 20
µ
A
Input leakage
current, low
ILIL3
VIN = 0 V
P50 to P53 (N-ch open drain) 3Note
µ
A
Note A low-level input leakage current of 30
µ
A (MAX.) flows only during the 1-cycle time after a read instruction
is executed to P50 to P53 when on-chip pull-up resistors are not connected to P50 to P53 (specified by
mask option) and P50 to P53 are set to input mode. At times other than this, a 3
µ
A (MAX.) current flows.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port
pins.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
282 User’s Manual U13952EJ3V1UD
DC Characteristics (TA = 40 to +85°C, VDD = 1.8 to 5.5 V) (2/3)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Output leakage
current, high
ILOH VOUT = VDD 3
µ
A
Output leakage
current, low
ILOL VOUT = 0 V 3
µ
A
Software pull-up
resistor
R1 VIN = 0 V, pins other than P50 to P53 50 100 200 k
Mask option pull-
up resistorNote 1
R2 VIN = 0 V, P50 to P53 15 30 60 k
VDD = 5.0 V ±10%Note 5 2.0 4.0 mA
VDD = 3.0 V ±10%Note 6 0.6 1.2 mA
IDD1Note 2 5.0 MHz crystal oscillation operating
mode
(C1 = C2 = 22 pF) VDD = 2.0 V ±10%Note 6 0.3 0.6 mA
VDD = 5.0 V ±10%Note 5 1.1 2.2 mA
VDD = 3.0 V ±10%Note 6 0.4 0.8 mA
IDD2Note 2 5.0 MHz crystal oscillation HALT
mode
(C1 = C2 = 22 pF) VDD = 2.0 V ±10%Note 6 0.2 0.4 mA
VDD = 5.0 V ±10% 30 90
µ
A
VDD = 3.0 V ±10% 9 50
µ
A
IDD3Note 2 32.768 kHz crystal oscillation
operating modeNote 4
(C3 = C4 = 22 pF, R1 = 220 k) VDD = 2.0 V ±10% 4 25
µ
A
VDD = 5.0 V ±10% 25 55
µ
A
VDD = 3.0 V ±10% 5 25
µ
A
IDD4Note 2 32.768 kHz crystal oscillation HALT
modeNote 4
(C3 = C4 = 22 pF, R1 = 220 k) VDD = 2.0 V ±10% 2.5 12.5
µ
A
VDD = 5.0 V ±10% 0.1 10
µ
A
VDD = 3.0 V ±10% 0.05 5.0
µ
A
TA = 25°C 0.05 3.0
µ
A
IDD5Note 2 32.768 kHz crystal oscillation STOP
mode
VDD = 2.0 V ±10% 0.05 3.0
µ
A
VDD = 5.0 V ±10% 2.6 6.0 mA
VDD = 3.0 V ±10% 1.2 3.6 mA
Supply current
(mask ROM
version)
IDD6Note 3 5.0 MHz crystal oscillation
A/D operating mode
(C1 = C2 = 22 pF) VDD = 2.0 V ±10% 0.9 2.7 mA
Notes 1. Mask ROM version only
2. The current flowing to AVREF (A/D operation ON (ADCS0 = 1)), AVDD current, and the port current
(including the current flowing through the on-chip pull-up resistors) is not included.
3. The current flowing to AVREF (A/D operation ON (ADCS0 = 1)) and the port current (including the current
flowing through the on-chip pull-up resistors) is not included. For the current flowing to AVREF, refer to
the parameter of “Resistance between AVREF and AVSS” in the 8-Bit A/D Converter Characteristics
and 10-Bit A/D Converter Characteristics.
4. When the main system clock is stopped
5. High-speed mode operation (when processor clock control register (PCC) is set to 00H)
6. Low-speed mode operation (when PCC is set to 02H)
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port
pins.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 283
DC Characteristics (TA = 40 to +85°C, VDD = 1.8 to 5.5 V) (3/3)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VDD = 5.0 V ±10%Note 4 5.0 14.0 mA
VDD = 3.0 V ±10%Note 5 2.0 5.0 mA
IDD1Note 1 5.0 MHz crystal oscillation operating
mode
(C1 = C2 = 22 pF) VDD = 2.0 V ±10%Note 5 1.5 3.0 mA
VDD = 5.0 V ±10%Note 4 2.0 6.0 mA
VDD = 3.0 V ±10%Note 5 1.0 3.0 mA
IDD2Note 1 5.0 MHz crystal oscillation HALT
mode
(C1 = C2 = 22 pF) VDD = 2.0 V ±10%Note 5 0.7 2.0 mA
VDD = 5.0 V ±10% 200 600
µ
A
VDD = 3.0 V ±10% 150 450
µ
A
IDD3Note 1 32.768 kHz crystal oscillation
operating modeNote 3
(C3 = C4 = 22 pF, R1 = 220 k) VDD = 2.0 V ±10% 100 300
µ
A
VDD = 5.0 V ±10% 50 150
µ
A
VDD = 3.0 V ±10% 30 90
µ
A
IDD4Note 1 32.768 kHz crystal oscillation HALT
modeNote 3
(C3 = C4 = 22 pF, R1 = 220 k) VDD = 2.0 V ±10% 20 60
µ
A
VDD = 5.0 V ±10% 0.1 10
µ
A
VDD = 3.0 V ±10% 0.05 5.0
µ
A
TA = 25°C 0.05 3.0
µ
A
IDD5Note 1 32.768 kHz crystal oscillation STOP
mode
VDD = 2.0 V ±10% 0.05 3.0
µ
A
VDD = 5.0 V ±10%Note 4 6.0 16.0 mA
VDD = 3.0 V ±10%Note 5 3.0 7.0 mA
Supply current
(
µ
PD78F9418A)
IDD6Note 2 5.0 MHz crystal oscillation
A/D operating mode
(C1 = C2 = 22 pF) VDD = 2.0 V ±10%Note 5 2.5 5.0 mA
Notes 1. The current flowing to AVREF (A/D operation ON (ADCS0 = 1)), AVDD current, and the port current
(including the current flowing through the on-chip pull-up resistors) is not included.
2. The current flowing to AVREF (A/D operation ON (ADCS0 = 1)) and the port current (including the
current flowing through the on-chip pull-up resistors) is not included. For the current flowing to AVREF,
refer to the parameter of “Resistance between AVREF and AVSS” in the 8-Bit A/D Converter
Characteristics and 10-Bit A/D Converter Characteristics.
3. When the main system clock is stopped
4. High-speed mode operation (when processor clock control register (PCC) is set to 00H)
5. Low-speed mode operation (when PCC is set to 02H)
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port
pins.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
284 User’s Manual U13952EJ3V1UD
LCD Characteristics (TA = 40 to +85°C, VDD = 2.2 to 5.5 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VAON0 = 1 2.2 VDD V
At 1/3 bias 2.7 VDD V
LCD drive voltage VLCD
VAON0 = 0Note 1
At 1/2 bias 3.0 VDD V
When selecting 100 k by mask option 100 200 400 k
LCD divider
resistorNote 2
RLCD
When selecting 10 k by mask option 10 20 40 k
LCD output voltage
deviationNote 3 (common)
VODC IO = ±5
µ
A VLCD0 = VLCD
VLCD1 = VLCD × 2/3
0
±0.2 V
LCD output voltage
deviationNote 3 (segment)
VODS IO = ±1
µ
A 2.2 V VLCD VDD
VLCD2 = VLCD × 1/3Note 1
0
±0.2 V
Notes 1. T
A = 10 to +85°C in the normal mode (VAON0 = 0)
2. For mask ROM version, 10 k, 100 k, or no divider resistor can be selected by mask option. The
µ
PD78F9418A has no divider resistor.
3. Voltage deviation is the voltage difference between the ideal value of the segment or common output
(VLCDn: n = 0 to 2) and the output voltage.
Flash Memory Write/Erase Characteristics (
µ
PD78F9418A only)
(TA = 10 to 40°C, VDD = 1.8 to 5.5 V, in 5.0 MHz crystal oscillation operating mode)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Write currentNote
(VDD pin)
IDDW When VPP supply voltage = VPP1 18 mA
Write currentNote
(VPP pin)
IPPW When VPP supply voltage = VPP1 22.5 mA
Erase currentNote
(VDD pin)
IDDE When VPP supply voltage = VPP1 18 mA
Erase currentNote
(VPP pin)
IPPE When VPP supply voltage = VPP1 115 mA
Unit erase time ter 0.5 1 1 s
Total erase time tera 20 s
Write count Erase/write are regarded as 1 cycle 20 Times
VPP0 In normal operation 0 0.2VDD V VPP supply voltage
VPP1 During flash memory programming 9.7 10.0 10.3 V
Note The current flowing to the ports (including the current flowing through the on-chip pull-up resistors) is not
included.
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 285
AC Characteristics
(1) Basic operation (TA = 40 to +85°C, VDD = 1.8 to 5.5 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VDD = 2.7 to 5.5 V 0.4 8
µ
s
Operating with main
system clock VDD = 1.8 to 5.5 V 1.6 8
µ
s
Cycle time (minimum
instruction execution
time)
TCY
Operating with subsystem clock 114 122 125
µ
s
VDD = 2.7 to 5.5 V 0 4 MHz TI0, TI1 input
frequency
fTI
VDD = 1.8 to 5.5 V 0 275 kHz
VDD = 2.7 to 5.5 V 0.1
µ
s
TI0, TI1 input high-/
low-level widths
tTIH, tTIL
VDD = 1.8 to 5.5 V 1.8
µ
s
Interrupt input high-/
low-level widths
tINTH,
tINTL
INTP0 to INTP3 10
µ
s
RESET input
low-level width
tRSL 10
µ
s
TCY vs VDD (Main system clock)
123456
0.1
0.4
1.0
10
60
Guaranteed
operating
range
Cycle time [ s]
µ
Supply voltage VDD [V]
CHAPTER 21 ELECTRICAL SPECIFICATIONS
286 User’s Manual U13952EJ3V1UD
(2) Serial interface (TA = 40 to +85°C, VDD = 1.8 to 5.5 V)
(a) 3-wire serial I/O mode (SCK ... Internal clock output)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VDD = 2.7 to 5.5 V 800 ns SCK cycle time tKCY1
VDD = 1.8 to 5.5 V 3200 ns
VDD = 2.7 to 5.5 V tKCY1/250 ns
SCK high-/low-level
widths
tKH1, tKL1
VDD = 1.8 to 5.5 V tKCY1/2150 ns
VDD = 2.7 to 5.5 V 150 ns SI setup time
(to SCK)
tSIK1
VDD = 1.8 to 5.5 V 500 ns
VDD = 2.7 to 5.5 V 400 ns SI hold time
(from SCK)
tKSI1
VDD = 1.8 to 5.5 V 600 ns
VDD = 2.7 to 5.5 V 0 250 ns SO output delay time
from SCK
tKSO1 R = 1 k,
C = 100 pFNote VDD = 1.8 to 5.5 V 0 1000 ns
Note R and C are the load resistance and load capacitance of the SO output line.
(b) 3-wire serial I/O mode (SCK ... External clock input)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VDD = 2.7 to 5.5 V 900 ns SCK cycle time tKCY2
VDD = 1.8 to 5.5 V 3500 ns
VDD = 2.7 to 5.5 V 400 ns SCK high-/low-level
widths
tKH2, tKL2
VDD = 1.8 to 5.5 V 1600 ns
VDD = 2.7 to 5.5 V 100 ns SI setup time
(to SCK)
tSIK2
VDD = 1.8 to 5.5 V 150 ns
VDD = 2.7 to 5.5 V 400 ns SI hold time
(from SCK)
tKSI2
VDD = 1.8 to 5.5 V 600 ns
VDD = 2.7 to 5.5 V 0 300 ns SO output delay time
from SCK
tKSO2 R = 1 k,
C = 100 pFNote VDD = 1.8 to 5.5 V 0 1000 ns
Note R and C are the load resistance and load capacitance of the SO output line.
(c) UART mode (dedicated baud rate generator output)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VDD = 2.7 to 5.5 V 78125 bps Transfer rate
VDD = 1.8 to 5.5 V 19531 bps
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 287
(d) UART mode (external clock input)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
VDD = 2.7 to 5.5 V 900 ns ASCK cycle time tKCY3
VDD = 1.8 to 5.5 V 3500 ns
VDD = 2.7 to 5.5 V 400 ns ASCK high-/low-level
widths
tKH3, tKL3
VDD = 1.8 to 5.5 V 1600 ns
VDD = 2.7 to 5.5 V 39063 bps Transfer rate
VDD = 1.8 to 5.5 V 9766 bps
ASCK rise/fall times tR, tF 1
µ
s
CHAPTER 21 ELECTRICAL SPECIFICATIONS
288 User’s Manual U13952EJ3V1UD
AC Timing Test Points (Excluding X1 and XT1 Inputs)
Clock Timing
TI Timing
Interrupt Input Timing
RESET Input Timing
0.8VDD
0.2VDD
0.8VDD
0.2VDD
Test points
1/f
X
t
XL
t
XH
X1 input V
IH4
(MIN.)
V
IL4
(MAX.)
1/f
XT
t
XTL
t
XTH
XT1 input V
IH4
(MIN.)
V
IL4
(MAX.)
INTP0 to INTP3
tINTL tINTH
RESET
t
RSL
TI0, TI1
t
TIL
1/f
TI
t
TIH
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 289
Serial Transfer Timing
3-wire serial I/O mode:
Remark m = 1 or 2
UART mode (external clock input):
t
KCYm
t
KLm
t
KHm
SCK
t
SIKm
t
KSIm
t
KSOm
SI
SO
Input data
Output data
t
KCY3
t
KL3
t
KH3
ASCK
t
R
t
F
CHAPTER 21 ELECTRICAL SPECIFICATIONS
290 User’s Manual U13952EJ3V1UD
8-Bit A/D Converter Characteristics (
µ
PD789405A, 789406A, 789407A)
(TA = 40 to +85°C, 1.8 V AVREF AVDD = VDD 5.5 V, AVSS = VSS = 0 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Resolution 8 8 8 bit
2.7 V AVREF AVDD 5.5 V ±0.4 ±0.6 %FSR
Overall errorNote
±0.8 ±1.2 %FSR
2.7 V AVREF AVDD 5.5 V 14 100
µ
s
Conversion time tCONV
28 100
µ
s
Analog input voltage VIAN 0 AVREF V
Reference voltage AVREF 1.8 AVDD V
Resistance between AVREF and AVSS RADREF 20 40 k
Note Excludes quantization error (±0.2%FSR).
Remark FSR: Full-scale range
10-Bit A/D Converter Characteristics (
µ
PD789415A, 789416A, 789417A, 78F9418A)
(TA = 40 to +85°C, 1.8 V AVREF AVDD = VDD 5.5 V, AVSS = VSS = 0 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Resolution 10 10 10 bit
4.5 V AVREF AVDD 5.5 V ±0.2 ±0.4 %FSR
2.7 V AVREF AVDD 5.5 V ±0.4 ±0.6 %FSR
Overall errorNote
1.8 V AVREF AVDD 5.5 V ±0.8 ±1.2 %FSR
4.5 V AVREF AVDD 5.5 V 14 100
µ
s
2.7 V AVREF AVDD 5.5 V 14 100
µ
s
Conversion time tCONV
1.8 V AVREF AVDD 5.5 V 28 100
µ
s
4.5 V AVREF AVDD 5.5 V
±0.4 %FSR
2.7 V AVREF AVDD 5.5 V
±0.6 %FSR
Zero-scale errorNote AINL
1.8 V AVREF AVDD 5.5 V
±1.2 %FSR
4.5 V AVREF AVDD 5.5 V
±0.4 %FSR
2.7 V AVREF AVDD 5.5 V
±0.6 %FSR
Full-scale errorNote AINL
1.8 V AVREF AVDD 5.5 V
±1.2 %FSR
4.5 V AVREF AVDD 5.5 V
±2.5 LSB
2.7 V AVREF AVDD 5.5 V
±4.5 LSB
Non-integral linearityNote INL
1.8 V AVREF AVDD 5.5 V
±8.5 LSB
4.5 V AVREF AVDD 5.5 V
±1.5 LSB
2.7 V AVREF AVDD 5.5 V
±2.0 LSB
Non-differential linearityNote DNL
1.8 V AVREF AVDD 5.5 V
±3.5 LSB
Analog input voltage VIAN 0 AVREF V
Reference voltage AVREF 1.8 AVDD V
Resistance between AVREF and AVSS RADREF 20 40 k
Note Excludes quantization error (±0.05%FSR).
Remark FSR: Full-scale range
CHAPTER 21 ELECTRICAL SPECIFICATIONS
User’s Manual U13952EJ3V1UD 291
Comparator Characteristics (TA = 40 to +85°C, VDD = 1.8 to 5.5 V)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Analog input range VCIN 0 VDD V
VDD = 2.7 to 5.5 V 1.35 1.6 1.85 V Reference voltage input range VCREF
VDD = 1.8 to 5.5 V 1.35 1.4 1.45 V
Accuracy
±100 mV
Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = 40 to +85°C)
Parameter Symbol Conditions MIN. TYP. MAX. Unit
Data retention power supply voltage VDDDR 1.8 5.5 V
Release signal set time tSREL 0
µ
s
Release by RESET 215/fX ms
Oscillation stabilization wait timeNote 1 tWAIT
Release by interrupt request Note 2 ms
Notes 1. The oscillation stabilization wait time is the time after oscillation has started during which the CPU is
stopped to prevent unstable operation.
2. Selection of 212/fX, 215/fX, or 217/fX is possible with bits 0 to 2 (OSTS0 to OSTS2) of the oscillation
stabilization time selection register (OSTS).
Remark fx: Main system clock oscillation frequency
CHAPTER 21 ELECTRICAL SPECIFICATIONS
292 User’s Manual U13952EJ3V1UD
Data Retention Timing (STOP Mode Release by RESET)
Data Retention Timing (Standby Release Signal: STOP Mode Release by Interrupt Signal)
V
DD
STOP mode
t
SREL
t
WAIT
STOP instruction execution
V
DDDR
RESET
Operation mode
HALT mode
Internal reset operation
Data retention mode
VDD
STOP mode Operation mode
Data retention mode
HALT mode
tSREL
tWAIT
VDDDR
STOP instruction execution
Standby release signal
(interrupt request)
User’s Manual U13952EJ3V1UD
293
CHAPTER 22 CHARACTERISTICS CURVES (REFERENCE VALUES)
22.1 Characteristics Curves for Mask ROM Versions
22 pF 33 pF
V
SS
V
SS
Crystal resonator
5.0 MHz
Crystal resonator
32.768 kHz
X1 XT1 XT2X2
Subsystem clock
operation mode (CSS0 = 1)
PCC = 00H
Subsystem clock
operation HALT mode (CSS0 = 1)
Supply voltage V
DD
(V)
Supply current I
DD
(mA)
10.0
1.0
0.5
0.1
0.05
0.01
0.005
0.001
012345678
(T
A
= 25°C)
PCC = 02H
PCC = 00H
(HALT mode)
PCC = 02H
(HALT mode)
220 k
22 pF 33 pF
CHAPTER 22 CHARACTERISTICS CURVES (REFERENCE VALUES)
294 User’s Manual U13952EJ3V1UD
V
DD
= 5.5 V
20
(T
A
= 25°C)
10
00 0.5 1.0 1.5
V
DD
- V
OH
(V)
2.0 2.5 3.0
I
OH
vs V
DD
- V
OH
V
DD
= 4.0 V
V
DD
= 4.5 V
V
DD
= 5.0 V
V
DD
= 3.5 V V
DD
= 3.0 V
V
DD
= 2.5 V
V
DD
= 2.0 V
V
DD
= 1.8 V
(T
A
= 25°C)
0
10
20
30
0 0.5 1.0 1.5 2.0 2.5 3.0 3.5
Low-level output voltage V
OL
(V)
Low-level output current I
OL
(mA)
High-level output current I
OH
(mA)
I
OL
vs V
OL
V
DD
= 4.0 V
V
DD
= 3.0 V
V
DD
= 2.0 V
V
DD
= 1.8 V
V
DD
= 3.5 V
V
DD
= 2.5 V
V
DD
= 4.5 V
V
DD
= 5.0 V
V
DD
= 5.5 V
CHAPTER 22 CHARACTERISTICS CURVES (REFERENCE VALUES)
User’s Manual U13952EJ3V1UD 295
22.2 Characteristics Curves for
µ
PD78F9418A
10.0
1.0
0.5
0.1
0.05
Supply current I
DD
(mA)
0.01
0.005
0.001
012345678
X1 X2
Crystal resonator
5.0 MHz
22 pF
XT1 XT2
Crystal resonator
32.768 kHz
33 pF
220 k
V
SS
22 pF 33 pF
V
SS
Subsystem clock
operation HALT mode
(CSS0 = 1, MCC = 1)
Subsystem clock
operation mode
(CSS0 = 1, MCC = 1)
Main system clock
operation mode
(PCC1 = 0, CSS0 = 0)
Main system clock
operation mode
(PCC1 = 1, CSS0 = 0)
Main system clock
operation HALT mode
(PCC1 = 1, CSS0 = 0)
Main system clock
operation HALT mode
(PCC1 = 0, CSS0 = 0)
(T
A
= 25˚C)
Supply voltage V
DD
(V)
User’s Manual U13952EJ3V1UD
296
CHAPTER 23 PACKAGE DRAWINGS
80-PIN PLASTIC QFP (14x14)
NOTE
Each lead centerline is located within 0.13 mm of
its true position (T.P.) at maximum material condition.
ITEM MILLIMETERS
A
B
D
G
17.20±0.20
14.00±0.20
0.13
0.825
I
17.20±0.20
J
C 14.00±0.20
H 0.32±0.06
0.65 (T.P.)
K1.60±0.20
P1.40±0.10
Q0.125±0.075
L0.80±0.20
F 0.825
N 0.10
M 0.17+0.03
0.07
P80GC-65-8BT-1
S 1.70 MAX.
R3°+7°
3°
41
60 4061
2180 201
S
SN
J
detail of lead end
C D
A
B
R
K
M
L
P
I
S
Q
G
F
M
H
CHAPTER 23 PACKAGE DRAWINGS
User’s Manual U13952EJ3V1UD 297
80-PIN PLASTIC TQFP (FINE PITCH) (12x12)
ITEM MILLIMETERS
G
H 0.22±0.05
1.25
A 14.0±0.2
C 12.0±0.2
D
F 1.25
14.0±0.2
B 12.0±0.2
M
N 0.08
0.145±0.05
P
Q 0.1±0.05
1.0
J 0.5 (T.P.)
K
L 0.5
1.0±0.2
I 0.08
S 1.1±0.1
R3°+4°
3°
R
H
K
L
J
FQ
GI
T
U
S
P
detail of lead end
NOTE
Each lead centerline is located within 0.08 mm of
its true position (T.P.) at maximum material condition.
60 41
40
21
61
80
120
M
S
S
CD
A
B
NM
P80GK-50-9EU-1
T 0.25
U 0.6±0.15
User’s Manual U13952EJ3V1UD
298
CHAPTER 24 RECOMMENDED SOLDERING CONDITIONS
The
µ
PD789407A and
µ
PD789417A Subseries should be soldered and mounted under the following
recommended conditions.
For soldering methods and conditions other than those recommended below, contact an NEC Electronics sales
representative.
For technical information, see the following website.
Semiconductor Device Mount Manual (http://www.necel.com/pkg/en/mount/index.html)
Table 24-1. Surface Mounting Type Soldering Conditions (1/3)
µ
PD789405AGC-×××-8BT: 80-pin plastic QFP (14 × 14)
µ
PD789406AGC-×××-8BT: 80-pin plastic QFP (14 × 14)
µ
PD789407AGC-×××-8BT: 80-pin plastic QFP (14 × 14)
µ
PD789415AGC-×××-8BT: 80-pin plastic QFP (14 × 14)
µ
PD789416AGC-×××-8BT: 80-pin plastic QFP (14 × 14)
µ
PD789417AGC-×××-8BT: 80-pin plastic QFP (14 × 14)
µ
PD78F9418AGC-8BT: 80-pin plastic QFP (14 × 14)
Soldering Method Soldering Conditions Recommended Condition
Symbol
Infrared reflow Package peak temperature: 235°C, Time: 30 seconds max. (at 210°C
or higher), Count: Twice or less
IR35-00-2
VPS Package peak temperature: 215°C, Time: 40 seconds max. (at 200°C
or higher), Count: Twice or less
VP15-00-2
Wave soldering Soldering bath temperature: 260°C max., Time: 10 seconds max.,
Count: 1, Preheating temperature: 120°C max. (package surface
temperature)
WS60-00-1
Partial heating Pin temperature: 350°C max., Time: 3 seconds max. (per pin row)
Caution Do not use different soldering methods together (except for partial heating).
CHAPTER 24 RECOMMENDED SOLDERING CONDITIONS
User’s Manual U13952EJ3V1UD 299
Table 24-1. Surface Mounting Type Soldering Conditions (2/3)
µ
PD789405AGK-×××-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
µ
PD789406AGK-×××-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
µ
PD789407AGK-×××-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
µ
PD789415AGK-×××-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
µ
PD789416AGK-×××-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
µ
PD789417AGK-×××-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
µ
PD78F9418GK-9EU: 80-pin plastic TQFP (fine pitch) (12 × 12)
Soldering Method Soldering Conditions Recommended Condition
Symbol
Infrared reflow Package peak temperature: 235°C, Time: 30 seconds max. (at 210°C
or higher), Count: Twice or less, Exposure limit: 7 daysNote (after that,
prebake at 125°C for 10 hours)
IR35-107-2
VPS Package peak temperature: 215°C, Time: 40 seconds max. (at 200°C
or higher), Count: Twice or less, Exposure limit: 7 daysNote (after that,
prebake at 125°C for 10 hours)
VP15-107-2
Partial heating Pin temperature: 350°C max., Time: 3 seconds max. (per pin row)
Note After opening the dry pack, store it at 25°C or less and 65% RH or less for the allowable storage period.
Caution Do not use different soldering methods together (except for partial heating).
CHAPTER 24 RECOMMENDED SOLDERING CONDITIONS
300 User’s Manual U13952EJ3V1UD
Table 24-1. Surface Mounting Type Soldering Conditions (3/3)
µ
PD789405AGC-×××-8BT-A: 80-pin plastic QFP (14 × 14)
µ
PD789406AGC-×××-8BT-A: 80-pin plastic QFP (14 × 14)
µ
PD789407AGC-×××-8BT-A: 80-pin plastic QFP (14 × 14)
µ
PD789415AGC-×××-8BT-A: 80-pin plastic QFP (14 × 14)
µ
PD789416AGC-×××-8BT-A: 80-pin plastic QFP (14 × 14)
µ
PD789417AGC-×××-8BT-A: 80-pin plastic QFP (14 × 14)
µ
PD78F9418AGC-8BT-A: 80-pin plastic QFP (14 × 14)
µPD789405AGK-×××-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
µPD789406AGK-×××-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
µPD789407AGK-×××-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
µPD789415AGK-×××-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
µPD789416AGK-×××-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
µPD789417AGK-×××-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
µPD78F9418GK-9EU-A: 80-pin plastic TQFP (fine pitch) (12 × 12)
Soldering Method Soldering Conditions Recommended Condition
Symbol
Infrared reflow Package peak temperature: 260°C, Time: 60 seconds max. (at 220°C
or higher), Count: Three times or less, Exposure limit: 7 daysNote (after
that, prebake at 125°C for 20 to 72 hours)
IR60-207-3
Wave soldering When the pin pitch of the package is 0.65 mm or more, wave soldering
can also be performed.
For details, contact an NEC Electronics sales representative.
Partial heating Pin temperature: 350°C max., Time: 3 seconds max. (per pin row)
Note After opening the dry pack, store it at 25°C or less and 65% RH or less for the allowable storage period.
Caution Do not use different soldering methods together (except for partial heating).
Remark Products that have the part numbers suffixed by "-A" are lead-free products.
User’s Manual U13952EJ3V1UD
301
APPENDIX A DEVELOPMENT TOOLS
The following development tools are available for development of systems using the
µ
PD789407A and
µ
PD789417A Subseries.
Figure A-1 shows development tools.
Support of PC98-NX series
Unless specified otherwise, the products supported by IBM PC/AT™ compatibles can be used in the PC98-NX
series. When using the PC98-NX series, refer to the explanation of IBM PC/AT compatibles.
Windows
Unless specified otherwise, “Windows” indicates the following operating systems.
Windows 3.1
Windows 95, 98, 2000
Windows NT™ Ver.4.0
APPENDIX A DEVELOPMENT TOOLS
302 User’s Manual U13952EJ3V1UD
Figure A-1. Development Tools
Language processing software
· Assembler package
· C compiler package
· Device file
· C library source file
Note 1
Debugging software
· Integrated debugger
· System simulator
Host machine
(PC or EWS)
Interface adapter
In-circuit emulator
Emulation board
Emulation probe
Conversion socket or
conversion adapter
Target system
Flash programmer
Flash memory
writing adapter
Flash memory
Power supply unit
· Software package
Control software
· Project Manager
(Windows version only)
Note 2
Software package
Flash memory writing environment
Notes 1. C library source file is not included in the software package.
2. Project Manager is included in the assembler package.
Project Manager is used only in the Windows environment.
APPENDIX A DEVELOPMENT TOOLS
User’s Manual U13952EJ3V1UD 303
A.1 Software Package
Software tools for development of the 78K/0S Series are combined in this package.
The following tools are included.
RA78K0S, CC78K0S, ID78K0S-NS, SM78K0S, and device files
SP78K0S
Software package
Part number:
µ
S××××SP78K0S
Remark ×××× in the part number differs depending on the operating system to be used.
µ
S××××SP78K0S
×××× Host Machine OS Supply Medium
AB17 Japanese Windows CD-ROM
BB17
PC-9800 series, IBM PC/AT
compatibles English Windows
A.2 Language Processing Software
Program that converts program written in mnemonic into object codes that can be executed
by microcontroller.
In addition, automatic functions to generate a symbol table and optimize branch instructions
are also provided.
Used in combination with a device file (DF789418) (sold separately).
<Caution when used in PC environment>
The assembler package is a DOS-based application but may be used in the Windows
environment by using the Project Manager of Windows (included in the assembler package).
RA78K0S
Assembler package
Part number:
µ
S××××RA78K0S
Program that converts program written in C language into object codes that can be executed
by microcontroller.
Used in combination with an assembler package (RA78K0S) and device file (DF789418)
(both sold separately).
<Caution when used in PC environment>
The C compiler package is a DOS-based application but may be used in the Windows
environment by using the Project Manager of Windows (included in the assembler package).
CC78K0S
C compiler package
Part number:
µ
S××××CC78K0S
File containing the information inherent to the device.
Used in combination with the RA78K0S, CC78K0S, ID78K0S-NS, and SM78K0S (all sold
separately).
DF789418Note 1
Device file
Part number:
µ
S××××DF789418
Source file of functions for generating object library included in C compiler package.
Necessary for changing object library included in C compiler package according to
customer’s specifications. Since this is a source file, its working environment does not
depend on any particular operating system.
CC78K0S-LNote 2
C library source file
Part number:
µ
S××××CC78K0S-L
Notes 1. DF789418 is a common file that can be used with RA78K0S, CC78K0S, ID78K0S-NS, and SM78K0S.
2. CC78K0S-L is not included in the software package (SP78K0S).
APPENDIX A DEVELOPMENT TOOLS
304 User’s Manual U13952EJ3V1UD
Remark ×××× in the part number differs depending on the host machine and operating system to be used.
µ
S××××RA78K0S
µ
S××××CC78K0S
×××× Host Machine OS Supply Medium
AB13 Japanese Windows
BB13 English Windows
3.5-inch 2HD FD
AB17 Japanese Windows
BB17
PC-9800 series,
IBM PC/AT compatibles
English Windows
3P17 HP9000 series 700TM HP-UXTM (Rel. 10.10)
3K17 SPARCstationTM SunOSTM (Rel. 4.1.4),
SolarisTM (Rel. 2.5.1)
CD-ROM
µ
S××××DF789418
µ
S××××CC78K0S-L
×××× Host Machine OS Supply Medium
AB13 Japanese Windows 3.5-inch 2HD FD
BB13
PC-9800 series,
IBM PC/AT compatibles English Windows
3P16 HP9000 series 700 HP-UX (Rel. 10.10) DAT
3K13 3.5-inch 2HD FD
3K15
SPARCstation SunOS (Rel. 4.1.4),
Solaris (Rel. 2.5.1) 1/4-inch CGMT
A.3 Control Software
Project Manager Control software created for efficient development of the user program in the Windows
environment. User program development operations such as editor startup, build, and
debugger startup can be performed from the Project Manager.
<Caution>
The Project Manager is included in the assembler package (RA78K0S).
The Project Manager is used only in the Windows environment.
A.4 Flash Memory Writing Tools
Flashpro III (FL-PR3, PG-FP3)
Flashpro IV (FL-PR4, PG-FP4)
Flash programmer
Dedicated flash programmer for microcontrollers incorporating flash memory
FA-80GC-8BT
FA-80GK-9EU
Flash memory writing adapter
Adapter for writing to flash memory and connected to Flashpro III or Flashpro IV.
FA-80GC-8BT: For 80-pin plastic QFP (GC-8BT type)
FA-80GK-9EU: For 80-pin plastic TQFP (GK-9EU type)
Remark The FL-PR3, FL-PR4, FA-80GC-8BT, and FA-80GK-9EU are products made by Naito Densei Machida
Mfg. Co., Ltd. (TEL +81-45-475-4191).
APPENDIX A DEVELOPMENT TOOLS
User’s Manual U13952EJ3V1UD 305
A.5 Debugging Tools (Hardware)
IE-78K0S-NS
In-circuit emulator
In-circuit emulator for debugging a hardware and software of application system using the
78K/0S Series. Supports an integrated debugger (ID78K0S-NS). Used in combination with an
AC adapter, emulation probe, and interface adapter for connecting the host machine.
IE-78K0S-NS-A
In-circuit emulator
In-circuit emulator with functions expanded from the IE-78K0S-NS.
The debug function has been further enhanced with the addition of a coverage function, and
enhancement of the tracer function and timer function.
IE-70000-MC-PS-B
AC adapter
Adapter for supplying power from AC 100 to 240 V outlet.
IE-70000-98-IF-C
Interface adapter
Adapter necessary when using a PC-9800 series PC (except notebook type) as the host
machine of the IE-78K0S-NS (C bus supported)
IE-70000-CD-IF-A
PC card interface
PC card and interface cable necessary when using a notebook PC as the host machine of the
IE-78K0S-NS (PCMCIA socket supported)
IE-70000-PC-IF-C
Interface adapter
Adapter necessary when using an IBM PC/AT compatible as the host machine of the
IE-78K0S-NS (ISA bus supported)
IE-70000-PCI-IF-A
Interface adapter
Adapter necessary when using a personal computer incorporating the PCI bus as the host
machine of the IE-78K0S-NS
IE-789418-NS-EM1
Emulation board
Board for emulating the peripheral hardware specific to the device. Used in combination with
an in-circuit emulator.
NP-80GC
Emulation probe
Cable to connect an in-circuit emulator to the target system. Used in combination with the
EV-9200GC-80.
EV-9200GC-80
Conversion socket
Conversion socket to connect the NP-80GC to a target system board on which an 80-pin plastic
QFP (GC-8BT type) can be mounted.
NP-80GC-TQ
NP-H80GC-TQ
Emulation probe
Cable to connect an in-circuit emulator to the target system. Used in combination with the TGC-
080SBP.
TGC-080SBP
Conversion adapter
Conversion adapter to connect the NP-80GC-TQ or NP-H80GC-TQ to a target system board on
which an 80-pin plastic QFP (GC-8BT type) can be mounted.
NP-80GK
NP-H80GK-TQ
Emulation probe
Cable to connect an in-circuit emulator to the target system. Used in combination with the TGK-
080SDW.
TGK-080SDW
Conversion adapter
Conversion adapter to connect the NP-80GK or NP-H80GK-TQ to a target system board on
which an 80-pin plastic TQFP (fine pitch) (GK-9EU type) can be mounted.
Remarks 1. The NP-80GC, NP-80GC-TQ, NP-H80GC-TQ, NP-80GK, and NP-H80GK-TQ are products made by
Naito Densei Machida Mfg. Co., Ltd. (TEL +81-45-475-4191).
2. The TGC-080SBP and TGK-080SDW are products made by TOKYO ELETECH CORPORATION.
For further information, contact: Daimaru Kogyo, Ltd.
Tokyo Electronics Department (TEL +81-3-3820-7112)
Osaka Electronics Department (TEL +81-6-6244-6672)
3. The EV-9200GC-80 is sold in five units as a set.
4. The TGC-080SBP and TGK-080SDW are sold in one set units.
APPENDIX A DEVELOPMENT TOOLS
306 User’s Manual U13952EJ3V1UD
A.6 Debugging Tools (Software)
This debugger supports the in-circuit emulators IE-78K0S-NS and IE-78K0S-NS-A for the
78K/0S Series. The ID78K0S-NS is Windows-based software.
It has improved C-compatible debugging functions and can display the results of tracing with
the source program using an integrating window function that associates the source
program, disassemble display, and memory display with the trace result.
Used in combination with a device file (DF789418) (sold separately).
ID78K0S-NS
Integrated debugger
Part number:
µ
S××××ID78K0S-NS
This is a system simulator for the 78K/0S Series. The SM78K0S is Windows-based software.
It can be used to debug the target system at C source level or assembler level while
simulating the operation of the target system on the host machine.
Using SM78K0S, the logic and performance of the application can be verified independently
of hardware development. Therefore, the development efficiency can be enhanced and the
software quality can be improved. Used
in combination with a device file (DF789418) (sold separately).
SM78K0S
System simulator
Part number:
µ
S××××SM78K0S
File containing the information inherent to the device.
Used in combination with the RA78K0S, CC78K0S, ID78K0S-NS, and SM78K0S (all sold
separately).
DF789418Note
Device file
Part number:
µ
S××××DF789418
Note DF789418 is a common file that can be used with RA78K0S, CC78K0S, ID78K0S-NS, and SM78K0S.
Remark ×××× in the part number differs depending on the operating system and supply medium to be used.
µ
S××××ID78K0S-NS
µ
S××××SM78K0S
×××× Host Machine OS Supply Medium
AB13 Japanese Windows
BB13 English Windows
3.5-inch 2HD FD
AB17 Japanese Windows
BB17
PC-9800 series,
IBM PC/AT compatibles
English Windows
CD-ROM
APPENDIX A DEVELOPMENT TOOLS
User’s Manual U13952EJ3V1UD 307
A.7 Package Drawings of Conversion Socket and Conversion Adapter
A.7.1 Package drawing and recommended footprint of conversion socket (EV-9200GC-80)
Figure A-2. Package Drawing of EV-9200GC-80 (for Reference)
A
F
D
1
No.1 pin index
E
EV-9200GC-80
B
C
M
N O
L
K
S
R
Q
P
I
H
J
G
EV-9200GC-80-G1E
ITEM MILLIMETERS INCHES
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
18.0
14.4
14.4
18.0
4-C 2.0
0.8
6.0
16.0
18.7
6.0
16.0
18.7
8.2
8.0
2.5
2.0
0.35
2.3
1.5
0.709
0.567
0.567
0.709
4-C 0.079
0.031
0.236
0.63
0.736
0.236
0.63
0.736
0.323
0.315
0.098
0.079
0.014
0.091
0.059
φ
φ
Based on EV-9200GC-80
(1) Package drawing (in mm)
φ
φ
APPENDIX A DEVELOPMENT TOOLS
308 User’s Manual U13952EJ3V1UD
Figure A-3. Recommended Footprint of EV-9200GC-80 (for Reference)
A
F
D
E
C
B
G
J
K
L
HI
0.026
×
0.748=0.486
0.026
×
0.748=0.486
EV-9200GC-80-P1E
ITEM MILLIMETERS INCHES
A
B
C
D
E
F
G
H
I
J
K
L
19.7
15.0
15.0
19.7
6.0±0.05
6.0±0.05
0.35±0.02
2.36±0.03
2.3
1.57±0.03
0.776
0.591
0.591
0.776
0.236
0.236
0.014
0.093
0.091
0.062
0.65±0.02 × 19=12.35±0.05
0.65±0.02 × 19=12.35±0.05
φ
φ
+0.001
–0.002 +0.003
–0.002
+0.001
–0.002 +0.003
–0.002
+0.003
–0.002
+0.003
–0.002
+0.001
–0.001
+0.001
–0.002
φ
+0.001
–0.002
φ
φ
Based on EV-9200GC-80
(2) Pad drawing (in mm)
Dimensions of mount pad for EV-9200 and that for
target device (QFP) may be different in some parts.
For the recommended mount pad dimensions for
QFP, refer to "Semiconductor Device Mount Manual"
(http://www.necel.com/pkg/en/mount/index.html).
Caution
φ
APPENDIX A DEVELOPMENT TOOLS
User’s Manual U13952EJ3V1UD 309
A.7.2 Package drawing of conversion adapter (TGK-080SDW)
Figure A-4. Package Drawing of TGK-080SDW (for Reference)
ITEM MILLIMETERS INCHES
b 0.25 0.010
c 5.3 0.209
a
0.5x19=9.5±0.10
0.020x0.748=0.374±0.004
d 5.3 0.209
h 1.85±0.2 0.073±0.008
i 3.5 0.138
j 2.0 0.079
e 1.3 0.051
f 3.55
g 0.3 0.012
0.140
ITEM MILLIMETERS INCHES
B
C
0.5x19=9.5 0.020x0.748=0.374
A 18.0 0.709
D
H
I 1.58 0.062
J 1.2 0.047
E
0.5x19=9.5 0.020x0.748=0.374
F 11.77 0.463
K 7.64 0.301
L 1.2 0.047
M
Q 1.2 0.047
R 1.58 0.062
S 3.55 0.140
N 1.58 0.062
O 1.2
P 7.64 0.301
0.047
W 6.8 0.268
X 8.24 0.324
Y 14.8 0.583
T C 2.0 C 0.079
U 12.31
V 10.17 0.400
0.485
Z 1.4±0.2 0.055±0.008
0.5
1.58
0.020
0.062
G 18.0 0.709
k 3.0 0.118
n 1.4±0.2 0.055±0.008
o 1.4±0.2 0.055±0.008
p
h=1.8 1.3 h=0.071 0.051
l 0.25
m 14.0 0.551
0.010
q 0~5°0.000~0.197°
φφ
11.77
0.5
φ
0.463
0.020
φ
TGK-080SDW-G1E
t 2.4 0.094
u 2.7 0.106
v 3.9 0.154
r 5.9
s 0.8 0.031
0.232
φ
φ
φ
φ
φ
φ
φ
φ
φ
φ
TGK-080SDW (TQPACK080SD + TQSOCKET080SDW)
Package dimension (unit: mm)
EFG P
R
Q
Q
Q
O
O
O
N
IJJJ LLLM
B
C
A
T
H
D
K
S
M2 screw
U
a
V
e
c
d
b
W
X
Y
Z
m
f
r
u
t
v
g
s
k
j
i
h
ln o
p
Protrusion : 4 places
q
note: Product by TOKYO ELETECH CORPORATION.
APPENDIX A DEVELOPMENT TOOLS
310 User’s Manual U13952EJ3V1UD
A.7.3 Package drawing of conversion adapter (TGC-080SBP)
Figure A-5. Package Drawing of TGC-080SBP (for Reference)
ITEM MILLIMETERS INCHES
b 7.35 0.289
c 1.2 0.047
a (16.95) (0.667)
d 1.85 0.073
e 3.5 0.138
f 2.0
g 6.0 0.236
0.079
ITEM MILLIMETERS INCHES
B
0.65x19=12.35 0.026x0.748=0.486
C 0.65 0.026
A 21.0 0.827
D
H
I C 2.0 C 0.079
14.47 0.570
J 14.95 0.589
E 12.75 0.502
F 15.15 0.596
K 13.95 0.549
L 13.7 0.539
M
Q 21.0 0.827
R 5.0 0.197
S
N 1.15 0.045
O 12.62
P 17.52 0.690
0.497
W
X
Y
T
U
V
Z
10.35
1.15
0.407
0.045
G 17.55 0.691
Reference diagram: TGC-080SBP (TQPACK080SB+TQSOCKET080SBP)
Package dimension (unit: mm)
note: Product by TOKYO ELETECH CORPORATION.
1.8 0.071
4-C 1.0 4-C 0.039
7.7 0.303
4- 0.0514- 1.3
φφ
3.55 0.140
φφ
5.3 0.209
φφ
0.3 0.012
φφ
0.9 0.035
φφ
h 0.25 0.010
i 13.95
j 1.025 0.040
0.549
k 1.025 0.040
l 2.4 0.094
m 2.7 0.106
TGC-080SBP-G0E
;
CW
IA
B
J
K
R
U
O
P
Q
H
i
X
Y
Z
m
l
kj
h
d
e
g
b
af
G F L V
M
N
E D
Protrusion height
S
T
c
User’s Manual U13952EJ3V1UD
311
APPENDIX B NOTES ON TARGET SYSTEM DESIGN
Figures B-1 to B-4 show the conditions when connecting the emulation probe to the conversion adapter or
conversion socket. Follow the configuration below and consider the shape of parts to be mounted on the target
system when designing a system.
(1) NP-80GC, NP-80GC-TQ, NP-H80GC-TQ
Figure B-1. Distance Between In-Circuit Emulator and Conversion Socket (80GC)
170 mm
Note
In-circuit emulator
IE-78K0S-NS or IE-78K0S-NS-A
Emulation board
IE-789418-NS-EM1
Conversion socket: EV-9200GC-80 or
Conversion adapter: TGC-080SBP
Target system
CN1
Emulation probe
NP-80GC, NP-80GC-TQ
NP-H80GC-TQ
Note When NP-H80GC-TQ is used, the distance is 370 mm.
Remark NP-80GC, NP-80GC-TQ, and NP-H80GC-TQ are products of Naito Densei Machida Mfg. Co., Ltd.
APPENDIX B NOTES ON TARGET SYSTEM DESIGN
312 User’s Manual U13952EJ3V1UD
Figure B-2. Connection Condition of Target System (NP-80GC-TQ)
Target system
40 mm
23 mm
11 mm
34 mm
Extension probe
NP-80GC-TQ
Emulation board
IE-789418-NS-EM1
Conversion
adapter
TGC-080SBP
Remark NP-80GC-TQ is a product of Naito Densei Machida Mfg. Co., Ltd.
TGC-080SBP is a product of TOKYO ELETECH CORPORATION.
APPENDIX B NOTES ON TARGET SYSTEM DESIGN
User’s Manual U13952EJ3V1UD 313
(2) NP-80GK, NP-H80GK-TQ
Figure B-3. Distance Between In-Circuit Emulator and Conversion Adapter (80GK)
170 mm
Note
In-circuit emulator
IE-78K0S-NS or IE-78K0S-NS-A
Emulation board
IE-789418-NS-EM1
Conversion adapter
TGK-080SDW
Target system
CN1
Emulation probe
NP-80GK, NP-H80GK-TQ
Note When NP-H80GK-TQ is used, the distance is 370 mm.
Remark NP-80GK and NP-H80GK-TQ are products of Naito Densei Machida Mfg. Co., Ltd.
TGK-080SDW is a product of TOKYO ELETECH CORPORATION.
APPENDIX B NOTES ON TARGET SYSTEM DESIGN
314 User’s Manual U13952EJ3V1UD
Figure B-4. Connection Condition of Target System (NP-80GK)
Target system
40 mm
23 mm
11 mm
34 mm
Extension probe
NP-80GK
Emulation board
IE-789418-NS-EM1
Conversion
adapter
TGK-080SDW
Remark NP-80GK is a product of Naito Densei Machida Mfg. Co., Ltd.
TGK-080SDW is a product of TOKYO ELETECH CORPORATION.
User’s Manual U13952EJ3V1UD
315
APPENDIX C REGISTER INDEX
C.1 Register Index (Alphabetic Order of Register Name)
[A]
A/D conversion result register 0 (ADCR0).................................................................................................... 141, 154
A/D converter mode register 0 (ADM0) ........................................................................................................ 143, 156
A/D input selection register 0 (ADS0)........................................................................................................... 144, 157
Asynchronous serial interface mode register 00 (ASIM00)........................................................... 177, 184, 186, 199
Asynchronous serial interface status register 00 (ASIS00)........................................................................... 179, 187
[B]
Baud rate generator control register 00 (BRGC00) .............................................................................. 180, 188, 200
[C]
Comparator mode register 0 (CMPRM0).............................................................................................................. 168
[E]
8-bit compare register 00 (CR00) ......................................................................................................................... 117
8-bit compare register 01 (CR01) ......................................................................................................................... 117
8-bit compare register 02 (CR02) ......................................................................................................................... 117
8-bit timer counter 00 (TM00)............................................................................................................................... 117
8-bit timer counter 01 (TM01)............................................................................................................................... 117
8-bit timer counter 02 (TM02)............................................................................................................................... 117
8-bit timer mode control register 00 (TMC00).......................................................................................................118
8-bit timer mode control register 01 (TMC01).......................................................................................................119
8-bit timer mode control register 02 (TMC02).......................................................................................................120
External interrupt mode register 0 (INTM0) .......................................................................................................... 234
External interrupt mode register 1 (INTM1) .......................................................................................................... 235
[ I ]
Interrupt mask flag register 0 (MK0) ..................................................................................................................... 233
Interrupt mask flag register 1 (MK1) ..................................................................................................................... 233
Interrupt request flag register 0 (IF0).................................................................................................................... 232
Interrupt request flag register 1 (IF1).................................................................................................................... 232
[K]
Key return mode register 00 (KRM00).................................................................................................................. 237
[L]
LCD clock control register 0 (LCDC0) .................................................................................................................. 207
LCD display mode register 0 (LCDM0)................................................................................................................. 205
LCD port selector 0 (LPS0) .................................................................................................................................. 206
APPENDIX C REGISTER INDEX
316 User’s Manual U13952EJ3V1UD
[O]
Oscillation stabilization time selection register (OSTS).........................................................................................245
[P]
Port 0 (P0) ..............................................................................................................................................................72
Port 2 (P2) ..............................................................................................................................................................73
Port 4 (P4) ..............................................................................................................................................................78
Port 5 (P5) ..............................................................................................................................................................80
Port 6 (P6) ..............................................................................................................................................................81
Port 8 (P8) ..............................................................................................................................................................83
Port 9 (P9) ..............................................................................................................................................................84
Port mode register 0 (PM0) ....................................................................................................................................85
Port mode register 2 (PM2) ....................................................................................................................85, 106, 121
Port mode register 4 (PM4) ....................................................................................................................................85
Port mode register 5 (PM5) ....................................................................................................................................85
Port mode register 8 (PM8) ....................................................................................................................................85
Port mode register 9 (PM9) ....................................................................................................................................85
Processor clock control register (PCC)...................................................................................................................91
Pull-up resistor option register 0 (PU0)...................................................................................................................86
Pull-up resistor option register 1 (PU1)...................................................................................................................86
Pull-up resistor option register 2 (PU2)...................................................................................................................86
[R]
Receive buffer register 00 (RXB00)......................................................................................................................175
[S]
Serial operation mode register 00 (CSIM00) ................................................................................ 176, 183, 185, 198
16-bit capture register 50 (TCP50) .......................................................................................................................103
16-bit compare register 50 (CR50) .......................................................................................................................103
16-bit timer counter 50 (TM50) .............................................................................................................................103
16-bit timer mode control register 50 (TMC50) .....................................................................................................104
Subclock control register (CSS)..............................................................................................................................93
Suboscillation mode register (SCKM).....................................................................................................................92
[T]
Timer clock selection register 2 (TCL2) ................................................................................................................136
Transmit shift register 00 (TXS00)........................................................................................................................175
[W]
Watch timer mode control register (WTM)............................................................................................................131
Watchdog timer mode register (WDTM) ...............................................................................................................137
APPENDIX C REGISTER INDEX
User’s Manual U13952EJ3V1UD 317
C.2 Register Index (Alphabetic Order of Register Symbol)
[A]
ADCR0: A/D conversion result register 0 ............................................................................................... 141, 154
ADM0: A/D converter mode register 0 ................................................................................................. 143, 156
ADS0: A/D input selection register 0 ................................................................................................... 144, 157
ASIM00: Asynchronous serial interface mode register 00 ...................................................... 177, 184, 186, 199
ASIS00: Asynchronous serial interface status register 00...................................................................... 179, 187
[B]
BRGC00: Baud rate generator control register 00............................................................................ 180, 188, 200
[C]
CMPRM0: Comparator mode register 0 ............................................................................................................ 168
CR00: 8-bit compare register 00 ................................................................................................................. 117
CR01: 8-bit compare register 01 ................................................................................................................. 117
CR02: 8-bit compare register 02 ................................................................................................................. 117
CR50: 16-bit compare register 50 ............................................................................................................... 103
CSIM00: Serial operation mode register 00 ............................................................................ 176, 183, 185, 198
CSS: Subclock control register.................................................................................................................... 93
[ I ]
IF0: Interrupt request flag register 0 ........................................................................................................ 232
IF1: Interrupt request flag register 1 ........................................................................................................ 232
INTM0: External interrupt mode register 0.................................................................................................... 234
INTM1: External interrupt mode register 1.................................................................................................... 235
[K]
KRM00: Key return mode register 00.............................................................................................................237
[L]
LCDC0: LCD clock control register 0 .............................................................................................................207
LCDM0: LCD display mode register 0 ............................................................................................................ 205
LPS0: LCD port selector 0 .......................................................................................................................... 206
[M]
MK0: Interrupt mask flag register 0 ........................................................................................................... 233
MK1: Interrupt mask flag register 1 ........................................................................................................... 233
[O]
OSTS: Oscillation stabilization time selection register ................................................................................. 245
[P]
P0: Port 0 ................................................................................................................................................. 72
P2: Port 2 ................................................................................................................................................. 73
P4: Port 4 ................................................................................................................................................. 78
P5: Port 5 ................................................................................................................................................. 80
P6: Port 6 ................................................................................................................................................. 81
APPENDIX C REGISTER INDEX
318 User’s Manual U13952EJ3V1UD
P8: Port 8..................................................................................................................................................83
P9: Port 9..................................................................................................................................................84
PCC: Processor clock control register .........................................................................................................91
PM0: Port mode register 0...........................................................................................................................85
PM2: Port mode register 2...........................................................................................................85, 106, 121
PM4: Port mode register 4...........................................................................................................................85
PM5: Port mode register 5...........................................................................................................................85
PM8: Port mode register 8...........................................................................................................................85
PM9: Port mode register 9...........................................................................................................................85
PU0: Pull-up resistor option register 0.........................................................................................................86
PU1: Pull-up resistor option register 1.........................................................................................................86
PU2: Pull-up resistor option register 2.........................................................................................................86
[R]
RXB00: Receive buffer register 00 ................................................................................................................175
[S]
SCKM: Suboscillation mode register ..............................................................................................................92
[T]
TCL2: Timer clock selection register 2........................................................................................................136
TCP50: 16-bit capture register 50 .................................................................................................................103
TM00: 8-bit timer counter 00 .......................................................................................................................117
TM01: 8-bit timer counter 01 .......................................................................................................................117
TM02: 8-bit timer counter 02 .......................................................................................................................117
TM50: 16-bit timer counter 50 .....................................................................................................................103
TMC00: 8-bit timer mode control register 00..................................................................................................118
TMC01: 8-bit timer mode control register 01..................................................................................................119
TMC02: 8-bit timer mode control register 02..................................................................................................120
TMC50: 16-bit timer mode control register 50................................................................................................104
TXS00: Transmit shift register 00..................................................................................................................175
[W]
WDTM: Watchdog timer mode register .........................................................................................................137
WTM: Watch timer mode control register....................................................................................................131
User’s Manual U13952EJ3V1UD
319
APPENDIX D REVISION HISTORY
Here is the revision history of this manual. The “Applied to:” column indicates the chapters of each edition in which
the revision was applied.
(1/2)
Edition Revision from Previous Edition Applied to:
Modification of packages
Deletion of 80-pin plastic TQFP (fine pitch) (GK-BE9 type)
Addition of 80-pin plastic TQFP (fine pitch) (GK-9EU type)
Throughout
Modification of Table 2-1 Types of Pin I/O Circuits CHAPTER 2 PIN FUNCTIONS
Modification of Table 4-3 Port Mode Register and Output Latch Settings When
Using Alternate Functions
CHAPTER 4 PORT
FUNCTIONS
Modification of Caution 2 in 6.2 Configuration of 16-Bit Timer (1) 16-bit compare
register 50 (CR50)
Modification of Figure 6-2 Format of 16-Bit Timer Mode Control Register 50
Addition of Caution in 6.4.1 Operation as timer interrupt
Modification of Figure 6-8 Settings of 16-Bit Timer Mode Control Register 50 for
Capture Operation
CHAPTER 6 16-BIT TIMER
Addition of Caution in 7.4.3 Operation as square-wave output CHAPTER 7 8-BIT TIMER/
EVENT COUNTER
Addition of Caution in 10.4.1 Basic operation of 8-bit A/D converter CHAPTER 10 8-BIT A/D
CONVERTER (
µ
PD789407A
SUBSERIES)
Addition of Caution in 11.4.1 Basic operation of 10-bit A/D converter CHAPTER 11 10-BIT A/D
CONVERTER (
µ
PD789417A
SUBSERIES)
Addition of Caution in Table 18-1 Differences Between
µ
PD78F9418A and Mask
ROM Versions
Modification of Table 18-2 Communication Mode and addition of Note in it
Modification of Figure 18-4 Flashpro III Connection Example in Pseudo 3-Wire
Mode (When P0 Is Used)
Modification of Table 18-4 Example of Settings for PG-FP3
CHAPTER 18
µ
PD78F9418A
Modification of product name of flash memory programming adapter in A.2 Flash
Memory Programming Tools
2nd
Addition of product name of conversion adapter corresponding to each emulation
probe in A.3.1 Hardware
APPENDIX A DEVELOPMENT
TOOLS
Modification of pin handling of AVREF pin and VPP pin CHAPTER 2 PIN FUNCTIONS
Addition of Note related to feedback resistor CHAPTER 5 CLOCK
GENERATOR
Addition of 6.5 Cautions on Using 16-Bit Timer 50 CHAPTER 6 16-BIT TIMER 50
3rd
Addition of (8) Input impedance of ANI0 to ANI6 pins in 10.5 Cautions on Using
8-Bit A/D Converter
CHAPTER 10 8-BIT A/D
CONVERTER (
µ
PD789407A
SUBSERIES)
320 User’s Manual U13952EJ3V1UD
(2/2)
Edition Revision from Previous Edition Applied to:
Modification of description of (2) A/D conversion result register 0 (ADCR0) in
11.2 Configuration of 10-Bit A/D Converter
Addition of (8) Input impedance of ANI0 to ANI6 pins in 11.5 Cautions on Using
10-Bit A/D Converter
CHAPTER 11 10-BIT A/D
CONVERTER (
µ
PD789417A
SUBSERIES)
Addition of description on reading receive data of UART CHAPTER 13 SERIAL
INTERFACE 00
Addition of Caution in Figure 15-2 Format of Interrupt Request Flag Register
Addition of Caution in Figure 15-7 Format of Key Return Mode Register 00
CHAPTER 15 INTERRUPT
FUNCTIONS
Addition of description on pull-up resistor and divider resistor for LCD driving in
Table 18-1 Differences Between
µ
PD78F9418A and Mask ROM Versions
Overall revision of contents related to flash memory programming as 18.1 Flash
Memory Characteristics
CHAPTER 18
µ
PD78F9418A
Addition of electrical specifications CHAPTER 21 ELECTRICAL
SPECIFICATIONS
Addition of characteristics curves (reference values) CHAPTER 22
CHARACTERISTICS CURVES
(REFERENCE VALUES)
Addition of package drawings CHAPTER 23 PACKAGE
DRAWINGS
Addition of recommended soldering conditions CHAPTER 24
RECOMMENDED SOLDERING
CONDITIONS
Overall revision of contents of development tools
Deletion of embedded software
APPENDIX A DEVELOPMENT
TOOLS
3rd
Addition of notes on target system design APPENDIX B NOTES ON
TARGET SYSTEM DESIGN
Modification of 1.3 Ordering Information CHAPTER 1 GENERAL
3rd Edition
(Modification
Version)
Addition of Table 24-1. Surface Mounting Type Soldering Conditions (3/3) CHAPTER 24
RECOMMENDED SOLDERING
CONDITIONS