UPD780031ASGB-XXX-8ET [RENESAS]
8-BIT, MROM, 12MHz, MICROCONTROLLER, PQFP52, 10 X 10 MM, PLASTIC, LQFP-52;型号: | UPD780031ASGB-XXX-8ET |
厂家: | RENESAS TECHNOLOGY CORP |
描述: | 8-BIT, MROM, 12MHz, MICROCONTROLLER, PQFP52, 10 X 10 MM, PLASTIC, LQFP-52 时钟 外围集成电路 |
文件: | 总362页 (文件大小:1740K) |
中文: | 中文翻译 | 下载: | 下载PDF数据表文档文件 |
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.
2.
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.
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.
4.
You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
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.
7.
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.
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.
9.
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.
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
µPD780024AS, 780034AS Subseries
8-Bit Single-Chip Microcontrollers
µPD780021AS µPD780021AS(A)
µPD780022AS µPD780022AS(A)
µPD780023AS µPD780023AS(A)
µPD780024AS µPD780024AS(A)
µPD780031AS µPD780031AS(A)
µPD780032AS µPD780032AS(A)
µPD780033AS µPD780033AS(A)
µPD780034AS µPD780034AS(A)
µPD78F0034BS µPD78F0034BS(A)
Document No. U16035EJ5V0UD00 (5th edition)
Date Published August 2005 N CP(K)
2002
Printed in Japan
[MEMO]
User’s Manual U16035EJ5V0UD
2
NOTES FOR CMOS DEVICES
VOLTAGE APPLICATION WAVEFORM AT INPUT PIN
1
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 VIL (MAX) and VIH (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 VIL (MAX) and
V
IH (MIN).
HANDLING OF UNUSED INPUT PINS
2
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 VDD 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.
3
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.
4
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.
5
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.
6
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.
User’s Manual U16035EJ5V0UD
3
FIP and IEBus 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.
TRON stands for The Realtime Operating system Nucleus.
ITRON is an abbreviation of Industrial TRON.
User’s Manual U16035EJ5V0UD
4
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 November, 2004. 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.
"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.
"Special": 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, life
support systems and medical equipment for life support, etc.
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)
(1)
"NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its
majority-owned subsidiaries.
(2)
"NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as
defined above).
M8E 02. 11-1
User’s Manual U16035EJ5V0UD
5
Regional Information
Some information contained in this document may vary from country to country. Before using any NEC
Electronics product in your application, pIease contact the NEC Electronics office in your country to
obtain a list of authorized representatives and distributors. They will verify:
•
•
•
•
•
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 Hong Kong Ltd.
Hong Kong
Tel: 2886-9318
NEC Electronics America, Inc. (U.S.)
Santa Clara, California
Tel: 408-588-6000
NEC Electronics (Europe) GmbH
Duesseldorf, Germany
Tel: 0211-65030
800-366-9782
•
•
•
NEC Electronics Hong Kong Ltd.
Seoul Branch
Seoul, Korea
Sucursal en España
Madrid, Spain
Tel: 091-504 27 87
Tel: 02-558-3737
Succursale Française
Vélizy-Villacoublay, France
Tel: 01-30-67 58 00
NEC Electronics Shanghai Ltd.
Shanghai, P.R. China
Tel: 021-5888-5400
Filiale Italiana
Milano, Italy
Tel: 02-66 75 41
NEC Electronics Taiwan Ltd.
Taipei, Taiwan
Tel: 02-2719-2377
•
Branch The Netherlands
Eindhoven, TheNetherlands
Tel: 040-2654010
NEC Electronics Singapore Pte. Ltd.
Novena Square, Singapore
Tel: 6253-8311
•
•
Tyskland Filial
Taeby, Sweden
Tel: 08-63 87 200
United Kingdom Branch
Milton Keynes, UK
Tel: 01908-691-133
J05.6
User’s Manual U16035EJ5V0UD
6
INTRODUCTION
Readers
This manual has been prepared for user engineers who understand the functions of the
µPD780024AS, 780034AS Subseries and wish to design and develop application
systems and programs for these devices.
µPD780024AS Subseries: µPD780021AS, 780022AS, 780023AS, 780024AS,
780021AS(A), 780022AS(A), 780023AS(A), 780024AS(A)
µPD780034AS Subseries: µPD780031AS, 780032AS, 780033AS, 780034AS,
78F0034BS, 780031AS(A), 780032AS(A), 780033AS(A),
780034AS(A), 78F0034BS(A)
Purpose
This manual is intended to give users an understanding of the functions described in the
Organization below.
Organization
The µPD780024AS, 780034AS Subseries manual is separated into two parts: this
manual and the instructions edition (common to the 78K/0 Series).
µPD780024AS, 780034AS Subseries
User’s Manual
78K/0 Series
User’s Manual
Instructions
(This Manual)
• Pin functions
• CPU functions
• Internal block functions
• Interrupt
• Instruction set
• Explanation of each instruction
• Other on-chip peripheral functions
• Electrical specifications
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.
•
For readers who use this as an (A) product:
→ Standard products differ from (A) products in their quality grade only. Re-read the
product name as indicated below if your product is an (A) product.
µPD780021AS → µPD780021AS(A)
µPD780022AS → µPD780022AS(A)
µPD780023AS → µPD780023AS(A)
µPD780024AS → µPD780024AS(A)
µPD780031AS → µPD780031AS(A)
To gain a general understanding of functions:
µPD780032AS → µPD780032AS(A)
µPD780033AS → µPD780033AS(A)
µPD780034AS → µPD780034AS(A)
µPD78F0034BS →µPD78F0034BS(A)
•
•
→ Read this manual in the order of the CONTENTS. The mark shows major revised
points.
How to interpret the register format:
→ For a bit number enclosed in angle brackets, the bit name is defined as a reserved
word in the RA78K0, and is defined as an sfr variable using the #pragma sfr directive
in the CC78K0.
•
To check the details of a register when you know the register name.
→ Refer to APPENDIX D REGISTER INDEX.
User’s Manual U16035EJ5V0UD
7
Differences Between µPD780024AS and 780034AS Subseries
The resolution of the A/D converter differ between the µPD780024AS and 780034AS Subseries products.
Subseries
µPD780024AS
µPD780034AS
Item
A/D converter
8-bit resolution
10-bit resolution
Conventions
Data significance:
Higher digits on the left and lower digits on the right
Active low representation: ××× (overscore over pin or signal name)
Note:
Footnote for item marked with Note in the text
Information requiring particular attention
Supplementary information
Caution:
Remark:
Numerical representation: Binary
Decimal
··· ×××× or ××××B
··· ××××
Hexadecimal ··· ××××H
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
µPD780024AS, 780034AS Subseries User’s Manual
Document No.
This manual
U12326E
78K/0 Series Instructions User’s Manual
78K/0 Series Basic (I) Application Note
U12704E
Documents Related to Development Tools (Software) (User’s Manuals)
Document Name
Document No.
U16629E
U14446E
U11789E
U16613E
U14298E
U16768E
U15802E
U16488E
RA78K0 Assembler Package
Operation
Language
Structured Assembly Language
CC78K0 C Compiler
Operation
Language
SM78K Series Ver. 2.52 System Simulator
Operation
External Part User Open Interface Specifications
Operation
ID78K0-NS Ver. 2.52 Integrated Debugger
PM plus Ver. 5.20
U16934E
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 U16035EJ5V0UD
8
Documents Related to Development Tools (Hardware) (User’s Manuals)
Document Name
IE-78K0-NS In-Circuit Emulator
Document No.
U13731E
IE-78K0-NS-A In-Circuit Emulator
U14889E
IE-78K0-NS-PA Performance Board
U16109E
IE-780034-NS-EM1 Emulation Board
U14642E
Documents Related to Flash Memory Programming
Document Name
Document No.
U13502E
PG-FP3 Flash Memory Programmer User’s Manual
PG-FP4 Flash Memory Programmer User’s Manual
U15260E
Other Documents
Document Name
SEMICONDUCTOR SELECTION GUIDE − Products and Packages −
Semiconductor Device Mount Manual
Document No.
X13769X
Note
Quality Grades on NEC Semiconductor Devices
C11531E
C10983E
C11892E
NEC Semiconductor Device Reliability/Quality Control System
Guide to Prevent Damage for Semiconductor Devices by Electrostatic Discharge (ESD)
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.
User’s Manual U16035EJ5V0UD
9
CONTENTS
CHAPTER 1 OUTLINE ....................................................................................................................... 16
1.1 Features ................................................................................................................................. 16
1.2 Applications .......................................................................................................................... 17
1.3 Ordering Information ............................................................................................................ 17
1.4 Quality Grade ........................................................................................................................ 18
1.5 Pin Configuration (Top View)............................................................................................... 19
1.6 78K/0 Series Lineup .............................................................................................................. 21
1.7 Block Diagram ....................................................................................................................... 24
1.8 Outline of Function ............................................................................................................... 25
1.9 Difference Between Standard Grade and Special Grade .................................................. 26
CHAPTER 2 PIN FUNCTION ............................................................................................................ 27
2.1 Pin Function List ................................................................................................................... 27
2.2 Description of Pin Functions ............................................................................................... 30
2.2.1 P00 to P03 (Port 0) .................................................................................................................... 30
2.2.2 P10 to P13 (Port 1) .................................................................................................................... 30
2.2.3 P20 to P25 (Port 2) .................................................................................................................... 30
2.2.4 P34 to P36 (Port 3) .................................................................................................................... 31
2.2.5 P40 to P47 (Port 4) .................................................................................................................... 31
2.2.6 P50 to P57 (Port 5) .................................................................................................................... 32
2.2.7 P70 to P75 (Port 7) .................................................................................................................... 32
2.2.8 AVREF .......................................................................................................................................... 32
2.2.9 AVDD ........................................................................................................................................... 32
2.2.10 AVSS ........................................................................................................................................... 33
2.2.11 RESET ....................................................................................................................................... 33
2.2.12 X1 and X2 .................................................................................................................................. 33
2.2.13 XT1 and XT2 .............................................................................................................................. 33
2.2.14 VDD0 and VDD1 ............................................................................................................................. 33
2.2.15 VSS0 and VSS1 ............................................................................................................................. 33
2.2.16 VPP (flash memory versions only) .............................................................................................. 33
2.2.17 IC (mask ROM version only) ...................................................................................................... 33
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins .................................... 34
CHAPTER 3 CPU ARCHITECTURE ................................................................................................. 36
3.1 Memory Spaces..................................................................................................................... 36
3.1.1 Internal program memory space ................................................................................................ 41
3.1.2 Internal data memory space ...................................................................................................... 42
3.1.3 Special function register (SFR) area .......................................................................................... 42
3.1.4 External memory space ............................................................................................................. 42
3.1.5 Data memory addressing ........................................................................................................... 43
3.2 Processor Registers ............................................................................................................. 48
3.2.1 Control registers ......................................................................................................................... 48
3.2.2 General-purpose registers ......................................................................................................... 52
3.2.3 Special function register (SFR) .................................................................................................. 53
3.3 Instruction Address Addressing ......................................................................................... 56
User’s Manual U16035EJ5V0UD
10
3.3.1 Relative addressing.................................................................................................................... 56
3.3.2 Immediate addressing................................................................................................................ 57
3.3.3 Table indirect addressing ........................................................................................................... 58
3.3.4 Register addressing ................................................................................................................... 58
3.4 Operand Address Addressing ............................................................................................. 59
3.4.1 Implied addressing ..................................................................................................................... 59
3.4.2 Register addressing ................................................................................................................... 60
3.4.3 Direct addressing ....................................................................................................................... 61
3.4.4 Short direct addressing .............................................................................................................. 62
3.4.5 Special function register (SFR) addressing................................................................................ 63
3.4.6 Register indirect addressing....................................................................................................... 64
3.4.7 Based addressing ...................................................................................................................... 65
3.4.8 Based indexed addressing ......................................................................................................... 66
3.4.9 Stack addressing........................................................................................................................ 67
CHAPTER 4 PORT FUNCTIONS ...................................................................................................... 68
4.1 Port Functions ......................................................................................................................... 68
4.2 Configuration of Ports............................................................................................................. 70
4.2.1 Port 0.......................................................................................................................................... 70
4.2.2 Port 1.......................................................................................................................................... 72
4.2.3 Port 2.......................................................................................................................................... 73
4.2.4 Port 3.......................................................................................................................................... 76
4.2.5 Port 4.......................................................................................................................................... 79
4.2.6 Port 5.......................................................................................................................................... 80
4.2.7 Port 7.......................................................................................................................................... 81
4.3 Registers Controlling Port Function ................................................................................... 84
4.4 Operations of Port Function ................................................................................................ 89
4.4.1 Writing to I/O port ....................................................................................................................... 89
4.4.2 Reading from I/O port ................................................................................................................ 89
4.4.3 Operations on I/O port ............................................................................................................... 89
CHAPTER 5 CLOCK GENERATOR ................................................................................................. 90
5.1 Functions of Clock Generator ............................................................................................. 90
5.2 Configuration of Clock Generator ....................................................................................... 90
5.3 Registers Controlling Clock Generator .............................................................................. 92
5.4 System Clock Oscillator ....................................................................................................... 95
5.4.1 Main system clock oscillator....................................................................................................... 95
5.4.2 Subsystem clock oscillator ......................................................................................................... 96
5.4.3 When no subsystem clocks are used......................................................................................... 99
5.5 Operations of Clock Generator............................................................................................ 100
5.5.1 Main system clock operations .................................................................................................... 101
5.5.2 Subsystem clock operations ...................................................................................................... 102
5.6 Changing System Clock and CPU Clock Settings ............................................................. 102
5.6.1 Time required for switchover between system clock and CPU clock ......................................... 102
5.6.2 System clock and CPU clock switching procedure .................................................................... 103
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0.......................................................................... 104
6.1 Functions of 16-Bit Timer/Event Counter 0 ........................................................................ 104
User’s Manual U16035EJ5V0UD
11
6.2 Configuration of 16-Bit Timer/Event Counter 0.................................................................. 105
6.3 Registers Controlling 16-Bit Timer/Event Counter 0 ......................................................... 108
6.4 Operations of 16-Bit Timer/Event Counter 0 ...................................................................... 113
6.4.1 Operation as interval timer ......................................................................................................... 113
6.4.2 Operation as external event counter .......................................................................................... 115
6.4.3 Operation as pulse width measurement..................................................................................... 117
6.4.4 Operation as square-wave output .............................................................................................. 124
6.4.5 Operation as PPG output ........................................................................................................... 125
6.5
Program List ......................................................................................................................... 127
6.5.1 Interval timer .............................................................................................................................. 128
6.5.2 Pulse width measurement by free-running counter and one capture register............................ 129
6.5.3 Two pulse widths measurement by free-running counter ........................................................... 130
6.5.4 Pulse width measurement by restart.......................................................................................... 132
6.5.5 PPG output................................................................................................................................. 133
6.6 Cautions for 16-Bit Timer/Event Counter 0 ........................................................................ 134
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51 ................................................................ 137
7.1 Functions of 8-Bit Timer/Event Counters 50, 51 ................................................................ 137
7.2 Configuration of 8-Bit Timer/Event Counters 50, 51.......................................................... 139
7.3 Registers Controlling 8-Bit Timer/Event Counters 50, 51 ................................................. 140
7.4 Operations of 8-Bit Timer/Event Counters 50, 51 .............................................................. 145
7.4.1 Operation as 8-bit interval timer ................................................................................................. 145
7.4.2 Operation as external event counter .......................................................................................... 148
7.4.3 Operation as square-wave output (8-bit resolution) ................................................................... 149
7.4.4 Operation as 8-bit PWM output .................................................................................................. 150
7.4.5 Operation as interval timer (16-bit)............................................................................................. 154
7.5
Program List ......................................................................................................................... 155
7.5.1 Interval timer (8-bit) .................................................................................................................... 155
7.5.2 External event counter ............................................................................................................... 156
7.5.3 Interval timer (16-bit) .................................................................................................................. 157
7.6 Cautions for 8-Bit Timer/Event Counters 50, 51 ................................................................ 158
CHAPTER 8 WATCH TIMER ............................................................................................................ 159
8.1 Functions of Watch Timer .................................................................................................... 159
8.2 Configuration of Watch Timer ............................................................................................. 160
8.3 Register Controlling Watch Timer ....................................................................................... 161
8.4 Operations of Watch Timer .................................................................................................. 162
8.4.1 Operation as watch timer ........................................................................................................... 162
8.4.2 Operation as interval timer ......................................................................................................... 162
CHAPTER 9 WATCHDOG TIMER .................................................................................................... 164
9.1 Functions of Watchdog Timer ............................................................................................. 164
9.2 Configuration of Watchdog Timer ....................................................................................... 165
9.3 Registers Controlling Watchdog Timer .............................................................................. 165
9.4 Operations of Watchdog Timer ........................................................................................... 167
9.4.1 Operation as watchdog timer ..................................................................................................... 167
9.4.2 Operation as interval timer ......................................................................................................... 168
User’s Manual U16035EJ5V0UD
12
CHAPTER 10 CLOCK OUTPUT/BUZZER OUTPUT CONTROLLER ............................................ 169
10.1 Functions of Clock Output/Buzzer Output Controller ....................................................... 169
10.2 Configuration of Clock Output/Buzzer Output Controller................................................. 170
10.3 Registers Controlling Clock Output/Buzzer Output Controller ........................................ 170
10.4 Operations of Clock Output/Buzzer Output Controller ..................................................... 173
10.4.1 Operation as clock output .......................................................................................................... 173
10.4.2 Operation as buzzer output ........................................................................................................ 173
CHAPTER 11 8-Bit A/D CONVERTER (µPD780024AS SUBSERIES).......................................... 174
11.1 Functions of A/D Converter ................................................................................................. 174
11.2 Configuration of A/D Converter ........................................................................................... 176
11.3 Registers Controlling A/D Converter .................................................................................. 178
11.4 Operations of A/D Converter ............................................................................................... 180
11.4.1 Basic operations of A/D converter.............................................................................................. 180
11.4.2 Input voltage and conversion results .......................................................................................... 183
11.4.3 A/D converter operation mode ................................................................................................... 184
11.5 How to Read A/D Converter Characteristics Table............................................................ 187
11.6 Cautions for A/D Converter.................................................................................................. 190
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)...................................... 196
12.1 Functions of A/D Converter ................................................................................................. 196
12.2 Configuration of A/D Converter ........................................................................................... 198
12.3 Registers Controlling A/D Converter .................................................................................. 200
12.4 Operations of A/D Converter ............................................................................................... 202
12.4.1 Basic operations of A/D converter.............................................................................................. 202
12.4.2 Input voltage and conversion results .......................................................................................... 205
12.4.3 A/D converter operation mode ................................................................................................... 206
12.5 How to Read A/D Converter Characteristics Table............................................................ 209
12.6 Cautions for A/D Converter.................................................................................................. 212
CHAPTER 13 SERIAL INTERFACE UART0 ................................................................................... 218
13.1 Functions of Serial Interface UART0................................................................................... 218
13.2 Configuration of Serial Interface UART0 ............................................................................ 220
13.3 Registers Controlling Serial Interface UART0.................................................................... 222
13.4 Operations of Serial Interface UART0 ................................................................................. 226
13.4.1 Operation stop mode.................................................................................................................. 226
13.4.2 Asynchronous serial interface (UART) mode ............................................................................. 226
13.4.3 Infrared data transfer mode........................................................................................................ 237
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31 ............................................................ 245
14.1 Functions of Serial Interfaces SIO30 and SIO31 ................................................................ 245
14.2 Configuration of Serial Interfaces SIO30 and SIO31 ......................................................... 246
14.3 Registers Controlling Serial Interfaces SIO30 and SIO31 ................................................. 247
14.4 Operations of Serial Interfaces SIO30 and SIO31 .............................................................. 251
14.4.1 Operation stop mode.................................................................................................................. 251
14.4.2 3-wire serial I/O mode ................................................................................................................ 252
User’s Manual U16035EJ5V0UD
13
CHAPTER 15 INTERRUPT FUNCTIONS ......................................................................................... 256
15.1 Interrupt Function Types...................................................................................................... 256
15.2 Interrupt Sources and Configuration .................................................................................. 256
15.3 Registers Controlling Interrupt Function ........................................................................... 260
15.4 Interrupt Servicing Operations ............................................................................................ 266
15.4.1 Non-maskable interrupt request acknowledge operation ........................................................... 266
15.4.2 Maskable interrupt request acknowledge operation................................................................... 269
15.4.3 Software interrupt request acknowledge operation .................................................................... 271
15.4.4 Multiple interrupt servicing ......................................................................................................... 272
15.4.5 Interrupt request hold ................................................................................................................. 275
CHAPTER 16 STANDBY FUNCTION ............................................................................................... 276
16.1 Standby Function and Configuration.................................................................................. 276
16.1.1 Standby function ........................................................................................................................ 276
16.1.2 Standby function control register................................................................................................ 277
16.2 Operations of Standby Function ......................................................................................... 278
16.2.1 HALT mode ................................................................................................................................ 278
16.2.2 STOP mode ............................................................................................................................... 281
CHAPTER 17 RESET FUNCTION .................................................................................................... 284
CHAPTER 18 µPD78F0034BS ........................................................................................................... 288
18.1 Memory Size Switching Register........................................................................................ 289
18.2 Flash Memory Characteristics ............................................................................................ 290
18.2.1 Programming environment ......................................................................................................... 290
18.2.2 Communication mode ................................................................................................................ 291
18.2.3 On-board pin handling................................................................................................................ 294
18.2.4 Connection of adapter for flash writing....................................................................................... 297
CHAPTER 19 INSTRUCTION SET ................................................................................................... 302
19.1 Conventions .......................................................................................................................... 302
19.1.1 Operand identifiers and specification methods .......................................................................... 302
19.1.2 Description of “operation” column .............................................................................................. 303
19.1.3 Description of “flag operation” column........................................................................................ 303
19.2 Operation List........................................................................................................................ 304
19.3 Instructions Listed by Addressing Type ............................................................................ 312
CHAPTER 20 ELECTRICAL SPECIFICATIONS............................................................................... 315
CHAPTER 21 PACKAGE DRAWING ................................................................................................ 338
CHAPTER 22 RECOMMENDED SOLDERING CONDITIONS .......................................................... 339
APPENDIX A DIFFERENCES BETWEEN µPD780024A, 780024AS, 780034A, AND 780034AS
SUBSERIES ................................................................................................................ 341
APPENDIX B DEVELOPMENT TOOLS ........................................................................................... 343
B.1 Software Package ................................................................................................................. 345
User’s Manual U16035EJ5V0UD
14
B.2 Language Processing Software .......................................................................................... 345
B.3 Control Software ................................................................................................................... 346
B.4 Flash Memory Writing Tools ................................................................................................ 347
B.5 Debugging Tools (Hardware) ............................................................................................... 348
B.6 Debugging Tools (Software) ................................................................................................ 349
B.7 Embedded Software ............................................................................................................. 350
APPENDIX C NOTES ON TARGET SYSTEM DESIGN ................................................................ 351
APPENDIX D REGISTER INDEX ...................................................................................................... 353
D.1 Register Name Index ............................................................................................................ 353
D.2 Register Symbol Index ......................................................................................................... 355
APPENDIX E REVISION HISTORY ..................................................................................................... 357
E.1 Major Revisions in This Edition........................................................................................... 357
E.2 Revision History up to Previous Edition ............................................................................ 358
User’s Manual U16035EJ5V0UD
15
CHAPTER 1 OUTLINE
1.1 Features
• Internal memory
Type
Program Memory
(ROM/Flash Memory)
Data Memory
Part Number
(High-Speed RAM)
µPD780021AS, 780031AS 8 KB
µPD780022AS, 780032AS 16 KB
µPD780023AS, 780033AS 24 KB
µPD780024AS, 780034AS 32 KB
512 bytes
1024 bytes
1024 bytes
Note
Note
µPD78F0034BS
32 KB
Note The capacities of internal flash memory and internal high-speed RAM can be changed by means of the
memory size switching register (IMS).
• External memory expansion space: 64 KB
• Minimum instruction execution time changeable from high speed (0.166 µs: @ 12 MHz operation when VDD = 4.5
to 5.5 V with main system clock) to ultra-low speed (122 µs: @ 32.768 kHz operation with subsystem clock)
• Instruction set suited to system control
•
Bit manipulation possible in all address spaces
•
Multiply and divide instructions
• I/O ports: 39
• 8-bit resolution A/D converter: 4 channels (µPD780024AS Subseries only)
• 10-bit resolution A/D converter: 4 channels (µPD780034AS Subseries only)
• Serial interface:
3 channels
3-wire serial I/O mode: 2 channels
UART mode: 1 channel
•
•
• Timer: Five channels
•
•
•
•
16-bit timer/event counter: 1 channel
8-bit timer/event counter: 2 channels
Watch timer:
1 channel
1 channel
Watchdog timer:
• Vectored interrupt sources: 20
• Two types of on-chip clock oscillators (main system clock and subsystem clock)
• Power supply voltage: VDD = 1.8 to 5.5 V
User’s Manual U16035EJ5V0UD
16
CHAPTER 1 OUTLINE
1.2 Applications
µPD780021AS, 780022AS, 780023AS, 780024AS
µPD780031AS, 780032AS, 780033AS, 780034AS, 78F0034BS
Home electric appliances, pagers, AV equipment, car audios, office automation equipment, etc.
µPD780021AS(A), 780022AS(A), 780023AS(A), 780024AS(A)
µPD780031AS(A), 780032AS(A), 780033AS(A), 780034AS(A), 78F0034BS(A)
Control of transportation equipment, gas detection breakers, safety devices, car electric equipment, etc.
1.3 Ordering Information
Part Number
Package
Internal ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Mask ROM
Flash memory
Flash memory
Flash memory
µPD780021ASGB-×××-8ET
µPD780022ASGB-×××-8ET
µPD780023ASGB-×××-8ET
µPD780024ASGB-×××-8ET
µPD780031ASGB-×××-8ET
µPD780032ASGB-×××-8ET
µPD780033ASGB-×××-8ET
µPD780034ASGB-×××-8ET
µPD780021ASGB-×××-8ET-A
µPD780022ASGB-×××-8ET-A
µPD780023ASGB-×××-8ET-A
µPD780024ASGB-×××-8ET-A
µPD780031ASGB-×××-8ET-A
µPD780032ASGB-×××-8ET-A
µPD780033ASGB-×××-8ET-A
µPD780034ASGB-×××-8ET-A
µPD780021ASGB(A)-×××-8ET
µPD780022ASGB(A)-×××-8ET
µPD780023ASGB(A)-×××-8ET
µPD780024ASGB(A)-×××-8ET
µPD780031ASGB(A)-×××-8ET
µPD780032ASGB(A)-×××-8ET
µPD780033ASGB(A)-×××-8ET
µPD780034ASGB(A)-×××-8ET
µPD78F0034BSGB-8ET
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
µPD78F0034BSGB-8ET-A
µPD78F0034BSGB(A)-8ET
Remarks 1. ××× indicates ROM code suffix.
2. Products with -A at the end of the part number are lead-free products.
17
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
1.4 Quality Grade
Part Number
Package
Quality Grades
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Standard
Special
µPD780021ASGB-×××-8ET
µPD780022ASGB-×××-8ET
µPD780023ASGB-×××-8ET
µPD780024ASGB-×××-8ET
µPD780031ASGB-×××-8ET
µPD780032ASGB-×××-8ET
µPD780033ASGB-×××-8ET
µPD780034ASGB-×××-8ET
µPD78F0034BSGB-8ET
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
µPD780021ASGB-×××-8ET-A
µPD780022ASGB-×××-8ET-A
µPD780023ASGB-×××-8ET-A
µPD780024ASGB-×××-8ET-A
µPD780031ASGB-×××-8ET-A
µPD780032ASGB-×××-8ET-A
µPD780033ASGB-×××-8ET-A
µPD780034ASGB-×××-8ET-A
µPD78F0034BSGB-8ET-A
µPD780021ASGB(A)-×××-8ET
µPD780022ASGB(A)-×××-8ET
µPD780023ASGB(A)-×××-8ET
µPD780024ASGB(A)-×××-8ET
µPD780031ASGB(A)-×××-8ET
µPD780032ASGB(A)-×××-8ET
µPD780033ASGB(A)-×××-8ET
µPD780034ASGB(A)-×××-8ET
µPD78F0034BSGB(A)-8ET
Special
Special
Special
Special
Special
Special
Special
Special
Remarks 1. ××× indicates ROM code suffix.
2. Products with -A at the end of the part number are lead-free products.
Please refer to "Quality Grades on NEC Semiconductor Devices" (Document No. C11531E) published by
NEC Electronics Corporation to know the specification of the quality grade on the device and its
recommended applications.
18
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
1.5 Pin Configuration (Top View)
•
52-pin plastic LQFP (10 × 10)
52 51 50 49 48 47 46 45 44 43 42 41 40
P50
P51
1
39
38
37
36
35
34
33
32
31
30
29
28
27
P70/TI00/TO0
P03/INTP3/ADTRG
P02/INTP2
P01/INTP1
P00/INTP0
VSS1
2
P52
3
P53
4
P54
5
P55
6
P56
7
X1
P57
8
X2
VSS0
9
IC (VPP)
XT1
VDD0
10
11
12
13
P34/SI31
P35/SO31
P36/SCK31
XT2
RESET
AVDD
14 15 16 17 18 19 20 21 22 23 24 25 26
Cautions 1. Connect IC (Internally Connected) pin directly to VSS0 or VSS1.
2. Connect AVSS pin to VSS0.
Remarks 1. When these devices are used in applications that require the reduction of noise generated from an
on-chip microcontroller, the implementation of noise measures is recommended, such as supplying
VDD0 and VDD1 independently, connecting VSS0 and VSS1 independently to ground lines, and so on.
2. Pin connection in parentheses is intended for the µPD78F0034BS and 78F0034BS(A).
19
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
ADTRG:
ANI0 to ANI3:
ASCK0:
AVDD:
AD trigger input
Analog input
P70 to P75:
PCL:
Port 7
Programmable clock
Reset
Asynchronous serial clock
Analog power supply
Analog reference voltage
Analog ground
RESET:
RxD0:
Receive data
Serial clock
Serial input
Serial output
AVREF:
AVSS:
SCK30, SCK31:
SI30, SI31:
SO30, SO31:
BUZ:
Buzzer clock
IC:
Internally connected
TI00, TI01, TI50, TI51: Timer input
INTP0 to INTP3: External interrupt input
TO0, TO50, TO51:
TxD0:
Timer output
P00 to P03:
P10 to P13:
P20 to P25:
P34 to P36:
P40 to P47:
P50 to P57:
Port 0
Port 1
Port 2
Port 3
Port 4
Port 5
Transmit data
VDD0, VDD1:
VPP:
Power supply
Programming power supply
Ground
VSS0, VSS1:
X1, X2:
Crystal (main system clock)
Crystal (subsystem clock)
XT1, XT2:
20
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
1.6 78K/0 Series Lineup
The 78K/0 Series product lineup is illustrated below. Part numbers in the boxes indicate subseries names.
Products in mass production
Products under development
Y subseries products are compatible with I2C bus.
Control
µ
EMI-noise reduced version of the PD78078
PD78075B
µ
µ
µ
100-pin
100-pin
100-pin
100-pin
80-pin
µ
PD78054 with timer and enhanced external interface
PD78078
µ
µ
PD78078Y
PD78070A
PD78070AY
µ
ROMless version of the PD78078
µ
µ
PD78078Y with enhanced serial I/O and limited functions
PD780018AY
µ
PD780058
µ
µ
PD78058F
PD78054
µ
PD78054 with enhanced serial I/O
PD780058Y
PD78058FY
PD78054Y
µ
EMI-noise reduced version of theµPD78054
µ
µ
80-pin
PD78018F with UART and D/A converter, and enhanced I/O
PD780024A with expanded RAM
80-pin
µ
µ
µ
µ
µ
PD780065
µ
µ
80-pin
PD780034A with timer and enhanced serial I/O
PD780024A with enhanced A/D converter
PD78018F with enhanced serial I/O
PD780078Y
PD780034AY
PD780024AY
µ
µ
64-pin
64-pin
64-pin
52-pin
52-pin
64-pin
PD780078
PD780034A
µ
µ
µ
µ
PD780024A
PD780034AS
PD780024AS
µ
µ
52-pin version of the PD780034A
52-pin version of the PD780024A
µ
EMI-noise reduced version of the PD78018F
µ
PD78014H
PD78018F
PD78083
µ
µ
µ
PD78018FY
Basic subseries for control
µ
64-pin
On-chip UART, capable of operating at low voltage (1.8 V)
42/44-pin
Inverter control
PD780988
64-pin
On-chip inverter control circuit and UART. EMI-noise reduced.
µ
VFD drive
µ
PD78044F with enhanced I/O and VFD C/D. Display output total: 53
For panel control. On-chip VFD C/D. Display output total: 53
PD78044F with N-ch open-drain I/O. Display output total: 34
Basic subseries for driving VFD. Display output total: 34
100-pin
80-pin
80-pin
80-pin
PD780208
PD780232
PD78044H
PD78044F
µ
µ
µ
µ
µ
LCD drive
78K/0
Series
µ
PD780344 with enhanced A/D converter
µ
PD780354Y
PD780344Y
100-pin
100-pin
120-pin
120-pin
120-pin
100-pin
100-pin
100-pin
PD780354
PD780344
µ
µ
µ
µ
PD780308 with enhanced display function and timer. Segment signal output: 40 pins max.
PD780308 with enhanced display function and timer. Segment signal output: 40 pins max.
µ
PD780338
PD780328
PD780318
µ
µ
µ
µ
µ
PD780308 with enhanced display function and timer. Segment signal output: 32 pins max.
PD780308 with enhanced display function and timer. Segment signal output: 24 pins max.
PD780308Y
PD78064Y
µ
µ
PD78064 with enhanced SIO, and expanded ROM and RAM
PD780308
µ
µ
µ
µ
EMI-noise reduced version of the PD78064
PD78064B
PD78064
Basic subseries for driving LCDs, on-chip UART
µ
Bus interface supported
100-pin
80-pin
µ
µ
PD780948
PD78098B
On-chip CAN controller
µ
PD78054 with IEBusTM controller
80-pin
80-pin
80-pin
64-pin
PD780702Y
PD780703AY
PD780833Y
µ
µ
µ
On-chip IEBus controller
On-chip CAN controller
On-chip controller compliant with J1850 (Class 2)
Specialized for CAN controller function
PD780816
µ
Meter control
PD780958
100-pin
80-pin
µ
For industrial meter control
On-chip automobile meter controller/driver
For automobile meter driver. On-chip CAN controller
PD780852
µ
80-pin
PD780828B
µ
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.
21
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
The major functional differences between the subseries are shown below.
•
Subseries without the suffix Y
VDD
MIN.
Value Expansion
Function
ROM
Timer
8-Bit 10-Bit 8-Bit
Serial Interface
I/O
External
Subseries Name
Capacity 8-Bit 16-Bit Watch WDT A/D A/D D/A
Control µPD78075B 32 KB to 40 KB 4 ch 1 ch 1 ch 1 ch 8 ch
µPD78078 48 KB to 60 KB
–
2 ch 3 ch (UART: 1 ch)
88 1.8 V Yes
µPD78070A
–
61 2.7 V
µPD780058 24 KB to 60 KB 2 ch
µPD78058F 48 KB to 60 KB
µPD78054 16 KB to 60 KB
µPD780065 40 KB to 48 KB
µPD780078 48 KB to 60 KB
µPD780034A 8 KB to 32 KB
µPD780024A
3 ch (time-division UART: 1 ch) 68 1.8 V
3 ch (UART: 1 ch)
69 2.7 V
2.0 V
–
4 ch (UART: 1 ch)
3 ch (UART: 2 ch)
3 ch (UART: 1 ch)
60 2.7 V
52 1.8 V
51
2 ch
1 ch
–
8 ch
8 ch
–
–
4 ch
–
µPD780034AS
39
53
33
–
Yes
–
µPD780024AS
4 ch
8 ch
µPD78014H
2 ch
µPD78018F 8 KB to 60 KB
µPD78083 8 KB to 16 KB
–
–
–
1 ch (UART: 1 ch)
3 ch (UART: 2 ch)
Inverter µPD780988 16 KB to 60 KB 3 ch Note
1 ch
–
8 ch
–
–
47 4.0 V Yes
control
VFD
drive
µPD780208 32 KB to 60 KB 2 ch 1 ch 1 ch 1 ch 8 ch
–
2 ch
74 2.7 V
40 4.5 V
68 2.7 V
–
–
µPD780232 16 KB to 24 KB 3 ch
–
–
4 ch
8 ch
µPD78044H 32 KB to 48 KB 2 ch 1 ch 1 ch
µPD78044F 16 KB to 40 KB
1 ch
2 ch
LCD
drive
µPD780354 24 KB to 60 KB 4 ch 1 ch 1 ch 1 ch
µPD780344
–
8 ch
–
8 ch
–
3 ch (UART: 1 ch)
66 1.8 V
–
µPD780338 48 KB to 60 KB 3 ch 2 ch
µPD780328
10 ch 1 ch 2 ch (UART: 1 ch)
54
62
70
µPD780318
µPD780308 48 KB to 60 KB 2 ch 1 ch
µPD78064B 32 KB
8 ch
–
–
–
3 ch (time-division UART: 1 ch) 57 2.0 V
2 ch (UART: 1 ch)
µPD78064 16 KB to 32 KB
Bus
µPD780948 60 KB
2 ch 2 ch 1 ch 1 ch 8 ch
1 ch
–
2 ch
–
3 ch (UART: 1 ch)
79 4.0 V Yes
interface µPD78098B 40 KB to 60 KB
supported µPD780816 32 KB to 60 KB
69 2.7 V
46 4.0 V
69 2.2 V
56 4.0 V
59
–
2 ch
12 ch
2 ch (UART: 1 ch)
2 ch (UART: 1 ch)
3 ch (UART: 1 ch)
Meter control µPD780958 48 KB to 60 KB 4 ch 2 ch
–
1 ch
–
–
–
–
–
–
Dashboard µPD780852 32 KB to 40 KB 3 ch 1 ch 1 ch 1 ch 5 ch
–
control
µPD780828B 32 KB to 60 KB
Note 16-bit timer: 2 channels
10-bit timer: 1 channel
22
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
•
Subseries with the suffix Y
Function
ROM
Timer
8-Bit 10-Bit 8-Bit
Serial Interface
I/O
VDD
External
Subseries Name
Control µPD78078Y
µPD78070AY
Capacity 8-Bit 16-Bit Watch WDT A/D A/D D/A
MIN. Value Expansion
48 KB to 60 KB 4 ch 1 ch 1 ch 1 ch 8 ch
–
2 ch 3 ch (UART: 1 ch,
88 1.8 V
61 2.7 V
88
Yes
2
I C: 1 ch)
–
2
µPD780018AY 48 KB to 60 KB
–
3 ch (I C: 1 ch)
µPD780058Y
24 KB to 60 KB 2 ch
2 ch 3 ch (time division
68 1.8 V
2
UART: 1 ch, I C: 1 ch)
µPD78058FY
µPD78054Y
µPD780078Y
48 KB to 60 KB
16 KB to 60 KB
3 ch (UART: 1 ch,
69 2.7 V
2.0 V
2
I C: 1 ch)
48 KB to 60 KB
2 ch
1 ch
–
8 ch
–
–
4 ch (UART: 2 ch,
52 1.8 V
2
I C: 1 ch)
µPD780034AY 8 KB to 32 KB
µPD780024AY
3 ch (UART: 1 ch,
51
2
I C: 1 ch)
8 ch
–
2
µPD78018FY
µPD780354Y
µPD780344Y
µPD780308Y
8 KB to 60 KB
2 ch (I C: 1 ch)
53
LCD
drive
24 KB to 32 KB 4 ch 1 ch 1 ch 1 ch
–
8 ch
4 ch (UART: 1 ch,
66 1.8 V
–
2
8 ch
–
I C: 1 ch)
48 KB to 60 KB 2 ch
16 KB to 32 KB
3 ch (time division
57 2.0 V
2
UART: 1 ch, I C: 1 ch)
µPD78064Y
2 ch (UART: 1 ch,
2
I C: 1 ch)
For bus µPD780702Y 60 KB
3 ch 2 ch 1 ch 1 ch 16 ch
–
–
4 ch (UART: 1 ch,
67 3.5 V
65 4.5 V
–
2
interface
I C: 1 ch)
µPD780703AY 59.5 KB
µPD780833Y 60 KB
Remark The functions of the subseries without the suffix Y and the subseries with the suffix Y are the same, except
for the serial interface (if a subseries without the suffix Y is available).
23
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
1.7 Block Diagram
TI00/TO0/P70
TI01/P71
16-bit timer/
event counter 0
4
4
6
3
8
8
6
Port 0
Port 1
Port 2
Port 3
Port 4
Port 5
Port 7
P00 to P03
P10 to P13
P20 to P25
P34 to P36
P40 to P47
P50 to P57
P70 to P75
8-bit timer/
event counter 50
TI50/TO50/P72
TI51/TO51/P73
8-bit timer/
event counter 51
Watchdog timer
Watch timer
ROM
78K/0
(flash
CPU core
memory)
SI30/P20
SO30/P21
SCK30/P22
Serial
interface SIO30
SI31/P34
SO31/P35
SCK31/P36
Serial
interface SIO31
RESET
X1
RAM
RxD0/P23
TxD0/P24
UART0
System control
X2
ASCK0/P25
XT1
XT2
ANI0/P10 to
4
ANI3/P13
AVDD
AVSS
A/D converter
AVREF
INTP0/P00 to
4
Interrupt control
INTP3/P03
Clock/buzzer
output control
BUZ/P75
PCL/P74
V
DD0
VDD1
VSS0
V
SS1 IC
(VPP
)
Remarks 1. The internal ROM and RAM capacities depend on the product.
2. Pin connection in parentheses is intended for the µPD78F0034BS.
24
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
1.8 Outline of Function
Part Number µPD780021AS µPD780022AS µPD780023AS µPD780024AS µPD78F0034BS
µPD780031AS µPD780032AS µPD780033AS µPD780034AS
Item
Note
Internal memory
ROM
8 KB
16 KB
24 KB
32 KB
32 KB
(Mask ROM)
(Mask ROM)
(Mask ROM)
(Mask ROM)
(Flash memory)
Note
High-speed RAM
512 bytes
64 KB
1024 bytes
1024 bytes
Memory space
General-purpose register
8 bits × 32 registers (8 bits × 8 registers × 4 banks)
Minimum instruction
execution time
Minimum instruction execution time changeable function
When main system
0.166
µs/0.333 µs/0.666 µs/1.33 µs/2.66 µs
clock selected
(@ 12 MHz operation when VDD = 4.5 to 5.5 V)
When subsystem
clock selected
122 s (@ 32.768 kHz operation)
µ
Instruction set
• 16-bit operation
• Multiply/divide (8 bits × 8 bits, 16 bits ÷ 8 bits)
• Bit manipulate (set, reset, test, and Boolean operation)
• BCD adjust, etc.
I/O port
Total:
39
4
• CMOS input:
• CMOS I/O:
35
A/D converter
•
•
8-bit resolution × 4 channels (µPD780021AS, 780022AS, 780023AS, 780024AS)
10-bit resolution × 4 channels (µPD780031AS, 780032AS, 780033AS, 780034AS, 78F0034BS)
• Low-voltage operation: AVDD = 1.8 to 5.5 V
Serial interface
Timer
• 3-wire serial I/O mode:
• UART mode:
2 channels
1 channel
• 16-bit timer/event counter: 1 channel
• 8-bit timer/event counter: 2 channels
• Watch timer:
1 channel
1 channel
• Watchdog timer:
Timer output
Clock output
Three outputs (8-bit PWM output enable: 2)
• 93.7 kHz, 187 kHz, 375 kHz, 750 kHz, 1.5 MHz, 3 MHz, 6 MHz, 12 MHz
(12 MHz when VDD = 4.5 to 5.5 V with main system clock)
• 32.768 kHz (32.768 kHz with subsystem clock)
Buzzer output
1.46 kHz, 2.92 kHz, 5.85 kHz, 11.7 kHz
(12 MHz when VDD = 4.5 to 5.5 V with main system clock)
Vectored interrupt
source
Maskable
Internal: 13, External: 5
Internal: 1
Non-maskable
Software
1
Power supply voltage
VDD = 1.8 to 5.5 V
TA = –40 to +85°C
• 52-pin plastic LQFP (10 × 10)
Operating ambient temperature
Package
Note The capacities of internal flash memory and internal high-speed RAM can be changed by means of the
memory size switching register (IMS).
25
User’s Manual U16035EJ5V0UD
CHAPTER 1 OUTLINE
The outline of the timer/event counter is as follows (for details, refer to CHAPTER 6 16-BIT TIMER/EVENT
COUNTER 0, CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51, CHAPTER 8 WATCH TIMER, and CHAPTER
9 WATCHDOG TIMER).
16-Bit Timer/
8-Bit Timer/
Watch Timer
Watchdog Timer
Event Counter
Event Counter
Note 1
Note 2
Operation Interval timer
mode
1 channel
2 channels
1 channel
1 channel
External event counter
√
√
√
–
√
√
√
√
√
–
√
–
√
√
–
–
–
–
–
–
√
–
–
–
–
–
–
√
Function
Timer output
PPG output
PWM output
Pulse width measurement
Square-wave output
Interrupt request
Notes 1. The watch timer can perform both watch timer and interval timer functions at the same time.
2. The watchdog timer can perform either the watchdog timer function or the interval timer function.
1.9 Difference Between Standard Grade and Special Grade
Standard grade: µPD780021AS, 780022AS, 780023AS, 780024AS
µPD780031AS, 780032AS, 780033AS, 780034AS, 78F0034BS
Special grade: µPD780021AS(A), 780022AS(A), 780023AS(A), 780024AS(A)
µPD780031AS(A), 780032AS(A), 780033AS(A), 780034AS(A), 78F0034BS(A)
The standard and the special grades differ only in the quality level.
26
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
2.1 Pin Function List
(1) Port pins
Alternate
Function
Pin Name
P00
I/O
I/O
Function
After Reset
Input
Port 0
INTP0
4-bit I/O port
P01
INTP1
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software
settings.
P02
INTP2
P03
INTP3/ADTRG
ANI0 to ANI3
P10 to P13
Input
I/O
Port 1
Input
Input
4-bit input-only port.
P20
P21
P22
P23
P24
P25
P34
P35
P36
SI30
Port 2
6-bit I/O port
SO30
SCK30
RxD0
TxD0
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software
settings.
ASCK0
SI31
Port 3
I/O
I/O
Input
Input
3-bit I/O port
SO31
SCK31
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software settings.
P40 to P47
Port 4
—
8-bit I/O port
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software settings.
Interrupt request flag (KRIF) is set to 1 by falling edge
detection.
P50 to P57
I/O
I/O
Port 5
Input
Input
—
8-bit I/O port
LEDs can be driven directly.
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software settings.
Port 7
P70
P71
P72
P73
P74
P75
TI00/TO0
TI01
6-bit I/O port
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software
settings.
TI50/TO50
TI51/TO51
PCL
BUZ
27
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
(2) Non-port pins (1/2)
Alternate
Function
Pin Name
I/O
Function
After Reset
Input
INTP0
INTP1
INTP2
INTP3
SI30
Input
External interrupt request input with specifiable valid edges
(rising edge, falling edge, both rising and falling edges)
P00
P01
P02
P03/ADTRG
P20
Input
Output
I/O
Serial interface serial data input
Serial interface serial data output
Serial interface serial clock input/output
Input
Input
Input
SI31
P34
SO30
SO31
SCK30
SCK31
RxD0
TxD0
P21
P35
P22
P36
Input
Output
Input
Asynchronous serial interface serial data input
Asynchronous serial interface serial data output
Asynchronous serial interface serial clock input
Input
Input
Input
Input
P23
P24
ASCK0
TI00
P25
Input
External count clock input to 16-bit timer/event counter 0
Capture trigger input to 16-bit timer/event counter 0 capture
register (CR00, CR01)
P70/TO0
TI01
Capture trigger input to 16-bit timer/event counter 0
capture register (CR00)
P71
TI50
TI51
TO0
TO50
External count clock input to 8-bit timer/event counter 50
External count clock input to 8-bit timer/event counter 51
16-bit timer/event counter 0 output
P72/TO50
P73/TO51
P70/TI00
P72/TI50
Output
Output
Input
Input
8-bit timer/event counter 50 output
(also used for 8-bit PWM output)
TO51
PCL
8-bit timer/event counter 51 output
(also used for 8-bit PWM output)
P73/TI51
P74
Clock output (for main system clock and subsystem clock
trimming)
Input
BUZ
Output
Input
Input
Input
—
Buzzer output
Input
Input
Input
Input
—
P75
ANI0 to ANI3
ADTRG
AVREF
AVDD
AVSS
A/D converter analog input
P10 to P13
A/D converter trigger signal input
A/D converter reference voltage input
A/D converter analog power supply. Connect to VDD0 or VDD1
A/D converter ground potential. Connect to VSS0 or VSS1.
System reset input
P03/INTP3
—
—
—
—
—
—
—
—
—
—
.
—
—
RESET
X1
Input
Input
—
Input
—
Crystal/ceramic connection for main system clock oscillation
X2
—
XT1
Input
—
Crystal connection for subsystem clock oscillation
—
XT2
—
VDD0
—
Positive power supply for ports
—
VDD1
—
Positive power supply other than ports
—
28
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
(2) Non-port pins (2/2)
Alternate
Function
Pin Name
I/O
Function
After Reset
VSS0
—
—
—
—
Ground potential for ports
—
—
—
—
—
—
—
—
VSS1
IC
Ground potential other than ports
Internally connected. Connect directly to VSS0 or VSS1.
High-voltage application for program write/verify.
VPP
29
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
2.2 Description of Pin Functions
2.2.1 P00 to P03 (Port 0)
These are 4-bit I/O ports. Besides serving as I/O ports, they function as an external interrupt input, and A/D
converter external trigger input.
The following operating modes can be specified in 1-bit units.
(1) Port mode
These ports function as 4-bit I/O ports.
P00 to P03 can be specified as input or output ports in 1-bit units with port mode register 0 (PM0). On-chip pull-
up resistors can be used by setting pull-up resistor option register 0 (PU0).
(2) Control mode
These ports function as an external interrupt request input, and A/D converter external trigger input.
(a) INTP0 to INTP3
INTP0 to INTP3 are external interrupt request input pins which can specify valid edges (rising edge, falling
edge, and both rising and falling edges).
(b) ADTRG
A/D converter external trigger input pin.
Caution
When P03 is used as an A/D converter external trigger input, specify the valid edge by
bits 1, 2 (EGA00, EGA01) of A/D converter mode register (ADM0) and set interrupt mask
flag (PMK3) to 1.
2.2.2 P10 to P13 (Port 1)
These are 4-bit input-only ports. Besides serving as input ports, they function as an A/D converter analog input.
The following operating modes can be specified in 1-bit units.
(1) Port mode
These ports function as 4-bit input-only ports.
(2) Control mode
These ports function as A/D converter analog input pins (ANI0 to ANI3).
2.2.3 P20 to P25 (Port 2)
These are 6-bit I/O ports. Besides serving as I/O ports, they function as serial interface data I/O and clock I/O.
The following operating modes can be specified in 1-bit units.
(1) Port mode
These ports function as 6-bit I/O ports. They can be specified as input or output ports in 1-bit units with port mode
register 2 (PM2). On-chip pull-up resistors can be used by setting pull-up resistor option register 2 (PU2).
30
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
(2) Control mode
These ports function as serial interface data I/O and clock I/O.
(a) SI30 and SO30
Serial interface serial data I/O pins.
(b) SCK30
Serial interface serial clock I/O pin.
(c) RXD0 and TXD0
Asynchronous serial interface serial data I/O pins.
(d) ASCK0
Asynchronous serial interface serial clock input pin.
2.2.4 P34 to P36 (Port 3)
These are 3-bit I/O ports. Besides serving as I/O ports, they function as serial interface data I/O and clock I/O.
The following operating modes can be specified in 1-bit units.
(1) Port mode
These ports function as 3-bit I/O ports. They can be specified as input or output ports in 1-bit units with port mode
register 3 (PM3). On-chip pull-up resistors can be used by setting pull-up resistor option register 3 (PU3).
(2) Control mode
These ports function as serial interface data I/O and clock I/O.
(a) SI31 and SO31
Serial interface serial data I/O pins.
(b) SCK31
Serial interface serial clock I/O pin.
2.2.5 P40 to P47 (Port 4)
These are 8-bit I/O ports.
The interrupt request flag (KRIF) can be set to 1 by detecting a falling edge.
The following operating mode can be specified in 1-bit units.
Caution
When using the falling edge detection interrupt (INTKR), be sure to set the memory expansion
mode register (MEM) to 01H.
(1) Port mode
These ports function as 8-bit I/O ports. They can be specified as input or output ports in 1-bit units with port mode
register 4 (PM4). On-chip pull-up resistors can be used by setting pull-up resistor option register 4 (PU4).
31
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
2.2.6 P50 to P57 (Port 5)
These are 8-bit I/O ports.
Port 5 can drive LEDs directly.
The following operating modes can be specified in 1-bit units.
(1) Port mode
These ports function as 8-bit I/O ports. They can be specified as input or output ports in 1-bit units with port mode
register 5 (PM5). On-chip pull-up resistors can be used by setting pull-up resistor option register 5 (PU5).
2.2.7 P70 to P75 (Port 7)
These are 6-bit I/O ports. Besides serving as I/O ports, they function as a timer I/O, clock output, and buzzer output.
The following operating modes can be specified in 1-bit units.
(1) Port mode
Port 7 functions as a 6-bit I/O port. They can be specified as an input port or output port in 1-bit units with port
mode register 7 (PM7). On-chip pull-up resistors can be used by setting pull-up resistor option register 7 (PU7).
P70 and P71 are also 16-bit timer/event counter capture trigger signal input pins with a valid edge input.
(2) Control mode
Port 7 functions as timer I/O, clock output, and buzzer output.
(a) TI00
External count clock input pin to 16-bit timer/event counter and capture trigger signal input pin to 16-bit timer/
event counter capture register (CR00, CR01).
(b) TI01
Capture trigger signal input pin to 16-bit timer/event counter capture register (CR00).
(c) TI50 and TI51
External count clock input pins to 8-bit timer/event counter.
(d) TO0, TO50, and TO51
Timer output pins.
(e) PCL
Clock output pin.
(f) BUZ
Buzzer output pin.
2.2.8 AVREF
This is an A/D converter reference voltage input pin. When no A/D converter is used, connect this pin to the VSS0
or VSS1 pin.
2.2.9 AVDD
This is an analog power supply pin of A/D converter. Always use the same potential as that of the VDD0 pin or VDD1
pin even when no A/D converter is used.
32
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
2.2.10 AVSS
This is a ground potential pin of A/D converter. Always use the same potential as that of the VSS0 pin or VSS1 pin
even when no A/D converter is used.
2.2.11 RESET
This is a low-level active system reset input pin.
2.2.12 X1 and X2
Crystal/ceramic resonator connect pins for main system clock oscillation.
For external clock supply, input clock signal to X1 and its inverted signal to X2.
2.2.13 XT1 and XT2
Crystal resonator connect pins for subsystem clock oscillation.
For external clock supply, input the clock signal to XT1 and its inverted signal to XT2.
2.2.14 VDD0 and VDD1
VDD0 is a positive power supply port pin.
VDD1 is a positive power supply pin other than port pin.
2.2.15 VSS0 and VSS1
VSS0 is a ground potential port pin.
VSS1 is a ground potential pin other than port pin.
2.2.16 VPP (flash memory versions only)
High-voltage apply pin for flash memory programming mode setting and program write/verify.
Handle in either of the following ways.
• Independently connect a 10 kΩ pull-down resistor.
• Set the jumper on the board so that this pin is connected directly to the dedicated flash programmer in
programming mode and directly to VSS0 or VSS1 in normal operation mode.
When there is a potential difference between the VPP pin and VSS0 pin or VSS1 pin because the wiring between the
two pins is too long or external noise is input to the VPP pin, the user program may not operate normally.
2.2.17 IC (mask ROM version only)
The IC (Internally Connected) pin is provided to set the test mode to check theµPD780024AS, 780034AS Subseries
at delivery. Connect it directly to the VSS0 or VSS1 pin with the shortest possible wire in the normal operating mode.
When a potential difference is produced between the IC pin and VSS0 pin or VSS1 pin, because the wiring between
those two pins is too long or an external noise is input to the IC pin, the user’s program may not operate normally.
• Connect IC pins to VSS0 pins or VSS1 pins directly.
V
SS0 or VSS1 IC
As short as possible
33
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins
Table 2-1 shows the types of pin I/O circuit and the recommended connections of unused pins.
Refer to Figure 2-1 for the configuration of the I/O circuit of each type.
Table 2-1. Pin I/O Circuit Types
Pin Name
I/O Circuit Type
8-C
I/O
I/O
Recommended Connection of Unused Pins
P00/INTP0 to P02/INTP2
P03/INTP3/ADTRG
Input: Independently connect to VSS0 or VSS1 via a
resistor.
Output: Leave open.
P10/ANI0 to P13/ANI3
P20/SI30
25
Input
I/O
Connect directly to VDD0, VDD1, VSS0, or VSS1.
8-C
5-H
8-C
Input:
Independently connect to VDD0, VDD1, VSS0,
or VSS1 via a resistor.
P21/SO30
Output: Leave open.
P22/SCK30
P23/RxD0
P24/TxD0
5-H
8-C
8-C
5-H
8-C
5-H
P25/ASCK0
P34/SI31
Input:
Independently connect to VDD0, VDD1, VSS0,
or VSS1 via a resistor.
P35/SO31
Output: Leave open.
P36/SCK31
P40 to P47
Input: Independently connect to VDD0 or VDD1 via a
resistor.
Output: Leave open.
P50 to P57
P70/TI00/TO0
P71/TI01
5-H
8-C
Input:
Independently connect to VDD0, VDD1, VSS0,
or VSS1 via a resistor.
Output: Leave open.
P72/TI50/TO50
P73/TI51/TO51
P74/PCL
5-H
P75/BUZ
RESET
2
Input
−
XT1
16
Connect directly to VDD0 or VDD1.
Leave open.
XT2
−
AVDD
−
Connect directly to VDD0 or VDD1.
Connect directly to VSS0 or VSS1.
AVREF
AVSS
IC (for mask ROM version)
VPP
Independently connect a 10 kΩ pull-down resistor
(for flash memory version)
to this pin, or connect directly to VSS0 or VSS1.
34
User’s Manual U16035EJ5V0UD
CHAPTER 2 PIN FUNCTION
Figure 2-1. Pin I/O Circuit List
TYPE 2
TYPE 16
Feedback
cut-off
P-ch
IN
Schmitt-triggered input with hysteresis characteristics
XT1
XT2
TYPE 5-H
TYPE 25
VDD0
Pull-up
enable
P-ch
N-ch
P-ch
Comparator
V
DD0
+
–
Data
P-ch
VSS0
IN
VREF (threshold voltage)
IN/OUT
Output
disable
N-ch
Input
enable
V
SS0
Input
enable
TYPE 8-C
VDD0
Pull-up
enable
P-ch
VDD0
Data
P-ch
IN/OUT
Output
disable
N-ch
VSS0
35
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1 Memory Spaces
µPD780024AS, 780034AS Subseries can access 64 KB memory space respectively.
Figures 3-1 to 3-5 show memory maps.
Caution
In case of the internal memory capacity, the initial value of memory size switching register (IMS)
of all products (µPD780024AS, 780034AS Subseries) is fixed (IMS = CFH). Therefore, set the
following values in the initial settings for each version.
µPD780021AS, 780031AS: 42H
µPD780022AS, 780032AS: 44H
µPD780023AS, 780033AS: C6H
µPD780024AS, 780034AS: C8H
µPD78F0034BS:
Value for mask ROM version
Figure 3-1. Memory Map (µPD780021AS, 780031AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
FF00H
FEFFH
General-purpose
registers
FEE0H
FEDFH
32 × 8 bits
Internal high-speed RAM
512 × 8 bits
FD00H
FCFFH
1FFFH
Program area
CALLF entry area
Program area
Data memory
space
1000H
0FFFH
Reserved
0800H
07FFH
0080H
007FH
2000H
1FFFH
CALLT table area
Vector table area
0040H
003FH
Program
memory
space
Internal ROM
8192 × 8 bits
0000H
0000H
36
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-2. Memory Map (µPD780022AS, 780032AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
FF00H
FEFFH
General-purpose
registers
FEE0H
FEDFH
32 × 8 bits
Internal high-speed RAM
512 × 8 bits
FD00H
FCFFH
3FFFH
Program area
CALLF entry area
Program area
Data memory
space
1000H
0FFFH
Reserved
0800H
07FFH
0080H
007FH
4000H
3FFFH
CALLT table area
Vector table area
0040H
003FH
Program
memory
space
Internal ROM
16384 × 8 bits
0000H
0000H
37
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-3. Memory Map (µPD780023AS, 780033AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
FF00H
FEFFH
General-purpose
registers
FEE0H
FEDFH
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
FB00H
FAFFH
5FFFH
Program area
CALLF entry area
Program area
Data memory
space
1000H
0FFFH
Reserved
0800H
07FFH
0080H
007FH
6000H
5FFFH
CALLT table area
Vector table area
0040H
003FH
Program
memory
space
Internal ROM
24576 × 8 bits
0000H
0000H
38
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-4. Memory Map (µPD780024AS, 780034AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
FF00H
FEFFH
General-purpose
registers
FEE0H
FEDFH
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
FB00H
FAFFH
7FFFH
Program area
CALLF entry area
Program area
Data memory
space
1000H
0FFFH
Reserved
0800H
07FFH
0080H
007FH
8000H
7FFFH
CALLT table area
Vector table area
0040H
003FH
Program
memory
space
Internal ROM
32768 × 8 bits
0000H
0000H
39
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-5. Memory Map (µPD78F0034BS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
FF00H
FEFFH
General-purpose
registers
FEE0H
FEDFH
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
FB00H
FAFFH
7FFFH
Program area
CALLF entry area
Program area
Data memory
space
1000H
0FFFH
Reserved
0800H
07FFH
0080H
007FH
8000H
7FFFH
CALLT table area
Vector table area
Program
memory
space
0040H
003FH
Flash memory
32768 × 8 bits
0000H
0000H
40
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1.1 Internal program memory space
The internal program memory space contains the program and table data. Normally, it is addressed with the
program counter (PC).
The µPD780024AS, 780034AS Subseries products incorporate an on-chip ROM (mask ROM or flash memory),
as listed below.
Table 3-1. Internal ROM Capacity
Part Number
µPD780021AS, 780031AS
µPD780022AS, 780032AS
µPD780023AS, 780033AS
µPD780024AS, 780034AS
µPD78F0034BS
Type
Capacity
Mask ROM
8192 × 8 bits (0000H to 1FFFH)
16384 × 8 bits (0000H to 3FFFH)
24576 × 8 bits (0000H to 5FFFH)
32768 × 8 bits (0000H to 7FFFH)
32768 × 8 bits (0000H to 7FFFH)
Flash memory
The internal program memory space is divided into the following three areas.
(1) Vector table area
The 64-byte area 0000H to 003FH is reserved as a vector table area. The RESET input and program start
addresses for branch upon generation of each interrupt request are stored in the vector table area. Of the 16-
bit address, lower 8 bits are stored at even addresses and higher 8 bits are stored at odd addresses.
Table 3-2. Vector Table
Vector Table Address
0000H
Interrupt Source
RESET input
INTWDT
INTP0
Vector Table Address
0016H
Interrupt Source
INTCSI31
INTWTI
0004H
001AH
0006H
001CH
INTTM00
INTTM01
INTTM50
INTTM51
INTAD0
0008H
INTP1
001EH
000AH
INTP2
0020H
000CH
INTP3
0022H
000EH
INTSER0
INTSR0
0024H
0010H
0026H
INTWT
0012H
INTST0
0028H
INTKR
0014H
INTCSI30
003EH
BRK
(2) CALLT instruction table area
The 64-byte area 0040H to 007FH can store the subroutine entry address of a 1-byte call instruction (CALLT).
(3) CALLF instruction entry area
The area 0800H to 0FFFH can perform a direct subroutine call with a 2-byte call instruction (CALLF).
41
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1.2 Internal data memory space
The µPD780024AS, 780034AS Subseries products incorporate an internal high-speed RAM, as listed below.
Table 3-3. Internal High-Speed RAM Capacity
Part Number
µPD780021AS, 780031AS
Internal High-Speed RAM
512 × 8 bits (FD00H to FEFFH)
µPD780022AS, 780032AS
µPD780023AS, 780033AS
µPD780024AS, 780034AS
µPD78F0034BS
1024 × 8 bits (FB00H to FEFFH)
The 32-byte area FEE0H to FEFFH is allocated four general-purpose register banks composed of eight 8-bit
registers.
This area cannot be used as a program area in which instructions are written and executed.
The internal high-speed RAM can also be used as a stack memory.
3.1.3 Special function register (SFR) area
An on-chip peripheral hardware special function register (SFR) is allocated in the area FF00H to FFFFH (refer to
3.2.3 Special function register (SFR) Table 3-5 Special Function Register List).
Caution Do not access addresses where the SFR is not assigned.
3.1.4 External memory space
The external memory space is accessible with memory expansion mode register (MEM). External memory space
can store program, table data, etc., and allocate peripheral devices.
42
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1.5 Data memory addressing
Addressing refers to the method of specifying the address of the instruction to be executed next or the address
of the register or memory relevant to the execution of instructions.
Several addressing modes are provided for addressing the memory relevant to the execution of instructions for
the µPD780024AS, 780034AS Subseries, based on operability and other considerations. For areas containing data
memory in particular, special addressing methods designed for the functions of special function registers (SFR) and
general-purpose registers are available for use. Correspondence between data memory and addressing is illustrated
in Figures 3-6 to 3-10. For the details of each addressing mode, see 3.4 Operand Address Addressing.
Figure 3-6. Correspondence Between Data Memory and Addressing (µPD780021AS, 780031AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
SFR addressing
FF20H
FF1FH
FF00H
FEFFH
General-purpose registers
Register addressing
32 × 8 bits
Short direct
addressing
FEE0H
FEDFH
Internal high-speed RAM
512 × 8 bits
FE20H
FE1FH
FD00H
FCFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
Based indexed
addressing
2000H
1FFFH
Internal ROM
8192 × 8 bits
0000H
43
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-7. Correspondence Between Data Memory and Addressing (µPD780022AS, 780032AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
SFR addressing
FF20H
FF1FH
FF00H
FEFFH
General-purpose registers
Register addressing
32 × 8 bits
Short direct
addressing
FEE0H
FEDFH
Internal high-speed RAM
512 × 8 bits
FE20H
FE1FH
FD00H
FCFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
Based indexed
addressing
4000H
3FFFH
Internal ROM
16384 × 8 bits
0000H
44
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-8. Correspondence Between Data Memory and Addressing (µPD780023AS, 780033AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
SFR addressing
FF20H
FF1FH
FF00H
FEFFH
General-purpose registers
Register addressing
32 × 8 bits
Short direct
addressing
FEE0H
FEDFH
Internal high-speed RAM
1024 × 8 bits
FE20H
FE1FH
FB00H
FAFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
Based indexed
addressing
6000H
5FFFH
Internal ROM
24576 × 8 bits
0000H
45
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-9. Correspondence Between Data Memory and Addressing (µPD780024AS, 780034AS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
SFR addressing
FF20H
FF1FH
FF00H
FEFFH
General-purpose registers
Register addressing
32 × 8 bits
Short direct
addressing
FEE0H
FEDFH
Internal high-speed RAM
1024 × 8 bits
FE20H
FE1FH
FB00H
FAFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
Based indexed
addressing
8000H
7FFFH
Internal ROM
32768 × 8 bits
0000H
46
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-10. Correspondence Between Data Memory and Addressing (µPD78F0034BS)
FFFFH
Special function
registers (SFRs)
256 × 8 bits
SFR addressing
FF20H
FF1FH
FF00H
FEFFH
General-purpose registers
Register addressing
32 × 8 bits
Short direct
addressing
FEE0H
FEDFH
Internal high-speed RAM
1024 × 8 bits
FE20H
FE1FH
FB00H
FAFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
Based indexed
addressing
8000H
7FFFH
Flash memory
32768 × 8 bits
0000H
47
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2 Processor Registers
The µPD780024AS, 780034AS Subseries products incorporate the following processor registers.
3.2.1 Control registers
The control registers control the program sequence, statuses and stack memory. The control registers consist
of a program counter (PC), a program status word (PSW) and a stack pointer (SP).
(1) Program counter (PC)
The program counter is a 16-bit register which 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 and register contents are set.
RESET input sets the reset vector table values at addresses 0000H and 0001H to the program counter.
Figure 3-11. Format of Program Counter
15
0
PC
PC15 PC14 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.
ProgramstatuswordcontentsareautomaticallystackeduponinterruptrequestgenerationorPUSHPSWinstruction
execution and are automatically reset upon execution of the RETB, RETI and POP PSW instructions.
RESET input sets the PSW to 02H.
Figure 3-12. Format of Program Status Word
7
0
PSW
IE
Z
RBS1
AC
RBS0
0
ISP
CY
(a) Interrupt enable flag (IE)
This flag controls the interrupt request acknowledge operations of the CPU.
When 0, the IE is set to the disable interrupt (DI) state, and only non-maskable interrupt request becomes
acknowledgeable. Other interrupt requests are all disabled.
When 1, the IE is set to the enable interrupt (EI) state and interrupt request acknowledge enable is controlled
with an in-service priority flag (ISP), an interrupt mask flag for various interrupt sources and a priority
specification flag.
The IE is reset (0) upon DI instruction execution or interrupt acknowledgement 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) Register bank select flags (RBS0 and RBS1)
These are 2-bit flags to select one of the four register banks.
In these flags, the 2-bit information which indicates the register bank selected by SEL RBn instruction
execution is stored.
48
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
(d) 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.
(e) In-service priority flag (ISP)
This flag manages the priority of acknowledgeable maskable vectored interrupts. When this flag is 0, low-
level vectored interrupt requests specified with a priority specification flag register (PR0L, PR0H, PR1L) (refer
to 15.3 (3) Priority specification flag registers (PR0L, PR0H, PR1L)) are disabled for acknowledgement.
When it is 1, all interrupts are acknowledgeable. Actual request acknowledgement is controlled with the
interrupt enable flag (IE).
(f) Carry flag (CY)
This flag stores overflow and 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.
(3) Stack pointer (SP)
This is a 16-bit register to hold the start address of the memory stack area. Only the internal high-speed RAM
area can be set as the stack area. The internal high-speed RAM areas of each product are as follows.
Table 3-4. Internal High-Speed RAM Area
Part Number
Internal High-Speed RAM Area
FD00H to FEFFH
µPD780021AS, 780022AS, 780031AS, 780032AS
µPD780023AS, 780024AS, 780033AS, 780034AS,
FB00H to FEFFH
78F0034BS
Figure 3-13. Format of Stack Pointer
15
0
SP
SP15 SP14 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 (reset) from
the stack memory.
Each stack operation saves/resets data as shown in Figures 3-14 and 3-15.
Caution
Since RESET input makes SP contents undefined, be sure to initialize the SP before using the
stack.
49
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-14. Data to Be Saved to Stack Memory
(a) PUSH rp instruction (when SP is FEE0H)
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
Register pair upper
Register pair lower
(b) CALL, CALLF, CALL instructions (when SP is FEE0H)
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
PC15 to PC8
PC7 to PC0
(c) Interrupt, BRK instruction (when SP is FEE0H)
SP
SP
FEE0H
FEE0H
FEDFH
FEDEH
FEDDH
PSW
PC15 to PC8
PC7 to PC0
FEDDH
50
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-15. Data to Be Restored from Stack Memory
(a) POP rp instruction (when SP is FEDEH)
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
Register pair upper
Register pair lower
(b) RET instruction (when SP is FEDEH)
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
PC15 to PC8
PC7 to PC0
(c) RETI, RETB instructions (when SP is FEDDH)
SP
SP
FEE0H
FEE0H
FEDFH
FEDEH
FEDDH
PSW
PC15 to PC8
PC7 to PC0
FEDDH
51
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2.2 General-purpose registers
A general-purpose register is mapped at particular addresses (FEE0H to FEFFH) of the data memory. It consists
of 4 banks, each bank consisting of eight 8-bit registers (X, A, C, B, E, D, L, and H).
Each register can also be used as an 8-bit register. Two 8-bit registers can be used in pairs as a 16-bit register
(AX, BC, DE, and HL).
They can be described in terms of function names (X, A, C, B, E, D, L, H, AX, BC, DE, and HL) and absolute names
(R0 to R7 and RP0 to RP3).
Register banks to be used for instruction execution are set with the CPU control instruction (SEL RBn). Because
of the 4-register bank configuration, an efficient program can be created by switching between a register for normal
processing and a register for interrupts for each bank.
Figure 3-16. Configuration of General-Purpose Register
(a) Absolute name
16-bit processing
8-bit processing
R7
FEFFH
FEF8H
BANK0
BANK1
BANK2
BANK3
RP3
R6
R5
R4
R3
R2
R1
R0
RP2
RP1
RP0
FEF0H
FEE8H
FEE0H
15
0
7
0
(b) Function name
16-bit processing
8-bit processing
H
FEFFH
FEF8H
BANK0
BANK1
BANK2
BANK3
HL
DE
BC
L
D
E
B
C
A
X
FEF0H
FEE8H
AX
FEE0H
15
0
7
0
52
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2.3 Special function register (SFR)
Unlike a general-purpose register, each special function register has special functions.
It is allocated in the FF00H to FFFFH area.
The special function register can be manipulated like the general-purpose register, with the operation, transfer and
bit manipulation instructions. Manipulatable bit units, 1, 8, and 16, depend on the special function register type.
Each manipulation bit unit can be specified as follows.
• 1-bit manipulation
Describe the symbol reserved with assembler for the 1-bit manipulation instruction operand (sfr.bit).
This manipulation can also be specified with an address.
• 8-bit manipulation
Describe the symbol reserved with assembler for the 8-bit manipulation instruction operand (sfr).
This manipulation can also be specified with an address.
• 16-bit manipulation
Describe the symbol reserved with assembler for the 16-bit manipulation instruction operand (sfrp).
When addressing an address, describe an even address.
Table 3-5 gives a list of special function registers. The meaning of items in the table is as follows.
• Symbol
Symbol indicating the address of a special function register. It is a reserved word in the RA78K0, and is defined
as the sfr variable by the #pragma sfr directive in the CC78K0. When using the RA78K0, ID78K0-NS, ID78K0,
or SM78K0, symbols can be written as an instruction operand.
• R/W
Indicates whether the corresponding special function register can be read or written.
R/W: Read/write enable
R:
Read only
W: Write only
• Manipulatable bit units
Indicates the manipulatable bit unit (1, 8, or 16). “–” indicates a bit unit for which manipulation is not possible.
• After reset
Indicates each register status upon RESET input.
53
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Table 3-5. Special Function Register List (1/2)
Manipulatable Bit Unit
1 Bit 8 Bits 16 Bits
Address
Special Function Register (SFR) Name
Port 0
Symbol
R/W
After Reset
FF00H
FF01H
FF02H
FF03H
FF04H
FF05H
FF07H
FF0AH
FF0BH
FF0CH
FF0DH
FF0EH
FF0FH
FF10H
FF11H
FF12H
FF13H
FF16H
FF17H
FF18H
P0
P1
P2
P3
P4
P5
P7
R/W
R
√
√
√
√
—
—
—
—
—
—
—
√
00H
Note 1
00H
Port 1
Port 2
R/W
√
√
Port 3
√
√
Note 2
00H
Port 4
√
√
Port 5
√
√
Port 7
√
√
16-bit timer capture/compare register 00
CR00
CR01
TM0
—
—
Undefined
16-bit timer capture/compare register 01
16-bit timer counter 0
—
—
—
—
√
√
R
R/W
R
0000H
Undefined
00H
8-bit timer compare register 50
8-bit timer compare register 51
8-bit timer counter 50
CR50
CR51
TM5
—
—
—
—
—
—
—
—
—
—
√
√
√
√
√
—
—
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
—
—
√
TM50
TM51
8-bit timer counter 51
A/D conversion result register 0
ADCR0
√
Transmit shift register 0
TXS0
RXB0
SIO30
SIO31
PM0
PM2
PM3
PM4
PM5
PM7
PU0
W
R
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
FFH
Undefined
FFH
Receive buffer register 0
Serial I/O shift register 30
Serial I/O shift register 31
Port mode register 0
FF1AH
FF1BH
FF20H
FF22H
FF23H
FF24H
FF25H
FF27H
FF30H
FF32H
FF33H
FF34H
FF35H
FF37H
FF40H
FF41H
FF42H
R/W
Port mode register 2
√
Port mode register 3
√
Port mode register 4
√
Port mode register 5
√
Port mode register 7
√
Pull-up resistor option register 0
Pull-up resistor option register 2
Pull-up resistor option register 3
Pull-up resistor option register 4
Pull-up resistor option register 5
Pull-up resistor option register 7
Clock output select register
Watch timer operation mode register
Watchdog timer clock select register
√
00H
PU2
√
PU3
√
PU4
√
PU5
√
PU7
√
CKS
WTM
WDCS
√
√
—
Notes 1. Higher 4 bits: Undefined, lower 4 bits: 0H
2. Higher 4 bits: 0H, lower 4 bits: Undefined
54
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
Table 3-5. Special Function Register List (2/2)
Manipulatable Bit Unit
1 Bit 8 Bits 16 Bits
Address
Special Function Register (SFR) Name
Symbol
MEM
R/W
R/W
After Reset
00H
FF47H
FF48H
FF49H
FF60H
FF61H
FF62H
FF63H
FF70H
FF71H
FF78H
FF79H
FF80H
FF81H
FFA0H
FFA1H
FFA2H
FFB0H
FFB8H
FFE0H
FFE1H
FFE2H
FFE4H
FFE5H
FFE6H
FFE8H
FFE9H
FFEAH
FFF0H
FFF9H
FFFAH
FFFBH
Memory expansion mode register
External interrupt rising edge enable register
External interrupt falling edge enable register
16-bit timer mode control register 0
Prescaler mode register 0
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
√
EGP
EGN
√
TMC0
PRM0
CRC0
TOC0
TMC50
TCL50
TMC51
TCL51
ADM0
ADS0
ASIM0
ASIS0
BRGC0
CSIM30
CSIM31
IF0
√
—
√
Capture/compare control register 0
16-bit timer output control register 0
8-bit timer mode control register 50
Timer clock select register 50
√
√
—
√
8-bit timer mode control register 51
Timer clock select register 51
—
√
A/D converter mode register 0
Analog input channel specification register 0
Asynchronous serial interface mode register 0
Asynchronous serial interface status register 0
Baud rate generator control register 0
Serial operation mode register 30
Serial operation mode register 31
Interrupt request flag register 0L
—
√
R
—
—
√
R/W
√
IF0L
IF0H
√
Interrupt request flag register 0H
Interrupt request flag register 1L
√
IF1L
MK0
√
—
Interrupt mask flag register 0L
MK0L
MK0H
√
√
FFH
Interrupt mask flag register 0H
√
Interrupt mask flag register 1L
MK1L
PR0
√
—
Priority level specification flag register 0L
Priority level specification flag register 0H
Priority level specification flag register 1L
Memory size switching register
PR0L
PR0H
√
√
√
PR1L
IMS
√
—
—
—
—
—
Note
—
√
CFH
Watchdog timer mode register
WDTM
OSTS
PCC
00H
04H
Oscillation stabilization time select register
Processor clock control register
—
√
Note Although the initial value is CFH, set the following values in the initial settings for each version.
µPD780021AS, 780031AS: 42H
µPD780022AS, 780032AS: 44H
µPD780023AS, 780033AS: C6H
µPD780024AS, 780034AS: C8H
µPD78F0034BS:
Value for mask ROM version
55
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3 Instruction Address Addressing
An instruction address is determined by program counter (PC) contents and is normally incremented (+1 for each
byte) automatically according to the number of bytes of an instruction to be fetched each time another instruction is
executed. When a branch instruction is executed, the branch destination information is set to the PC and branched
by the following addressing (for details of instructions, refer to 78K/0 Series Instructions User’s Manual (U12326E)).
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.
In other words, relative addressing consists in relative branching from the start address of the following instruction
to the –128 to +127 range.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
15
0
0
PC indicates the start address
of the instruction after the BR instruction.
...
PC
+
15
8
7
6
S
α
jdisp8
15
0
PC
When S = 0, all bits of
When S = 1, all bits of
α
α
are 0.
are 1.
56
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3.2 Immediate addressing
[Function]
Immediate data in the instruction word is transferred to the program counter (PC) and branched.
This function is carried out when the CALL !addr16 or BR !addr16 or CALLF !addr11 instruction is executed.
CALL !addr16 and BR !addr16 instructions can be branched to the entire memory space. The CALLF !addr11
instruction is branched to the 0800H to 0FFFH area.
[Illustration]
In the case of CALL !addr16 and BR !addr16 instructions
7
0
CALL or BR
Low Addr.
High Addr.
15
8 7
0
PC
In the case of CALLF !addr11 instruction
7
6
4
3
0
fa10–8
CALLF
fa7–0
15
11 10
1
8 7
0
PC
0
0
0
0
57
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3.3 Table indirect addressing
[Function]
Table contents (branch destination address) of the particular location to be addressed by bits 1 to 5 of the
immediate data of an operation code are transferred to the program counter (PC) and branched.
This function is carried out when the CALLT [addr5] instruction is executed.
This instruction references the address stored in the memory table from 40H to 7FH, and allows branching to
the entire memory space.
[Illustration]
7
6
1
5
1
0
1
Operation code
1
ta4–0
15
8
0
7
0
6
1
5
1
0
0
Effective address
0
0
0
0
0
0
0
7
Memory (Table)
Low Addr.
0
High Addr.
Effective address+1
15
8
7
0
PC
3.3.4 Register addressing
[Function]
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]
7
0
8
7
7
0
0
rp
A
X
15
PC
58
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4 Operand Address Addressing
The following various methods are available to specify the register and memory (addressing) which undergo
manipulation during instruction execution.
3.4.1 Implied addressing
[Function]
The register which functions as an accumulator (A and AX) in the general-purpose register is automatically
(implicitly) addressed.
Of the µPD780024AS, 780034AS Subseries instruction words, the following instructions employ implied
addressing.
Instruction
MULU
Register to Be Specified by Implied Addressing
A register for multiplicand and AX register for product storage
AX register for dividend and quotient storage
DIVUW
ADJBA/ADJBS
ROR4/ROL4
A register for storage of numeric values which become decimal correction targets
A register for storage of digit data which undergoes digit rotation
[Operand format]
Because implied addressing can be automatically employed with an instruction, no particular operand format is
necessary.
[Description example]
In the case of MULU X
With an 8-bit × 8-bit multiply instruction, the product of A register and X register is stored in AX. In this example,
the A and AX registers are specified by implied addressing.
59
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.2 Register addressing
[Function]
The general-purpose register to be specified is accessed as an operand with the register specify code (Rn and
RPn) of an instruction word in the registered bank specified with the register bank select flag (RBS0 and RBS1).
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 operation code.
[Operand format]
Identifier
Description
X, A, C, B, E, D, L, H
AX, BC, DE, HL
r
rp
‘r’ and ‘rp’ can be described with absolute names (R0 to R7 and RP0 to RP3) as well as function names (X, A,
C, B, E, D, L, H, AX, BC, DE, and HL).
[Description example]
MOV A, C; when selecting C register as r
Operation code
0 1 1 0 0 0 1 0
Register specify code
Register specify code
INCW DE; when selecting DE register pair as rp
Operation code
1 0 0 0 0 1 0 0
60
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.3 Direct addressing
[Function]
The memory to be manipulated is addressed with immediate data in an instruction word becoming an operand
address.
[Operand format]
Identifier
addr16
Description
Label or 16-bit immediate data
[Description example]
MOV A, !0FE00H; when setting !addr16 to FE00H
Operation code
1 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
Opcode
00H
FEH
[Illustration]
7
0
Opcode
addr16 (lower)
addr16 (upper)
Memory
61
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.4 Short direct addressing
[Function]
The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word.
This addressing is applied to the 256-byte space FE20H to FF1FH. An internal RAM and a special function register
(SFR) are mapped at FE20H to FEFFH and FF00H to FF1FH, respectively.
If the SFR area (FF00H to FF1FH) where short direct addressing is applied, ports which are frequently accessed
in a program and a compare register of the timer/event counter and a capture register of the timer/event counter
are mapped 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. Refer to the [Illustration] below.
[Operand format]
Identifier
saddr
Description
Label or immediate data indicating FE20H to FF1FH
Label or immediate data indicating FE20H to FF1FH (even address only)
saddrp
[Description example]
MOV 0FE30H, A; when transferring the value in register A to saddr (FE30H)
Operation code
1 1 1 1 0 0 1 0
0 0 1 1 0 0 0 0
Opcode
30H (saddr-offset)
[Illustration]
7
0
Opcode
saddr-offset
Short direct memory
15
1
8
7
0
Effective address
1
1
1
1
1
1
α
When 8-bit immediate data is 20H to FFH, α = 0
When 8-bit immediate data is 00H to 1FH, α = 1
62
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.5 Special function register (SFR) addressing
[Function]
The 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 SFR
mapped at FF00H to FF1FH can be accessed with short direct addressing.
[Operand format]
Identifier
sfr
Description
Special function register name
16-bit manipulatable special function register name (even address only)
sfrp
[Description example]
MOV PM0, A; when selecting PM0 (FF20H) as sfr
Operation code
1 1 1 1 0 1 1 0
0 0 1 0 0 0 0 0
Opcode
20H (sfr-offset)
[Illustration]
7
0
Opcode
sfr-offset
SFR
15
1
8 7
0
Effective address
1
1
1
1
1
1
1
63
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.6 Register indirect addressing
[Function]
Register pair contents specified with a register pair specify code in an instruction word of the register bank
specified with a register bank select flag (RBS0 and RBS1) serve as an operand address for addressing the
memory to be manipulated. This addressing can be carried out for all the memory spaces.
[Operand format]
Identifier
Description
—
[DE], [HL]
[Description example]
MOV A, [DE]; when selecting [DE] as register pair
Operation code
1 0 0 0 0 1 0 1
[Illustration]
16
8
7
7
0
DE
D
E
The memory address
specified with the
register pair DE
Memory
0
The contents of the memory
addressed are transferred.
7
0
A
64
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.7 Based addressing
[Function]
8-bit immediate data is added as offset data to the contents of the base register, that is, the HL register pair in
an instruction word of the register bank specified with the register bank select flag (RBS0 and RBS1) 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
Operation code
1 0 1 0 1 1 1 0
0 0 0 1 0 0 0 0
[Illustration]
16
8 7
0
HL
H
L
+10
7
0
Memory
The contents of the
addressed memory
is transferred.
7
0
A
65
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.8 Based indexed addressing
[Function]
The B or C register contents specified in an instruction are added to the contents of the base register, that is,
the HL register pair in an instruction word of the register bank specified with the register bank select flag (RBS0
and RBS1) and the sum is used to address the memory. Addition is performed by expanding the B or C register
contents 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 + B], [HL + C]
[Description example]
In the case of MOV A, [HL + B] (selecting the B register)
Operation code 1 0 1 0 1 0 1 1
[Illustration]
16
8 7
0
0
HL
H
L
+
7
B
7
0
Memory
The contents of the
addressed memory
is transferred.
7
0
A
66
User’s Manual U16035EJ5V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.9 Stack addressing
[Function]
The stack area is indirectly addressed with the stack pointer (SP) contents.
This addressing method is automatically employed when the PUSH, POP, subroutine call and return instructions
are executed or the register is saved/reset upon generation of an interrupt request.
Stack addressing enables to address the internal high-speed RAM area only.
[Description example]
In the case of PUSH DE (saving the DE register)
Operation code
1 0 1 1 0 1 0 1
[Illustration]
7
Memory
0
SP
SP
FEE0H
FEE0H
FEDFH
FEDEH
D
E
FEDEH
67
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
4.1 Port Functions
The µPD780024AS, 780034AS Subseries products incorporate four input ports and 35 I/O ports. Figure 4-1 shows
the port configuration. Every port is capable of 1-bit and 8-bit manipulations and can carry out considerably varied
control operations. Besides port functions, the ports can also serve as on-chip hardware I/O pins.
Figure 4-1. Port Types
P50
P00
Port 0
Port 1
P03
P10
Port 5
P57
P70
P13
P20
Port 7
Port 2
P75
P25
P34
P36
P40
Port 3
Port 4
P47
User’s Manual U16035EJ5V0UD
68
CHAPTER 4 PORT FUNCTIONS
Table 4-1. Port Functions
Alternate
Function
Pin Name
P00
Function
Port 0
INTP0
4-bit I/O port.
P01
INTP1
Input/output mode can be specified in 1-bit units.
P02
INTP2
An on-chip pull-up resistor can be used by software settings.
P03
INTP3/ADTRG
ANI0 to ANI3
P10 to P13
Port 1
4-bit input-only port.
P20
P21
P22
P23
P24
P25
P34
P35
P36
Port 2
SI30
6-bit I/O port.
SO30
SCK30
RxD0
TxD0
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software settings.
ASCK0
SI31
Port 3
3-bit I/O port.
SO31
SCK31
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be specified by software settings.
P40 to P47
Port 4
—
8-bit I/O port.
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be specified by software settings.
Interrupt request flag (KRIF) is set to 1 by falling edge detection.
P50 to P57
Port 5
—
8-bit I/O port.
LEDs can be driven directly.
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software settings.
P70
P71
P72
P73
P74
P75
Port 7
TI00/TO0
TI01
6-bit I/O port.
Input/output mode can be specified in 1-bit units.
An on-chip pull-up resistor can be used by software settings.
TI50/TO50
TI51/TO51
PCL
BUZ
User’s Manual U16035EJ5V0UD
69
CHAPTER 4 PORT FUNCTIONS
4.2 Configuration of Ports
A port includes the following hardware.
Table 4-2. Configuration of Ports
Item
Configuration
Control register
Port mode register (PMm: m = 0, 2 to 5, 7)
Pull-up resistor option register (PUm: m = 0, 2 to 5, 7)
Port
Total: 39 ports (4 inputs, 35 inputs/outputs)
Total: 39 (software control)
Pull-up resistor
4.2.1 Port 0
Port 0 is a 4-bit I/O port with output latch. P00 to P03 pins can specify the input mode/output mode in 1-bit units
with the port mode register 0 (PM0). An on-chip pull-up resistor of P00 to P03 pins can be used for them in 1-bit
units with a pull-up resistor option register 0 (PU0).
This port can also be used as an external interrupt request input, and A/D converter external trigger input.
RESET input sets port 0 to input mode.
Figure 4-2 shows a block diagram of port 0.
Cautions 1. Port 0 functions alternately as an external interrupt request input pin. If the output mode of
the port function is specified and the output level of the port is changed while interrupts are
not disabled by the external interrupt rising edge enable register (EGP) and external interrupt
falling edge enable register (EGN), the interrupt request flag is set. Thus, when the output
mode is used, set the interrupt mask flag to 1.
2. When the external interrupt request function is switched to the port function, edge detection
may be performed. Therefore, clear bit n (EGPn) of EGP and bit n (EGNn) of EGN to 0 before
selecting the port mode.
3. When using P03/INTP3/ADTRG as an A/D converter external trigger input, specify valid edges
by setting bits 1 and 2 (EGA00 and EGA01) of A/D converter mode register 0 (ADM0) and set
the interrupt mask flag (PMK3) to 1.
Remark n = 0 to 3
70
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-2. Block Diagram of P00 to P03
V
DD0
WRPU
PU00 to PU03
P-ch
Alternate
function
RD
WRPORT
P00/INTP0 to
P02/INTP2,
P03/INTP3/ADTRG
Output latch
(P00 to P03)
WRPM
PM00 to PM03
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 0 read signal
WR: Port 0 write signal
User’s Manual U16035EJ5V0UD
71
CHAPTER 4 PORT FUNCTIONS
4.2.2 Port 1
Port 1 is a 4-bit input-only port.
This port can also be used as an A/D converter analog input.
Figure 4-3 shows a block diagram of port 1.
Figure 4-3. Block Diagram of P10 to P13
RD
A/D converter
P10/ANI0 to P13/ANI3
RD: Port 1 read signal
Caution When port 1 is used as an input port, the input value can be read using an 8-bit memory
manipulation instruction. However, in this case, do not use the higher 4 bits (P17 to P14)
because they are undefined. Also, do not read the higher 4 bits using a 1-bit memory
manipulation instruction.
72
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.3 Port 2
Port 2 is a 6-bit I/O port with output latch. P20 to P25 pins can specify the input mode/output mode in 1-bit units
with the port mode register 2 (PM2). An on-chip pull-up resistor of P20 to P25 pins can be used for them in 1-bit
units with a pull-up resistor option register 2 (PU2).
This port has also alternate functions as serial interface data I/O and clock I/O.
RESET input sets port 2 to input mode.
Figures 4-4 to 4-6 show block diagrams of port 2.
Figure 4-4. Block Diagram of P20, P23, and P25
VDD0
WRPU
PU20, PU23,
P-ch
PU25
Alternate
function
RD
WRPORT
P20/SI30,
P23/RxD0,
P25/ASCK0
Output latch
(P20, P23, P25)
WRPM
PM20, PM23,
PM25
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
User’s Manual U16035EJ5V0UD
73
CHAPTER 4 PORT FUNCTIONS
Figure 4-5. Block Diagram of P21 and P24
V
DD0
WRPU
PU21, PU24
P-ch
RD
WRPORT
WRPM
Output latch
(P21, P24)
P21/SO30,
P24/TxD0
PM21, PM24
Alternate
function
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
74
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-6. Block Diagram of P22
VDD0
WRPU
PU22
P-ch
Alternate
function
RD
WRPORT
Output latch
(P22)
P22/SCK30
WRPM
PM22
Alternate
function
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 2 read signal
WR: Port 2 write signal
User’s Manual U16035EJ5V0UD
75
CHAPTER 4 PORT FUNCTIONS
4.2.4 Port 3
Port 3 is a 3-bit I/O port with output latch. P34 to P36 pins can specify the input mode/output mode in 1-bit units
with port mode register 3 (PM3). Use of an on-chip pull-up resistor can be specified for the P34 to P36 pins in 1-
bit units by pull-up resistor option register 3 (PU3).
Port 3 can also be used for serial interface data I/O and clock I/O.
RESET input sets port 3 to input mode.
Figures 4-7 to 4-9 show block diagrams of port 3.
Cautions 1. When reading port 3 using an 8-bit memory manipulation instruction, do not use the lower
4 bits (P33 to P30) because they are undefined. When writing port 3 using an 8-bit memory
manipulation instruction, any values can be written to the lower 4 bits. Execution of a 1-bit
memory manipulation instruction for the lower 4 bits is prohibited.
2. Be sure to set the lower 4 bits (PM33 to PM30) of port mode register 3 (PM3) to 1.
Figure 4-7. Block Diagram of P34
V
DD0
WRPU
PU34
P-ch
Alternate
function
RD
WRPORT
Output latch
(P34)
P34/SI31
WRPM
PM34
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 3 read signal
WR: Port 3 write signal
76
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-8. Block Diagram of P35
VDD0
WRPU
PU35
P-ch
RD
WRPORT
Output latch
(P35)
P35/SO31
WRPM
PM35
Alternate
function
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 3 read signal
WR: Port 3 write signal
User’s Manual U16035EJ5V0UD
77
CHAPTER 4 PORT FUNCTIONS
Figure 4-9. Block Diagram of P36
V
DD0
WRPU
PU36
P-ch
Alternate
function
RD
WRPORT
Output latch
(P36)
P36/SCK31
WRPM
PM36
Alternate
function
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 3 read signal
WR: Port 3 write signal
78
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.5 Port 4
Port 4 is an 8-bit I/O port with output latch. The P40 to P47 pins can specify the input mode/output mode in 1-
bit units with port mode register 4 (PM4). An on-chip pull-up resistor of P40 to P47 pins can be used for them in 1-
bit units with pull-up resistor option register 4 (PU4).
The interrupt request flag (KRIF) can be set to 1 by detecting falling edges.
RESET input sets port 4 to input mode.
Figures 4-10 and 4-11 show a block diagram of port 4 and block diagram of the falling edge detector, respectively.
Caution When using the falling edge detection interrupt (INTKR), be sure to set the memory expansion
mode register (MEM) to 01H.
Figure 4-10. Block Diagram of P40 to P47
V
DD0
WRPU
PU40 to PU47
P-ch
RD
Selector
WRPORT
WRPM
Output latch
(P40 to P47)
P40 to P47
PM40 to PM47
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 4 read signal
WR: Port 4 write signal
Figure 4-11. Block Diagram of Falling Edge Detector
P40
P41
P42
P43
P44
P45
P46
P47
Falling edge detector
INTKR
“1” when MEM = 01H
User’s Manual U16035EJ5V0UD
79
CHAPTER 4 PORT FUNCTIONS
4.2.6 Port 5
Port 5 is an 8-bit I/O port with output latch. The P50 to P57 pins can specify the input mode/output mode in 1-
bit units with port mode register 5 (PM5). An on-chip pull-up resistor of P50 to P57 pins can be used for them in 1-
bit units with pull-up resistor option register 5 (PU5).
Port 5 can drive LEDs directly.
RESET input sets port 5 to input mode.
Figure 4-12 shows a block diagram of port 5.
Figure 4-12. Block Diagram of P50 to P57
V
DD0
WRPU
PU50 to PU57
P-ch
RD
Selector
WRPORT
WRPM
Output latch
(P50 to P57)
P50 to P57
PM50 to PM57
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 5 read signal
WR: Port 5 write signal
80
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.7 Port 7
Port 7 is a 6-bit I/O port with output latch. The P70 to P75 pins can specify the input mode/output mode in 1-bit
units with port mode register 7 (PM7). An on-chip pull-up resistor of P70 to P75 pins can be used for them in 1-bit
units with pull-up resistor option register 7 (PU7).
This port can also be used as a timer I/O, clock output, and buzzer output.
RESET input sets port 7 to input mode.
Figures 4-13 to 4-15 show block diagrams of port 7.
Figure 4-13. Block Diagram of P70, P72, and P73
VDD0
WRPU
PU70, PU72, PU73
P-ch
Alternate
function
RD
WRPORT
Output latch
(P70, P72, P73)
P70/TI00/TO0,
P72/TI50/TO50,
P73/TI51/TO51
WRPM
PM70, PM72, PM73
Alternate
function
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 7 read signal
WR: Port 7 write signal
User’s Manual U16035EJ5V0UD
81
CHAPTER 4 PORT FUNCTIONS
Figure 4-14. Block Diagram of P71
VDD0
WRPU
PU71
P-ch
Alternate
function
RD
WRPORT
Output latch
(P71)
P71/TI01
WRPM
PM71
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 7 read signal
WR: Port 7 write signal
82
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-15. Block Diagram of P74 and P75
VDD0
WRPU
PU74, PU75
P-ch
RD
WRPORT
WRPM
Output latch
(P74, P75)
P74/PCL,
P75/BUZ
PM74, PM75
Alternate
function
PU: Pull-up resistor option register
PM: Port mode register
RD: Port 7 read signal
WR: Port 7 write signal
User’s Manual U16035EJ5V0UD
83
CHAPTER 4 PORT FUNCTIONS
4.3 Registers Controlling Port Function
The following two types of registers are used to control the ports.
•
•
Port mode registers (PM0, PM2 to PM5, PM7)
Pull-up resistor option registers (PU0, PU2 to PU5, PU7)
(1) Port mode registers (PM0, PM2 to PM5, PM7)
These registers are used to set port input/output in 1-bit units.
PM0, PM2 to PM5, and PM7 are independently set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets these registers to FFH.
When using a port pin as its alternate-function pin, set the port mode registers and output latches as shown in
Table 4-3.
Cautions 1. Pins P10 to P17 are input-only pins.
2. Port 0 functions alternately as an external interrupt request input pin. If the output mode
of the port function is specified and the output level of the port is changed while interrupts
are not disabled by the external interrupt rising edge enable register (EGP) and external
interrupt falling edge enable register (EGN), the interrupt request flag is set. When the
output mode is used, therefore, the interrupt mask flag should be set to 1 beforehand.
3. If a port has an alternate function pin and it is used as an alternate output function, clear
the corresponding output latches (P0 and P2 to P7) to 0.
84
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-16. Format of Port Mode Register (PM0, PM2 to PM5, PM7)
Address: FF20H After reset: FFH
R/W
Symbol
PM0
7
1
6
1
5
1
4
1
3
2
1
0
PM03
PM02
PM01
PM00
Address: FF22H After reset: FFH
R/W
Symbol
PM2
7
1
6
1
5
4
3
2
1
0
PM25
PM24
PM23
PM22
PM21
PM20
Address: FF23H After reset: FFH
R/W
Symbol
PM3
7
1
6
5
4
3
2
1
0
Note
Note
Note
Note
PM36
PM35
PM34
1
1
1
1
Address: FF24H After reset: FFH
R/W
Symbol
PM4
7
6
5
4
3
2
1
0
PM47
PM46
PM45
PM44
PM43
PM42
PM41
PM40
Address: FF25H After reset: FFH
R/W
Symbol
PM5
7
6
5
4
3
2
1
0
PM57
PM56
PM55
PM54
PM53
PM52
PM51
PM50
Address: FF27H After reset: FFH
R/W
Symbol
PM7
7
1
6
1
5
4
3
2
1
0
PM75
PM74
PM73
PM72
PM71
PM70
PMmn
Pmn pin I/O mode selection (m = 0, 2 to 5, 7; n = 0 to 7)
0
1
Output mode (Output buffer on)
Input mode (Output buffer off)
Note Since the lower 4 bits (PM33 to PM30) of PM3 are not fixed to 1, be sure to set the lower 4 bits to 1 when
setting by an 8-bit memory manipulation instruction.
User’s Manual U16035EJ5V0UD
85
CHAPTER 4 PORT FUNCTIONS
Table 4-3. Port Mode Registers and Output Latch Settings When Alternate Function Is Used
Pin Name
Alternate Function
Name
INTP0 to INTP2
PM××
P××
I/O
P00 to P02
Input
1
1
×
×
×
×
×
0
×
0
×
0
×
×
0
×
0
×
0
×
×
0
×
0
0
0
P03
INTP3
Input
ADTRG
ANI0 to ANI3
SI30
Input
1
P10 to P13
P20
Input
1 (fix)
1
Input
P21
SO30
Output
Input
0
P22
SCK30
1
Output
Input
0
P23
P24
P25
P34
P35
P36
RxD0
TxD0
1
Output
Input
0
ASCK0
SI31
1
Input
1
SO31
SCK31
Output
Input
0
1
Output
Input
0
P70
TI00
TO0
TI01
TI50
TO50
TI51
TO51
PCL
BUZ
1
Output
Input
0
P71
P72
1
Input
1
Output
Input
0
P73
1
Output
Output
Output
0
P74
P75
0
0
Remark ×:
Don’t care
PM××: Port mode register
P××: Port output latch
86
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
(2) Pull-up resistor option registers (PU0, PU2 to PU5, PU7)
These registers are used to set whether to use an on-chip pull-up resistor at each port or not. By setting PU0,
PU2 to PU5, and PU7, the on-chip pull-up resistors of the port pins corresponding to the bits in PU0, PU2 to PU5,
and PU7 can be used.
PU0, PU2 to PU5, and PU7 are independently set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears these registers to 00H.
Cautions 1. The P10 to P13 pins do not incorporate a pull-up resistor.
2. When PUm is set to 1, the on-chip pull-up resistor is connected irrespective of the input/
output mode. When using in output mode, therefore, set the bit of PUm to 0 (m = 0, 2 to
5, 7).
User’s Manual U16035EJ5V0UD
87
CHAPTER 4 PORT FUNCTIONS
Figure 4-17. Format of Pull-up Resistor Option Register (PU0, PU2 to PU5, PU7)
Address: FF30H After reset: 00H
R/W
Symbol
PU0
7
0
6
0
5
0
4
0
3
2
1
0
PU03
PU02
PU01
PU00
Address: FF32H After reset: 00H
R/W
Symbol
PU2
7
0
6
0
5
4
3
2
1
0
PU25
PU24
PU23
PU22
PU21
PU20
Address: FF33H After reset: 00H
R/W
Symbol
PU3
7
0
6
5
4
3
0
2
0
1
0
0
0
PU36
PU35
PU34
Address: FF34H After reset: 00H
R/W
Symbol
PU4
7
6
5
4
3
2
1
0
PU47
PU46
PU45
PU44
PU43
PU42
PU41
PU40
Address: FF35H After reset: 00H
R/W
Symbol
PU5
7
6
5
4
3
2
1
0
PU57
PU56
PU55
PU54
PU53
PU52
PU51
PU50
Address: FF37H After reset: 00H
R/W
Symbol
PU7
7
0
6
0
5
4
3
2
1
0
PU75
PU74
PU73
PU72
PU71
PU70
PUmn
Pmn pin on-chip pull-up resistor selection (m = 0, 2 to 5, 7; n = 0 to 7)
0
1
On-chip pull-up resistor not used
On-chip pull-up resistor used
88
User’s Manual U16035EJ5V0UD
CHAPTER 4 PORT FUNCTIONS
4.4 Operations of Port Function
Port operations differ depending on whether the input or output mode is set, as shown below.
Caution
In the case of 1-bit memory manipulation instruction, although a single bit is manipulated, the
port is accessed as an 8-bit unit. Therefore, on a port with a mixture of input and output pins,
the output latch contents for pins specified as input are undefined, even for bits other than
the manipulated bit.
4.4.1 Writing to I/O port
(1) Output mode
A value is written to the output latch by a transfer instruction, and the output latch contents are output from the
pin.
Once data is written to the output latch, it is retained until data is written to the output latch again.
The output latch data is cleared by reset.
(2) Input mode
A value is written to the output latch by a transfer instruction, but since the output buffer is OFF, the pin status
does not change.
Once data is written to the output latch, it is retained until data is written to the output latch again.
4.4.2 Reading from I/O port
(1) Output mode
The output latch contents are read by a transfer instruction. The output latch contents do not change.
(2) Input mode
The pin status is read by a transfer instruction. The output latch contents do not change.
4.4.3 Operations on I/O port
(1) Output mode
An operation is performed on the output latch contents, and the result is written to the output latch. The output
latch contents are output from the pins.
Once data is written to the output latch, it is retained until data is written to the output latch again.
The output latch data is cleared by reset.
(2) Input mode
The output latch contents are undefined, but since the output buffer is OFF, the pin status does not change.
User’s Manual U16035EJ5V0UD
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 available.
(1) Main system clock oscillator
This circuit oscillates a clock with a frequency of 1 to 12 MHz. Oscillation can be stopped by executing the STOP
instruction or setting the processor clock control register (PCC).
(2) Subsystem clock oscillator
The circuit oscillates a clock with a frequency of 32.768 kHz. Oscillation cannot be stopped. If the subsystem
clock oscillator is not used, the internal feedback resistor can be disabled by the processor clock control register
(PCC). This enables to reduce the power consumption in the STOP mode.
5.2 Configuration of Clock Generator
The clock generator includes the following hardware.
Table 5-1. Configuration of Clock Generator
Item
Configuration
Control registers Processor clock control register (PCC)
Oscillation stabilization time select register (OSTS)
Oscillators
Main system clock oscillator
Subsystem clock oscillator
Controllers
Prescaler
Standby controller
Wait controller
90
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
Figure 5-1. Block Diagram of Clock Generator
Internal bus
Oscillation stabilization
time select register (OSTS)
FRC
OSTS2 OSTS1 OSTS0
Subsystem
clock
oscillator
XT1
XT2
fXT
Watch timer,
clock output
function
Prescaler
1/2
Clock to
Main system
clock
oscillator
peripheral
hardware
X1
X2
f
2
XT
Prescaler
fX
f
2
X
f
X
f
X
f
X
3
22 23 24
Standby
controller
Wait
controller
CPU clock
(fCPU
)
HALT
3
STOP
MCC FRC CLS CSS PCC2 PCC1 PCC0
Processor clock control register
(PCC)
Internal bus
User’s Manual U16035EJ5V0UD
91
CHAPTER 5 CLOCK GENERATOR
5.3 Registers Controlling Clock Generator
The clock generator is controlled by the following two registers.
• Processor clock control register (PCC)
• Oscillation stabilization time select register (OSTS)
(1) Processor clock control register (PCC)
This register selects the CPU clock and the division ratio, sets main system clock oscillator operation/stop and
sets whether to use the subsystem clock oscillator internal feedback resistorNote
PCC is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets the value of PCC to 04H.
.
Note The feedback resistor is required to control the bias point of the oscillation waveform so that the bias point
is in the middle of the power supply voltage.
When the subsystem clock is not used, the power consumption in the STOP mode can be reduced by setting
bit 6 (FRC) of PCC to 1 (see Figure 5-7 Subsystem Clock Feedback Resistor).
92
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
Figure 5-2. Format of Processor Clock Control Register (PCC)
Note 1
Address: FFFBH After reset: 04H
R/W
Symbol
PCC
<7>
<6>
<5>
CLS
<4>
3
0
2
1
0
MCC
FRC
CSS
PCC2
PCC1
PCC0
MCC
Main system clock oscillation controlNote 2
0
1
Oscillation possible
Oscillation stopped
FRC
Subsystem clock feedback resistor selection
0
1
Internal feedback resistor used
Internal feedback resistor not usedNote 3
CLS
0
CPU clock status
Main system clock
Subsystem clock
1
CSS
0
PCC2
PCC1
PCC0
CPU clock (fCPU) selection
0
0
0
0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
1
0
0
1
0
1
0
0
1
0
1
0
fX
fX/2
fX/2
fX/2
fX/2
2
3
4
1
fXT/2
Other than above
Setting prohibited
Notes 1. Bit 5 is read-only.
2. When the CPU is operating on the subsystem clock, MCC should be used to stop the main system clock
oscillation. A STOP instruction should not be used.
3. This bit can be set to 1 only when the subsystem clock is not used.
Cautions 1. Be sure to set bit 3 to 0.
2. When the external clock is input, MCC should not be set. This is because the X2 pin is
connected to VDD1 via a pull-up resistor.
Remarks 1. fX: Main system clock oscillation frequency
2. fXT: Subsystem clock oscillation frequency
User’s Manual U16035EJ5V0UD
93
CHAPTER 5 CLOCK GENERATOR
The fastest instructions of µPD780024AS, 780034AS Subseries are carried out in two CPU clocks. The relationship
between the CPU clock (fCPU) and minimum instruction execution time is shown in Table 5-2.
Table 5-2. Relationship Between CPU Clock and Minimum Instruction Execution Time
CPU Clock (fCPU)
Minimum Instruction Execution Time: 2/fCPU
0.166 µs
fX
fX/2
fX/2
fX/2
fX/2
0.333 µs
0.666 µs
1.33 µs
2.66 µs
122 µs
2
3
4
fXT/2
fX = 12 MHz, fXT = 32.768 kHz
fX: Main system clock oscillation frequency
fXT: Subsystem clock oscillation frequency
(2) Oscillation stabilization time select register (OSTS)
This register is used to select the oscillation stabilization time from when reset is effected or STOP mode is
released to when oscillation is stabilized.
OSTS is set by an 8-bit memory manipulation instruction.
RESET input sets OSTS to 04H. Thus, when releasing the STOP mode by RESET input, the time required to
release is 217/fX.
Figure 5-3. Format of Oscillation Stabilization Time Select Register (OSTS)
Address: FFFAH
After reset: 04H
R/W
5
Symbol
OSTS
7
6
0
4
0
3
0
2
1
0
0
0
OSTS2
OSTS1
OSTS0
OSTS2
OSTS1
OSTS0
Selection of oscillation stabilization time
12
14
15
16
17
0
0
0
0
1
0
0
1
1
0
0
1
0
1
0
2
2
2
2
2
/fX (341 µs)
/fX (1.36 ms)
/fX (2.73 ms)
/fX (5.46 ms)
/fX (10.9 ms)
Other than the above
Setting prohibited
94
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
Caution
The wait time when STOP mode is released does not include the time (“a” in the figure below)
from when STOP mode is released until the clock starts oscillation.
This also applies when RESET is input and an interrupt request is generated.
STOP mode is released
Voltage waveform
of X1 pin
a
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
5.4 System Clock Oscillator
5.4.1 Main system clock oscillator
The main system clock oscillator oscillates with a crystal resonator or a ceramic resonator (12 MHz TYP.) connected
to the X1 and X2 pins.
External clocks can be input to the main system clock oscillator. In this case, input a clock signal to the X1 pin
and an inverted-phase clock signal to the X2 pin.
Figure 5-4 shows an external circuit of the main system clock oscillator.
Figure 5-4. External Circuit of Main System Clock Oscillator
(a) Crystal and ceramic oscillation
(b) External clock
IC
X2
X2
V
SS1
X1
External
clock
X1
Crystal resonator or
ceramic resonator
Caution Do not execute the STOP instruction and do not set MCC (bit 7 of processor clock control
register (PCC)) to 1 if an external clock is input. This is because when the STOP instruction or
MCC is set to 1, the main system clock operation stops and the X2 pin is connected to VDD1 via
a pull-up resistor.
User’s Manual U16035EJ5V0UD
95
CHAPTER 5 CLOCK GENERATOR
5.4.2 Subsystem clock oscillator
The subsystem clock oscillator oscillates with a crystal resonator (32.768 kHz TYP.) connected to the XT1 and
XT2 pins.
External clocks can be input to the subsystem clock oscillator. In this case, input a clock signal to the XT1 pin
and an inverted-phase clock signal to the XT2 pin.
Figure 5-5 shows an external circuit of the subsystem clock oscillator.
Figure 5-5. External Circuit of Subsystem Clock Oscillator
(a) Crystal oscillation
(b) External clock
External
clock
IC
XT1
XT1
XT2
32.768
kHz
XT2
VSS1
Cautions are listed on the next page.
96
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
Cautions 1. When using the main system clock oscillator and a subsystem clock oscillator, wire as
follows in the area enclosed by the broken lines in Figures 5-4 and 5-5 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 VSS1. Do
not ground the capacitor to a ground pattern through which a high current flows.
Do not fetch signals from the oscillator.
Take special note of the fact that the subsystem clock oscillator is a circuit with low-level
amplification so that power consumption is maintained at low levels.
Figure 5-6 shows examples of incorrect resonator connection.
Figure 5-6. Examples of Incorrect Resonator Connection (1/2)
(a) Too long wiring
(b) Crossed signal line
PORTn
(n = 0 to 7)
IC
X2
X1
IC
X2
X1
VSS1
VSS1
Remark When using a subsystem clock, replace X1 and X2 with XT1 and XT2, respectively. Further, insert
resistors in series on the side of XT2.
User’s Manual U16035EJ5V0UD
97
CHAPTER 5 CLOCK GENERATOR
Figure 5-6. Examples of Incorrect Resonator Connection (2/2)
(c) Wiring near high alternating current
(d) Current flowing through ground line of
oscillator (potential at points A, B, and
C fluctuates)
VDD0
Pmn
X1
IC
X2
X1
IC
X2
A
B
C
High current
VSS1
VSS1
(e) Signals are fetched
IC
X2
X1
VSS1
Remark When using a subsystem clock, replace X1 and X2 with XT1 and XT2, respectively. Also, insert resistors
in series on the XT2 side.
Cautions 2. When X2 and XT1 are wired in parallel, the crosstalk noise of X2 may increase with XT1,
resulting in malfunctioning.
To prevent that from occurring, it is recommended to wire X2 and XT1 so that they are not
in parallel, and to connect the IC pin between X2 and XT1 directly to VSS1.
98
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
5.4.3 When no subsystem clocks are used
If it is not necessary to use subsystem clocks for low power consumption operations and clock operations, connect
the XT1 and XT2 pins as follows.
XT1: Connect directly to VDD0 or VDD1
XT2: Leave open
In this state, however, some current may leak via the internal feedback resistor of the subsystem clock oscillator
when the main system clock stops. To minimize leakage current, the above internal feedback resistor can be removed
by setting bit 6 (FRC) of the processor clock control register (PCC). In this case also, connect the XT1 and XT2 pins
as described above.
Figure 5-7. Subsystem Clock Feedback Resistor
FRC
P-ch
Feedback resistor
XT1
XT2
Remark The feedback resistor is required to control the bias point of the oscillation waveform so that the bias
point is in the middle of the power supply voltage.
User’s Manual U16035EJ5V0UD
99
CHAPTER 5 CLOCK GENERATOR
5.5 Operations of Clock Generator
The clock generator generates the following various types of clocks and controls the CPU operating mode including
the standby mode.
•
•
•
•
Main system clock fX
Subsystem clock
CPU clock
Clock to peripheral hardware
fXT
fCPU
The following clock generator functions and operations are determined with the processor clock control register
(PCC).
(a) Upon generation of RESET signal, the lowest speed mode of the main system clock (2.66 µs @ 12 MHz operation)
is selected (PCC = 04H). Main system clock oscillation stops while low level is applied to RESET pin.
(b) With the main system clock selected, one of the five minimum instruction execution time types (0.166 µs, 0.333
µs, 0.666 µs, 1.33 µs, 2.66 µs @ 12 MHz operation) can be selected by setting the PCC.
(c) With the main system clock selected, two standby modes, the STOP and HALT modes, are available. To reduce
current consumption in the STOP mode, the subsystem clock feedback resistor can be disconnected to stop the
subsystem clock.
(d) The PCC can be used to select the subsystem clock and to operate the system with low-power consumption (122
µs @ 32.768 kHz operation).
(e) With the subsystem clock selected, main system clock oscillation can be stopped with the PCC. The HALT mode
can be used. However, the STOP mode cannot be used (subsystem clock oscillation cannot be stopped).
(f) The main system clock is divided and supplied to the peripheral hardware. The subsystem clock is supplied to
the watch timer and clock output functions only. Thus the watch function and the clock output function can also
be continued in the standby state. However, since all other peripheral hardware operate with the main system
clock, the peripheral hardware also stops if the main system clock is stopped (except external input clock
operation).
100
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
5.5.1 Main system clock operations
When operated with the main system clock (with bit 5 (CLS) of the processor clock control register (PCC) set to
0), the following operations are carried out by PCC setting.
(a) Because the operation guarantee instruction execution speed depends on the power supply voltage, the minimum
instruction execution time can be changed by bits 0 to 2 (PCC0 to PCC2) of the PCC.
(b) When bit 4 (CSS) of PCC is set to 1 when operating with the main system clock, if bit 7 (MCC) of PCC is set
to 1 after the operation has been switched to the subsystem clock (CLS = 1), the main system clock oscillation
stops (see Figure 5-8 (1)).
(c) If bit 7 (MCC) of PCC is set to 1 when operating with the main system clock, the main system clock oscillation
does not stop. When bit 4 (CSS) of PCC is set to 1 and the operation is switched to the subsystem clock (CLS
= 1) after that, the main system clock oscillation stops (see Figure 5-8 (2)).
Figure 5-8. Main System Clock Stop Function
(1) Operation when MCC is set after setting CSS with main system clock operation
MCC
CSS
CLS
Main system clock oscillation
Subsystem clock oscillation
CPU clock
(2) Operation when CSS is set after setting MCC with main system clock operation
MCC
CSS
CLS
Oscillation does not stop
Main system clock oscillation
Subsystem clock oscillation
CPU clock
User’s Manual U16035EJ5V0UD
101
CHAPTER 5 CLOCK GENERATOR
5.5.2 Subsystem clock operations
When operated with the subsystem clock (with bit 5 (CLS) of the processor clock control register (PCC) set to 1),
the following operations are carried out.
(a) The minimum instruction execution time remains constant (122 µs @ 32.768 kHz operation) irrespective of bits
0 to 2 (PCC0 to PCC2) of the PCC.
(b) Watchdog timer counting stops.
Caution Do not execute the STOP instruction while the subsystem clock is in operation.
5.6 Changing System Clock and CPU Clock Settings
5.6.1 Time required for switchover between system clock and CPU clock
The system clock and CPU clock can be switched over by means of bits 0 to 2 (PCC0 to PCC2) and bit 4 (CSS)
of the processor clock control register (PCC).
The actual switchover operation is not performed directly after writing to the PCC, but operation continues on the
pre-switchover clock for several instructions (see Table 5-3).
Determination as to whether the system is operating on the main system clock or the subsystem clock is performed
by bit 5 (CLS) of the PCC register.
Table 5-3. Maximum Time Required for CPU Clock Switchover
Set Value Before
Set Value After Switchover
Switchover
CSS PCC2 PCC1 PCC0 CSS PCC2 PCC1 PCC0 CSS PCC2 PCC1 PCC0 CSS PCC2 PCC1 PCC0 CSS PCC2 PCC1 PCC0 CSS PCC2 PCC1 PCC0 CSS PCC2 PCC1 PCC0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
1
×
×
×
0
0
0
0
0
1
×
0
0
1
1
0
×
0
1
0
1
0
×
8 instructions
8 instructions
4 instructions
8 instructions
4 instructions
2 instructions
8 instructions
4 instructions
2 instructions
1 instruction
fX/fXT instruction
fX/2fXT instruction
fX/4fXT instruction
fX/8fXT instruction
fX/16fXT instruction
4 instructions
2 instructions
1 instruction
2 instructions
1 instruction
1 instruction
0.5 instruction
1 instruction
0.5 instruction
1 instruction
0.5 instruction
1 instruction
0.5 instruction
1 instruction
1
1 instruction
Remark One instruction is the minimum instruction execution time with the pre-switchover CPU clock.
Caution Selection of the CPU clock cycle dividing factor (PCC0 to PCC2) and switchover from the main
systemclocktothesubsystemclock(changingCSSfrom0to1)shouldnotbeset simultaneously.
Simultaneous setting is possible, however, for selection of the CPU clock cycle dividing factor
(PCC0 to PCC2) and switch over from the subsystem clock to the main system clock (changing
CSS from 1 to 0).
102
User’s Manual U16035EJ5V0UD
CHAPTER 5 CLOCK GENERATOR
5.6.2 System clock and CPU clock switching procedure
This section describes switching procedure between the system clock and CPU clock.
Figure 5-9. System Clock and CPU Clock Switching
VDD
RESET
Interrupt request signal
fX
fX
fXT
fX
System clock
CPU clock
Lowest-
speed
Highest-
speed
Subsystem
clock
High-speed
operation
operation
operation
operation
Wait (10.9 ms: @12 MHz operation)
Internal reset operation
<1> The CPU is reset by setting the RESET signal to low level after power-on. After that, when reset is released
by setting the RESET signal to high level, main system clock starts oscillation. At this time, oscillation
stabilization time (217/fX) is secured automatically.
After that, the CPU starts executing the instruction at the minimum speed of the main system clock (2.66 µs
@ 12 MHz operation).
<2> After the lapse of a sufficient time for the VDD voltage to increase to enable operation at maximum speeds, the
PCC is rewritten and maximum-speed operation is carried out.
<3> Upon detection of a decrease of the VDD voltage due to an interrupt request signal, the main system clock is
switched to the subsystem clock (which must be in an oscillation stable state).
<4> Upon detection of VDD voltage reset due to an interrupt, 0 is set to bit 7 (MCC) of the PCC and oscillation of
the main system clock is started. After the lapse of time required for stabilization of oscillation, the PCC is
rewritten and the maximum-speed operation is resumed.
Caution When subsystem clock is being operated while the main system clock is stopped, if switching
to the main system clock is done again, be sure to switch after securing oscillation stabilization
time by program.
User’s Manual U16035EJ5V0UD
103
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.1 Functions of 16-Bit Timer/Event Counter 0
16-bit timer/event counter 0 has the following functions.
(1) Interval timer
16-bit timer/event counter 0 generates interrupt requests at the preset time interval.
• Number of counts: 2 to 65536
(2) External event counter
16-bit timer/event counter 0 can measure the number of pulses with a high-/low-level width of a signal input
externally.
• Valid level pulse width: 16/fX or more
(3) Pulse width measurement
16-bit timer/event counter 0 can measure the pulse width of an externally input signal.
• Valid level pulse width: 2/fX or more
(4) Square-wave output
16-bit timer/event counter 0 can output a square wave with any selected frequency.
• Cycle: (2 × 2 to 65536 × 2) × count clock cycle
(5) PPG output
16-bit timer/event counter 0 can output a square wave that have arbitrary cycle and pulse width.
• 2 < Pulse width < Cycle ≤ (FFFF + 1) H
104
User’s Manual U16035EJ5V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.2 Configuration of 16-Bit Timer/Event Counter 0
16-bit timer/event counter 0 includes the following hardware.
Table 6-1. Configuration of 16-Bit Timer/Event Counter 0
Item
Timer counter
Register
Configuration
16-bit timer counter 0 (TM0)
16-bit timer capture/compare registers 00, 01 (CR00, CR01)
Timer input
Timer output
TI00, TI01
TO0
Control registers 16-bit timer mode control register 0 (TMC0)
Capture/compare control register 0 (CRC0)
16-bit timer output control register 0 (TOC0)
Prescaler mode register 0 (PRM0)
Port mode register 7 (PM7)
Port 7 (P7)
Figure 6-1 shows block diagram of this counter.
Figure 6-1. Block Diagram of 16-Bit Timer/Event Counter 0
Internal bus
Capture/compare control
register 0 (CRC0)
CRC02 CRC01 CRC00
INTTM00
Noise
elimi-
nator
16-bit timer capture/compare
register 00 (CR00)
TI01/P71
Match
f
X
f
f
X
/22
/26
TO0/TI00/
P70
16-bit timer counter 0
(TM0)
X
Note
Clear
Output
controller
Match
Noise
elimi-
nator
f
/23
X
2
PM70
Output latch
(P70)
Noise
elimi-
nator
16-bit timer capture/compare
register 01 (CR01)
TI00/TO0/P70Note
INTTM01
CRC02
PRM01 PRM00
TMC03 TMC02 OVF0
TOC04 LVS0 LVR0 TOC01 TOE0
16-bit timer mode
control register 0
(TMC0)
16-bit timer output
control register 0
(TOC0)
Prescaler mode
register 0 (PRM0)
Internal bus
Note TI00 input and TO0 output cannot be used at the same time.
User’s Manual U16035EJ5V0UD
105
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(1) 16-bit timer counter 0 (TM0)
TM0 is a 16-bit read-only register that counts count pulses.
The counter is incremented in synchronization with the rising edge of the count clock. If the count value is read
during operation, input of the count clock is temporarily stopped, and the count value at that point is read. The
count value is reset to 0000H in the following cases.
<1> At RESET input
<2> If TMC03 and TMC02 are cleared
<3> If the valid edge of TI00 is input in the clear & start mode entered by inputting the valid edge of TI00
<4> If TM0 and CR00 match in the clear & start mode entered on a match between TM0 and CR00
(2) 16-bit timer capture/compare register 00 (CR00)
CR00 is a 16-bit register which has the functions of both a capture register and a compare register. Whether
it is used as a capture register or as a compare register is set by bit 0 (CRC00) of capture/compare control register
0 (CRC0).
•
When CR00 is used as a compare register
The value set in CR00 is constantly compared with the 16-bit timer counter 0 (TM0) count value, and an interrupt
request (INTTM00) is generated if they match. It can also be used as the register that holds the interval time
then TM0 is set to interval timer operation.
•
When CR00 is used as a capture register
It is possible to select the valid edge of the TI00 pin or the TI01 pin as the capture trigger. Setting of the TI00
or TI01 valid edge is performed by means of prescaler mode register 0 (PRM0) (see Table 6-2).
Table 6-2. CR00 Capture Trigger and Valid Edges of TI00 and TI01 Pins
(1) TI00 pin valid edge selected as capture trigger (CRC01 = 1, CRC00 = 1)
CR00 Capture Trigger
TI00 Pin Valid Edge
ES01
ES00
Falling edge
Rising edge
0
0
1
1
0
1
Rising edge
Falling edge
No capture operation
Both rising and falling edges
(2) TI01 pin valid edge selected as capture trigger (CRC01 = 0, CRC00 = 1)
CR00 Capture Trigger
TI01 Pin Valid Edge
ES11
ES10
Falling edge
Falling edge
0
0
1
0
1
1
Rising edge
Rising edge
Both rising and falling edges
Both rising and falling edges
Remarks 1. Setting ES01, ES00 = 1, 0 and ES11, ES10 = 1, 0 is prohibited.
2. ES01, ES00:
Bits 5 and 4 of prescaler mode register 0 (PRM0)
Bits 7 and 6 of prescaler mode register 0 (PRM0)
ES11, ES10:
CRC01, CRC00: Bits 1 and 0 of capture/compare control register 0 (CRC0)
User’s Manual U16035EJ5V0UD
106
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
CR00 is set by a 16-bit memory manipulation instruction.
RESET input makes CR00 undefined.
Cautions 1. Set CR00 to a value other than 0000H in the clear & start mode entered on a match between
TM0 and CR00. However, in the free-running mode and in the clear mode using the valid
edge of TI00, if CR00 is cleared to 0000H, an interrupt request (INTTM00) is generated when
CR00 changes from 0000H to 0001H following overflow (FFFFH).
2. If the new value of CR00 is less than the value of 16-bit timer counter 0 (TM0), TM0 continues
counting, overflows, and then starts counting from 0 again. If the new value of CR00 is less
than the old value, therefore, the timer must be reset to be restarted after the value of CR00
is changed.
3. When P70 is used as the input pin for the valid edge of TI00, it cannot be used as a timer
output (TO0). Moreover, when P70 is used as TO0, it cannot be used as the input pin for
the valid edge of TI00.
(3) 16-bit timer capture/compare register 01 (CR01)
CR01 is a 16-bit register which has the functions of both a capture register and a compare register. Whether it is
usedasacaptureregisteroracompareregisterissetbybit2(CRC02)ofcapture/comparecontrolregister0(CRC0).
•
•
When CR01 is used as a compare register
The value set in CR01 is constantly compared with the 16-bit timer counter 0 (TM0) count value, and an interrupt
request (INTTM01) is generated if they match.
When CR01 is used as a capture register
It is possible to select the valid edge of the TI00 pin as the capture trigger. The TI00 valid edge is set by means
of prescaler mode register 0 (PRM0) (see Table 6-3).
Table 6-3. CR01 Capture Trigger and Valid Edge of TI00 Pin (CRC02 = 1)
CR01 Capture Trigger
TI00 Pin Valid Edge
ES01
ES00
Falling edge
Falling edge
0
0
1
0
1
1
Rising edge
Rising edge
Both rising and falling edges
Both rising and falling edges
Remarks 1. Setting ES01, ES00 = 1, 0 is prohibited.
2. ES01, ES00: Bits 5 and 4 of prescaler mode register 0 (PRM0)
CRC02: Bit 2 of capture/compare control register 0 (CRC0)
CR01 is set by a 16-bit memory manipulation instruction.
RESET input makes CR01 undefined.
Caution
Set CR01 to other than 0000H in the clear & start mode entered on a match between TM0 and
CR00. However, in the free-running mode and in the clear mode using the valid edge of TI00,
if CR01 is cleared to 0000H, an interrupt request (INTTM01) is generated when CR01 changes
from 0000H to 0001H following overflow (FFFFH).
User’s Manual U16035EJ5V0UD
107
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.3 Registers Controlling 16-Bit Timer/Event Counter 0
The following six registers are used to control 16-bit timer/event counter 0.
•
•
•
•
•
•
16-bit timer mode control register 0 (TMC0)
Capture/compare control register 0 (CRC0)
16-bit timer output control register 0 (TOC0)
Prescaler mode register 0 (PRM0)
Port mode register 7 (PM7)
Port 7 (P7)
(1) 16-bit timer mode control register 0 (TMC0)
This register sets the 16-bit timer operating mode, the 16-bit timer counter 0 (TM0) clear mode, and output timing,
and detects an overflow.
TMC0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears TMC0 to 00H.
Caution
16-bit timer counter 0 (TM0) starts operation at the moment TMC02 and TMC03 (operation stop
mode) are set to a value other than 0, 0, respectively. Clear TMC02 and TMC03 to 0, 0 to stop
the operation.
Figure 6-2. Format of 16-Bit Timer Mode Control Register 0 (TMC0)
Address: FF60H
After reset: 00H
R/W
Symbol
TMC0
7
0
6
0
5
0
4
0
<3> <2>
1
0
<0>
TMC03 TMC02
OVF0
TMC03 TMC02
Operating mode
TO0 output timing selection
Interrupt request generation
Not generated
and clear mode selection
0
0
0
1
Operation stop
No change
(TM0 cleared to 0)
Generated on match
between TM0 and CR00, or
match between TM0 and
CR01
Free-running mode
Match between TM0 and
CR00 or match between
TM0 and CR01
1
1
0
1
Clear & start on TI00 valid
−
Note 1
edge
Clear & start on match between Match between TM0 and
Note 2
TM0 and CR00
CR00 or match between
TM0 and CR01
OVF0
Overflow detection of 16-bit timer counter 0 (TM0)
0
1
Overflow not detected
Overflow detected
Notes 1. Set the valid edge of the TI00/TO0/P70 pin with prescaler mode register 0 (PRM0).
2. If the clear & start mode entered on a match between TM0 and CR00 is selected, when the set value
of CR00 is FFFFH and the TM0 value changes from FFFFH to 0000H, the OVF0 flag is set to 1.
User’s Manual U16035EJ5V0UD
108
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Cautions 1. To write different data to TMC0, stop the timer operation before writing.
2. The timer operation must be stopped before writing to bits other than the OVF0 flag.
Remark TO0: Output pin of 16-bit timer/event counter 0
TI00: Input pin of 16-bit timer/event counter 0
TM0: 16-bit timer counter 0
CR00: 16-bit timer capture/compare register 00
CR01: 16-bit timer capture/compare register 01
(2) Capture/compare control register 0 (CRC0)
This register controls the operation of the 16-bit timer capture/compare registers (CR00, CR01).
CRC0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears CRC0 to 00H.
Figure 6-3. Format of Capture/Compare Control Register 0 (CRC0)
Address: FF62H
Symbol
After reset: 00H
R/W
5
7
0
6
0
4
0
3
0
2
1
0
CRC0
0
CRC02
CRC01
CRC00
CRC02
CR01 operating mode selection
0
1
Operate as compare register
Operate as capture register
CRC01
CR00 capture trigger selection
0
1
Capture on valid edge of TI01
Note
Capture on valid edge of TI00 by reverse phase
CRC00
CR00 operating mode selection
0
1
Operate as compare register
Operate as capture register
Note If both the rising and falling edges have been selected as the valid edges of TI00, capture is not performed.
Cautions 1. The timer operation must be stopped before setting CRC0.
2. When the clear & start mode entered on a match between TM0 and CR00 is selected by 16-
bit timer mode control register 0 (TMC0), CR00 should not be specified as a capture register.
3. To ensure the reliability of the capture operation, the capture trigger requires a pulse longer
than two cycles of the count clock selected by prescaler mode register 0 (PRM0) (see Figure
6-31).
User’s Manual U16035EJ5V0UD
109
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(3) 16-bit timer output control register 0 (TOC0)
This register controls the operation of the 16-bit timer/event counter 0 output controller. It sets R-S type flip-flop
(LV0) set/reset, output inversion enable/disable, and 16-bit timer/event counter 0 timer output enable/disable.
TOC0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears TOC0 to 00H.
Figure 6-4. Format of 16-Bit Timer Output Control Register 0 (TOC0)
Address: FF63H
Symbol
After reset: 00H
R/W
5
7
0
6
0
4
<3>
<2>
1
<0>
TOC0
0
TOC04
LVS0
LVR0
TOC01
TOE0
TOC04
Timer output F/F control by match of CR01 and TM0
Inversion operation disabled
Inversion operation enabled
0
1
LVS0
LVR0
16-bit timer/event counter 0 timer output F/F status setting
0
0
1
1
0
1
0
1
No change
Timer output F/F reset (0)
Timer output F/F set (1)
Setting prohibited
TOC01
Timer output F/F control by match of CR00 and TM0
0
1
Inversion operation disabled
Inversion operation enabled
TOE0
16-bit timer/event counter 0 output control
0
1
Output disabled (output set to level 0)
Output enabled
Cautions 1. The timer operation must be stopped before setting TOC0.
2. If LVS0 and LVR0 are read after data is set, they will be 0.
3. Be sure to clear bits 5 to 7 of TOC0 to 0.
User’s Manual U16035EJ5V0UD
110
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(4) Prescaler mode register 0 (PRM0)
This register is used to set the 16-bit timer counter 0 (TM0) count clock and TI00, TI01 input valid edges.
PRM0 is set by an 8-bit memory manipulation instruction.
RESET input clears PRM0 to 00H.
Figure 6-5. Format of Prescaler Mode Register 0 (PRM0)
Address: FF61H
Symbol
After reset: 00H
R/W
5
7
6
4
3
0
2
0
1
0
PRM0
ES11
ES10
ES01
ES00
PRM01
PRM00
ES11
ES10
TI01 valid edge selection
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both falling and rising edges
ES01
ES00
TI00 valid edge selection
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both falling and rising edges
PRM01
PRM00
Count clock selection
0
0
1
1
0
1
0
1
fX (12 MHz)
2
fX/2 (3 MHz)
6
fX/2 (187 kHz)
Notes 1, 2
TI00 valid edge
Notes 1. The external clock requires a pulse longer than two cycles of the internal count clock (fX/23).
2. When the valid edge of TI00 is selected, the main system clock is used as the sampling clock for noise
elimination. The valid edge of TI00 can be used only when the main system clock is operating.
Cautions 1. Always set data to PRM0 after stopping the timer operation.
2. If the valid edge of TI00 is to be set as the count clock, do not set the clear & start mode
and the capture trigger at the valid edge of TI00.
Moreover, do not use the P70/TI00/TO0 pin as a timer output (TO0).
3. If the TI00 or TI01 pin is high level immediately after system reset, the rising edge is
immediately detected after the rising edge or both the rising and falling edges are set as
the valid edge(s) of the TI00 pin or TI01 pin to enable the operation of 16-bit timer counter
0 (TM0). Be careful when pulling up the TI00 pin or the TI01 pin. However, when re-enabling
operation after the operation has been stopped once, the rising edge is not detected.
Remarks 1. fX: Main system clock oscillation frequency
2. TI00, TI01: 16-bit timer/event counter 0 input pin
3. Figures in parentheses are for operation with fX = 12 MHz.
User’s Manual U16035EJ5V0UD
111
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(5) Port mode register 7 (PM7)
This register sets port 7 input/output in 1-bit units.
When using the P70/TO0/TI00 pin for timer output, clear PM70 and the output latch of P70 to 0.
When using the P70/TO0/TI00 pin for timer input, set PM70 to 1. At this time, the output latch of P70 can be
either 0 or 1.
PM7 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM7 to FFH.
Figure 6-6. Format of Port Mode Register 7 (PM7)
Address: FF27H
After reset: FFH
R/W
Symbol
PM7
7
1
6
1
5
4
3
2
1
0
PM75
PM74
PM73
PM72
PM71
PM70
PM7n
P7n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
User’s Manual U16035EJ5V0UD
112
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.4 Operations of 16-Bit Timer/Event Counter 0
6.4.1 Operation as interval timer
Setting 16-bit timer mode control register 0 (TMC0) and capture/compare control register 0 (CRC0) as shown in
Figure 6-7 allows operation as an interval timer. Interrupt requests are generated repeatedly using the count value
set in 16-bit timer capture/compare register 00 (CR00) beforehand as the interval.
When the count value of 16-bit timer counter 0 (TM0) matches the value set to CR00, counting continues with the
TM0 value cleared to 0 and the interrupt request signal (INTTM00) is generated.
The count clock of 16-bit timer/event counter 0 can be selected using bits 0 and 1 (PRM00, PRM01) of prescaler
mode register 0 (PRM0).
Figure 6-7. Control Register Settings for Interval Timer Operation
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
1
1
0
Clears and starts on match between TM0 and CR00.
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
0/1
0/1
0
CR00 used as compare register
Figure 6-8. Interval Timer Configuration Diagram
16-bit timer capture/compare
register 00
INTTM00
fX
f
f
X
X
/22
/26
OVF0Note
16-bit timer counter 0
Noise
eliminator
TI00/TO0/P70
Clear
circuit
f
/23
X
Note OVF0 is 1 only when 16-bit timer capture/compare register 00 is set to FFFFH.
User’s Manual U16035EJ5V0UD
113
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-9. Timing of Interval Timer Operation
t
Count clock
TM0 count value
0000H
0000H
0001H
N
0001H
N
0000H 0001H
N
N
Count start
Clear
Clear
N
N
N
CR00
INTTM00
Interrupt acknowledged
Interval time
Interrupt acknowledged
Interval time
TO0
Remark Interval time = (N + 1) × t
N = 0001H to FFFFH
When the compare register is changed during timer count operation, if the value after 16-bit timer capture/
compare register 00 (CR00) is changed is smaller than that of 16-bit timer counter 0 (TM0), TM0 continues
counting, overflows and then restarts counting from 0. Thus, if the value (M) after the CR00 change is smaller
than that (N) before the change, it is necessary to restart the timer after changing CR00.
Figure 6-10. Timing After Change of Compare Register During Timer Count Operation
Count clock
N
M
CR00
X − 1
X
FFFFH
0000H
0001H
0002H
TM0 count value
Remark N > X > M
User’s Manual U16035EJ5V0UD
114
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.4.2 Operation as external event counter
The external event counter counts the number of external clock pulses to be input to the TI00/TO0/P70 pin with
using 16-bit timer counter 0 (TM0).
TM0 is incremented each time the valid edge specified by prescaler mode register 0 (PRM0) is input.
When the TM0 count value matches the 16-bit timer capture/compare register 00 (CR00) value, TM0 is cleared
to 0 and the interrupt request signal (INTTM00) is generated.
Input a value other than 0000H to CR00. (A count operation with a pulse cannot be carried out.)
The rising edge, the falling edge, or both edges can be selected using bits 4 and 5 (ES00 and ES01) of prescaler
mode register 0 (PRM0).
Because an operation is carried out only when the valid edge of the TI00 pin is detected twice after sampling with
the internal clock (fX/23), noise with a short pulse width can be removed.
Caution When used as an external event counter, the P70/TI00/TO0 pin cannot be used as a timer output
(TO0).
Figure 6-11. Control Register Settings in External Event Counter Mode
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
1
1
0
Clears and starts on match between TM0 and CR00.
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
0/1
0/1
0
CR00 used as compare register
User’s Manual U16035EJ5V0UD
115
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-12. External Event Counter Configuration Diagram
Internal bus
16-bit timer capture/compare
register 00
Match
Clear
INTTM00
fX/23
OVF0Note
Noise eliminator
16-bit timer counter 0 (TM0)
Valid edge of TI00
Note OVF0 is 1 only when 16-bit timer capture/compare register 00 is set to FFFFH.
Figure 6-13. External Event Counter Operation Timing (with Rising Edge Specified)
TI00 pin input
TM0 count value
CR00
0000H 0001H 0002H 0003H 0004H 0005H
N − 1
N
0000H 0001H 0002H 0003H
N
INTTM00
Caution When reading the external event counter count value, TM0 should be read.
User’s Manual U16035EJ5V0UD
116
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.4.3 Operation as pulse width measurement
It is possible to measure the pulse width of the signals input to the TI00/TO0/P70 pin and TI01/P71 pin using
16-bit timer counter 0 (TM0).
There are two measurement methods: measuring with TM0 used in free-running mode, and measuring by restarting
the timer in synchronization with the edge of the signal input to the TI00 pin.
(1) Pulse width measurement with free-running counter and one capture register
When 16-bit timer counter 0 (TM0) is operated in free-running mode (see register settings in Figure 6-14), and
the edge specified by prescaler mode register 0 (PRM0) is input to the TI00 pin, the value of TM0 is taken into
16-bit timer capture/compare register 01 (CR01) and an external interrupt request signal (INTTM01) is set.
Any of three edges can be selected—rising, falling, or both edges—specified by bits 4 and 5 (ES00 and ES01)
of PRM0.
Sampling is performed with the count clock selected by PRM0, and a capture operation is only performed when
a valid level of the TI00 pin is detected twice, thus eliminating noise with a short pulse width.
Figure 6-14. Control Register Settings for Pulse Width Measurement with Free-Running Counter
and One Capture Register
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
0
1
0
Free-running mode
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
1
0/1
0
CR00 used as compare register
CR01 used as capture register
User’s Manual U16035EJ5V0UD
117
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-15. Configuration Diagram for Pulse Width Measurement with Free-Running Counter
f
X
f
f
X
/22
/26
OVF0
16-bit timer counter 0
X
16-bit timer capture/compare
register 01
TI00/TO0/P70
INTTM01
Internal bus
Figure 6-16. Timing of Pulse Width Measurement Operation with Free-Running Counter
and One Capture Register (with Both Edges Specified)
t
Count clock
0000H 0001H
D0 D0 + 1
D1 D1 + 1
FFFFH 0000H
D2
D3
TM0 count value
TI00 pin input
CR01 capture value
INTTM01
D0
D1
D2
D3
Note
OVF0
(D1 − D0) × t
(10000H − D1 + D2) × t
(D3 − D2) × t
Note OVF0 must be cleared by software.
User’s Manual U16035EJ5V0UD
118
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(2) Measurement of two pulse widths with free-running counter
When 16-bit timer counter 0 (TM0) is operated in free-running mode (see register settings in Figure 6-17), it is
possible to simultaneously measure the pulse widths of the two signals input to the TI00 pin and the TI01 pin.
When the edge specified by bits 4 and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0) is input to the
TI00 pin, the value of TM0 is taken into 16-bit timer capture/compare register 01 (CR01) and an interrupt request
signal (INTTM01) is set.
Also, when the edge specified by bits 6 and 7 (ES10 and ES11) of PRM0 is input to the TI01 pin, the value of
TM0 is taken into 16-bit timer capture/compare register 00 (CR00) and an interrupt request signal (INTTM00)
is set.
Any of three edges can be selected—rising, falling, or both edges—as the valid edges for the TI00 pin and the
TI01 pin specified by bits 4 and 5 (ES00 and ES01) and bits 6 and 7 (ES10 and ES11) of PRM0, respectively.
Sampling is performed at the interval selected by prescaler mode register 0 (PRM0), and a capture operation
is only performed when a valid level of the TI00 pin or TI01 pin is detected twice, thus eliminating noise with a
short pulse width.
Figure 6-17. Control Register Settings for Measurement of Two Pulse Widths with Free-Running Counter
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
0
1
0
Free-running mode
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
1
0
1
CR00 used as capture register
Captures valid edge of TI01 pin to CR00
CR01 used as capture register
User’s Manual U16035EJ5V0UD
119
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-18. Timing of Pulse Width Measurement Operation with Free-Running Counter
(with Both Edges Specified)
t
Count clock
0000H 0001H
D0 D0 + 1
D1 D1 + 1
FFFFH 0000H
D2 D2 + 1 D2 + 2
D3
TM0 count value
TI00 pin input
CR01 capture value
INTTM01
D0
D1
D2
TI01 pin input
CR00 capture value
INTTM00
D1
D2 + 1
Note
OVF0
(D1 − D0) × t
(10000H − D1 + D2) × t
(D3 − D2) × t
(10000H − D1 + (D2 + 1)) × t
Note OVF0 must be cleared by software.
User’s Manual U16035EJ5V0UD
120
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(3) Pulse width measurement with free-running counter and two capture registers
When 16-bit timer counter 0 (TM0) is operated in free-running mode (see register settings in Figure 6-19), it is
possible to measure the pulse width of the signal input to the TI00 pin.
When the edge specified by bits 4 and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0) is input to the
TI00 pin, the value of TM0 is taken into 16-bit timer capture/compare register 01 (CR01) and an interrupt request
signal (INTTM01) is set.
Also, when the inverse edge to that of the capture operation to CR01 is input, the value of TM0 is taken into 16-
bit timer capture/compare register 00 (CR00).
Either of two edges can be selected—rising or falling—as the valid edges for the TI00 pin specified by bits 4 and
5 (ES00 and ES01) of prescaler mode register 0 (PRM0).
Sampling is performed at the interval selected by prescaler mode register 0 (PRM0), and a capture operation
is only performed when a valid level of the TI00 pin is detected twice, thus eliminating noise with a short pulse
width.
Caution
If the valid edge of TI00 is specified to be both the rising and falling edges, 16-bit timer capture/
compare register 00 (CR00) cannot perform the capture operation.
Figure 6-19. Control Register Settings for Pulse Width Measurement with Free-Running Counter and
Two Capture Registers
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
0
1
0
Free-running mode
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
1
1
1
CR00 used as capture register
Captures to CR00 at edge reverse
to valid edge of TI00.
CR01 used as capture register
User’s Manual U16035EJ5V0UD
121
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-20. Timing of Pulse Width Measurement Operation with Free-Running Counter
and Two Capture Registers (with Rising Edge Specified)
t
Count clock
TM0 count value
TI00 pin input
0000H 0001H
D0 D0 + 1
D1 D1 + 1
FFFFH 0000H
D2 D2 + 1
D3
CR01 capture value
CR00 capture value
INTTM01
D0
D2
D1
D3
Note
(D3 − D2) × t
OVF0
(D1 − D0) × t
(10000H − D1 + D2) × t
Note OVF0 must be cleared by software.
(4) Pulse width measurement by means of restart
When input of a valid edge to the TI00 pin is detected, the count value of 16-bit timer counter 0 (TM0) is taken
into 16-bit timer capture/compare register 01 (CR01), and then the pulse width of the signal input to the TI00
pin is measured by clearing TM0 and restarting the count (see register settings in Figure 6-22).
The edge specification can be selected from two types, rising or falling edges, by bits 4 and 5 (ES00 and ES01)
of prescaler mode register 0 (PRM0).
Sampling is performed at the interval selected by prescaler mode register 0 (PRM0) and a capture operation is
only performed when a valid level of the TI00 pin is detected twice, thus eliminating noise with a short pulse width.
Caution
If the valid edge of TI00 is specified to be both the rising and falling edges, 16-bit timer capture/
compare register 00 (CR00) cannot perform the capture operation.
User’s Manual U16035EJ5V0UD
122
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-21. Control Register Settings for Pulse Width Measurement by Means of Restart
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
1
0
0
Clears and starts at valid edge of TI00 pin.
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
1
1
1
CR00 used as capture register
Captures to CR00 at edge reverse to valid edge of TI00.
CR01 used as capture register
Figure 6-22. Timing of Pulse Width Measurement Operation by Means of Restart
(with Rising Edge Specified)
t
Count clock
0000H 0001H
D0 0000H 0001H D1
D2 0000H 0001H
TM0 count value
TI00 pin input
CR01 capture value
D0
D2
D1
CR00 capture value
INTTM01
D1 × t
D2 × t
User’s Manual U16035EJ5V0UD
123
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.4.4 Operation as square-wave output
A square wave with any selected frequency can be output at intervals determined by the count value preset to
16-bit timer capture/compare register 00 (CR00).
The TO0 pin output status is reversed at intervals determined by the count value preset to CR00 by setting bit 0
(TOE0) and bit 1 (TOC01) of 16-bit timer output control register 0 (TOC0) to 1. This enables a square wave with
any selected frequency to be output.
Figure 6-23. Control Register Settings in Square-Wave Output Mode
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
1
1
0
Clears and starts on match between TM0 and CR00.
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
0/1
0/1
0
CR00 used as compare register
(c) 16-bit timer output control register 0 (TOC0)
TOC04 LVS0 LVR0 TOC01 TOE0
TOC0
0
0
0
0
0/1
0/1
1
1
Enables TO0 output.
Reverses output on match between TM0 and CR00.
Specifies initial value of TO0 output F/F.
Does not reverse output on match between TM0 and CR01.
Figure 6-24. Square-Wave Output Operation Timing
Count clock
TM0 count value
CR00
0000H 0001H 0002H
N − 1
N
0000H 0001H 0002H
N − 1
N
0000H
N
INTTM00
TO0 pin output
User’s Manual U16035EJ5V0UD
124
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.4.5 Operation as PPG output
Setting 16-bit timer mode control register 0 (TMC0) and capture/compare control register 0 (CRC0) as shown in
Figure 6-25 allows operation as PPG (Programmable Pulse Generator) output.
In the PPG output operation, square waves are output from the TO0 pin with the pulse width and the cycle that
correspond to the count values set beforehand in 16-bit timer capture/compare register 01 (CR01) and in 16-bit timer
capture/compare register 00 (CR00), respectively.
Figure 6-25. Control Register Settings for PPG Output Operation
(a) 16-bit timer mode control register 0 (TMC0)
TMC03 TMC02
OVF0
0
TMC0
0
0
0
0
1
1
0
Clears and starts on match between TM0 and CR00.
(b) Capture/compare control register 0 (CRC0)
CRC02 CRC01 CRC00
CRC0
0
0
0
0
0
0
×
0
CR00 used as compare register
CR01 used as compare register
(c) 16-bit timer output control register 0 (TOC0)
TOC04 LVS0 LVR0 TOC01 TOE0
TOC0
0
0
0
1
0/1
0/1
1
1
Enables TO0 output
Reverses output on match between TM0 and CR00
Specifies initial value of TO0 output F/F
Reverse output on match between TM0 and CR01
Cautions 1. CR00 and CR01 values in the following range should be set to:
0000H < CR01 < CR00 ≤ FFFFH
2. The cycle of the pulse generated via PPG output (CR00 setting value + 1) has a duty of (CR01
setting value + 1)/(CR00 setting value + 1).
Remark ×: Don’t care
User’s Manual U16035EJ5V0UD
125
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
Figure 6-26. PPG Output Configuration Diagram
16-bit timer capture/
compare register 00
f
X
Clear
f
X
X
/22
/26
16-bit timer counter 0
circuit
f
TO0/TI00/P70
16-bit timer capture/compare
register 01
Figure 6-27. PPG Output Operation Timing
t
Count clock
TM0 count value
0000H 0001H
M − 1
M
0000H 0001H
N − 1
N
Count start
Clear
CR00
CR01
TO0
N
M
Pulse width: (M + 1) × t
One cycle: (N + 1) × t
Remark 0000H < M < N ≤ FFFFH
User’s Manual U16035EJ5V0UD
126
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.5 Program List
Caution The following sample program is shown as an example to describe the operation of
semiconductor products and their applications. Therefore, when applying the following
information to your devices, design the devices after performing evaluation under your own
responsibility.
User’s Manual U16035EJ5V0UD
127
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.5.1 Interval timer
/*******************************************************************************/
/*
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
*/
*/
*/
Setting example of timer 0 interval timer mode
Cycle set to 130 as intervalTM0 (at 8.38 MHz for 1 ms)
Variable ppgdata prepared as rewrite data area
: Cycle (if 0000, no change)
ppgdata to be checked at every INTTM00, and changed if required.
Therefore, if change is required, set the change data in ppgdata.
When changed, ppgdata cleared to 0000.
/*******************************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#define intervalTM0 130
#pragma interrupt INTTM00 intervalint rb2
unsigned int ppgdata;
/* Cycle data to be set to CR00 */
/* Data area to be set to timer 0 */
void main(void)
{
PCC = 0x0;
ppgdata = 0;
/* Set high-speed operation mode */
/* Set port */
/* Set the following to output */
/* Clear P70 */
/* Set P70 as output */
P7 = 0b11111110;
PM7.0 = 0;
/* Set interrupt */
TMMK00 = 0;
/* Cancel INTTM00 interrupt mask */
/* Set timer 0 */
PRM0 = 0b00000010;
CRC0 = 0b00000000;
CR00 = intervalTM0;
TOC0 = 0b00000111;
TMC0 = 0b00001100;
EI();
/* Count clock is fx/2^6 */
/* Set CR00 and CR01 to compare register */
/* Set cycle initial value to CR00 */
/* Invert on match with CR00, initial value L */
/* Clear & start on match between TM0 and CR00 */
while(1);
}
/* Loop as dummy here */
/* Timer 0 interrupt function */
void intervalint()
{
unsigned int work;
/***************************************************/
/*
*/
*/
*/
/* Define variables required for interrupt here
/*
/***************************************************/
work = ppgdata;
if (work != 0)
{
CR00 = work;
ppgdata = 0;
if (work == 0xffff)
{
TMC0 = 0b00000000;
/* Stop timer */
}
}
/***********************************************************/
/*
*/
*/
*/
/* Describe processing required for interrupt below
/*
/***********************************************************/
}
User’s Manual U16035EJ5V0UD
128
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.5.2 Pulse width measurement by free-running counter and one capture register
/******************************************************************************/
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
Timer 0 operation sample
Pulse width measurement example by free-running and CR01
Measurement results to be up to 16 bits and not checked for errors */
data[0]: End flag
data[1]: Measurement results (pulse width)
data[2]: Previous read value
*/
*/
*/
*/
/******************************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#pragma interrupt INTTM01 intervalint rb2
unsigned int data[3];
/* Data area */
void main(void)
{
unsigned int length;
PCC = 0x0;
/* Set high-speed operation mode */
data[0] = 0;
data[1] = 0;
data[2] = 0;
/* Set port */
PM7.0 = 1;
/* Set P70 as input */
/* Set interrupt */
TMMK01 = 0;
/* Cancel INTTM01 interrupt mask */
/* Set timer 0 */
PRM0 = 0b00110010;
/* Both rising and falling edges for TI00 */
/* Count clock is fx/2^6
*/
CRC0 = 0b00000100;
TMC0 = 0b00000100;
EI();
/* Set CR01 to capture register */
/* Start in free-run mode */
while(1){
/* Dummy loop */
while(data[0] == 0);
/* Wait for measurement completion */
DI();
/* Prohibit interrupt for exclusive operation */
/* Read measurement results */
/* Clear end flag */
length = data[1];
data[0] = 0;
EI();
/* Exclusive operation completed */
}
}
/* Timer 0 interrupt function */
void intervalint()
{
unsigned int work;
/*****************************************************/
/*
*/
*/
*/
/* Define variables required for interrupt here
/*
/*****************************************************/
work = CR01;
/* Read capture value */
data[1] = work - data[2];
data[2] = work;
/* Calculate and update interval */
/* Update read value */
data[0] = 0xffff;
/* Set measurement completion flag */
/***********************************************************/
/*
*/
*/
*/
/* Describe processing required for interrupt below
/*
/***********************************************************/
}
User’s Manual U16035EJ5V0UD
129
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.5.3 Two pulse widths measurement by free-running counter
/******************************************************************************/
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
Timer 0 operation sample
Two-pulse-width measurement sample by free-running
Measurement results to be up to 16 bits and not checked for errors
Result area at TI00 side
data[0]: End flag
data[1]: Measurement results (pulse width)
data[2]: Previous read value
Result area at TI01 side
data[3]: End flag
data[4]: Measurement results (pulse width)
data[5]: Previous read value
/******************************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#pragma interrupt INTTM00 intervalint rb2
#pragma interrupt INTTM01 intervalint2 rb2
unsigned int data[6];
/* Data area */
void main(void)
{
unsigned int length,length2;
PCC = 0x0;
data[0] = 0;
/* Set high-speed operation mode */
/* Clear data area */
data[1] = 0;
data[2] = 0;
data[3] = 0;
data[4] = 0;
data[5] = 0;
/* Set port */
PM7.0 = 1;
PM7.1 = 1;
/* Set P70 as input */
/* Set P71 as input */
/* Set interrupt */
TMMK01 = 0;
TMMK00 = 0;
/* Cancel INTTM01 interrupt mask */
/* Cancel INTTM00 interrupt mask */
/* Set timer 0 */
PRM0 = 0b11110010;
/* Both rising and falling edges */
/* Count clock is fx/2^6
*/
CRC0 = 0b00000101;
TMC0 = 0b00000100;
EI();
/* Set CR00 and CR01 to capture register */
/* Start in free-run mode */
while(1){
/* Dummy loop */
if(data[0] != 0)
{
/* TI00 measurement completion check */
TMMK01 = 1;
/* INTTM01 interrupt prohibited for
exclusive operation */
length = data[1];
data[0] = 0;
/* Read measurement results */
/* Clear end flag */
TMMK01 = 0;
/* Exclusive operation completed */
}
if(data[3] != 0)
/* TI01 measurement completion check */
{
TMMK00 = 1;
/* INTTM00 interrupt prohibited for
exclusive operation */
length2 = data[4];
data[3] = 0;
/* Read measurement results */
/* Clear end flag */
TMMK00 = 0;
/* Exclusive operation completed */
}
}
}
User’s Manual U16035EJ5V0UD
130
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
/* INTTM00 interrupt function */
void intervalint()
{
unsigned int work;
/******************************************************/
/*
*/
*/
*/
/* Define variables required for interrupt here
/*
/******************************************************/
work = CR00;
/* Read capture value */
data[4] = work - data[5];
data[5] = work;
/* Calculate and update interval */
/* Update read value */
data[3] = 0xffff;
/* Set measurement completion flag */
/********************************************************/
/*
*/
*/
*/
/* Describe processing required for interrupt below
/*
/********************************************************/
}
/* INTTM01 interrupt function */
void intervalint2()
{
unsigned int work;
/******************************************************/
/*
*/
*/
*/
/* Define variables required for interrupt here
/*
/******************************************************/
work = CR01;
/* Read capture value */
data[1] = work - data[2];
data[2] = work;
/* Calculate and update interval */
/* Update read value */
data[0] = 0xffff;
/* Set measurement completion flag */
/********************************************************/
/*
*/
*/
*/
/* Describe processing required for interrupt below
/*
/********************************************************/
}
User’s Manual U16035EJ5V0UD
131
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.5.4 Pulse width measurement by restart
/**************************************************************************/
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
Timer 0 operation sample
Pulse width measurement example by restart
Measurement results up to 16 bits, not to be checked for errors */
data[0]: End flag
data[1]: Measurement results (pulse width)
data[2]: Previous read value
*/
*/
*/
*/
/**************************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#pragma interrupt INTTM01 intervalint rb2
unsigned int data[3];
/* Data area */
void main(void)
{
unsigned int length;
PCC = 0x0;
/* Set high-speed operation mode */
data[0] = 0;
data[1] = 0;
data[2] = 0;
/* Set port */
PM7.0 = 1;
/* Set P70 as input */
/* Set interrupt */
TMMK01 = 0;
/* Cancel INTTM01 interrupt mask */
/* Set timer 0 */
PRM0 = 0b00110010;
/* Both rising and falling edges */
/* Count clock is fx/2^6
/* Set CR01 to capture register
*/
*/
CRC0 = 0b00000100;
TMC0 = 0b00001000;
EI();
/* Clear & start at TI00 valid edge */
while(1){
/* Dummy loop */
if(data[0] != 0)
/* Wait for TI00 measurement completion */
{
TMMK01 = 1;
/* Prohibit INTTM01 interrupt for
exclusive operation */
length = data[1]+data[2];
/* Cycle calculation based on
measurement results */
data[0] = 0;
TMMK01 = 0;
/* Clear end flag */
/* Exclusive operation completed */
}
}
}
/* Timer 0 interrupt function */
void intervalint()
{
/******************************************************/
/*
*/
*/
*/
/* Define variables required for interrupt here
/*
/******************************************************/
data[2] = data[1];
data[1] = CR01;
/* Update old data */
/* Update read value */
data[0] = 0xffff;
/* Set measurement completion flag */
/********************************************************/
/*
*/
*/
*/
/* Describe processing required for interrupt below
/*
/********************************************************/
}
User’s Manual U16035EJ5V0UD
132
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.5.5 PPG output
/******************************************************************************/
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
Timer 0 PPG mode setting example
Cycle set to 130 as intervalTM0
Active period set to 65 as active_time
Array ppgdata prepared as data area for rewriting
[0]: Active period (0000: no change, 0xffff: stop)
[1]: Cycle (0000: no change)
ppgdata to be checked at every INTTM00, and changed if required.
Therefore, if change is required, set the change data in ppgdata.
When changed, ppgdata cleared to 0000.
/******************************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#define intervalTM0 130
#define active_time 65
/* Cycle data to be set to CR00 */
/* Initial value data of CR01 */
#pragma interrupt INTTM00 ppgint rb2
unsigned int ppgdata[2];
/* Data area to be set to timer 0 */
void main(void)
{
PCC = 0x0;
/* Set high-speed operation mode */
ppgdata[0] = 0;
ppgdata[1] = 0;
/* Set port */
P7 = 0b11111110;
PM7.0 = 0;
/* Clear P70 */
/* Set P70 to output */
/* Set interrupt */
TMMK00 = 0;
/* Cancel INTTM00 interrupt mask */
/* Set timer 0 */
PRM0 = 0b00000010;
CRC0 = 0b00000000;
CR00 = intervalTM0;
CR01 = active_time;
TOC0 = 0b00010111;
/* Count clock is fx/2^6 */
/* Set CR00 and CR01 to compare register */
/* Set initial value of cycle */
/* Set initial value of active period */
/* Inverted on match between CR00 and CR01,
initial value L */
TMC0 = 0b00001100;
EI();
/* Clear & start on match between TM0 and CR00 */
while(1);
}
/* Timer 0 interrupt function */
void ppgint()
{
unsigned int work;
work = ppgdata[0];
if (work != 0)
{
CR01 = work;
ppgdata[0] = 0;
if (work == 0xffff)
{
TMC0 = 0b00000000;
/* Stop timer */
}
}
work = ppgdata[1];
if (work != 0)
{
CR00 = work;
ppgdata[1]=0;
}
}
User’s Manual U16035EJ5V0UD
133
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
6.6 Cautions for 16-Bit Timer/Event Counter 0
(1) Timer start errors
An error of up to one clock may occur in the time required for a match signal to be generated after timer start.
This is because 16-bit timer counter 0 (TM0) is started asynchronously to the count clock.
Figure 6-28. Start Timing of 16-Bit Timer Counter 0 (TM0)
Count clock
0000H
0001H
0002H
0003H
0004H
TM0 count value
Timer start
(2) 16-bit timer capture/compare register setting (clear & start mode entered on match between TM0 and
CR00)
Set 16-bit timer capture/compare registers 00, 01 (CR00, CR01) to other than 0000H. This means a 1-pulse
count operation cannot be performed.
(3) Capture register data retention timing
If the valid edge of the TI00 pin is input during 16-bit timer capture/compare register 01 (CR01) read, CR01
performs a capture operation but, the read value at this time is not guaranteed. The interrupt request signal
(INTTM01) is generated upon detection of the valid edge.
Figure 6-29. Capture Register Data Retention Timing
Count clock
TM0 count
Edge input
N
N + 1
N + 2
M
M + 1
M + 2
INTTM01
Capture read signal
CR01 capture value
X
N + 1
M + 1
Capture
Read value not guaranteed
though capture operation performed
(4) Valid edge setting
Set the valid edge of the TI00 pin after clearing bits 2 and 3 (TMC02 and TMC03) of 16-bit timer mode control
register 0 (TMC0) to 0, 0, respectively, and then stopping the timer operation. The valid edge is set by bits 4
and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0).
User’s Manual U16035EJ5V0UD
134
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(5) Operation of OVF0 flag
<1> The OVF0 flag is also set to 1 in the following case.
Either of the clear & start mode entered on a match between TM0 and CR00, clear & start at the valid edge
of TI00, or free-running mode is selected.
↓
CR00 is set to FFFFH.
↓
When TM0 is counted up from FFFFH to 0000H.
Figure 6-30. Operation Timing of OVF0 Flag
Count clock
CR00
TM0
FFFFH
FFFEH
FFFFH
0000H
0001H
OVF0
INTTM00
<2> Even if the OVF0 flag is cleared before the next count clock is counted (before TM0 becomes 0001H) after
the occurrence of a TM0 overflow, the OVF0 flag is reset newly and clear is disabled.
(6) Conflicting operations
When the 16-bit timer capture/compare register (CR00/CR01) is used as a compare register, if the write period
and the match timing of 16-bit timer counter 0 (TM0) conflict, match determination is not successfully done. Do
not perform a write operation of CR00/CR01 near the match timing.
(7) Timer operation
<1> Even if 16-bit timer counter 0 (TM0) is read, the value is not captured by 16-bit timer capture/compare
register 01 (CR01).
<2> Regardless of the CPU’s operation mode, when the timer stops, the signals input to pins TI00/TI01 are
not acknowledged.
User’s Manual U16035EJ5V0UD
135
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 0
(8) Capture operation
<1> If TI00 is specified as the valid edge of the count clock, a capture operation by the capture register specified
as the trigger for TI00 is not possible.
<2> If both the rising and falling edges are selected as the valid edges of TI00, capture is not performed.
<3> To ensure the reliability of the capture operation, the capture trigger requires a pulse longer than two cycles
of the count clock selected by prescaler mode register 0 (PRM0).
Figure 6-31. CR01 Capture Operation with Rising Edge Specified
Count clock
TM0
N − 3
N − 2
N − 1
N
N + 1
TI00
Rising edge detection
N
CR01
INTTM01
<4> The capture operation is performed at the fall of the count clock. An interrupt request input (INTTM0n),
however, occurs at the rise of the next count clock.
Remark n = 0 or 1
(9) Compare operation
<1> When the 16-bit timer capture/compare register (CR00/CR01) is overwritten during timer operation, match
interrupt may be generated or the clear operation may not be performed normally if that value is close to
or large than the timer value.
<2> The capture operation may not be performed for CR00/CR01 set in compare mode even if a capture trigger
is input.
(10) Edge detection
<1> If the TI00 pin or the TI01 pin is high level immediately after system reset and the rising edge or both the
rising and falling edges are specified as the valid edge for the TI00 pin or TI01 pin to enable 16-bit timer
counter 0 (TM0) operation, a rising edge is detected immediately. Be careful when pulling up the TI00 pin
or the TI01 pin. However, the rising edge is not detected at restart after the operation has been stopped
once.
<2> The sampling clock used to remove noise differs when a TI00 valid edge is used as the count clock and
when it is used as a capture trigger. In the former case, the count clock is fX/23, and in the latter case the
count clock is selected by prescaler mode register 0 (PRM0). The capture operation is not performed until
the valid edge is sampled and the valid level is detected twice, thus eliminating noise with a short pulse
width.
(11) STOP mode or main system clock stop mode setting
Except when TI00, TI01 input is selected, stop the timer operation before setting STOP mode or main system
clock stop mode; otherwise the timer may malfunction when the main system clock starts.
User’s Manual U16035EJ5V0UD
136
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.1 Functions of 8-Bit Timer/Event Counters 50, 51
8-bit timer/event counters 50, 51 (TM50, TM51) have the following two modes.
(1) Mode using 8-bit timer/event counters 50, 51 alone (discrete mode)
The timer operates as 8-bit timer/event counter 50 or 51.
It has the following functions.
<1> Interval timer
Interrupt requests are generated at the preset interval.
•
Number of counts: 1 to 256
<2> External event counter
The number of pulses with high/low level widths of the signal input externally can be measured.
<3> Square-wave output
A square wave with an arbitrary frequency can be output.
•
Cycle: (1 × 2 to 256 × 2) × Cycles of count clock
<4> PWM output
A pulse with an arbitrary duty ratio can be output.
•
•
Cycle:
Count clock × 256
Duty ratio: Set value of compare register/256
(2) Mode using cascade connection (16-bit resolution: cascade connection mode)
The timer operates as a 16-bit timer/event counter by combining two 8-bit timer/event counters.
It has the following functions.
•
•
•
Interval timer with 16-bit resolution
External event counter with 16-bit resolution
Square-wave output with 16-bit resolution
Figures 7-1 and 7-2 show diagrams of 8-bit timer/event counters 50 and 51 block.
137
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-1. Block Diagram of 8-Bit Timer/Event Counter 50
Internal bus
8-bit timer compare
register 50 (CR50)
Selector
Note 2
INTTM50
TI50/TO50/P72Note 1
Match
fX
fX/22
fX/24
fX/26
fX/28
fX/210
S
INV
Q
8-bit timer
counter 50 (TM50)
OVF
TO50/TI50/
P72Note 1
R
Clear
Note 3
S
R
Invert
level
3
Output latch
(P72)
PM72
Selector
TCE50 TMC506 TMC504 LVS50 LVR50 TMC501 TOE50
TCL502 TCL501 TCL500
8-bit timer mode control
register 50 (TMC50)
Timer clock selection
register 50 (TCL50)
Internal bus
Figure 7-2. Block Diagram of 8-Bit Timer/Event Counter 51
Internal bus
8-bit timer
compare register
Selector
Note 2
INTTM51
51 (CR51)
TI51/TO51/P73Note 1
Match
fX/2
fX/23
fX/25
fX/27
fX/29
fX/211
S
INV
Q
8-bit timer
counter 51
(TM51)
OVF
TO51/TI51/
P73Note 1
R
Clear
Note 3
S
R
Invert
level
3
Output latch
(P73)
PM73
Selector
TCE51 TMC516 TMC514 LVS51 LVR51 TMC511 TOE51
TCL512 TCL511 TCL510
8-bit timer mode control
register 51 (TMC51)
Timer clock selection
register 51 (TCL51)
Internal bus
Notes 1. The respective combinations, TI50 input and TO50 output, and TI51 input and TO51 output, cannot be
used at the same time.
2. Timer output F/F
3. PWM output F/F
138
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.2 Configuration of 8-Bit Timer/Event Counters 50, 51
8-bit timer/event counters 50, 51 include the following hardware.
Table 7-1. Configuration of 8-Bit Timer/Event Counters 50, 51
Item
Timer counter
Register
Configuration
8-bit timer counter 5n (TM5n)
8-bit timer compare register 5n (CR5n)
Timer input
Timer output
TI5n
TO5n
Control registers Timer clock select register 5n (TCL5n)
8-bit timer mode control register 5n (TMC5n)
Port mode register 7 (PM7)
Port 7 (P7)
(1) 8-bit timer counter 5n (TM5n: n = 0 or 1)
TM5n is an 8-bit read-only register that counts the count pulses.
The counter is incremented in synchronization with the rising edge of the count clock.
When TM50 and TM51 can be connected in cascade and used as a 16-bit timer, they can be read by a 16-bit
memory manipulation instruction. However, since they are connected by an internal 8-bit bus, TM50 and TM51
are read separately twice in that order. Thus, take reading during the count change into consideration and
compare them by reading twice. When the count value is read during operation, the count clock input is
temporarily stoppedNote, and then the count value is read. In the following situations, count value is set to 00H.
<1> RESET input
<2> When TCE5n is cleared
<3> When TM5n and CR5n match in the clear & start mode entered on a match between TM5n and CR5n.
Note An error may occur in the count. Select a count clock that has a high/low level longer than two cycles
of the CPU clock.
Caution In cascade connection mode, the count value is reset to 0000H when TCE50 of the lowest timer
is cleared.
(2) 8-bit timer compare register 5n (CR5n: n = 0 or 1)
When CR5n is used as a compare register in other than PWM mode, the value set in CR5n is constantly compared
with the 8-bit timer counter (TM5n) count value, and an interrupt request (INTTM5n) is generated if they match.
In PWM mode, the TO5n pin goes to the active level by the overflow of TM5n. When the values of TM5n and
CR5n match, the TO5n pin goes to the inactive level.
It is possible to rewrite the value of CR5n within 00H to FFH during a count operation.
When TM50 and TM51 can be connected in cascade and used as a 16-bit timer, CR50 and CR51 operate as
a 16-bit compare register. This register compares the count value with the register value, and if the values match,
an interrupt request (INTTM50) is generated. The INTTM51 interrupt request is also generated at this time. Thus,
mask the INTTM51 interrupt request. Set CR5n using an 8-bit memory manipulation instruction. CR5n is
undefined when RESET is input.
Caution In cascade connection mode, stop the timer operation before setting data.
Remark n = 0 or 1
139
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.3 Registers Controlling 8-Bit Timer/Event Counters 50, 51
The following four registers are used to control 8-bit timer/event counters 50, 51.
•
•
•
•
Timer clock select register 5n (TCL5n)
8-bit timer mode control register 5n (TMC5n)
Port mode register 7 (PM7)
Port 7 (P7)
Remark n = 0 or 1
(1) Timer clock select register 5n (TCL5n: n = 0, 1)
This register sets the count clock of 8-bit timer/event counter 5n and the valid edge of TI50, TI51 input.
TCL5n is set by an 8-bit memory manipulation instruction.
RESET input clears TCL5n to 00H.
Figure 7-3. Format of Timer Clock Select Register 50 (TCL50)
Address: FF71H
Symbol
After reset: 00H
R/W
5
7
0
6
0
4
0
3
0
2
1
0
TCL50
0
TCL502
TCL501
TCL500
TCL502
TCL501
TCL500
Count clock selection
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
TI50 falling edge
TI50 rising edge
fX
(12 MHz)
(3 MHz)
2
fX/2
fX/2
fX/2
fX/2
fX/2
4
(750 kHz)
(187 kHz)
(46.8 kHz)
(11.7 kHz)
6
8
10
Cautions 1. When rewriting TCL50 to other data, stop the timer operation beforehand.
2. Be sure to set bits 3 to 7 to 0.
Remarks 1. When cascade connection is used, only TCL50 is valid for count clock setting.
2. fX: Main system clock oscillation frequency
3. Figures in parentheses are for operation with fX = 12 MHz.
140
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-4. Format of Timer Clock Select Register 51 (TCL51)
Address: FF79H
Symbol
After reset: 00H
R/W
5
7
0
6
0
4
0
3
0
2
1
0
TCL51
0
TCL512
TCL511
TCL510
TCL512
TCL511
TCL510
Count clock selection
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
TI51 falling edge
TI51 rising edge
fX/2
fX/2
fX/2
fX/2
fX/2
fX/2
(6 MHz)
3
(1.5 MHz)
(375 kHz)
(93.7 kHz)
(23.4 kHz)
(5.85 kHz)
5
7
9
11
Cautions 1. When rewriting TCL51 to other data, stop the timer operation beforehand.
2. Be sure to set bits 3 to 7 to 0.
Remarks 1. When cascade connection is used, only TCL50 is valid for count clock setting.
2. fX: Main system clock oscillation frequency
3. Figures in parentheses are for operation with fX = 12 MHz.
(2) 8-bit timer mode control register 5n (TMC5n: n = 0, 1)
TMC5n is a register that makes the following six settings.
<1> 8-bit timer counter 5n (TM5n) count operation control
<2> 8-bit timer counter 5n (TM5n) operating mode selection
<3> Discrete mode/cascade connection mode selection (TMC51 only)
<4> Timer output F/F (flip flop) status setting
<5> Active level selection in timer F/F control or PWM (free-running) mode.
<6> Timer output control
TMC5n is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears TMC5n to 00H.
141
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-5. Format of 8-Bit Timer Mode Control Register 50 (TMC50)
Address: FF70H
After reset: 00H
6
R/W
5
Symbol
TMC50
<7>
TCE50
4
0
<3>
<2>
1
<0>
TMC506
0
LVS50
LVR50
TMC501
TOE50
TCE50
TM50 count operation control
0
1
After clearing to 0, count operation disabled (prescaler disabled)
Count operation start
TMC506
TM50 operating mode selection
Clear and start mode by match between TM50 and CR50
PWM (free-running) mode
0
1
LVS50
LVR50
Timer output F/F status setting
0
0
1
1
0
1
0
1
No change
Timer output F/F reset (0)
Timer output F/F set (1)
Setting prohibited
In other modes (TMC506 = 0)
Timer F/F control
In PWM mode (TMC506 = 1)
Active level selection
TMC501
0
1
Inversion operation disabled
Inversion operation enabled
Active high
Active low
TOE50
Timer output control
0
1
Output disabled (port mode)
Output enabled
Remarks 1. In PWM mode, PWM output will be inactive because TCE50 = 0.
2. If LVS50 and LVR50 are read after data is set, 0 is read.
142
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-6. Format of 8-Bit Timer Mode Control Register 51 (TMC51)
Address: FF78H
After reset: 00H
6
R/W
5
Symbol
TMC51
<7>
TCE51
4
<3>
<2>
1
<0>
TMC516
0
TMC514
LVS51
LVR51
TMC511
TOE51
TCE51
TM51 count operation control
0
1
After clearing to 0, count operation disabled (prescaler disabled)
Count operation start
TMC516
TM51 operating mode selection
Clear and start mode by match between TM51 and CR51
PWM (free-running) mode
0
1
TMC514
Discrete mode/cascade connection mode selection
0
1
Discrete mode
Cascade connection mode (TM50: Lower timer, TM51: Higher timer)
LVS51
LVR51
Timer output F/F status setting
0
0
1
1
0
1
0
1
No change
Timer output F/F reset (0)
Timer output F/F set (1)
Setting prohibited
In other modes (TMC516 = 0)
Timer F/F control
In PWM mode (TMC516 = 1)
Active level selection
TMC511
0
1
Inversion operation disabled
Inversion operation enabled
Active high
Active low
TOE51
Timer output control
0
1
Output disabled (port mode)
Output enabled
Remarks 1. In PWM mode, PWM output will be inactive because TCE51 = 0.
2. If LVS51 and LVR51 are read after data is set, 0 is read.
143
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
(3) Port mode register 7 (PM7)
This register sets port 7 input/output in 1-bit units.
When using the P72/TO50/TI50 and P73/TI51/TO51 pins for timer output, set PM72, PM73, and the output latches
of P72 and P73 to 0.
When using the P72/TO50/TI50 and P73/TI51/TO51 pins as timer input, set PM72 and PM73 to 1. At this time,
the output latches of P72 and P73 may be either 0 or 1.
PM7 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM7 to FFH.
Figure 7-7. Format of Port Mode Register 7 (PM7)
Address: FF27H
After reset: FFH
R/W
Symbol
PM7
7
1
6
1
5
4
3
2
1
0
PM75
PM74
PM73
PM72
PM71
PM70
PM7n
P7n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
144
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.4 Operations of 8-Bit Timer/Event Counters 50, 51
7.4.1 Operation as 8-bit interval timer
The 8-bit timer/event counters operate as interval timers that generate interrupt requests repeatedly at intervals
of the count value preset to 8-bit timer compare register 5n (CR5n).
When the count value of 8-bit timer counter 5n (TM5n) matches the value set to CR5n, counting continues with
the TM5n value cleared to 0 and an interrupt request signal (INTTM5n) is generated.
The count clock of TM5n can be selected with bits 0 to 2 (TCL5n0 to TCL5n2) of timer clock select register 5n
(TCL5n).
[Setting]
<1> Set the registers.
•
•
•
TCL5n: Select count clock.
CR5n: Compare value
TMC5n: Count operation stop, clear & start mode on match between TM5n and CR5n.
(TMC5n = 0000×××0B × = don’t care)
<2> After TCE5n = 1 is set, count operation starts.
<3> If the values of TM5n and CR5n match, the timer output flip-flop inverts. Also, INTTM5n is generated and
TM5n is cleared to 00H.
<4> INTTM5n is generated repeatedly at the same interval.
Set TCE5n to 0 to stop the count operation.
Remark n = 0 or 1
Figure 7-8. Interval Timer Operation Timing (1/3)
(a) Basic operation
t
Count clock
TM5n count value
CR5n
00H 01H
Start count
N
N
00H 01H
N
00H 01H
N
N
Clear
Clear
N
N
TCE5n
INTTM5n
Interrupt acknowledged
Interval time
Interrupt acknowledged
Interval time
TO5n
Remarks 1. Interval time = (N + 1) × t
N = 00H to FFH
2. n = 0 or 1
145
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-8. Interval Timer Operation Timing (2/3)
(b) When CR5n = 00H
t
Count clock
TM5n 00H
CR5n
00H 00H
00H 00H
TCE5n
INTTM5n
TO5n
Interval time
(c) When CR5n = FFH
t
Count clock
TM5n
01H
FEH FFH 00H
FFH
FEH FFH 00H
FFH
CR5n
FFH
TCE5n
INTTM5n
Interrupt acknowledged
Interrupt
acknowledged
TO5n
Interval time
Remark n = 0 or 1
146
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-8. Interval Timer Operation Timing (3/3)
(d) Operated by CR5n transition (M < N)
Count clock
TM5n
N
H
00H
M
N
FFH 00H
M
M
00H
CR5n
N
TCE5n
INTTM5n
TO5n
CR5n transition
TM5n overflows since M < N
(e) Operated by CR5n transition (M > N)
Count clock
TM5n
N–1
N
N
00H 01H
N
M–1
M
00H 01H
CR5n
M
H
TCE5n
INTTM5n
TO5n
CR5n transition
Remark n = 0 or 1
147
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.4.2 Operation as external event counter
The external event counter counts the number of external clock pulses to be input to TI5n using 8-bit timer counter
5n (TM5n).
TM5n is incremented each time the valid edge specified by timer clock select register 5n (TCL5n) is input. Either
the rising or falling edge can be selected.
When the TM5n count value matches the value of 8-bit timer compare register 5n (CR5n), TM5n is cleared to 0
and an interrupt request signal (INTTM5n) is generated.
Whenever the TM5n count value matches the value of CR5n, INTTM5n is generated.
[Setting]
<1> Set each register.
•
TCL5n: Edge selection of TI5n input
Rising edge of TI5n → TCL5n = 00H
Falling edge of TI5n → TCL5n = 01H
•
•
CR5n: Compare value
TMC5n: Count operation stop, clear & start mode on match between TM5n and CR5n, timer F/F inverted
operation disable, timer output disable
(TMC5n = 0000 ××00B, × = don’t care)
<2> When TCE5n = 1 is set, the number of pulses input from TI5n is counted.
<3> When the values of TM5n and CR5n match, INTTM5n is generated (TM5n is cleared to 00H).
<4> Each time the values of TM5n and CR5n match, INTTM5n is generated.
Figure 7-9. External Event Counter Operation Timing (with Rising Edge Specified)
TI5n
TM5n count value
CR5n
00H 01H 02H 03H 04H 05H
N–1
N
00H 01H 02H 03H
N
INTTM5n
Remarks 1. N = 00H to FFH
2. n = 0 or 1
148
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.4.3 Operation as square-wave output (8-bit resolution)
A square wave with any selected frequency is output at intervals determined by the value preset to 8-bit timer
compare register 5n (CR5n).
The TO5n pin output status is reversed at intervals determined by the count value preset to CR5n by setting bit
0 (TOE5n) of 8-bit timer mode control register 5n (TMC5n) to 1. This enables a square wave with any selected
frequency to be output (duty = 50%).
[Setting]
<1> Set each register.
•
•
•
•
Set port latches (P72, P73)Note and port mode registers (PM72, PM73)Note to 0.
TCL5n: Select count clock
CR5n: Compare value
TMC5n: Count operation stop, clear & start mode on match between TM5n and CR5n
LVS5n LVR5n
Timer Output F/F Status Setting
High-level output
Low-level output
1
0
0
1
Timer output F/F reverse enable
Timer output enable → TOE5n = 1
(TMC5n = 00001011B or 00000111B)
<2> After TCE5n = 1 is set, the count operation starts.
<3> Timer output F/F is reversed by match between TM5n and CR5n. After INTTM5n is generated, TM5n is
cleared to 00H.
<4> Timer output F/F is reversed at the same interval and a square wave is output from TO5n.
The frequency is as follows.
•
Frequency = fCNT/2 (N + 1)
(N = 00H to FFH, fCNT: Count clock)
Note 8-bit timer/event counter 50: P72, PM72
8-bit timer/event counter 51: P73, PM73
149
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-10. Square-Wave Output Operation Timing
Count clock
TM5n count value
00H
01H
02H
N–1
N
00H
01H
02H
N–1
N
00H
Count start
N
CR5n
TO5nNote
Note The TO5n output initial value can be set by bits 2 and 3 (LVR5n, LVS5n) of 8-bit timer mode control register
5n (TMC5n).
Remarks 1. N = 00H to FFH
2. n = 0 or 1
7.4.4 Operation as 8-bit PWM output
The 8-bit timer/event counter operates as PWM output when bit 6 (TMC5n6) of 8-bit timer mode control register
5n (TMC5n) is set to 1.
The duty ratio pulse is determined by the value set to 8-bit timer compare register 5n (CR5n).
Set the active level width of the PWM pulse to CR5n. The active level can be selected with bit 1 of TMC5n (TMC5n1).
The count clock can be selected with bits 0 to 2 (TCL5n0 to TCL5n2) of timer clock select register 5n (TCL5n).
PWM output enable/disable can be selected with bit 0 of TMC5n (TOE5n).
•
•
Frequency = Count clock × 256
Set value of compare register
Duty ratio =
256
Caution CR5n can be rewritten in PWM mode only once per cycle.
Remark n = 0 or 1
150
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
(1) PWM output basic operation
[Setting]
<1> Set each register.
•
•
•
•
Set port latches (P72, P73)Note, port mode registers (PM72, PM73)Note to 0.
TCL5n: Count clock selection
CR5n: Compare value
TMC5n: Count operation stop, PWM mode selection, timer output F/F not changed
TMC5n1
Active Level Selection
Active high
0
1
Active low
Timer output enabled
(TMC5n = 01000001B or 01000011B)
<2> When TCE5n = 1 is set, the count operation is started.
To stop the count operation, set TCE5n to 0.
Note 8-bit timer/event counter 50: P72, PM72
8-bit timer/event counter 51: P73, PM73
[PWM output operation]
<1> PWM output (output from TO5n) outputs an inactive level after the count operation starts until an overflow
occurs.
<2> When an overflow occurs, the active level is output.
The active level is output until CR5n matches the count value of 8-bit timer counter 5n (TM5n).
<3> After CR5n matches the count value, PWM output outputs the inactive level again until an overflow occurs.
<4> Operations <2> and <3> are repeated until the count operation stops.
<5> When the count operation is stopped by setting TCE5n = 0, PWM output becomes the inactive level.
Remark n = 0 or 1
151
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
Figure 7-11. PWM Output Operation Timing
(a) Basic operation (active level = H)
Count clock
TM5n
00H 01H
N
FFH 00H 01H 02H
N
N+1
FFH 00H 01H 02H
M
00H
CR5n
TCE5n
INTTM5n
TO5n
Active level
Inactive level
Active level
(b) CR5n = 0
Count clock
TM5n 00H 01H
FFH 00H 01H 02H
N
N+1 N+2
FFH 00H 01H 02H
M 00H
00H
CR5n
TCE5n
INTTM5n
TO5n
L
Inactive level
Inactive level
(c) CR5n = FFH
Count clock
TM5n
CR5n
M 00H
00H 01H
FFH 00H 01H 02H
N
N+1 N+2
FFH 00H 01H 02H
FFH
TCE5n
INTTM5n
TO5n
Active level
Inactive level
Inactive level
Active level
Inactive level
Remark n = 0 or 1
152
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
(2) Operated by CR5n transition
Figure 7-12. Timing of Operation by Change of CR5n
(a) CR5n value is changed from N to M when TM5n > CR5n
Count clock
TM5n
CR5n
N
N+1 N+2
FFH 00H 01H 02H
M
M+1 M+2
FFH 00H 01H 02H
M
M+1 M+2
N
M
TCE5n
H
INTTM5n
TO5n
CR5n transition (N → M)
(b) CR5n value is changed from N to M when TM5n < CR5n
Count clock
TM5n
N
N+1 N+2
FFH 00H 01H 02H 03H
N
N+1 N+2
FFH 00H 01H 02H
M M+1 M+2
CR5n
N
N
M
TCE5n
H
INTTM5n
TO5n
CR5n transition (N → M)
Remark n = 0 or 1
153
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.4.5 Operation as interval timer (16-bit)
When bit 4 (TMC514) of 8-bit timer mode control register 51 (TMC51) is set to 1, the 16-bit resolution timer/counter
mode is entered.
The 8-bit timer/event counter operates as an interval timer that generates interrupt requests repeatedly at intervals
of the count value preset to the 8-bit timer compare registers (CR50, CR51).
[Setting]
<1> Set each register.
TCL50:
Select count clock for TM50.
Cascade-connected TM51 need not be selected.
Compare value (each value can be set to 00H to FFH)
CR50, CR51:
TMC50, TMC51: Select the clear & start mode entered on a match between TM50 and CR50 (TM51 and
CR51).
TM50 → TMC50 = 0000×××0B ×: don’t care
TM51 → TMC51 = 0001×××0B ×: don’t care
<2> When TMC51 is set to TCE51 = 1 and then TCE50 is set to TCE50 = 1, the count operation starts.
<3> When the values of TM50 and CR50 of the cascade-connected timer match, INTTM50 of TM50 is generated
(TM50 and TM51 are cleared to 00H).
<4> INTTM50 is generated repeatedly at the same interval.
Cautions 1. Stop the timer operation without fail before setting the compare registers (CR50, CR51).
2. INTTM51 of TM51 is generated when the TM51 count value matches CR51, even if cascade
connection is used. Be sure to mask TM51 to disable interrupts.
3. Set TCE50 and TCE51 in order of TM51 then TM50.
4. Count restart/stop can only be controlled by setting TCE50 of TM50 to 1/0.
Figure 7-13 shows an example of 16-bit resolution cascade connection mode timing.
Figure 7-13. 16-Bit Resolution Cascade Connection Mode
Count clock
TM50
TM51
00H
00H
01H
N
N+1
FFH 00H
01H
FFH 00H
02H
FFH 00H 01H
M–1
N
00H 01H
00H
A
B
00H
00H
M
N
CR50
CR51
M
TCE50
TCE51
INTTM50
TO50
Interval time
Interrupt request
generation
Level reverse
Counter clear
Operation
stop
Operation enable
Count start
154
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.5 Program List
Caution Thefollowingsampleprogramisshownasanexampletodescribetheoperationofsemiconductor
products and their applications. Therefore, when applying the following information to your
devices, design the devices after performing evaluation under your own responsibility.
7.5.1 Interval timer (8-bit)
/*************************************************************************************/
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
Timer 50 operation sample
Interval timer setting example (frequency change by interrupt processing)
data[0]: Data set flag (value changed when other than 00)
data[1]: Set data
/*************************************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#pragma interrupt INTTM50 intervalint rb2
unsigned char data[2];
/* Data area */
void main(void)
{
PCC = 0x0;
data[0] = 0;
data[1] = 0;
/* Set high-speed operation mode */
/* Clear data area */
/* Set port
*/
P7 = 0b11111011;
PM7.2 = 0;
/* When using TO50 */
/* Set P72 to output */
/* Set interrupt
*/
TMMK50 = 0;
/* Clear INTTM50 interrupt mask */
/* Set timer 50
*/
TMC50 = 0b00000111;
CL50 = 0b00000101;
/* Clear & start mode, initial value L */
/* Both rising and falling edges */
/* Count clock is fx/2^6 */
CR50 = 131;
TCE50 = 1;
/* Set interval to 1 ms as initial value */
/* Timer start */
EI();
while(1);
}
/* Dummy loop */
/* INTTM50 interrupt function */
void intervalint()
{
if(data[0] != 0)
{
CR50 = data[1];
data[0] = 0;
}
/* Set new set value */
/* Clear request flag */
}
155
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.5.2 External event counter
/***************************************************************/
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
Timer 50 operation sample
Event counter setting example
data: Count up flag
/***************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#pragma interrupt INTTM50 intervalint rb2
unsigned char data;
void main(void)
/* Data area */
{
PCC = 0x0;
data = 0;
/* Set high-speed operation mode */
/* Clear data area */
/* Set port
*/
PM7.2 = 1;
/* Set P72 to input */
/* Set interrupt
*/
TMMK50 = 0;
/* Clear INTTM50 interrupt mask */
/* Set timer 50
*/
*/
TMC50 = 0b00000000;
TCL50 = 0b00000001;
CR50 = 0x10;
TCE50 = 1;
/* Clear & start mode
*/
/* Specify rising edge of TI50
/* Set N = 16 as initial value
/* Timer start
*/
*/
EI();
/*************************************************************/
/*
/*
/*
*/
*/
*/
Describe the processing to be executed
/*************************************************************/
while(data == 0); /* Wait for count up */
/*************************************************************/
/*
/*
/*
*/
*/
*/
Describe the processing after count up below
/*************************************************************/
}
/* INTTM50 interrupt function */
void intervalint()
{
data = 0xff;
TCE50 = 0;
/* Set count up flag
/* Timer stop
*/
*/
}
156
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.5.3 Interval timer (16-bit)
/***************************************************************/
/*
/*
/*
/*
*/
*/
*/
*/
Timer 5 operation sample
Cascade connection setting example
/***************************************************************/
#pragma sfr
#pragma EI
#pragma DI
#define intervalTM5 130
/* Cycle data to be set to CR */
#pragma interrupt INTTM50 ppgint rb2
unsigned char ppgdata[2];
/* Data area to be set to timer 5 */
void main(void)
{
int interval;
interval = intervalTM5;
PCC = 0x0;
ppgdata[0] = 0;
ppgdata[1] = 0;
/* Select high-speed operation mode */
/* Clear CR50 data */
/* Clear CR51 data */
/* Set port */
P7 = 0b11111011;
PM7.2 = 0;
/* Clear P72 */
/* Set P72 to output */
/* Set interrupt */
TMMK50 = 0;
TMMK51 = 1;
/* Clear INTTM50 interrupt mask */
/* Set INTTM51 interrupt mask */
/* Set timer 5 */
TCL50 = 0b00000101;
CR50 = interval & 0xff;
CR51 = interval >> 8;
TMC50 = 0b00000111;
TMC51 = 0b00010000;
TCE51 = 1;
/* Count clock is fx/2^6 */
/* Set lower compare register to CR50 */
/* Set higher compare register to CR51 */
/* Inverted on match, initial value L */
/* Cascade mode */
TCE50 = 1;
/* Timer starts */
EI();
while(1);
}
/* Timer 5 interrupt function */
void ppgint()
{
unsigned int work;
work = ppgdata[0]+ppgdata[1]*0x100;
if (work != 0)
{
TCE50 =0;
CR51 = work >> 8;
CR50 = work & 0xff;
ppgdata[0] = 0;
ppgdata[1] = 0;
if (work != 0xffff)
{
TCE50 = 1; /* Timer resumes */
}
}
}
157
User’s Manual U16035EJ5V0UD
CHAPTER 7 8-BIT TIMER/EVENT COUNTERS 50, 51
7.6 Cautions for 8-Bit Timer/Event Counters 50, 51
(1) Timer start errors
An error of up to one clock may occur in the time required for a match signal to be generated after timer start.
This is because 8-bit timer counter 5n (TM5n) is started asynchronously to the count pulse.
Figure 7-14. Start Timing of 8-Bit Timer/Counter 5n (TM5n)
Count pulse
TM5n count
00H
Timer start
01H
02H
03H
04H
(2) Setting STOP mode or main system clock stop mode
Except when TI5n input is selected, always set TCE5n = 0 before setting the STOP mode or main system clock
stop mode.
The timer may malfunction when the main system clock starts oscillating.
(3) TM5n (n = 0 or 1) reading during timer operation
When reading TM5n during operation, the count clock stops temporarily, so select a count clock with a high/low-
level waveform longer than two cycles of the CPU clock. For example, in the case where the CPU clock (fCPU)
is fx, when the selected count clock is fx/4 or below, it can be read.
Remark n = 0 or 1
158
User’s Manual U16035EJ5V0UD
CHAPTER 8 WATCH TIMER
8.1 Functions of Watch Timer
The watch timer has the following functions.
(1) Watch timer
When the main system clock or subsystem clock is used, interrupt requests (INTWT) are generated at 214/fW
second intervals.
(2) Interval timer
Interrupt requests (INTWTI) are generated at the preset time interval.
For the interval time, refer to Table 8-2.
The watch timer and the interval timer can be used simultaneously.
Figure 8-1 shows the watch timer block diagram.
Figure 8-1. Block Diagram of Watch Timer
Clear
f
/27
X
5-bit counter
INTWT
INTWTI
9-bit prescaler
f
W
fW
f
W
f
W
fW
fW
f
W
29
Clear
24 25 26 27 28
fXT
WTM7 WTM6 WTM5 WTM4 WTM1 WTM0
Watch timer operation
mode register (WTM)
Internal bus
Remark fW: Watch timer clock frequency (fX/27 or fXT)
fX: Main system clock oscillation frequency
fXT: Subsystem clock oscillation frequency
User’s Manual U16035EJ5V0UD
159
CHAPTER 8 WATCH TIMER
8.2 Configuration of Watch Timer
The watch timer includes the following hardware.
Table 8-1. Configuration of Watch Timer
Item
Counter
Configuration
5 bits × 1
9 bits × 1
Prescaler
Control register
Watch timer operation mode register (WTM)
160
User’s Manual U16035EJ5V0UD
CHAPTER 8 WATCH TIMER
8.3 Register Controlling Watch Timer
The watch timer operation mode register (WTM) is used to control the watch timer.
•
Watch timer operation mode register (WTM)
This register sets the watch timer count clock, enables/disables operation, prescaler interval time, and 5-bit
counter operation control.
WTM is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears WTM to 00H.
Figure 8-2. Format of Watch Timer Operation Mode Register (WTM)
Address: FF41H
Symbol
After reset: 00H
6
R/W
5
7
4
3
0
2
0
<1>
<0>
WTM
WTM7
WTM6
WTM5
WTM4
WTM1
WTM0
WTM7
Watch timer count clock selection
7
0
1
fX/2 (93.7 kHz)
fXT (32.768 kHz)
WTM6
WTM5
WTM4
Prescaler interval time selection
4
0
0
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
2 /fW
5
2 /fW
6
2 /fW
7
2 /fW
8
2 /fW
9
2 /fW
Other than above
Setting prohibited
WTM1
5-bit counter operation control
0
1
Clear after operation stop
Start
WTM0
Watch timer operation enable
0
1
Operation stop (clear both prescaler and timer)
Operation enable
Caution Do not change the count clock and interval time (by setting bits 4 to 7 (WTM4 to WTM7) of WTM)
during watch timer operation.
Remarks 1. fW: Watch timer clock frequency (fX/27 or fXT)
2. fX: Main system clock oscillation frequency
3. fXT: Subsystem clock oscillation frequency
4. Figures in parentheses apply to operation with fX = 12 MHz, fXT = 32.768 kHz.
User’s Manual U16035EJ5V0UD
161
CHAPTER 8 WATCH TIMER
8.4 Operations of Watch Timer
8.4.1 Operation as watch timer
The watch timer generates an interrupt request (INTWT) at a specific time interval (214/fW seconds) by using the
main system clock or subsystem clock.
The interrupt request is generated at the following time interval.
• If main system clock (8.38 MHz) is selected: 0.25 seconds
• If subsystem clock (32.768 kHz) is selected: 0.5 seconds
When bit 0 (WTM0) and bit 1 (WTM1) of the watch timer operation mode register (WTM) are set to 1, the count
operation starts. When these bits are set to 0, the 5-bit counter is cleared and the count operation stops.
When the interval timer is simultaneously operated, zero-second start can be achieved only for the watch timer
by setting WTM1 to 1 after clearing it to 0. In this case, however, the 9-bit prescaler is not cleared. Therefore, an
error up to 29/fW seconds occurs in the first overflow (INTWT) after zero-second start.
Remark fW: Watch timer clock frequency (fX/27 or fXT)
8.4.2 Operation as interval timer
The watch timer operates as interval timer which generates interrupt requests (INTWTI) repeatedly at an interval
of the preset count value.
The interval time can be selected with bits 4 to 6 (WTM4 to WTM6) of the watch timer operation mode register
(WTM).
Table 8-2. Interval Timer Interval Time
Interval When Operated at When Operated at When Operated at
Time fX = 12 MHz fX = 8.38 MHz fX = 4.19 MHz
When Operated at
fXT = 32.768 kHz
WTM6
WTM5
WTM4
4
0
0
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
2 /fW
170 µs 244 µs 488 µs
488 µs
5
2 /fW
341 µs
488 µs
977 µs
976 µs
6
2 /fW
682 µs
977 µs
1.95 ms
3.91 ms
7.82 ms
15.6 ms
1.95 ms
3.90 ms
7.81 ms
15.6 ms
7
2 /fW
1.36 ms
2.73 ms
5.46 ms
1.95 ms
3.91 ms
7.82 ms
8
2 /fW
9
2 /fW
Other than above
Setting prohibited
Remark fX: Main system clock oscillation frequency
fXT: Subsystem clock oscillation frequency
fW: Watch timer clock frequency (fX/27 or fXT)
162
User’s Manual U16035EJ5V0UD
CHAPTER 8 WATCH TIMER
Figure 8-3. Operation Timing of Watch Timer/Interval Timer
5-bit counter
0H
Overflow
Overflow
Start
Count clock
/29
fW
Watch timer
interrupt INTWT
Interrupt time of watch timer (0.5 s) Interrupt time of watch timer (0.5 s)
Interval timer
interrupt INTWTI
Interval time
(T)
T
n x T
n x T
Caution If the watch timer and 5-bit counter are enabled by the watch timer mode control register (WTM)
(by setting bits 0 (WTM0) and 1 (WTM1) of WTM to 1), the time from this setting to the occurrence
of the first interrupt request (INTWT) is not exactly the watch timer interrupt time (0.25 or 0.5
seconds). This is because the 5-bit counter is late by one output cycle of the 9-bit prescaler in
starting counting. The second INTWT signal and those that follow are generated exactly at the
set time.
Remark fW: Watch timer clock frequency (fX/27 or fXT)
n: The number of times of interval timer operations
Figures in parentheses are for operation with fW = 32.768 kHz
User’s Manual U16035EJ5V0UD
163
CHAPTER 9 WATCHDOG TIMER
9.1 Functions of Watchdog Timer
The watchdog timer has the following functions.
(1) Watchdog timer
The watchdog timer detects a program loop. Upon detection of a program loop, a non-maskable interrupt request
or RESET can be generated.
For the loop detection time, refer to Table 9-2.
(2) Interval timer
Interrupt requests are generated at the preset time intervals.
For the interval time, refer to Table 9-3.
Caution Select the watchdog timer mode or the interval timer mode using the watchdog timer mode
register (WDTM). (The watchdog timer and the interval timer cannot be used simultaneously.)
Figure 9-1 shows a block diagram of the watchdog timer.
Figure 9-1. Watchdog Timer Block Diagram
fX
Clock
input
controller
Divided
clock
selector
INTWDT
RESET
f
/28
X
Divider
Output
controller
Division mode
selector
RUN
3
WDT mode signal
WDCS2 WDCS1 WDCS0
RUN WDTM4WDTM3
Watchdog timer clock
select register (WDCS)
Watchdog timer mode
register (WDTM)
Internal bus
164
User’s Manual U16035EJ5V0UD
CHAPTER 9 WATCHDOG TIMER
9.2 Configuration of Watchdog Timer
The watchdog timer includes the following hardware.
Table 9-1. Configuration of Watchdog Timer
Item
Configuration
Control registers Watchdog timer clock select register (WDCS)
Watchdog timer mode register (WDTM)
9.3 Registers Controlling Watchdog Timer
The following two registers are used to control the watchdog timer.
•
•
Watchdog timer clock select register (WDCS)
Watchdog timer mode register (WDTM)
(1) Watchdog timer clock select register (WDCS)
This register sets overflow time of the watchdog timer and the interval timer.
WDCS is set by an 8-bit memory manipulation instruction.
RESET input clears WDCS to 00H.
Figure 9-2. Format of Watchdog Timer Clock Select Register (WDCS)
Address: FF42H
Symbol
After reset: 00H
R/W
5
7
0
6
0
4
0
3
0
2
1
0
WDCS
0
WDCS2
WDCS1
WDCS0
WDCS2
WDCS1
WDCS0
Overflow time of watchdog timer/interval timer
12
13
14
15
16
17
18
20
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
2
2
2
2
2
2
2
2
/fX (341 µs)
/fX (682 µs)
/fX (1.36 ms)
/fX (2.73 ms)
/fX (5.46 ms)
/fX (10.9 ms)
/fX (21.8 ms)
/fX (87.3 ms)
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz
User’s Manual U16035EJ5V0UD
165
CHAPTER 9 WATCHDOG TIMER
(2) Watchdog timer mode register (WDTM)
This register sets the watchdog timer operating mode and enables/disables counting.
WDTM is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears WDTM to 00H.
Figure 9-3. Format of Watchdog Timer Mode Register (WDTM)
Address: FFF9H
After reset: 00H
R/W
5
Symbol
WDTM
<7>
6
0
4
3
2
0
1
0
0
0
RUN
0
WDTM4
WDTM3
Note 1
RUN
Watchdog timer operation mode selection
0
1
Count stop
Counter is cleared and counting starts
Note 2
WDTM4
0
WDTM3
Watchdog timer operation mode selection
Note 3
×
Interval timer mode
(Maskable interrupt request occurs upon generation of an overflow)
1
1
0
1
Watchdog timer mode 1
(Non-maskable interrupt request occurs upon generation of an overflow)
Watchdog timer mode 2
(Reset operation is activated upon generation of an overflow)
Notes 1. Once set to 1, RUN cannot be cleared to 0 by software.
Thus, once counting starts, it can only be stopped by RESET input.
2. Once set to 1, WDTM3 and WDTM4 cannot be cleared to 0 by software.
3. The watchdog timer starts operations as the interval timer when 1 is set to RUN.
Caution
When 1 is set to RUN so that the watchdog timer is cleared, the actual overflow time is up to
28/fX seconds shorter than the time set by watchdog timer clock select register (WDCS).
Remark ×: don’t care
166
User’s Manual U16035EJ5V0UD
CHAPTER 9 WATCHDOG TIMER
9.4 Operations of Watchdog Timer
9.4.1 Operation as watchdog timer
When bit 4 (WDTM4) of the watchdog timer mode register (WDTM) is set to 1, the watchdog timer is operated to
detect any program loops.
The program loop detection time interval is selected with bits 0 to 2 (WDCS0 to WDCS2) of the watchdog timer
clock select register (WDCS).
Watchdog timer starts by setting bit 7 (RUN) of WDTM to 1. After the watchdog timer is started, set RUN to 1 within
the set program loop time interval. The watchdog timer can be cleared and counting is started by setting RUN to
1. If RUN is not set to 1 and the program loop detection time is exceeded, system reset or a non-maskable interrupt
request is generated according to WDTM bit 3 (WDTM3) value.
The watchdog timer continues operating in the HALT mode but it stops in the STOP mode. Thus, set RUN to 1
before the STOP mode is set, clear the watchdog timer and then execute the STOP instruction.
Cautions 1. The actual program loop detection time may be shorter than the set time by a maximum of
28/fX seconds.
2. When the subsystem clock is selected for CPU clock, watchdog timer count operation is
stopped.
Table 9-2. Watchdog Timer Program Loop Detection Time
Program Loop Detection Time
12
2
2
2
2
2
2
2
2
/fX (341 µs)
/fX (682 µs)
/fX (1.36 ms)
/fX (2.73 ms)
/fX (5.46 ms)
/fX (10.9 ms)
/fX (21.8 ms)
/fX (87.3 ms)
13
14
15
16
17
18
20
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
User’s Manual U16035EJ5V0UD
167
CHAPTER 9 WATCHDOG TIMER
9.4.2 Operation as interval timer
The watchdog timer operates as an interval timer which generates interrupt requests repeatedly at an interval of
the preset count value when bit 4 (WDTM4) of the watchdog timer mode register (WDTM) is set to 0.
The interval time of interval timer is selected with bits 0 to 2 (WDCS0 to WDCS2) of the watchdog timer clock select
register (WDCS). When 1 is set to bit 7 (RUN) of WDTM, the watchdog timer operates as the interval timer.
When the watchdog timer operated as the interval timer, the interrupt mask flag (WDTMK) and priority specify flag
(WDTPR) are validated and the maskable interrupt request (INTWDT) can be generated. Among maskable interrupts,
INTWDT has the highest priority at default.
The interval timer continues operating in the HALT mode but it stops in STOP mode. Thus, set RUN to 1 before
the STOP mode is set, clear the interval timer and then execute the STOP instruction.
Cautions 1. Once bit 4 (WDTM4) of WDTM is set to 1 (this selects the watchdog timer mode), the interval
timer mode is not set unless RESET input is applied.
2. The interval time just after setting by WDTM may be shorter than the set time by a maximum
of 28/fX seconds.
3. When the subsystem clock is selected for CPU clock, watchdog timer count operation is
stopped.
Table 9-3. Interval Timer Interval Time
Interval Time
12
2
2
2
2
2
2
2
2
/fX (341 µs)
/fX (682 µs)
/fX (1.36 ms)
/fX (2.73 ms)
/fX (5.46 ms)
/fX (10.9 ms)
/fX (21.8 ms)
/fX (87.3 ms)
13
14
15
16
17
18
20
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
168
User’s Manual U16035EJ5V0UD
CHAPTER 10 CLOCK OUTPUT/BUZZER OUTPUT CONTROLLER
10.1 Functions of Clock Output/Buzzer Output Controller
The clock output controller is intended for carrier output during remote controlled transmission and clock output
for supply to peripheral ICs. The clock selected with the clock output select register (CKS) is output.
In addition, the buzzer output is intended for square wave output of buzzer frequency selected with CKS.
Figure 10-1 shows the block diagram of clock output/buzzer output controller.
Figure 10-1. Block Diagram of Clock Output/Buzzer Output Controller
f
X
Prescaler
8
fX X
/210 to f /213
4
BUZ/P75
PCL/P74
BCS0, BCS1
BZOE
Output latch
(P75)
PM75
PM74
f
X
to fX
/27
Clock
controller
f
XT
CLOE
Output latch
(P74)
BZOE BCS1 BCS0 CLOE CCS3 CCS2 CCS1 CCS0
Clock output select register (CKS)
Internal bus
169
User’s Manual U16035EJ5V0UD
CHAPTER 10 CLOCK OUTPUT/BUZZER OUTPUT CONTROLLER
10.2 Configuration of Clock Output/Buzzer Output Controller
The clock output/buzzer output controller includes the following hardware.
Table 10-1. Configuration of Clock Output/Buzzer Output Controller
Item
Configuration
Clock output select register (CKS)
Control registers
Port mode register (PM7)
Port 7 (P7)
10.3 Registers Controlling Clock Output/Buzzer Output Controller
The following three registers are used to control the clock output/buzzer output controller.
•
•
•
Clock output select register (CKS)
Port mode register (PM7)
Port 7 (P7)
(1) Clock output select register (CKS)
This register sets output enable/disable for clock output (PCL) and for the buzzer frequency output (BUZ), and
sets the output clock.
CKS is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears CKS to 00H.
170
User’s Manual U16035EJ5V0UD
CHAPTER 10 CLOCK OUTPUT/BUZZER OUTPUT CONTROLLER
Figure 10-2. Format of Clock Output Select Register (CKS)
Address: FF40H After reset: 00H R/W
Symbol
CKS
<7>
6
5
<4>
3
2
1
0
BZOE
BCS1
BCS0
CLOE
CCS3
CCS2
CCS1
CCS0
BZOE
BUZ output enable/disable specification
0
1
Stop clock divider operation. BUZ fixed to low level.
Enable clock divider operation. BUZ output enabled.
BCS1
BCS0
BUZ output clock selection
10
0
0
1
1
0
1
0
1
fX/2 (11.7 kHz)
11
fX/2 (5.85 kHz)
12
fX/2 (2.92 kHz)
13
fX/2 (1.46 kHz)
CLOE
PCL output enable/disable specification
0
1
Stop clock divider operation. PCL fixed to low level.
Enable clock divider operation. PCL output enabled.
CCS3
CCS2
CCS1
CCS0
PCL output clock selection
fX (12 MHz)
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
fX/2 (6 MHz)
2
fX/2 (3 MHz)
3
fX/2 (1.5 MHz)
4
fX/2 (750 kHz)
5
fX/2 (375 kHz)
6
fX/2 (187 kHz)
7
fX/2 (93.7 kHz)
fXT (32.768 kHz)
Setting prohibited
Other than above
Remarks 1. fX: Main system clock oscillation frequency
2. fXT: Subsystem clock oscillation frequency
3. Figures in parentheses are for operation with fX = 12 MHz or fXT = 32.768 kHz.
User’s Manual U16035EJ5V0UD
171
CHAPTER 10 CLOCK OUTPUT/BUZZER OUTPUT CONTROLLER
(2) Port mode register (PM7)
This register sets port 7 input/output in 1-bit units.
When using the P74/PCL pin for clock output and the P75/BUZ pin for buzzer output, set PM74, PM75 and the
output latch of P74, P75 to 0.
PM7 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM7 to FFH.
Figure 10-3. Format of Port Mode Register 7 (PM7)
Address: FF27H
After reset: FFH
R/W
Symbol
PM7
7
1
6
1
5
4
3
2
1
0
PM75
PM74
PM73
PM72
PM71
PM70
PM7n
P7n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
172
User’s Manual U16035EJ5V0UD
CHAPTER 10 CLOCK OUTPUT/BUZZER OUTPUT CONTROLLER
10.4 Operations of Clock Output/Buzzer Output Controller
10.4.1 Operation as clock output
The clock pulse is output as the following procedure.
<1> Select the clock pulse output frequency with bits 0 to 3 (CCS0 to CCS3) of the clock output select register
(CKS) (clock pulse output in disabled status).
<2> Set bit 4 (CLOE) of CKS to 1 to enable clock output.
Remark The clock output controller is designed not to output pulses with a small width during output enable/
disable switching of the clock output. As shown in Figure 10-4, be sure to start output from the low period
of the clock (marked with * in the figure). When stopping output, do so after securing high level of the
clock.
Figure 10-4. Remote Control Output Application Example
CLOE
*
*
Clock output
10.4.2 Operation as buzzer output
The buzzer frequency is output as the following procedure.
<1> Select the buzzer output frequency with bits 5 and 6 (BCS0, BCS1) of the clock output select register (CKS)
(buzzer output in disabled status).
<2> Set bit 7 (BZOE) of CKS to 1 to enable buzzer output.
User’s Manual U16035EJ5V0UD
173
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.1 Functions of A/D Converter
A/D converter is an 8-bit resolution converter that converts analog inputs into digital values. It can control up to
4 analog input channels (ANI0 to ANI3).
(1) Hardware start
Conversion is started by trigger input (ADTRG: rising edge, falling edge, or both rising and falling edges can be
specified).
(2) Software start
Conversion is started by setting A/D converter mode register 0 (ADM0).
Select one channel for analog input from ANI0 to ANI3 to perform A/D conversion. In the case of hardware start,
A/D conversion stops when an A/D conversion operation ends and an interrupt request (INTAD0) is generated. In
the case of software start, A/D conversion is repeated. Each time an A/D conversion operation ends, an interrupt
request (INTAD0) is generated.
Caution Although the µPD78F0034BS incorporate a 10-bit A/D converter, this converter can be operated
as an 8-bit A/D converter by using the device file DF780024.
174
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
Figure 11-1. Block Diagram of 8-Bit A/D Converter
Series resistor string
AVDD
ANI0/P10
ANI1/P11
ANI2/P12
ANI3/P13
Sample & hold circuit
AVREF
Voltage comparator
Successive
approximation
register (SAR)
AVSS
Edge
detector
ADTRG/INTP3/P03
Controller
INTAD0
INTP3
Edge
detector
A/D conversion result
register 0 (ADCR0)
Note
Trigger enable
ADS01ADS00
ADSC0 TRG0 FR02 FR01 FR00 EGA01 EGA00
Analog input channel
specification register 0 (ADS0)
A/D converter
mode register 0 (ADM0)
Internal bus
Note The valid edge of an external interrupt is specified by bit 3 of the EGP and EGN registers (see Figure 15-
5 Format of External Interrupt Rising Edge Enable Register (EGP) and External Interrupt Falling Edge
Enable Register (EGN)).
175
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.2 Configuration of A/D Converter
The A/D converter includes the following hardware.
Table 11-1. Configuration of A/D Converter
Item
Analog input
Configuration
4 channels (ANI0 to ANI3)
Hardware trigger input
Registers
1 (ADTRG)
Successive approximation register (SAR)
A/D conversion result register 0 (ADCR0)
Control registers
A/D converter mode register 0 (ADM0)
Analog input channel specification register 0 (ADS0)
(1) Successive approximation register (SAR)
This register compares the analog input voltage value to the voltage tap (compare voltage) value applied from
the series resistor string, and holds the result from the most significant bit (MSB).
When up to the least significant bit (LSB) is held (end of A/D conversion), the SAR contents are transferred to
A/D conversion result register 0 (ADCR0).
(2) A/D conversion result register 0 (ADCR0)
ADCR0 is an 8-bit register that stores the A/D conversion result. Each time A/D conversion ends, the conversion
result is loaded from the successive approximation register.
ADCR0 is read by an 8-bit memory manipulation instruction.
RESET input clears ADCR0 to 00H.
Caution The contents of ADCR0 may become undefined when writing is performed to A/D converter
mode register 0 (ADM0) and analog input channel specification register 0 (ADS0). Read the
conversion result following conversion completion before writing to ADM0 or ADS0. Using a
timing other than the above may cause an incorrect conversion result to be read.
(3) Sample & hold circuit
The sample & hold circuit samples the input signal of the analog input pin selected by the selector when A/D
conversion is started and holds the sampled analog input voltage value during A/D conversion.
(4) Voltage comparator
The voltage comparator compares the sampled analog input voltage to the series resistor string output voltage.
(5) Series resistor string
The series resistor string is connected between AVREF and AVSS, and generates a voltage to be compared to
the analog input.
176
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(6) ANI0 to ANI3 pins
These are four analog input pins to input analog signals to undergo A/D conversion to the A/D converter. ANI0
to ANI3 are alternate-function pins that can also be used for digital input.
Cautions 1. Use ANI0 to ANI3 input voltages within the specification range. If a voltage higher than
AVREF or lower than AVSS is applied (even if within the absolute maximum rating range), the
conversion value of that channel will be undefined and the conversion values of other
channels may also be affected.
2. Analog input (ANI0 to ANI3) pins are alternate function pins that can also be used as input
port (P10 to P13) pins. When A/D conversion is performed by selecting any one of ANI0
to ANI3, do not access port 1 during conversion. It may cause the lower conversion
resolution.
3. When a digital pulse is applied to a pin adjacent to the pin in the process of A/D conversion,
A/D conversion values may not be obtained as expected due to coupling noise. Thus, do
not apply any pulse to a pin adjacent to the pin in the process of A/D conversion.
(7) AVREF pin
This pin inputs the A/D converter reference voltage.
It converts signals input to ANI0 to ANI3 into digital signals according to the voltage applied between AVREF and
AVSS.
Caution
A series resistor string of several 10 kΩ is connected between the AVREF pin and AVSS pin.
Therefore, when the output impedance of the reference voltage is too high, it seems as if the
AVREF pin and the series resistor string are connected in series. This may cause a greater
reference voltage error.
(8) AVSS pin
This is the ground potential pin of the A/D converter. Always keep it at the same potential as the VSS0 or VSS1
pin even when not using the A/D converter.
(9) AVDD pin
This is the A/D converter analog power supply pin. Always keep it at the same potential as the VDD0 or VDD1 pin
even when not using the A/D converter.
(10) ADTRG pin
This pin is a pin used to start the A/D converter by hardware.
177
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.3 Registers Controlling A/D Converter
The following two registers are used to control the A/D converter.
•
•
A/D converter mode register 0 (ADM0)
Analog input channel specification register 0 (ADS0)
(1) A/D converter mode register 0 (ADM0)
This register sets the conversion time for analog input to be A/D converted, conversion start/stop, and external
trigger.
ADM0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears ADM0 to 00H.
Figure 11-2. Format of A/D Converter Mode Register 0 (ADM0)
Address: FF80H After reset: 00H R/W
Symbol
ADM0
<7>
<6>
5
4
3
2
1
0
0
ADCS0
TRG0
FR02
FR01
FR00
EGA01
EGA00
ADCS0
A/D conversion operation control
0
1
Stop conversion operation.
Enable conversion operation.
TRG0
Software start/hardware start selection
0
1
Software start
Hardware start
Note 1
FR02
FR01
FR00
Conversion time selection
0
0
0
1
1
1
0
0
1
0
0
1
0
1
0
0
1
0
144/fX (12.0 µs)
Note 2
120/fX (Setting prohibited
)
Note 2
Note 2
Note 2
Note 2
96/fX (Setting prohibited
72/fX (Setting prohibited
60/fX (Setting prohibited
48/fX (Setting prohibited
Setting prohibited
)
)
)
)
Other than above
EGA01
EGA00
External trigger signal, edge specification
0
0
1
1
0
1
0
1
No edge detection
Falling edge detection
Rising edge detection
Both falling and rising edge detection
Notes 1. Set so that the A/D conversion time is 12 µs or more.
2. Setting prohibited because A/D conversion time is less than 12 µs.
178
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
Caution
When rewriting FR00 to FR02 to other than the same data, stop A/D conversion operations
once prior to performing rewrite.
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
(2) Analog input channel specification register 0 (ADS0)
This register specifies the analog voltage input port for A/D conversion.
ADS0 is set by an 8-bit memory manipulation instruction.
RESET input clears ADS0 to 00H.
Figure 11-3. Format of Analog Input Channel Specification Register 0 (ADS0)
Address: FF81H After reset: 00H R/W
Symbol
ADS0
7
0
6
0
5
0
4
0
3
0
2
1
0
Note
0
ADS01
ADS00
ADS01
ADS00
Analog input channel specification
0
0
1
1
0
1
0
1
ANI0
ANI1
ANI2
ANI3
Note Be sure to set bit 2 to 0.
179
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.4 Operations of A/D Converter
11.4.1 Basic operations of A/D converter
<1> Select one channel for A/D conversion with analog input channel specification register 0 (ADS0).
<2> The voltage input to the selected analog input channel is sampled by the sample & hold circuit.
<3> When sampling has been done for a certain time, the sample & hold circuit is placed in the hold state and
the input analog voltage is held until the A/D conversion operation is ended.
<4> Bit 7 of the successive approximation register (SAR) is set. The series resistor string voltage tap is set to
(1/2) AVREF by the tap selector.
<5> The voltage difference between the series resistor string voltage tap and analog input is compared by the
voltage comparator. If the analog input is greater than (1/2) AVREF, the MSB of SAR remains set. If the analog
input is smaller than (1/2) AVREF, the MSB is reset.
<6> Next, bit 6 of SAR is automatically set, and the operation proceeds to the next comparison. The series resistor
string voltage tap is selected according to the preset value of bit 7, as described below.
•
•
Bit 7 = 1: (3/4) AVREF
Bit 7 = 0: (1/4) AVREF
The voltage tap and analog input voltage are compared and bit 6 of SAR is manipulated as follows.
•
•
Analog input voltage ≥ Voltage tap: Bit 6 = 1
Analog input voltage < Voltage tap: Bit 6 = 0
<7> Comparison is continued in this way up to bit 0 of SAR.
<8> Upon completion of the comparison of 8 bits, an effective digital result value remains in SAR, and the result
value is transferred to and latched in A/D conversion result register 0 (ADCR0).
At the same time, the A/D conversion end interrupt request (INTAD0) can also be generated.
Cautions 1. The first A/D conversion value immediately after A/D conversion has been started may not
satisfy the rated value. Take measures such as polling the A/D conversion end interrupt
request (INTAD0) and removing the first conversion results.
2. The A/D converter stops operation in standby mode.
180
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
Figure 11-4. Basic Operation of 8-Bit A/D Converter
Setting ADCS0 to 1, external trigger,
or overwriting ADS0
A/D conversion start delay time
Conversion time
Sampling time
A/D converter
operation
Sampling
A/D conversion
C0H
or
40H
Conversion
result
Undefined
80H
SAR
Conversion
result
ADCR0
INTAD0
ADCS0
A/D conversion operations are performed continuously until bit 7 (ADCS0) of A/D converter mode register 0 (ADM0)
is reset (0) by software.
RESET input clears A/D conversion result register 0 (ADCR0) to 00H.
Confirm the conversion results by referring to the A/D conversion end interrupt request flag (ADIF0).
The sampling time of the A/D converter varies depending on the values set in A/D converter mode register 0 (ADM0).
There is a delay time from when the A/D converter is enabled for operation until sampling is actually performed.
For the sets in which a strict A/D conversion time is required, note the contents described in Table 11-2.
181
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
Table 11-2. Sampling Time and A/D Conversion Start Delay Time of A/D Converter
Note
FR02
FR01
FR00
Conversion Time
Sampling Time
A/D Conversion Start Delay Time
MIN.
MAX.
0
0
0
1
1
1
0
0
1
0
0
1
0
1
0
0
1
0
144/fX
20/fX
0.5/fCPU + 6/fX
0.5/fCPU + 8/fX
120/fX
16/fX
12/fX
10/fX
8/fX
96/fX
72/fX
0.5/fCPU + 3/fX
0.5/fCPU + 4/fX
60/fX
48/fX
6/fX
Other than above
Setting prohibited
−
−
−
Note Make setting so that the A/D conversion time becomes 12 µs or longer (when operated at fX = 12 MHz).
Remark fX: Main system clock oscillation frequency
fCPU: CPU clock frequency
182
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.4.2 Input voltage and conversion results
The relationship between the analog input voltage input to the analog input pins (ANI0 to ANI3) and the theoretical
A/D conversion result (stored in A/D conversion result register 0 (ADCR0)) is shown by the following expression.
VAIN
ADCR0 = INT (
× 256 + 0.5)
AVREF
or
AVREF
AVREF
256
(ADCR0 – 0.5) ×
≤ VAIN < (ADCR0 + 0.5) ×
256
where, INT( ): Function which returns integer part of value in parentheses
VAIN: Analog input voltage
AVREF: AVREF pin voltage
ADCR0: A/D conversion result register 0 (ADCR0) value
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
255
254
253
A/D conversion result
(ADCR0)
3
2
1
0
1
1
3
2
5
3
507 254 509 255 511
512 256 512 256 512
1
512 256 512 256 512 256
Input voltage/AVREF
183
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.4.3 A/D converter operation mode
Select one analog input channel from among ANI0 to ANI3 by analog input channel specification register 0 (ADS0)
to start A/D conversion.
A/D conversion can be started in either of the following two ways.
• Hardware start: Conversion is started by trigger input (rising edge, falling edge, or both rising and falling edges
specified).
• Software start: Conversion is started by specifying A/D converter mode register 0 (ADM0).
The interrupt request signal (INTAD0) is generated when the A/D conversion is complete.
(1) A/D conversion by hardware start
When bit 6 (TRG0) and bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) are set to 1, the A/D conversion
standby state is set. When the external trigger signal (ADTRG) is input, A/D conversion of the voltage applied
to the analog input pins specified by analog input channel specification register 0 (ADS0) starts.
Upon the end of the A/D conversion, the conversion result is stored in A/D conversion result register 0 (ADCR0),
and the interrupt request signal (INTAD0) is generated. After the next A/D conversion operation is started and
ended, the next conversion operation is not started until a new external trigger signal is input.
If ADS0 is rewritten during A/D conversion, the converter suspends A/D conversion and waits for a new external
trigger signal to be input. When the external trigger input signal is reinput, A/D conversion is carried out from
the beginning. If ADS0 is rewritten during A/D conversion waiting, A/D conversion starts when the following
external trigger input signal is input.
If 1 is written to ADCS0 again during A/D conversion, the A/D conversion in progress is discontinued and a new
A/D conversion is started when the next external trigger input signal is input.
If 0 is written to ADCS0 during A/D conversion, the A/D conversion operation stops immediately.
Caution
When P03/INTP3/ADTRG is used as the external trigger input (ADTRG), specify the valid edge
by bits 1 and 2 (EGA00, EGA01) of A/D converter mode register 0 (ADM0) and set the interrupt
mask flag (PMK3) to 1.
184
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
Figure 11-6. A/D Conversion by Hardware Start (When Falling Edge Is Specified)
ADTRG
ADM0 set
ADCS0 = 1, TRG0 = 1
ADS0 rewrite
Standby
state
Standby
state
Standby
state
A/D conversion
ANIn
ANIn
ANIn
ANIn
ANIm
ANIm
ANIm
ANIm
ANIm
ANIn
ANIn
Undefined
ADCR0
INTAD0
Remarks 1. n = 0, 1, ......, 3
2. m = 0, 1, ......, 3
185
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(2) A/D conversion by software start
When bit 6 (TRG0) and bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) are set to 0 and 1, respectively,
A/D conversion of the voltage applied to the analog input pin specified by analog input channel specification
register 0 (ADS0) starts.
Upon the end of the A/D conversion, the conversion result is stored in A/D conversion result register 0 (ADCR0),
and the interrupt request signal (INTAD0) is generated. After one A/D conversion operation is started and ended,
the next conversion operation is immediately started. A/D conversion operations are repeated until new data
is written to ADS0.
If ADS0 is rewritten during A/D conversion, the converter suspends A/D conversion and A/D conversion of the
newly selected analog input channel is started.
If 1 is written to ADCS0 again during A/D conversion, the A/D conversion in progress is discontinued and a new
A/D conversion is started.
If 0 is written to ADCS0 during A/D conversion, the A/D conversion operation stops immediately.
Figure 11-7. A/D Conversion by Software Start
ADM0 set
ADCS0 = 1, TRG0 = 0
ADS0 rewrite
ADCS0 = 0
ANIm
A/D conversion
ANIn
ANIn
ANIn
ANIm
Conversion suspended;
Conversion results are not stored
Stop
ADCR0
INTAD0
ANIn
ANIn
Undefined
ANIm
Remarks 1. n = 0, 1, ......, 3
2. m = 0, 1, ......, 3
186
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.5 How to Read A/D Converter Characteristics Table
Here we will explain the special terms unique to A/D converters.
(1) Resolution
This is the minimum analog input voltage that can be identified. That is, the percentage of the analog input voltage
per 1 bit of digital output is called 1LSB (Least Significant Bit). The percentage of 1LSB with respect to the full
scale is expressed by %FSR (Full Scale Range).
When the resolution is 8 bits,
1LSB = 1/28 = 1/256
= 0.4%FSR
Accuracy has no relation to resolution, but is determined by overall error.
(2) Overall error
This shows the maximum error value between the actual measured value and the theoretical value.
Zero scale error, full scale error, integral linearity error, differential linearity error and errors which are
combinations of these express overall error.
Furthermore, quantization error is not included in overall error in the characteristics table.
(3) Quantization error
When analog values are converted to digital values, there naturally occurs a 1/2LSB error. In an A/D converter,
an analog input voltage in a range of 1/2LSB are converted to the same digital code, so a quantization error
cannot be avoided.
Furthermore, it is not included in the overall error, zero scale error, full scale error, integral linearity error, and
differential linearity error in the characteristics table.
Figure 11-8. Overall Error
Figure 11-9. Quantization Error
……
……
1 1
1
1
Ideal line
Overall
error
Quantization error
1/2LSB
1/2LSB
……
……
0 0
0
0
0
AVREF
0
AVREF
Analog input
Analog input
187
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(4) Zero scale error
This shows the difference between the actual measured value of the analog input voltage and the theoretical
value (1/2LSB) when the digital output changes from 0……000 to 0……001. If the actual measured value is
greater than the theoretical value, it shows the difference between the actual measured value of the analog input
voltage and the theoretical value (3/2LSB) when the digital output changes from 0……001 to 0……010.
(5) Full scale error
This shows the difference between the actual measured value of the analog input voltage and the theoretical
value (full scale –3/2LSB) when the digital output changes from 1……110 to 1……111.
(6) Integral linearity error
This shows the degree to which the conversion characteristics deviate from the ideal linear relationship. It
expresses the maximum value of the difference between the actual measured value and the ideal straight line
when the zero scale error and full scale error are 0.
(7) Differential linearity error
Although the ideal output width for a given code is 1LSB, this value shows the difference between the actual
measured value and the ideal value of the width when outputting a particular code.
Figure 11-10. Zero Scale Error
Figure 11-11. Full Scale Error
111
Full scale error
Ideal line
111
011
010
110
101
000
Ideal line
001
000
Zero scale error
0
AVREF−3 AVREF−2 AVREF−1 AVREF
0
1
2
3
AVREF
Analog input (LSB)
Analog input (LSB)
Figure 11-12. Integral Linearity Error
Figure 11-13. Differential Linearity Error
......
1
1
……
1
1
Ideal width of 1LSB
Ideal line
Differential
linearity error
Integral
linearity
error
......
0
0
0
AVREF
Analog input
……
0
0
AVREF
0
Analog input
188
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(8) Conversion time
This expresses the time from when the sampling was started to the time when the digital output was obtained.
Sampling time is included in the conversion time in the characteristics table.
(9) Sampling time
This is the time the analog switch is turned on for the analog voltage to be sampled by the sample & hold circuit.
Sampling
time
Conversion time
189
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
11.6 Cautions for A/D Converter
(1) Power consumption in standby mode
A/D converter stops operating in the standby mode. At this time, power consumption can be reduced by clearing
bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) to 0.
Figure 11-14 shows the circuit configuration of a series resistor string.
Figure 11-14. Circuit Configuration of Series Resistor String
AVREF
ADCS0
P-ch
Series resistor string
AVSS
(2) Input range of ANI0 to ANI3
The input voltages of ANI0 to ANI3 should be within the specification range. In particular, if a voltage higher
than AVREF or lower than AVSS is input (even if within the absolute maximum rating range), the conversion value
of that channel will be undefined and the conversion values of other channels may also be affected.
(3) Contending operations
<1> Contention between A/D conversion result register 0 (ADCR0) write and ADCR0 read by instruction upon
the end of conversion
ADCR0 read is given priority. After the read operation, the new conversion result is written to ADCR0.
<2> Contention between ADCR0 write and external trigger signal input upon the end of conversion
The external trigger signal is not accepted during A/D conversion. Therefore, the external trigger signal
is not accepted during ADCR0 write.
<3> Contention between ADCR0 write and A/D converter mode register 0 (ADM0) write or analog input channel
specification register 0 (ADS0) write upon the end of conversion
ADM0 or ADS0 write is given priority. ADCR0 write is not performed, nor is the conversion end interrupt
request signal (INTAD0) generated.
(4) ANI0/P10 to ANI3/P13
<1> The analog input pins (ANI0 to ANI3) also function as input port pins (P10 to P13).
When A/D conversion is performed with any of pins ANI0 to ANI3 selected, do not access port 1 while
conversion is in progress, as this may reduce the conversion resolution.
<2> If digital pulses are applied to a pin adjacent to the pin in the process of A/D conversion, the expected A/
D conversion value may not be obtainable due to coupling noise. Therefore, avoid applying pulses to pins
adjacent to the pin undergoing A/D conversion.
190
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(5) AVREF pin input impedance
A series resistor string of several 10 kΩ is connected between the AVREF pin and the AVSS pin.
Therefore, when the output impedance of the reference voltage is too high, it seems as if the AVREF pin and the
series resistor string are connected in series. This may cause a greater reference voltage error.
(6) Interrupt request flag (ADIF0)
The interrupt request flag (ADIF0) is not cleared even if analog input channel specification register 0 (ADS0) is
changed.
Therefore, if an analog input pin is changed during A/D conversion, the A/D conversion result and conversion
end interrupt request flag for the pre-change analog input may be set just before the ADS0 rewrite. Caution is
therefore required since, at this time, when ADIF0 is read immediately just after the ADS0 rewrite, ADIF0 is set
despite the fact that the A/D conversion for the post-change analog input has not ended.
When the A/D conversion is restarted after it is stopped, clear ADIF0 before restart.
Figure 11-15. A/D Conversion End Interrupt Request Generation Timing
ADM0 rewrite
(start of ANIn conversion)
ADS0 rewrite
(start of ANIm conversion)
ADIF is set but ANIm conversion
has not ended.
A/D conversion
ANIn
ANIn
ANIn
ANIm
ANIm
ADCR0
INTAD0
ANIm
ANIm
Undefined
Remarks 1. n = 0, 1, ......, 3
2. m = 0, 1, ......, 3
(7) Conversion results just after A/D conversion start
The A/D conversion value just after A/D conversion operations start may not fall within the rating. Polling A/D
conversion end interrupt request (INTAD0) and take measures such as removing the first conversion results.
(8) A/D conversion result register 0 (ADCR0) read operation
When writing is performed to A/D converter mode register 0 (ADM0) and analog input channel specification
register 0 (ADS0), the contents of ADCR0 may become undefined. Read the conversion result following
conversion completion before writing to ADM0, ADS0. Using a timing other than the above may cause an incorrect
conversion result to be read.
191
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(9) Timing at which A/D conversion result is undefined
The A/D conversion value may be undefined if the timing of completion of A/D conversion and the timing of
stopping the A/D conversion conflict with each other. Therefore, read the A/D conversion result during the A/
D conversion operation.
Figure 11-16 shows the timing of reading the conversion result.
Figure 11-16. Timing of Reading Conversion Result (When Conversion Result Is Undefined)
A/D conversion completes
A/D conversion completes
ADCR0
INTAD0
ADCS0
Normal conversion result
Undefined value
Normal conversion result is read.
A/D conversion
is stopped.
Undefined value
is read.
(10) Notes on board design
Locate analog circuits as far away from digital circuits as possible on the board because the analog circuits may
be affected by the noise of the digital circuits. In particular, do not cross an analog signal line with a digital signal
line, or wire an analog signal line in the vicinity of a digital signal line. Otherwise, the A/D conversion
characteristics may be affected by the noise of the digital line.
Connect AVSS0 and VSS0 at one location on the board where the voltages are stable.
192
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(11) AVDD pin
The AVDD pin is the analog circuit power supply pin. It supplies power to the input circuits of the ANI0 to ANI3
pins.
Therefore, be sure to apply the same potential as VDD0 to this pin even for applications designed to switch to
a backup battery for power supply.
Figure 11-17. AVDD Pin Connection
AVREF
VDD0
AVDD
Main power supply
Capacitor
for backup
VSS0
AVSS
(12) AVREF pin
Connect a capacitor to the AVREF pin to minimize conversion errors due to noise. If an A/D conversion operation
has been stopped and then is started, the voltage applied to the AVREF pin becomes unstable, causing the
accuracy of the A/D conversion to drop. To prevent this, also connect a capacitor to the AVREF pin.
Figure 11-18 shows an example of connecting a capacitor.
Figure 11-18. Example of Connecting Capacitor to AVREF Pin
Clamp using a diode with a low
VF (0.3 V or lower).
AVDD
AVREF
C1
C2
AVSS
Remark C1: 4.7 µF to 10 µF (reference value)
C2: 0.01 µF to 0.1 µF (reference value)
Connect C2 as close to the pin as possible.
193
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
(13) Internal equivalent circuit of ANI0 to ANI3 pins and permissible signal source impedance
To complete sampling within the sampling time with sufficient A/D conversion accuracy, the impedance of the
signal source such as a sensor must be sufficiently low. Figure 11-19 shows the internal equivalent circuit of
the ANI0 to ANI3 pins.
If the impedance of the signal source is high, connect capacitors with a high capacitance to the pins ANI0 to ANI3.
An example of this is shown in Figure 11-20. In this case, however, the microcontroller cannot follow an analog
signal with a high differential coefficient because a lowpass filter is created.
To convert a high-speed analog signal or to convert an analog signal in the scan mode, insert a low-impedance
buffer.
Figure 11-19. Internal Equivalent Circuit of Pins ANI0 to ANI3
R1
R2
ANIn
C1
C2
C3
Remark n = 0 to 3
Table 11-3. Resistance and Capacitance of Equivalent Circuit (Reference Values)
AVREF
2.7 V
4.5 V
R1
R2
C1
C2
C3
12 kΩ
4 kΩ
8 kΩ
8 pF
8 pF
3 pF
2 pF
2 pF
2.7 kΩ
1.4 pF
Caution
The resistance and capacitance in Table 11-3 are not guaranteed values.
194
User’s Manual U16035EJ5V0UD
CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
Figure 11-20. Example of Connection When Signal Source Impedance Is High
If a noise of AVREF or higher or AVSS or lower
may be generated, clamp using a diode with
a low VF (0.3 V or lower).
Reference
voltage input
<Sensor internal circuit>
<Microcontroller internal circuit>
AVREF
Output impedance
of sensor
R1
R2
ANIn
R0
C1
C2
C3
C0
C0 ≤ 0.1 F
µ
Lowpass filter
is created.
Remark n = 0 to 3
(14) Input impedance of ANI0 to ANI3 pins
This A/D converter executes sampling by charging the internal sampling capacitor for approximately 1/10 of the
conversion time.
Therefore, only the leakage current flows during other than sampling, and the current for charging the capacitor
flows during sampling. The input impedance therefore varies and has no meaning.
To achieve sufficient sampling, it is recommended that the output impedance of the analog input source be 10
kΩ or less, or attach a capacitor of around 100 pF to the ANI0 to ANI3 pins (see Figure 11-20).
195
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.1 Functions of A/D Converter
A/D converter is a 10-bit resolution converter that converts analog inputs into digital signals. It can control up to
4 analog input channels (ANI0 to ANI3).
(1) Hardware start
Conversion is started by trigger input (ADTRG: rising edge, falling edge, or both rising and falling edges can
be specified).
(2) Software start
Conversion is started by setting A/D converter mode register 0 (ADM0).
Select one channel for analog input from ANI0 to ANI3 to start A/D conversion. In the case of hardware start, the
A/D converter stops when A/D conversion is completed, and an interrupt request (INTAD0) is generated. In the case
of software start, A/D conversion is repeated. Each time as A/D conversion operation ends, an interrupt request
(INTAD0) is generated.
Caution
Although the µPD78F0034BS incorporate a 10-bit A/D converter, this converter can be operated
as an 8-bit A/D converter by using the device file DF780024.
196
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
Figure 12-1. Block Diagram of 10-Bit A/D Converter
Series resistor string
AVDD
ANI0/P10
ANI1/P11
ANI2/P12
ANI3/P13
Sample & hold circuit
AVREF
Voltage comparator
Successive
approximation
register (SAR)
AVSS
Edge
detector
ADTRG/INTP3/P03
Controller
INTAD0
INTP3
Edge
detector
A/D conversion result
register 0 (ADCR0)
Note
Trigger enable
ADS00
ADCS0 TRG0 FR02 FR01 FR00 EGA01 EGA00
ADS01
Analog input channel
specification register 0 (ADS0)
A/D converter
mode register 0 (ADM0)
Internal bus
Note The valid edge of an external interrupt is specified by bit 3 of the EGP and EGN registers (see Figure 15-
5 Format of External Interrupt Rising Edge Enable Register (EGP) and External Interrupt Falling Edge
Enable Register (EGN)).
User’s Manual U16035EJ5V0UD
197
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.2 Configuration of A/D Converter
The A/D converter includes the following hardware.
Table 12-1. Configuration of A/D Converter
Item
Analog input
Configuration
4 channels (ANI0 to ANI3)
Hardware trigger input
Registers
1 (ADTRG)
Successive approximation register (SAR)
A/D conversion result register 0 (ADCR0)
Control registers
A/D converter mode register 0 (ADM0)
Analog input channel specification register 0 (ADS0)
(1) Successive approximation register (SAR)
This register compares the analog input voltage value to the voltage tap (compare voltage) value applied from
the series resistor string, and holds the result from the most significant bit (MSB).
When up to the least significant bit (LSB) is hold (end of A/D conversion), the SAR contents are transferred to
A/D conversion result register 0 (ADCR0).
(2) A/D conversion result register 0 (ADCR0)
This is a 16-bit register that stores the A/D conversion results. The lower 6 bits are fixed to 0. Each time A/D
conversion ends, the conversion result is loaded from the successive approximation register (SAR) and held by
this register. The most significant bit (MSB) is stored in ADCR0 first. The higher 8 bits of the conversion results
are stored in FF17H. The lower 2 bits of the conversion results are stored in FF16H.
ADCR0 is read by a 16-bit memory manipulation instruction.
RESET input sets ADCR0 to 0000H.
Figure 12-2. Format of A/D Conversion Result Register 0 (ADCR0)
Address: FF16H, FF17H After reset: 0000H R
FF17H
FF16H
Symbol
ADCR0
0
0
0
0
0
0
Caution
When A/D converter mode register 0 (ADM0) and analog input channel specification register
0 (ADS0) are written, the contents of ADCR0 may become undefined. Read the conversion
result following conversion completion before writing to ADM0 and ADS0. Using a timing other
than the above may cause an incorrect conversion result to be read.
(3) Sample & hold circuit
The sample & hold circuit samples the input signal of the analog input pin selected by the selector when A/D
conversion is started and holds the sampled analog input voltage value during A/D conversion.
(4) Voltage comparator
The voltage comparator compares the sampled analog input voltage to the series resistor string output voltage.
198
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(5) Series resistor string
The series resistor string is connected between AVREF and AVSS, and generates a voltage to be compared to
the analog input.
(6) ANI0 to ANI3 pins
These are four analog input pins to input analog signals to undergo A/D conversion to the A/D converter. ANI0
to ANI3 are alternate-function pins that can also be used for digital input.
Cautions 1. Use ANI0 to ANI3 input voltages within the specification range. If a voltage higher than
AVREF or lower than AVSS is applied (even if within the absolute maximum rating range), the
conversion value of that channel will be undefined and the conversion values of other
channels may also be affected.
2. Analog input (ANI0 to ANI3) pins are alternate function pins that can also be used as input
port (P10 to P13) pins. When A/D conversion is performed by selecting any one of ANI0
to ANI3, do not access port 1 during conversion. It may cause the lower conversion
resolution.
3. When a digital pulse is applied to a pin adjacent to the pin in the process of A/D conversion,
A/D conversion values may not be obtained as expected due to coupling noise. Thus, do
not apply any pulse to a pin adjacent to the pin in the process of A/D conversion.
(7) AVREF pin
This pin inputs the A/D converter reference voltage.
It converts signals input to ANI0 to ANI3 into digital signals according to the voltage applied between AVREF and
AVSS.
Caution
A series resistor string of several 10 kΩ is connected between the AVREF and AVSS pins.
Therefore, when output impedance of the reference voltage is too high, it seems as if the AVREF
pin and the series resistor string are connected in series. This may cause a greater reference
voltage error.
(8) AVSS pin
This is the ground potential pin of the A/D converter. Always keep it at the same potential as the VSS0 or VSS1
pin when not using the A/D converter.
(9) AVDD pin
This is the A/D converter analog power supply pin. Always keep it at the same potential as the VDD0 or VDD1 pin
even when not using the A/D converter.
(10) ADTRG pin
This pin is a pin used to start the A/D converter by hardware.
User’s Manual U16035EJ5V0UD
199
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.3 Registers Controlling A/D Converter
The following two registers are used to control the A/D converter.
•
•
A/D converter mode register 0 (ADM0)
Analog input channel specification register 0 (ADS0)
(1) A/D converter mode register 0 (ADM0)
This register sets the conversion time for analog input to be A/D converted, conversion start/stop, and external
trigger.
ADM0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears ADM0 to 00H.
Figure 12-3. Format of A/D Converter Mode Register 0 (ADM0)
Address: FF80H After reset: 00H R/W
Symbol
ADM0
<7>
<6>
5
4
3
2
1
0
0
ADCS0
TRG0
FR02
FR01
FR00
EGA01
EGA00
ADCS0
A/D conversion operation control
0
1
Stop conversion operation.
Enable conversion operation.
TRG0
Software start/hardware start selection
0
1
Software start
Hardware start
Note 1
FR02
FR01
FR00
Conversion time selection
0
0
0
1
1
1
0
0
1
0
0
1
0
1
0
0
1
0
144/fX (12.0 µs)
Note 2
120/fX (Setting prohibited
)
Note 2
Note 2
Note 2
Note 2
96/fX (Setting prohibited
72/fX (Setting prohibited
60/fX (Setting prohibited
48/fX (Setting prohibited
Setting prohibited
)
)
)
)
Other than above
EGA01
EGA00
External trigger signal, edge specification
0
0
1
1
0
1
0
1
No edge detection
Falling edge detection
Rising edge detection
Both falling and rising edge detection
Notes 1. Set so that the A/D conversion time is 12 µs or more.
2. Setting prohibited because A/D conversion time is less than 12 µs.
200
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
Caution
When rewriting FR00 to FR02 to other than the same data, stop A/D conversion operations
once prior to performing rewrite.
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
(2) Analog input channel specification register 0 (ADS0)
This register specifies the analog voltage input port for A/D conversion.
ADS0 is set by an 8-bit memory manipulation instruction.
RESET input clears ADS0 to 00H.
Figure 12-4. Format of Analog Input Channel Specification Register 0 (ADS0)
Address: FF81H After reset: 00H R/W
Symbol
ADS0
7
0
6
0
5
0
4
0
3
0
2
1
0
Note
0
ADS01
ADS00
ADS01
ADS00
Analog input channel specification
0
0
1
1
0
1
0
1
ANI0
ANI1
ANI2
ANI3
Note Be sure to set bit 2 to 0.
User’s Manual U16035EJ5V0UD
201
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.4 Operations of A/D Converter
12.4.1 Basic operations of A/D converter
<1> Select one channel for A/D conversion with analog input channel specification register 0 (ADS0).
<2> The voltage input to the selected analog input channel is sampled by the sample & hold circuit.
<3> When sampling has been done for a certain time, the sample & hold circuit is placed in the hold state and
the input analog voltage is held until the A/D conversion operation is ended.
<4> Bit 9 of the successive approximation register (SAR) is set. The series resistor string voltage tap is set to
(1/2) AVREF by the tap selector.
<5> The voltage difference between the series resistor string voltage tap and analog input is compared by the
voltage comparator. If the analog input is greater than (1/2) AVREF, the MSB of SAR remains set. If the analog
input is smaller than (1/2) AVREF, the MSB is reset.
<6> Next, bit 8 of SAR is automatically set, and the operation proceeds to the next comparison. The series resistor
string voltage tap is selected according to the preset value of bit 9, as described below.
•
•
Bit 9 = 1: (3/4) AVREF
Bit 9 = 0: (1/4) AVREF
The voltage tap and analog input voltage are compared and bit 8 of SAR is manipulated as follows.
•
•
Analog input voltage ≥ Voltage tap: Bit 8 = 1
Analog input voltage < Voltage tap: Bit 8 = 0
<7> Comparison is continued in this way up to bit 0 of SAR.
<8> Upon completion of the comparison of 10 bits, an effective digital result value remains in SAR, and the result
value is transferred to and latched in A/D conversion result register 0 (ADCR0).
At the same time, the A/D conversion end interrupt request (INTAD0) can also be generated.
Cautions 1. The first A/D conversion value immediately after A/D conversion has been started may not
satisfy the rated value. Take measures such as polling the A/D conversion end interrupt
request (INTAD0) and removing the first conversion results.
2. The A/D converter stops operation in standby mode.
202
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
Figure 12-5. Basic Operation of 10-Bit A/D Converter
Setting ADCS0 to 1, external trigger,
or overwriting ADS0
A/D conversion start delay time
Conversion time
Sampling time
A/D converter
operation
Sampling
A/D conversion
300H
or
100H
Conversion
result
200H
Undefined
SAR
Conversion
result
ADCR0
INTAD0
ADCS0
A/D conversion operations are performed continuously until bit 7 (ADCS0) of A/D converter mode register 0 (ADM0)
is reset (0) by software.
RESET input clears A/D conversion result register 0 (ADCR0) to 0000H.
Confirm the conversion results by referring to the A/D conversion end interrupt request flag (ADIF0).
The sampling time of the A/D converter varies depending on the values set in A/D converter mode register 0 (ADM0).
There is a delay time from when the A/D converter is enabled for operation until sampling is actually performed.
For the sets in which a strict A/D conversion time is required, note the contents described in Table 12-2.
User’s Manual U16035EJ5V0UD
203
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
Table 12-2. Sampling Time and A/D Conversion Start Delay Time of A/D Converter
Note
FR02
FR01
FR00
Conversion Time
Sampling Time
A/D Conversion Start Delay Time
MIN.
MAX.
0
0
0
1
1
1
0
0
1
0
0
1
0
1
0
0
1
0
144/fX
20/fX
0.5/fCPU + 6/fX
0.5/fCPU + 8/fX
120/fX
16/fX
12/fX
10/fX
8/fX
96/fX
72/fX
0.5/fCPU + 3/fX
0.5/fCPU + 4/fX
60/fX
48/fX
6/fX
Other than above
Setting prohibited
−
−
−
Note Make setting so that the A/D conversion time becomes 12 µs or longer (when operated at fX = 12 MHz).
Remark fX: Main system clock oscillation frequency
fCPU: CPU clock frequency
204
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.4.2 Input voltage and conversion results
The relationship between the analog input voltage input to the analog input pins (ANI0 to ANI7) and the theoretical
A/D conversion result (stored in A/D conversion result register 0 (ADCR0)) is shown by the following expression.
VAIN
ADCR0 = INT (
× 1024 + 0.5)
AVREF
or
AVREF
AVREF
1024
(ADCR0 – 0.5) ×
≤ VAIN < (ADCR0 + 0.5) ×
1024
where, INT( ): Function which returns integer part of value in parentheses
VAIN: Analog input voltage
AVREF: AVREF pin voltage
ADCR0: A/D conversion result register 0 (ADCR0) value
Figure 12-6 shows the relationship between the analog input voltage and the A/D conversion result.
Figure 12-6. Relationship Between Analog Input Voltage and A/D Conversion Result
1023 × 26
1022 × 26
1021 × 26
A/D conversion result
(ADCR0)
3 × 26
2 × 26
1 × 26
0
1
1
3
2
5
3
2043 1022 2045 1023 2047 1
2048 1024 2048 1024 2048
204810242048102420481024
Input voltage/AVREF
User’s Manual U16035EJ5V0UD
205
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.4.3 A/D converter operation mode
Select one analog input channel from among ANI0 to ANI3 by analog input channel specification register 0 (ADS0)
to start A/D conversion.
A/D conversion can be started in either of the following two ways.
• Hardware start: Conversion is started by trigger input (rising edge, falling edge, or both rising and falling edges
specified).
• Software start: Conversion is started by specifying A/D converter mode register 0 (ADM0).
The interrupt request signal (INTAD0) is generated when the A/D conversion is complete.
(1) A/D conversion by hardware start
When bit 6 (TRG0) and bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) are set to 1, the A/D conversion
standby state is set. When the external trigger signal (ADTRG) is input, A/D conversion of the voltage applied
to the analog input pin specified by analog input channel specification register 0 (ADS0) starts.
Upon the end of the A/D conversion, the conversion result is stored in A/D conversion result register 0 (ADCR0),
and the interrupt request signal (INTAD0) is generated. After the next A/D conversion operation is started and
ended, the next conversion operation is not started until a new external trigger signal is input.
If ADS0 is rewritten during A/D conversion, the converter suspends A/D conversion and waits for a new external
trigger signal to be input. When the external trigger input signal is reinput, A/D conversion is carried out from
the beginning. If ADS0 is rewritten during A/D conversion waiting, A/D conversion starts when the following
external trigger input signal is input.
If 1 is written to ADCS0 again during A/D conversion, the A/D conversion in progress is discontinued and a new
A/D conversion is started when the next external trigger input signal is input.
If 0 is written to ADCS0 during A/D conversion, the A/D conversion operation stops immediately.
Caution
When P03/INTP3/ADTRG is used as the external trigger input (ADTRG), specify the valid edge
by bits 1 and 2 (EGA00, EGA01) of A/D converter mode register 0 (ADM0) and set the interrupt
mask flag (PMK3) to 1.
206
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
Figure 12-7. A/D Conversion by Hardware Start (When Falling Edge Is Specified)
ADTRG
ADM0 set
ADCS0 = 1, TRG0 = 1
ADS0 rewrite
Standby state
Standby
state
A/D conversion
Standby state ANIn
ANIn
ANIn
ANIn
ANIm
ANIm
ANIm
ANIm
ANIm
ANIn
ANIn
Undefined
ADCR0
INTAD0
Remarks 1. n = 0, 1, ......, 3
2. m = 0, 1, ......, 3
User’s Manual U16035EJ5V0UD
207
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(2) A/D conversion by software start
When bit 6 (TRG0) and bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) are set to 0 and 1, respectively,
A/D conversion of the voltage applied to the analog input pin specified by analog input channel specification
register 0 (ADS0) starts.
Upon the end of the A/D conversion, the conversion result is stored in A/D conversion result register 0 (ADCR0),
and the interrupt request signal (INTAD0) is generated. After one A/D conversion operation is started and ended,
the next conversion operation is immediately started. A/D conversion operations are repeated until new data
is written to ADS0.
If ADS0 is rewritten during A/D conversion, the converter suspends A/D conversion and A/D conversion of the
new selected analog input channel is started.
If 1 is written to ADCS0 again during A/D conversion, the A/D conversion in progress is discontinued and a new
A/D conversion is started.
If 0 is written to ADCS0 during A/D conversion, the A/D conversion operation stops immediately.
Figure 12-8. A/D Conversion by Software Start
ADM0 set
ADCS0 = 1, TRG0 = 0
ADS0 rewrite
ANIn ANIm
ADCS0 = 0
ANIm
A/D conversion
ANIn
ANIn
Conversion suspended;
Conversion results are not stored
Stop
ADCR0
INTAD0
ANIn
ANIn
Undefined
ANIm
Remarks 1. n = 0, 1, ......, 3
2. m = 0, 1, ......, 3
208
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.5 How to Read A/D Converter Characteristics Table
Here we will explain the special terms unique to A/D converters.
(1) Resolution
This is the minimum analog input voltage that can be identified. That is, the percentage of the analog input voltage
per 1 bit of digital output is called 1LSB (Least Significant Bit). The percentage of 1LSB with respect to the full
scale is expressed by %FSR (Full Scale Range).
When the resolution is 10 bits,
1LSB = 1/210 = 1/1024
= 0.098%FSR
Accuracy has no relation to resolution, but is determined by overall error.
(2) Overall error
This shows the maximum error value between the actual measured value and the theoretical value.
Zero scale error, full scale error, integral linearity error, differential linearity error and errors which are
combinations of these express overall error.
Furthermore, quantization error is not included in overall error in the characteristics table.
(3) Quantization error
When analog values are converted to digital values, there naturally occurs a 1/2LSB error. In an A/D converter,
an analog input voltage in a range of 1/2LSB are converted to the same digital code, so a quantization error
cannot be avoided.
Furthermore, it is not included in the overall error, zero scale error, full scale error, integral linearity error, and
differential linearity error in the characteristics table.
Figure 12-9. Overall Error
Figure 12-10. Quantization Error
……
1
1
……
1
1
Ideal line
Overall
error
Quantization error
1/2LSB
1/2LSB
……
0
0
……
0
0
0
AVREF
0
AVREF
Analog input
Analog input
User’s Manual U16035EJ5V0UD
209
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(4) Zero scale error
This shows the difference between the actual measured value of the analog input voltage and the theoretical
value (1/2LSB) when the digital output changes from 0……000 to 0……001. If the actual measured value is
greater than the theoretical value, it shows the difference between the actual measured value of the analog input
voltage and the theoretical value (3/2LSB) when the digital output changes from 0……001 to 0……010.
(5) Full scale error
This shows the difference between the actual measured value of the analog input voltage and the theoretical
value (full scale –3/2LSB) when the digital output changes from 1……110 to 1……111.
(6) Integral linearity error
This shows the degree to which the conversion characteristics deviate from the ideal linear relationship. It
expresses the maximum value of the difference between the actual measured value and the ideal straight line
when the zero scale error and full scale error are 0.
(7) Differential linearity error
Although the ideal output width for a given code is 1LSB, this value shows the difference between the actual
measured value and the ideal value of the width when outputting a particular code.
Figure 12-11. Zero Scale Error
111
Figure 12-12. Full Scale Error
Full scale error
Ideal line
111
011
010
110
101
000
Ideal line
001
000
Zero scale error
0
AVREF−3 AVREF−2 AVREF−1 AVREF
0
1
2
3
AVREF
Analog input (LSB)
Analog input (LSB)
Figure 12-13. Integral Linearity Error
Figure 12-14. Differential Linearity Error
......
1
1
……
1
1
Ideal width of 1LSB
Ideal line
Differential
linearity error
Integral
linearity
error
......
0
0
0
……
AVREF
0
0
Analog input
AVREF
0
Analog input
210
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(8) Conversion time
This expresses the time from when the sampling was started to the time when the digital output was obtained.
Sampling time is included in the conversion time in the characteristics table.
(9) Sampling time
This is the time the analog switch is turned on for the analog voltage to be sampled by the sample & hold circuit.
Sampling
time
Conversion time
User’s Manual U16035EJ5V0UD
211
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
12.6 Cautions for A/D Converter
(1) Power consumption in standby mode
A/D converter stops operating in the standby mode. At this time, power consumption can be reduced by clearing
bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) to 0.
Figure 12-15 shows the circuit configuration of a series resistor string.
Figure 12-15. Circuit Configuration of Series Resistor String
AVREF
ADCS0
P-ch
Series resistor string
AVSS
(2) Input range of ANI0 to ANI3
The input voltages of ANI0 to ANI3 should be within the specification range. In particular, if a voltage higher
than AVREF or lower than AVSS is input (even if within the absolute maximum rating range), the conversion value
of that channel will be undefined and the conversion values of other channels may also be affected.
(3) Contending operations
<1> Contention between A/D conversion result register 0 (ADCR0) write and ADCR0 read by instruction upon
the end of conversion
ADCR0 read is given priority. After the read operation, the new conversion result is written to ADCR0.
<2> Contention between ADCR0 write and external trigger signal input upon the end of conversion
The external trigger signal is not accepted during A/D conversion. Therefore, the external trigger signal
is not accepted during ADCR0 write.
<3> Contention between ADCR0 write and A/D converter mode register 0 (ADM0) write or analog input channel
specification register 0 (ADS0) write upon the end of conversion
ADM0 or ADS0 write is given priority. ADCR0 write is not performed, nor is the conversion end interrupt
request signal (INTAD0) generated.
(4) ANI0/P10 to ANI3/P13
<1> The analog input pins (ANI0 to ANI3) also function as input port pins (P10 to P13).
When A/D conversion is performed with any of pins ANI0 to ANI3 selected, do not access port 1 while
conversion is in progress, as this may reduce the conversion resolution.
<2> If digital pulses are applied to a pin adjacent to the pin in the process of A/D conversion, the expected
A/D conversion value may not be obtainable due to coupling noise. Therefore, avoid applying pulses to
pins adjacent to the pin undergoing A/D conversion.
212
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(5) AVREF pin input impedance
A series resistor string of several 10 kΩ is connected between the AVREF pin and the AVSS pin.
Therefore, when the output impedance of the reference voltage is too high, it seems as if the AVREF pin and the
series resistor string are connected in series. This may cause a greater reference voltage error.
(6) Interrupt request flag (ADIF0)
The interrupt request flag (ADIF0) is not cleared even if analog input channel specification register 0 (ADS0) is
changed.
Therefore, if an analog input pin is changed during A/D conversion, the A/D conversion result and conversion
end interrupt request flag for the pre-change analog input may be set just before the ADS0 rewrite. Caution is
therefore required since, at this time, when ADIF0 is read immediately just after the ADS0 rewrite, ADIF0 is set
despite the fact that the A/D conversion for the post-change analog input has not ended.
When A/D conversion is restarted after it is stopped, clear ADIF0 before restart.
Figure 12-16. A/D Conversion End Interrupt Request Generation Timing
ADM0 rewrite
ADS0 rewrite
ADIF is set but ANIm
(start of ANIn conversion)
(start of ANIm conversion)
conversion has not ended.
A/D conversion
ANIn
ANIn
ANIm
ANIm
ANIm
Undefined
ADCR0
INTAD0
ANIn
ANIm
Remarks 1. n = 0, 1, ......, 3
2. m = 0, 1, ......, 3
(7) Conversion results just after A/D conversion start
The A/D conversion value just after A/D conversion operations start may not fall within the rating. Polling A/D
conversion end interrupt request (INTAD0) and take measures such as removing the first conversion results.
(8) A/D conversion result register 0 (ADCR0) read operation
When writing is performed to A/D converter mode register 0 (ADM0) and analog input channel specification
register 0 (ADS0), the contents of ADCR0 may become undefined. Read the conversion result following
conversion completion before writing to ADM0, ADS0. Using a timing other than the above may cause an incorrect
conversion result to be read.
User’s Manual U16035EJ5V0UD
213
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(9) Timing at which A/D conversion result is undefined
The A/D conversion value may be undefined if the timing of completion of A/D conversion and the timing of
stopping the A/D conversion conflict with each other. Therefore, read the A/D conversion result during the
A/D conversion operation.
Figure 12-17 shows the timing of reading the conversion result.
Figure 12-17. Timing of Reading Conversion Result (When Conversion Result Is Undefined)
A/D conversion completes
A/D conversion completes
ADCR0
INTAD0
ADCS0
Normal conversion result
Undefined value
Normal conversion result is read.
A/D conversion
is stopped.
Undefined value
is read.
(10) Notes on board design
Locate analog circuits as far away from digital circuits as possible on the board because the analog circuits may
be affected by the noise of the digital circuits. In particular, do not cross an analog signal line with a digital signal
line, or wire an analog signal line in the vicinity of a digital signal line. Otherwise, the A/D conversion
characteristics may be affected by the noise of the digital line.
Connect AVSS0 and VSS0 at one location on the board where the voltages are stable.
214
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(11) AVDD pin
The AVDD pin is the analog circuit power supply pin. It supplies power to the input circuits of the ANI0 to ANI3
pins.
Therefore, be sure to apply the same potential as VDD0 to this pin even for applications designed to switch to a
backup battery for power supply.
Figure 12-18. AVDD Pin Connection
AVREF
VDD0
AVDD
Main power supply
Capacitor
for backup
VSS0
AVSS
(12) AVREF pin
Connect a capacitor to the AVREF pin to minimize conversion errors due to noise. If an A/D conversion operation
has been stopped and then is started, the voltage applied to the AVREF pin becomes unstable, causing the
accuracy of the A/D conversion to drop. To prevent this, also connect a capacitor to the AVREF pin.
Figure 12-19 shows an example of connecting a capacitor.
Figure 12-19. Example of Connecting Capacitor to AVREF Pin
Clamp using a diode with a low
VF (0.3 V or lower).
AVDD
AVREF
C1
C2
AVSS
Remark C1: 4.7 µF to 10 µF (reference value)
C2: 0.01 µF to 0.1 µF (reference value)
Connect C2 as close to the pin as possible.
User’s Manual U16035EJ5V0UD
215
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
(13) Internal equivalent circuit of ANI0 to ANI3 pins and permissible signal source impedance
To complete sampling within the sampling time with sufficient A/D conversion accuracy, the impedance of the
signal source such as a sensor must be sufficiently low. Figure 12-20 shows the internal equivalent circuit of
the ANI0 to ANI3 pins.
If the impedance of the signal source is high, connect capacitors with a high capacitance to the pins ANI0 to ANI3.
An example of this is shown in Figure 12-21. In this case, however, the microcontroller cannot follow an analog
signal with a high differential coefficient because a lowpass filter is created.
To convert a high-speed analog signal or to convert an analog signal in the scan mode, insert a low-impedance
buffer.
Figure 12-20. Internal Equivalent Circuit of Pins ANI0 to ANI3
R1
R2
ANIn
C1
C2
C3
Remark n = 0 to 3
Table 12-3. Resistance and Capacitance of Equivalent Circuit (Reference Values)
AVREF
2.7 V
4.5 V
R1
R2
C1
C2
C3
12 kΩ
4 kΩ
8 kΩ
8 pF
8 pF
3 pF
2 pF
2 pF
2.7 kΩ
1.4 pF
Caution
The resistance and capacitance in Table 12-3 are not guaranteed values.
216
User’s Manual U16035EJ5V0UD
CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
Figure 12-21. Example of Connection When Signal Source Impedance Is High
If a noise of AVREF or higher or AVSS or lower
may be generated, clamp using a diode with
a low VF (0.3 V or lower).
Reference
voltage input
<Sensor internal circuit>
<Microcontroller internal circuit>
AVREF
Output impedance
of sensor
R1
R2
ANIn
R0
C1
C2
C3
C0
C0 ≤ 0.1 F
µ
Lowpass filter
is created.
Remark n = 0 to 3
(14) Input impedance of ANI0 to ANI3 pins
This A/D converter executes sampling by charging the internal sampling capacitor for approximately 1/10 of the
conversion time.
Therefore, only the leakage current flows during other than sampling, and the current for charging the capacitor
flows during sampling. The input impedance therefore varies and has no meaning.
To achieve sufficient sampling, it is recommended that the output impedance of the analog input source be 10
kΩ or less, or attach a capacitor of around 100 pF to the ANI0 to ANI3 pins (see Figure 12-21).
User’s Manual U16035EJ5V0UD
217
CHAPTER 13 SERIAL INTERFACE UART0
13.1 Functions of Serial Interface UART0
Serial interface UART0 has the following three modes.
(1) Operation stop mode
This mode is used when serial transfers are not performed to reduce power consumption.
For details, see 13.4.1 Operation stop mode.
(2) Asynchronous serial interface (UART) mode (fixed to LSB first)
This mode enables full-duplex operation wherein one byte of data after the start bit is transmitted and received.
The on-chip baud rate generator dedicated to UART enables communications using a wide range of selectable
baud rates. The communication range is between 1.2 kbps and 131 kbps (when operated at fX = 8.38 MHz).
In addition, a baud rate (39 kbps max. (when operated at fX = 1.25 MHz)) can also be defined by dividing the
clock input to the ASCK0 pin.
The UART baud rate generator can also be used to generate a MIDI-standard baud rate (31.25 kbps).
For details, see 13.4.2 Asynchronous serial interface (UART) mode.
(3) Infrared data transfer mode
For details, see 13.4.3 Infrared data transfer mode.
Figure 13-1 shows a block diagram of serial interface UART0.
218
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
Figure 13-1. Block Diagram of Serial Interface UART0
Internal bus
Asynchronous serial interface
mode register 0 (ASIM0)
Receive
TXE0 RXE0 PS01 PS00 CL0 SL0 ISRM0 IRDAM0
buffer
register 0
(RXB0)
Asynchronous serial
interface status
register 0 (ASIS0)
Transmit
shift
register 0
(TXS0)
Receive
shift
register 0
(RX0)
RxD0/P23
TxD0/P24
PE0 FE0 OVE0
Receive
controller
(parity
INTSER0
Output latch
(P24)
PM24
INTSR0
check)
Transmit
controller
(parity
INTST0
addition)
ASCK0/P25
Baud rate
generatorNote
fX
/2 to f
/27
X
Note For the configuration of the baud rate generator, refer to Figure 13-2.
Figure 13-2. Block Diagram of Baud Rate Generator
Start bit
sampling clock
TXE0
ASCK0/P25
fX/2 to fX/27
5-bit counter
Match
Transmit clock
1/2
1/2
Encoder
Match
Receive clock
5-bit counter
3
4
TPS02 TPS0
1
TPS00 MDL03 MDL02 MDL01 MDL00
RXE0
Start bit detection
Baud rate generator
control register 0 (BRGC0)
Internal bus
Remark TXE0: Bit 7 of asynchronous serial interface mode register 0 (ASIM0)
RXE0: Bit 6 of asynchronous serial interface mode register 0 (ASIM0)
User’s Manual U16035EJ5V0UD
219
CHAPTER 13 SERIAL INTERFACE UART0
13.2 Configuration of Serial Interface UART0
Serial interface UART0 includes the following hardware.
Table 13-1. Configuration of Serial Interface UART0
Item
Registers
Configuration
Transmit shift register 0 (TXS0)
Receive shift register 0 (RX0)
Receive buffer register 0 (RXB0)
Asynchronous serial interface status register 0 (ASIS0)
Control registers
Asynchronous serial interface mode register 0 (ASIM0)
Baud rate generator control register 0 (BRGC0)
Port mode register 2 (PM2)
Port 2 (P2)
(1) Transmit shift register 0 (TXS0)
This is the register for setting transmit data. Data written to TXS0 is transmitted as serial data.
When the data length is set as 7 bits, bits 0 to 6 of the data written to TXS0 are transferred as transmit data.
Writing data to TXS0 starts the transmit operation.
TXS0 can be written by an 8-bit memory manipulation instruction. It cannot be read.
RESET input sets TXS0 to FFH.
Caution
Do not write to TXS0 during a transmit operation.
The same address is assigned to TXS0 and receive buffer register 0 (RXB0). A read operation
reads values from RXB0.
(2) Receive shift register 0 (RX0)
This register converts serial data input via the RxD0 pin to parallel data. When one byte of data is received at
this register, the receive data is transferred to receive buffer register 0 (RXB0).
RX0 cannot be manipulated directly by a program.
(3) Receive buffer register 0 (RXB0)
This register is used to hold receive data. When one byte of data is received, one byte of new receive data is
transferred from receive shift register 0 (RX0).
When the data length is set as 7 bits, receive data is sent to bits 0 to 6 of RXB0. In this case, the MSB of RXB0
always becomes 0.
RXB0 can be read by an 8-bit memory manipulation instruction. It cannot be written to.
RESET input sets RXB0 to FFH.
Caution
The same address is assigned to RXB0 and transmit shift register 0 (TXS0). During a write
operation, values are written to TXS0.
220
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(4) Asynchronous serial interface status register 0 (ASIS0)
When a receive error occurs in UART mode, this register indicates the type of error.
ASIS0 can be read by an 8-bit memory manipulation instruction.
RESET input clears ASIS0 to 00H.
Figure 13-3. Format of Asynchronous Serial Interface Status Register 0 (ASIS0)
Address: FFA1H After reset: 00H
R
Symbol
ASIS0
7
0
6
0
5
0
4
0
3
0
2
1
0
PE0
FE0
OVE0
PE0
0
Parity error flag
Framing error flag
Overrun error flag
No parity error
Parity error
1
(Transmit data parity not matched)
FE0
0
No framing error
Note 1
1
Framing error
(Stop bit not detected)
OVE0
0
1
No overrun error
Note 2
Overrun error
(Next receive operation was completed before data was read from receive buffer register
0 (RXB0))
Notes 1. Even if the stop bit length is set to two bits by setting bit 2 (SL0) of asynchronous serial interface mode
register 0 (ASIM0), stop bit detection during a receive operation only applies to a stop bit length of
1 bit.
2. When an overrun error has occurred, further overrun errors will continue to occur until the contents
of receive buffer register 0 (RXB0) are read.
(5) Transmit controller
The transmit controller controls transmit operations, such as adding a start bit, parity bit, and stop bit to data that
is written to transmit shift register 0 (TXS0), based on the values set to asynchronous serial interface mode register
0 (ASIM0).
(6) Receive controller
The receive controller controls receive operations based on the values set to asynchronous serial interface mode
register 0 (ASIM0). During a receive operation, it performs error checking, such as for parity errors, and sets
various values to asynchronous serial interface status register 0 (ASIS0) according to the type of error that is
detected.
User’s Manual U16035EJ5V0UD
221
CHAPTER 13 SERIAL INTERFACE UART0
13.3 Registers Controlling Serial Interface UART0
The following four registers are used to control serial interface UART0.
•
•
•
•
Asynchronous serial interface mode register 0 (ASIM0)
Baud rate generator control register 0 (BRGC0)
Port mode register 2 (PM2)
Port 2 (P2)
(1) Asynchronous serial interface mode register 0 (ASIM0)
This is an 8-bit register that controls serial interface UART0’s serial transfer operations.
ASIM0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears ASIM0 to 00H.
Figure 13-4 shows the format of ASIM0.
222
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
Figure 13-4. Format of Asynchronous Serial Interface Mode Register 0 (ASIM0)
Address: FFA0H After reset: 00H
R/W
Symbol
ASIM0
<7>
<6>
5
4
3
2
1
0
TXE0
RXE0
PS01
PS00
CL0
SL0
ISRM0
IRDAM0
TXE0
RXE0
Operation mode
Operation stop
RxD0/P23 pin function
Port function (P23)
TxD0/P24 pin function
Port function (P24)
0
0
0
1
UART mode
Serial function (RxD0)
(receive only)
1
1
0
1
UART mode
Port function (P23)
Serial function (TxD0)
(transmit only)
UART mode
Serial function (RxD0)
(transmit and receive)
PS01
PS00
Parity bit specification
0
0
0
1
No parity
Zero parity always added during transmission
No parity detection during reception (parity errors do not occur)
1
1
0
1
Odd parity
Even parity
CL0
0
Character length specification
7 bits
1
8 bits
SL0
0
Stop bit length specification for transmit data
Receive completion interrupt control when error occurs
1 bit
1
2 bits
ISRM0
0
1
Receive completion interrupt request is issued when an error occurs
Receive completion interrupt request is not issued when an error occurs
Note 1
IRDAM0
Operation specified for infrared data transfer mode
0
1
UART (transmit/receive) mode
Note 2
Infrared data transfer (transmit/receive) mode
Notes 1. The UART/infrared data transfer mode specification is controlled by TXE0 and RXE0.
2. When using infrared data transfer mode, be sure to set baud rate generator control register 0 (BRGC0)
to 10H.
Caution Stop operation before writing different data to ASIM0.
User’s Manual U16035EJ5V0UD
223
CHAPTER 13 SERIAL INTERFACE UART0
(2) Baud rate generator control register 0 (BRGC0)
This register sets the serial clock for serial interface.
BRGC0 is set by an 8-bit memory manipulation instruction.
RESET input clears BRGC0 to 00H.
Figure 13-5 shows the format of BRGC0.
Figure 13-5. Format of Baud Rate Generator Control Register 0 (BRGC0)
Address: FFA2H After reset: 00H
R/W
Symbol
BRGC0
7
0
6
5
4
3
2
1
0
TPS02
TPS01
TPS00
MDL03
MDL02
MDL01
MDL00
TPS02
TPS01
TPS00
Source clock selection for 5-bit counter
n
0
1
2
3
4
5
6
7
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
External clock input to ASCK0
fX/2
2
fX/2
3
fX/2
4
fX/2
5
fX/2
6
fX/2
7
fX/2
MDL03
MDL02
MDL01
MDL00
Output clock selection for baud rate generator
k
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
fSCK0/16
fSCK0/17
fSCK0/18
fSCK0/19
fSCK0/20
fSCK0/21
fSCK0/22
fSCK0/23
fSCK0/24
fSCK0/25
fSCK0/26
fSCK0/27
fSCK0/28
fSCK0/29
fSCK0/30
Setting prohibited
1
2
3
4
5
6
7
8
9
10
11
12
13
14
—
Cautions 1. Writing to BRGC0 during a communication operation may cause abnormal output from the
baud rate generator and disable further communication operations. Therefore, do not write
to BRGC0 during a communication operation.
2. Set 10H to BRGC0 when using in infrared data transfer mode.
224
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
Remarks 1. fX:
Main system clock oscillation frequency
2. fSCK0: Source clock for 5-bit counter
3. n:
4. k:
Value set via TPS00 to TPS02 (0 ≤ n ≤ 7)
Value set via MDL00 to MDL03 (0 ≤ k ≤ 14)
5. The equation for the baud rate is as follows.
fX
[Baud rate] =
[Hz]
2n+1(k + 16)
(3) Port mode register 2 (PM2)
Port mode register 2 is used to set input/output of port 2 in 1-bit units.
To use the P24/TxD0 pin as a serial data output, clear PM24 and the output latch of P24 to 0.
To use the P23/RxD0 pin as a serial data input, and the P25/ASCK0 pin as a clock input, set PM23 and PM25
to 1. At this time, the output latches of P23 and P25 can be either 0 or 1.
PM2 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 to FFH.
Figure 13-6. Format of Port Mode Register 2 (PM2)
Address: FF22H After reset: FFH
R/W
Symbol
PM2
7
1
6
1
5
4
3
2
1
0
PM25
PM24
PM23
PM22
PM21
PM20
PM2n
P2n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
User’s Manual U16035EJ5V0UD
225
CHAPTER 13 SERIAL INTERFACE UART0
13.4 Operations of Serial Interface UART0
This section explains the three modes of serial interface UART0.
13.4.1 Operation stop mode
Because serial transfer is not performed during this mode, the power consumption can be reduced.
In addition, pins can be used as normal ports.
(1) Register to be used
Operation stop mode is set by asynchronous serial interface mode register 0 (ASIM0).
ASIM0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears ASIM0 to 00H.
Address: FFA0H After reset: 00H
R/W
Symbol
ASIM0
<7>
<6>
5
4
3
2
1
0
TXE0
RXE0
PS01
PS00
CL0
SL0
ISRM0
IRDAM0
TXE0
0
RXE0
0
Operation mode
Operation stop
RxD0/P23 pin function
Port function (P23)
TxD0/P24 pin function
Port function (P24)
13.4.2 Asynchronous serial interface (UART) mode
This mode enables full-duplex operation wherein one byte of data after the start bit is transmitted or received.
The on-chip baud rate generator dedicated to UART enables communications using a wide range of selectable
baud rates. The communication range is between 1.2 kbps and 131 kbps (when operated at fX = 8.38 MHz). The
baud rate (39 kbps max. (when operated of fX = 1.25 MHz)) can be defined by dividing the input clock to the ASCK0
pin.
The UART baud rate generator can also be used to generate a MIDI-standard baud rate (31.25 kbps).
(1) Registers to be used
• Asynchronous serial interface mode register 0 (ASIM0)
• Asynchronous serial interface status register 0 (ASIS0)
• Baud rate generator control register 0 (BRGC0)
• Port mode register 2 (PM2)
• Port 2 (P2)
(a) Asynchronous serial interface mode register 0 (ASIM0)
ASIM0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears ASIM0 to 00H.
226
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
Address: FFA0H After reset: 00H
R/W
Symbol
ASIM0
<7>
<6>
5
4
3
2
1
0
TXE0
RXE0
PS01
PS00
CL0
SL0
ISRM0
IRDAM0
TXE0
RXE0
Operation mode
Operation stop
RxD0/P23 pin function
Port function (P23)
TxD0/P24 pin function
Port function (P24)
0
0
0
1
UART mode
Serial function (RxD0)
(receive only)
1
1
0
1
UART mode
Port function (P23)
Serial function (TxD0)
(transmit only)
UART mode
Serial function (RxD0)
(transmit and receive)
PS01
PS00
Parity bit specification
0
0
0
1
No parity
Zero parity always added during transmission
No parity detection during reception (parity errors do not occur)
1
1
0
1
Odd parity
Even parity
CL0
0
Character length specification
7 bits
1
8 bits
SL0
0
Stop bit length specification for transmit data
1 bit
1
2 bits
ISRM0
Receive completion interrupt control when error occurs
0
1
Receive completion interrupt request is issued when an error occurs
Receive completion interrupt request is not issued when an error occurs
Note 1
IRDAM0
Operation specified for infrared data transfer mode
0
1
UART (transmit/receive) mode
Note 2
Infrared data transfer (transmit/receive) mode
Notes 1. The UART/infrared data transfer mode specification is controlled by TXE0 and RXE0.
2. When using infrared data transfer mode, be sure to set baud rate generator control register 0
(BRGC0) to 10H.
Caution Stop operation before writing different data to ASIM0.
User’s Manual U16035EJ5V0UD
227
CHAPTER 13 SERIAL INTERFACE UART0
(b) Asynchronous serial interface status register 0 (ASIS0)
ASIS0 can be read by an 8-bit memory manipulation instruction.
RESET input clears ASIS0 to 00H.
Address: FFA1H After reset: 00H
R
Symbol
ASIS0
7
0
6
0
5
0
4
0
3
0
2
1
0
PE0
FE0
OVE0
PE0
0
Parity error flag
Framing error flag
Overrun error flag
No parity error
Parity error
1
(Transmit data parity not matched)
FE0
0
No framing error
Note 1
1
Framing error
(Stop bit not detected)
OVE0
0
1
No overrun error
Note 2
Overrun error
(Next receive operation was completed before data was read from receive buffer register
0 (RXB0))
Notes 1. Even if a stop bit length is set to 2 bits by setting bit 2 (SL0) in asynchronous serial interface mode
register 0 (ASIM0), stop bit detection during a receive operation only applies to a stop bit length
of 1 bit.
2. When an overrun error has occurred, further overrun errors will continue to occur until the contents
of receive buffer register 0 (RXB0) are read.
228
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(c) Baud rate generator control register 0 (BRGC0)
BRGC0 is set by an 8-bit memory manipulation instruction.
RESET input clears BRGC0 to 00H.
Address: FFA2H After reset: 00H
R/W
Symbol
BRGC0
7
0
6
5
4
3
2
1
0
TPS02
TPS01
TPS00
MDL03
MDL02
MDL01
MDL00
TPS02
TPS01
TPS00
Source clock selection for 5-bit counter
n
0
1
2
3
4
5
6
7
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
External clock input to ASCK0
fX/2
2
fX/2
3
fX/2
4
fX/2
5
fX/2
6
fX/2
7
fX/2
MDL03
MDL02
MDL01
MDL00
Output clock selection for baud rate generator
k
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
fSCK0/16
fSCK0/17
fSCK0/18
fSCK0/19
fSCK0/20
fSCK0/21
fSCK0/22
fSCK0/23
fSCK0/24
fSCK0/25
fSCK0/26
fSCK0/27
fSCK0/28
fSCK0/29
fSCK0/30
Setting prohibited
1
2
3
4
5
6
7
8
9
10
11
12
13
14
—
Caution Writing to BRGC0 during a communication operation may cause abnormal output from the
baud rate generator and disable further communication operations. Therefore, do not write
to BRGC0 during a communication operation.
Remarks 1. fX:
Main system clock oscillation frequency
2. fSCK0: Source clock for 5-bit counter
3. n:
4. k:
Value set via TPS00 to TPS02 (0 ≤ n ≤ 7)
Value set via MDL00 to MDL03 (0 ≤ k ≤ 14)
User’s Manual U16035EJ5V0UD
229
CHAPTER 13 SERIAL INTERFACE UART0
The transmit/receive clock that is used to generate the baud rate is obtained by dividing the main system
clock.
•
Transmit/receive clock generation for baud rate by using main system clock
The main system clock is divided to generate the transmit/receive clock. The baud rate generated from
the main system clock is determined according to the following formula.
fX
[Baud rate] =
[Hz]
2n+1(k + 16)
fX: Main system clock oscillation frequency
When ASCK0 is selected as the source clock of the 5-bit counter, substitute the input clock frequency
to the ASCK0 pin for fX in the above expression.
n: Value set via TPS00 to TPS02 (0 ≤ n ≤ 7)
k: Value set via MDL00 to MDL03 (0 ≤ k ≤ 14)
Table 13-2. Relationship Between Main System Clock and Baud Rate Error
fX = 8.3886 MHz
fX = 8.000 MHz
fX = 7.3728 MHz
fX = 5.000 MHz
fX = 4.1943 MHz
Baud Rate
(bps)
BRGC0 ERR (%) BRGC0 ERR (%) BRGC0 ERR (%) BRGC0 ERR (%) BRGC0 ERR (%)
600
−
−
−
−
−
−
0
−
−
7BH
6BH
5BH
4BH
3BH
2BH
21H
1BH
−
1.14
1.14
1.14
1.14
1.14
1.14
−1.3
1.14
−
1200
7BH
6BH
5BH
4BH
3BH
31H
2BH
1BH
12H
1.10
1.10
1.10
1.10
1.10
−1.3
1.10
1.10
1.10
7AH
6AH
5AH
4AH
3AH
30H
2AH
1AH
11H
0.16
0.16
0.16
0.16
0.16
0
78H
68H
58H
48H
38H
2DH
28H
18H
10H
70H
60H
50H
40H
30H
24H
20H
10H
−
1.73
1.73
1.73
1.73
1.73
0
2400
0
4800
0
9600
0
19200
31250
38400
76800
115200
0
1.70
0
0.16
0.16
2.12
1.73
1.73
−
0
0
−
−
Remark fX: Main system clock oscillation frequency
Error tolerance range for baud rate
•
The error for the baud rate depends on the number of bits per frame and the 5-bit counter’s division ratio
[1/(16 + k)].
Figure 13-7 shows an example of the baud rate error tolerance range.
230
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
Figure 13-7. Error Tolerance (When k = 0), Including Sampling Errors
Ideal
sampling
point
32T
64T
256T
288T
320T
352T
304T
P
336T
Basic timing
Start
Start
Start
D0
D7
Stop
15.5T
STOP
High-speed limit timing
Low-speed limit timing
D0
D7
P
Sampling error
0.5T
30.45T
60.9T
304.5T
15.5T
D0
D7
P
Stop
33.55T
67.1T
15.5
301.95T
335.5T
Baud rate error tolerance (when k = 0) =
× 100 = 4.8438 (%)
320
Caution
The above error tolerance value is the value calculated based on the ideal sample point.
In the actual design, allow margins that include errors of timing for detecting a start bit.
Remark T: 5-bit counter’s source clock cycle
(d) Port mode register 2 (PM2)
Port mode register 2 is used to set input/output of port 2 in 1-bit units.
To use the P24/TxD0 pin as a serial data output, clear PM24 and the output latch of P24 to 0.
To use the P23/RxD0 pin as a serial data input, and the P25/ASCK0 pin as a clock input, set PM23 and PM25
to 1. At this time, the output latches of P23 and P25 can be either 0 or 1.
PM2 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 to FFH.
Address: FF22H After reset: FFH
R/W
Symbol
PM2
7
1
6
1
5
4
3
2
1
0
PM25
PM24
PM23
PM22
PM21
PM20
PM2n
P2n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
User’s Manual U16035EJ5V0UD
231
CHAPTER 13 SERIAL INTERFACE UART0
(2) Communication operations
(a) Data format
Figure 13-8 shows the format of the transmit/receive data.
Figure 13-8. Format of Transmit/Receive Data in Asynchronous Serial Interface
1 data frame
Start
bit
Parity
bit
Stop bit
D0
D1
D2
D3
D4
D5
D6
D7
Character bits
1 data frame consists of the following bits.
•
•
•
•
Start bit .............1 bit
Character bits ... 7 bits or 8 bits (LSB first)
Parity bit ........... Even parity, odd parity, zero parity, or no parity
Stop bit(s) ......... 1 bit or 2 bits
Asynchronous serial interface mode register 0 (ASIM0) is used to set the character bit length, parity selection,
and stop bit length within each data frame.
When “7 bits” is selected as the number of character bits, only the lower 7 bits (bits 0 to 6) are valid, so that
during a transmission the highest bit (bit 7) is ignored and during reception the highest bit (bit 7) must be
cleared to 0.
Baud rate generator control register 0 (BRGC0) is used to set the serial transfer rate.
If a receive error occurs, information about the receive error can be recognized by reading asynchronous
serial interface status register 0 (ASIS0).
232
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(b) Parity types and operations
The parity bit is used to detect bit errors in communication data. Usually, the same type of parity bit is used
by the transmitting and receiving sides. When odd parity or even parity is set, errors in the parity bit (the
odd-number bit) can be detected. When zero parity or no parity is set, errors are not detected.
(i) Even parity
•
During transmission
The number of bits in transmit data that includes a parity bit is controlled so that there are an even
number of character bits whose value is 1. The value of the parity bit is as follows.
If the transmit data contains an odd number of character bits whose value is 1: the parity bit is “1”
If the transmit data contains an even number of character bits whose value is 1: the parity bit is “0”
•
During reception
The number of character bits whose value is 1 is counted among the receive data that include a parity
bit, and a parity error occurs when the counted result is an odd number.
(ii) Odd parity
• During transmission
The number of character bits in transmit data that includes a parity bit is controlled so that there is
an odd number of bits whose value is 1. The value of the parity bit is as follows.
If the transmit data contains an odd number of character bits whose value is 1: the parity bit is “0”
If the transmit data contains an even number of character bits whose value is 1: the parity bit is “1”
•
During reception
The number of character bits whose value is 1 is counted among the receive data that include a parity
bit, and a parity error occurs when the counted result is an even number.
(iii) Zero parity
During transmission, the parity bit is set to “0” regardless of the transmit data.
During reception, the parity bit is not checked. Therefore, no parity errors will occur regardless of
whether the parity bit is a “0” or a “1”.
(iv) No parity
No parity bit is added to the transmit data.
During reception, receive data is regarded as having no parity bit. Since there is no parity bit, no parity
errors will occur.
User’s Manual U16035EJ5V0UD
233
CHAPTER 13 SERIAL INTERFACE UART0
(c) Transmission
The transmit operation is enabled when bit 7 (TXE0) of the asynchronous serial interface mode register 0
(ASIM0) is set (1). The transmit operation is started when transmit data is written to transmit shift register
0 (TXS0). A start bit, parity bit, and stop bit(s) are automatically added to the data.
Starting the transmit operation shifts out the data in TXS0, thereby emptying TXS0, after which a transmit
completion interrupt request (INTST0) is issued.
The timing of the transmit completion interrupt request is shown in Figure 13-9.
Figure 13-9. Timing of Asynchronous Serial Interface Transmit Completion Interrupt Request
(i) Stop bit length: 1 bit
TxD0 (output)
INTST0
START
D0
D1
D2
D6
D7
Parity STOP
(ii) Stop bit length: 2 bits
TxD0 (output)
INTST0
START
D0
D1
D2
D6
D7
Parity
STOP
Caution
Do not rewrite to asynchronous serial interface mode register 0 (ASIM0) during a transmit
operation. Rewriting ASIM0 register during a transmit operation may disable further
transmit operations (in such cases, input a RESET to restore normal operation).
234
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(d) Reception
The receive operation performs level detection.
The receive operation is enabled when “1” is set to bit 6 (RXE0) of asynchronous serial interface mode
register 0 (ASIM0), and the input via the RxD0 pin is sampled.
The serial clock specified by baud rate generator control register 0 (BRGC0) is used to sample the RxD0
pin.
When the RxD0 pin goes low, the 5-bit counter of the baud rate generator begins counting and the start timing
signal for data sampling is output when half of the specified baud rate time has elapsed. If sampling the
RxD0 pin input at this start timing signal yields a low-level result, a start bit is recognized, after which the
5-bit counter is initialized and starts counting and data sampling begins. After the start bit is recognized,
the character data, parity bit, and one-bit stop bit are detected, at which point reception of one data frame
is completed.
Once reception of one data frame is completed, the receive data in the shift register is transferred to receive
buffer register 0 (RXB0) and INTSR0 (receive completion interrupt request) occurs.
If the RXE0 bit is reset (to 0) during a receive operation, the receive operation is stopped immediately. At
this time, the contents of RXB0 and ASIS0 do not change, nor does INTSR0 or INTSER0 (receive error
interrupt request) occur.
Figure 13-10 shows the timing of the asynchronous serial interface receive completion interrupt request.
Figure 13-10. Timing of Asynchronous Serial Interface Receive Completion Interrupt Request
RxD0 (input)
Start
D0
D1
D2
D6
D7
Parity STOP
INTSR0
Caution
If the receive operation is enabled with the RxD0 pin input at the low level, the receive
operation is immediately started. Make sure the RxD0 pin input is at the high level before
enabling the receive operation.
User’s Manual U16035EJ5V0UD
235
CHAPTER 13 SERIAL INTERFACE UART0
(e) Receive errors
Three types of errors can occur during a receive operation: parity error, framing error, or overrun error. If,
as the result of data reception, an error flag is set to asynchronous serial interface status register 0 (ASIS0),
a receive error interrupt request (INTSER0) will occur. Receive error interrupt requests are generated before
receive completion interrupt request (INTSR0). Table 13-3 lists the causes behind receive errors.
As part of receive error interrupt request (INTSER0) servicing, the contents of ASIS0 can be read to determine
which type of error occurred during the receive operation (see Table 13-3 and Figure 13-11).
The contents of ASIS0 are reset (0) when receive buffer register 0 (RXB0) is read or when the next data
is received (if the next data contains an error, its error flag will be set).
Table 13-3. Causes of Receive Errors
Receive Error
Parity error
Cause
ASIS0 Value
04H
Parity specified does not match parity of receive data
Framing error Stop bit was not detected
02H
Overrun error Reception of the next data was completed before data was read from
receive buffer register 0 (RXB0)
01H
Figure 13-11. Receive Error Timing
RxD0 (input)
INTSR0 Note
Start
D0
D1
D2
D6
D7
Parity
Stop
INTSER0
(When framing/overrun error occurs)
INTSER0
(When parity error occurs)
Note If a receive error occurs when ISRM0 bit has been set (1), INTSR0 does not occur.
Cautions 1. The contents of asynchronous serial interface status register 0 (ASIS0) are reset (0)
when receive buffer register 0 (RXB0) is read or when the next data is received. To
obtain information about the error, be sure to read the contents of ASIS0 before reading
RXB0.
2. Be sure to read the contents of receive buffer register 0 (RXB0) after the receive
completion interrupt request has occurred even when a receive error has occurred;
otherwise overrun errors will occur during the next data receive operations and the
receive error status will remain until the contents of RXB0 are read.
236
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
13.4.3 Infrared data transfer mode
In infrared data transfer mode, pulses can be output and received in the data format shown in (2).
(1) Registers to be used
• Asynchronous serial interface mode register 0 (ASIM0)
• Asynchronous serial interface status register 0 (ASIS0)
• Baud rate generator control register 0 (BRGC0)
• Port mode register 2 (PM2)
• Port 2 (P2)
(a) Asynchronous serial interface mode register 0 (ASIM0)
ASIM0 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears ASIM0 to 00H.
User’s Manual U16035EJ5V0UD
237
CHAPTER 13 SERIAL INTERFACE UART0
Address: FFA0H After reset: 00H
R/W
Symbol
ASIM0
<7>
<6>
5
4
3
2
1
0
TXE0
RXE0
PS01
PS00
CL0
SL0
ISRM0
IRDAM0
TXE0
RXE0
Operation mode
Operation stop
RxD0/P23 pin function
Port function (P23)
TxD0/P24 pin function
Port function (P24)
0
0
0
1
UART mode
Serial function (RxD0)
(receive only)
1
1
0
1
UART mode
Port function (P23)
Serial function (TxD0)
(transmit only)
UART mode
Serial function (RxD0)
(transmit and receive)
PS01
PS00
Parity bit specification
0
0
0
1
No parity
Zero parity always added during transmission
No parity detection during reception (parity errors do not occur)
1
1
0
1
Odd parity
Even parity
CL0
0
Character length specification
7 bits
1
8 bits
SL0
0
Stop bit length specification for transmit data
1 bit
1
2 bits
ISRM0
Receive completion interrupt control when error occurs
0
1
Receive completion interrupt request is issued when an error occurs
Receive completion interrupt request is not issued when an error occurs
Note 1
IRDAM0
Operation specified for infrared data transfer mode
0
1
UART (transmit/receive) mode
Note 2
Infrared data transfer (transmit/receive) mode
Notes 1. The UART/infrared data transfer mode specification is controlled by TXE0 and RXE0.
2. When using infrared data transfer mode, be sure to set baud rate generator control register 0 (BRGC0)
to “10H”.
Caution Stop operation before writing different data to ASIM0.
238
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(b) Asynchronous serial interface status register 0 (ASIS0)
ASIS0 can be read by an 8-bit memory manipulation instruction.
RESET input clears ASIS0 to 00H.
Address: FFA1H After reset: 00H
R
Symbol
ASIS0
7
0
6
0
5
0
4
0
3
0
2
1
0
PE0
FE0
OVE0
PE0
0
Parity error flag
Framing error flag
Overrun error flag
No parity error
Parity error
1
(Incorrect parity bit detected)
FE0
0
No framing error
Note 1
1
Framing error
(Stop bit not detected)
OVE0
0
1
No overrun error
Note 2
Overrun error
(Next receive operation was completed before data was read from receive buffer register
0 (RXB0))
Notes 1. Even if the stop bit length is set to two bits by setting bit 2 (SL0) of asynchronous serial interface
mode register 0 (ASIM0), stop bit detection during a receive operation only applies to a stop bit
length of 1 bit.
2. When an overrun error has occurred, further overrun errors will continue to occur until the contents
of receive buffer register 0 (RXB0) are read.
User’s Manual U16035EJ5V0UD
239
CHAPTER 13 SERIAL INTERFACE UART0
(c) Baud rate generator control register 0 (BRGC0)
BRGC0 is set by an 8-bit memory manipulation instruction.
RESET input clears BRGC0 to 00H.
Address: FFA2H After reset: 00H
R/W
Symbol
BRGC0
7
0
6
5
4
3
2
1
0
TPS02
TPS01
TPS00
MDL03
MDL02
MDL01
MDL00
TPS02
TPS01
TPS00
Source clock selection for 5-bit counter
n
0
1
2
3
4
5
6
7
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
External clock input to ASCK0
fX/2
2
fX/2
3
fX/2
4
fX/2
5
fX/2
6
fX/2
7
fX/2
MDL03
MDL02
MDL01
MDL00
Output clock selection for baud rate generator
k
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
fSCK0/16
fSCK0/17
fSCK0/18
fSCK0/19
fSCK0/20
fSCK0/21
fSCK0/22
fSCK0/23
fSCK0/24
fSCK0/25
fSCK0/26
fSCK0/27
fSCK0/28
fSCK0/29
fSCK0/30
Setting prohibited
1
2
3
4
5
6
7
8
9
10
11
12
13
14
—
Cautions 1. Writing to BRGC0 during a communication operation may cause abnormal output from
the baud rate generator and disable further communication operations. Therefore, do
not write to BRGC0 during a communication operation.
2. Set BRGC0 to 10H when using in infrared data transfer mode.
Remarks 1. fX:
Main system clock oscillation frequency
2. fSCK0: Source clock for 5-bit counter
3. n:
4. k:
Value set via TPS00 to TPS02 (0 ≤ n ≤ 7)
Value set via MDL00 to MDL03 (0 ≤ k ≤ 14)
240
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(d) Port mode register 2 (PM2)
Port mode register 2 is used to set input/output of port 2 in 1-bit units.
To use the P24/TxD0 pin as a serial data output, set PM24 and the output latch of P24 to 0.
To use the P23/RxD0 pin as a serial data input, and the P25/ASCK0 pin as a clock input, set PM23 and PM25
to 1. At this time, the output latches of P23 and P25 can be either 0 or 1.
PM2 is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 to FFH.
Address: FF22H After reset: FFH
R/W
Symbol
PM2
7
1
6
1
5
4
3
2
1
0
PM25
PM24
PM23
PM22
PM21
PM20
PM2n
P2n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
(2) Data format
Figure 13-12 compares the data format used in UART mode with that used in infrared data transfer mode.
The IR (infrared) frame corresponds to the bit string of the UART frame, which consists of pulses that include
a start bit, eight data bits, and a stop bit.
The length of the electrical pulses that are used to transmit and receive in an IR frame is 3/16 the length of the
cycle time for one bit (i.e., the “bit time”). This pulse (whose width is 3/16 the length of one bit time) rises from
the middle of the bit time (see the figure below).
Bit time
Pulse width = 3/16 bit time
User’s Manual U16035EJ5V0UD
241
CHAPTER 13 SERIAL INTERFACE UART0
Figure 13-12. Data Format Comparison Between Infrared Data Transfer Mode and UART Mode
UART frame
Data bits
0
1
0
1
0
0
1
1
0
1
Start bit
D0
D1
D2
D3
D4
D5
D6
D7
Stop bit
IR frame
Data bits
Start bit
0
Stop bit
1
1
0
1
0
0
1
1
0
Bit time
Pulse width =
3/16 bit time
(3) Relationship between main system clock and baud rate
Table 13-4 shows the relationship between the main system clock and the baud rate.
Table 13-4. Relationship Between Main System Clock and Baud Rate
fX = 8.3886 MHz
131031 bps
fX = 8.000 MHz
125000 bps
fX = 7.3728 MHz
115200 bps
fX = 5.000 MHz
78125 bps
fX = 4.1943 MHz
65536 bps
Baud rate
(4) Bit rate and pulse width
Table 13-5 lists the bit rate, bit rate error tolerance, and pulse width values.
Table 13-5. Bit Rate and Pulse Width Values
3/16 Pulse Width
<Nominal Value>
(µs)
Bit Rate
(kbps)
Bit Rate Error Tolerance Pulse Width Minimum Value
Maximum Pulse Width
Note 2
(% of Bit Rate)
(µs)
(µs)
Note 1
115.2
+/– 0.87
1.41
1.63
2.71
Notes 1. Operation with fX = 7.3728 MHz
2. When a digital noise eliminator is used in a microcontroller operating at 1.41 MHz or above.
Caution
When using baud rate generator control register 0 (BRGC0) in infrared data transfer mode,
set it to 10H.
Remark fX: Main system clock oscillation frequency
242
User’s Manual U16035EJ5V0UD
CHAPTER 13 SERIAL INTERFACE UART0
(5) Input data and internal signals
•
Transmit operation timing
UART
output data
Start bit
Stop bit
UART
(Inverted data)
Infrared data transfer
enable signal
TxD0 pin
output signal
•
Receive operation timing
Data reception is delayed for one-half of the specified baud rate.
UART
transfer data
Start bit
Stop bit
RxD0 input
Edge detection
Sampling clock
Receive rate
Conversion data
Sampling timing
User’s Manual U16035EJ5V0UD
243
Table 13-6. Register Settings
(1) Operation stop mode
PM23
P23
PM24
P24
Pin Function
Operation
Mode
ASIM0
BRGC0
TXE0 RXE0 PS01 PS00
CL0
SL0 ISRM0 IRDAM0 TPS02 TPS01 TPS00 MDL03 MDL02 MDL01 MDL00
P23/RxD0 P24/TxD0
×
×
×
×
Stop
0
0
×
×
×
×
×
×
×
×
×
×
×
×
×
P23
P24
Setting prohibited
Other than above
(2) Asynchronous serial interface (UART) mode
PM23
P23
PM24
P24
Pin Function
Operation
Mode
ASIM0
BRGC0
TXE0 RXE0 PS01 PS00
CL0
0/1
0/1
0/1
SL0 ISRM0 IRDAM0 TPS02 TPS01 TPS00 MDL03 MDL02 MDL01 MDL00
P23/RxD0 P24/TxD0
1
×
1
×
×
×
×
0
0
×
0
0
Receive
Transmit
0
1
1
1
0
1
0/1
0/1
0/1
0/1
0/1
0/1
×
0/1
×
0
0
0
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
RxD0
P23
P24
TxD0
0/1
0/1
Transmit
/receive
0/1
RxD0
TxD0
Other than above
Setting prohibited
(3) Infrared data transfer mode
PM23
P23
PM24
P24
Pin Function
Operation
Mode
ASIM0
BRGC0
TXE0 RXE0 PS01 PS00
CL0
0/1
0/1
0/1
SL0 ISRM0 IRDAM0 TPS02 TPS01 TPS00 MDL03 MDL02 MDL01 MDL00
P23/RxD0 P24/TxD0
1
×
1
×
×
×
×
0
0
×
0
0
Receive
Transmit
0
1
1
1
0
1
0/1
0/1
0/1
0/1
0/1
0/1
×
0/1
×
1
1
1
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
RxD0
P23
P24
TxD0
0/1
0/1
Transmit
/receive
0/1
RxD0
TxD0
Other than above
Setting prohibited
Caution
When using the infrared data transfer mode, set the BRGC0 register to 10H.
Remark ×: Don’t care, ASIM0: Asynchronous serial interface mode register 0
BRGC0: Baud rate generator control register 0, PMxx: Port mode register, Pxx: Output latch of port
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
14.1 Functions of Serial Interfaces SIO30 and SIO31
Serial interface SIO3n has the following two modes.
(1) Operation stop mode
This mode is used when serial transfers are not performed. For details, see 14.4.1 Operation stop mode.
(2) 3-wire serial I/O mode (fixed as MSB first)
This is an 8-bit data transfer mode using three lines: a serial clock line (SCK3n), serial output line (SO3n), and
serial input line (SI3n).
Since simultaneous transmit and receive operations are enabled in 3-wire serial I/O mode, the processing time
for data transfers is reduced.
The first bit of the serial transferred 8-bit data is fixed as the MSB.
3-wire serial I/O mode is useful for connection to a peripheral IC incorporating a clocked serial interface, a display
controller, etc. For details, see 14.4.2 3-wire serial I/O mode.
Figure 14-1 shows a block diagram of serial interface SIO3n.
Figure 14-1. Block Diagram of Serial Interface SIO3n
Internal bus
8
Serial I/O shift register
3n (SIO3n)
SI3nNote
SO3nNote
Output latch
Interrupt
request signal
generator
Serial clock
counter
SCK3nNote
INTCSI3n
f
f
f
X
X
X
/23
/24
/25
Serial clock
controller
Selector
Note SI30, SO30, and SCK30 pins are alternate with P20, P21, and P22 pins. SI31, SO31, and SCK31 pins are
alternate with P34, P35, and P36 pins.
Remark n = 0 or 1
245
User’s Manual U16035EJ5V0UD
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
14.2 Configuration of Serial Interfaces SIO30 and SIO31
Serial interface SIO3n includes the following hardware.
Table 14-1. Configuration of Serial Interface SIO3n
Item
Configuration
Serial I/O shift register 3n (SIO3n)
Register
Control registers
Serial operation mode register 3n (CSIM3n)
Port mode registers 2, 3 (PM2, PM3)
Ports 2, 3 (P2, P3)
(1) Serial I/O shift register 3n (SIO3n)
This is an 8-bit register that performs parallel-serial conversion and serial transmit/receive (shift operations)
synchronized with the serial clock.
When 1 is set to bit 7 (CSIE3n) of serial operation mode register 3n (CSIM3n), a serial operation can be started
by writing data to or reading data from SIO3n.
When transmitting, data written to SIO3n is output to the serial output (SO3n).
When receiving, data is read from the serial input (SI3n) and written to SIO3n.
SIO3n is set by an 8-bit memory manipulation instruction.
RESET input makes SIO3n undefined.
Caution
Do not access SIO3n during a transfer operation unless the access is triggered by a transfer
start (read operation is disabled when MODEn = 0 and write operation is disabled when MODEn
= 1).
Remark n = 0 or 1
User’s Manual U16035EJ5V0UD
246
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
14.3 Registers Controlling Serial Interfaces SIO30 and SIO31
Serial interface SIO3n is controlled by the following three registers.
• Serial operation mode register 3n (CSIM3n)
• Port mode registers 2, 3 (PM2, PM3)
• Ports 2, 3 (P2, P3)
(1) Serial operation mode register 3n (CSIM3n)
This register is used to enable or disable SIO3n’s serial clock, operation modes, and specific operations.
CSIM3n is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears CSIM3n to 00H.
Remark n = 0 or 1
User’s Manual U16035EJ5V0UD
247
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
Figure 14-2. Format of Serial Operation Mode Register 30 (CSIM30)
Address: FFB0H After reset: 00H
R/W
Symbol
CSIM30
<7>
6
0
5
0
4
0
3
0
2
1
0
CSIE30
MODE0
SCL301
SCL300
CSIE30
Enable/disable specification for SIO30
Serial counter
Shift register operation
Operation stopped
Port
Note 1
0
1
Clear
Port function
Note 2
Operation enabled
Count operation enable
Serial function + port function
MODE0
Transfer operation modes and flags
Transfer start trigger
Operation mode
SO30/P21 pin function
SO30
0
1
Transmit/transmit and receive mode Write to SIO30
Note 3
Receive-only mode
Read from SIO30
P21
SCL301
SCL300
Clock selection
0
0
1
1
0
1
0
1
External clock input to SCK30
3
fX/2 (1.50 MHz)
4
fX/2 (750 kHz)
5
fX/2 (375 kHz)
Notes 1. When CSIE30 = 0 (SIO30 operation stopped status), the SI30, SO30, and SCK30 pins can be used
as port functions.
2. When CSIE30 = 1 (SIO30 operation enabled status), the SI30 pin can be used as a port pin if only
the transmit function is used, and the SO30 pin can be used as a port pin if only the receive-only mode
is used.
3. When MODE0 = 1 (receive-only mode), the SO30 pin can be used for port functions.
Caution
Do not rewrite the value of CSIM30 during transfer. However, CSIE30 can be rewritten using
a 1-bit memory manipulation instruction.
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
User’s Manual U16035EJ5V0UD
248
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
Figure 14-3. Format of Serial Operation Mode Register 31 (CSIM31)
Address: FFB8H After reset: 00H
R/W
Symbol
CSIM31
<7>
6
0
5
0
4
0
3
0
2
1
0
CSIE31
MODE1
SCL311
SCL310
CSIE31
Enable/disable specification for SIO31
Serial counter
Shift register operation
Operation stopped
Port
Note 1
0
1
Clear
Port function
Note 2
Operation enabled
Count operation enable
Serial function + port function
MODE1
Transfer operation modes and flags
Transfer start trigger
Operation mode
SO31/P35 pin function
SO31
0
1
Transmit/transmit and receive mode Write to SIO31
Note 3
Receive-only mode
Read from SIO31
P35
SCL311
SCL310
Clock selection
0
0
1
1
0
1
0
1
External clock input to SCK31
3
fX/2 (1.50 MHz)
4
fX/2 (750 kHz)
5
fX/2 (375 kHz)
Notes 1. When CSIE31 = 0 (SIO31 operation stopped status), the SI31, SO31, and SCK31 pins can be used
as port functions.
2. When CSIE31 = 1 (SIO31 operation enabled status), the SI31 pin can be used as a port pin if only
the transmit function is used, and the SO31 pin can be used as a port pin if only the receive-only mode
is used.
3. When MODE1 = 1 (receive-only mode), the SO31 pin can be used for port functions.
Caution
Do not rewrite the value of CSIM31 during transfer. However, CSIE31 can be rewritten using
a 1-bit memory manipulation instruction.
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
User’s Manual U16035EJ5V0UD
249
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
(2) Port mode registers 2, 3 (PM2, PM3)
These registers set the input/output of ports 2 and 3 in 1-bit units.
To use the P21/SO30 and P35/SO31 pins as serial data output, and the P22/SCK30 and P36/SCK31 pins as
clock output, clear PM21, PM35, PM22, PM36, and the output latches of P21, P35, P22, and P36 to 0.
To use the P20/SI30 and P34/SI31 pins as serial data input, and the P22/SCK30 and P36/SCK31 pins as clock
input, set PM20, PM34, PM22, and PM36 to 1.
At this time, the output latches of P20, P34, P22, and P36 can be either 0 or 1.
PM2 and PM3 are set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 and PM3 to FFH.
Figure 14-4. Format of Port Mode Register 2 (PM2)
Address: FF22H After reset: FFH
R/W
Symbol
PM2
7
1
6
1
5
4
3
2
1
0
PM25
PM24
PM23
PM22
PM21
PM20
PM2n
I/O mode selection of P2n pin (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
Figure 14-5. Format of Port Mode Register 3 (PM3)
Address: FF23H After reset: FFH
R/W
Symbol
PM3
7
1
6
5
4
3
2
1
0
Note
Note
Note
Note
PM36
PM35
PM34
1
1
1
1
PM3n
I/O mode selection of P3n pin (n = 4 to 6)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
Note The lower 4 bits (PM 33 to PM30) of PM3 are not fixed to 1. When setting the value using an 8-bit memory
manipulation instruction, therefore, be sure to set the lower 4 bits to 1.
User’s Manual U16035EJ5V0UD
250
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
14.4 Operations of Serial Interfaces SIO30 and SIO31
This section explains the two modes of serial interface SIO3n.
14.4.1 Operation stop mode
Because the serial transfer is not performed during this mode, the power consumption can be reduced.
In addition, pins can be used as normal I/O ports.
(1) Register settings
Operation stop mode is set by serial operation mode register 3n (CSIM3n).
CSIM3n is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears CSIM3n to 00H.
Address: FFB0H (SIO30), FFB8H (SIO31) After reset: 00H
R/W
Symbol
CSIM3n
<7>
6
0
5
0
4
0
3
0
2
1
0
CSIE3n
MODEn
SCL3n1
SCL3n0
CSIE3n
0
Enable/disable specification for SIO3n
Serial counter
Shift register operation
Operation disabled
Port
Note
Clear
Port function
Note When CSIE3n = 0 (SIO3n operation stop status), the pins SI3n, SO3n, and SCK3n can be used for port
functions.
Remark n = 0 or 1
User’s Manual U16035EJ5V0UD
251
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
14.4.2 3-wire serial I/O mode
The 3-wire serial I/O mode can be used when connecting a peripheral IC incorporating a clocked serial interface,
a display controller, etc.
This mode executes data transfers via three lines: a serial clock line (SCK3n), serial output line (SO3n), and serial
input line (SI3n).
(1) Registers to be used
•
•
•
Serial operation mode register 3n (CSIM3n)
Port mode registers 2, 3 (PM2, PM3)
Ports 2, 3 (P2, P3)
(a) Serial operation mode register 3n (CSIM3n)
CSIM3n is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears CSIM3n to 00H.
Address: FFB0H (SIO30), FFB8H (SIO31) After reset: 00H
R/W
Symbol
CSIM3n
<7>
6
0
5
0
4
0
3
0
2
1
0
CSIE3n
MODEn
SCL3n1
SCL3n0
CSIE3n
Enable/disable specification for SIO3n
Serial counter
Shift register operation
Operation stopped
Port
Note 1
0
1
Clear
Port function
Note 2
Operation enabled
Count operation enable
Serial function + port function
MODEn
Transfer operation modes and flags
Transfer start trigger
Operation mode
SO3n pin function
0
1
Transmit/transmit and receive mode Write to SIO3n
SO3n
Port function
Note 3
Receive-only mode
Read from SIO3n
SCL3n1
SCL3n0
Clock selection
0
0
1
1
0
1
0
1
External clock input to SCK3n
3
fX/2 (1.50 MHz)
4
fX/2 (750 kHz)
5
fX/2 (375 kHz)
Notes 1. When CSIE3n = 0 (SIO3n operation stopped status), the SI3n, SO3n, and SCK3n pins can be used
as port functions.
2. When CSIE3n = 1 (SIO3n operation enabled status), the SI3n pin can be used as a port pin if only
the transmit function is used, and the SO3n pin can be used as a port pin if only the receive-only mode
is used.
3. When MODEn = 1 (receive-only mode), the SO3n pin can be used for port functions.
Caution
Do not rewrite the value of CSIM3n during transfer. However, CSIE3n can be rewritten using
a 1-bit memory manipulation instruction.
User’s Manual U16035EJ5V0UD
252
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
3. n = 0 or 1
(b) Port mode registers 2, 3 (PM2, PM3)
These registers set the input/output of ports 2 and 3 in 1-bit units.
To use the P21/SO30 and P35/SO31 pins as serial data output, and the P22/SCK30 and P36/SCK31 pins
as clock output, clear PM21, PM35, PM22, PM36, and the output latches of P21, P35, P22, and P36 to 0.
To use the P20/SI30 and P34/SI31 pins as serial data input, and the P22/SCK30 and P36/SCK31 pins as
clock input, set PM20, PM34, PM22, and PM36 to 1.
At this time, the output latches of P20, P34, P22, and P36 can be either 0 or 1.
PM2 and PM3 are set by a 1-bit or 8-bit memory manipulation instruction.
RESET input sets PM2 and PM3 to FFH.
Address: FF22H After reset: FFH
R/W
Symbol
PM2
7
1
6
1
5
4
3
2
1
0
PM25
PM24
PM23
PM22
PM21
PM20
PM2n
P2n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
Address: FF23H After reset: FFH
R/W
Symbol
PM3
7
1
6
5
4
3
2
1
0
Note
Note
Note
Note
PM36
PM35
PM34
1
1
1
1
PM3n
P3n pin I/O mode selection (n = 4 to 6)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
Note The lower 4 bits (PM 33 to PM30) of PM3 are not fixed to 1. When setting the value using an 8-bit memory
manipulation instruction, therefore, be sure to set the lower 4 bits to 1.
User’s Manual U16035EJ5V0UD
253
CHAPTER 14 SERIAL INTERFACES SIO30 AND SIO31
(2) Transfer start
A serial transfer starts when the following two conditions have been satisfied and transfer data has been set (or
read) to serial I/O shift register 3n (SIO3n).
<Transfer start conditions>
•
•
SIO3n operation control bit (CSIE3n) = 1
After an 8-bit serial transfer, either the internal serial clock is stopped or SCK3n is set to high level.
<Transfer start timing>
•
•
Transmit/transmit and receive mode (MODEn = 0)
Transfer starts when writing to SIO3n.
Receive-only mode (MODEn = 1)
Transfer starts when reading from SIO3n.
Caution
After data has been written to SIO3n, transfer will not start even if the CSIE3n bit value is set
to 1.
(3) Communication operations
In the 3-wire serial I/O mode, data is transmitted and received in 8-bit units. Each bit of data is transmitted or
received in synchronization with the serial clock.
Serial I/O shift register 3n (SIO3n) is shifted in synchronization with the falling edge of the serial clock. Transmit
data is held in the SO3n latch and is output from the SO3n pin. Data that is received via the SI3n pin in
synchronization with the rising edge of the serial clock is latched to SIO3n.
Figure 14-6. Timing of 3-Wire Serial I/O Mode
Latched to SIO3n at the SCK3n rising edge
SCK3n
SI3n
1
2
3
4
5
6
7
8
DI7
DI6
DI5
DI4
DI3
DI2
DI1
DI0
SO3n
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
CSIIF3n
Transfer completion
Transfer starts in synchronization with the SCK3n falling edge
(4) Transfer complete
Completion of an 8-bit transfer automatically stops the serial transfer operation and the interrupt request flag
(CSIIF3n) is set.
Remark n = 0 or 1
User’s Manual U16035EJ5V0UD
254
Table 14-2. Register Settings
(1) Operation stop mode
• Serial interface SIO30
CSIM30
PM20
P20
PM21
P21
PM22
P22
Pin Function
P21/SO30
P21
Operation Mode
Stop
CSIE30
0
MODE0
SCL301
SCL300
P20/SI30
P20
P22/SCK30
P22
×
×
×
×
×
×
×
×
×
Setting prohibited
Other than above
• Serial interface SIO31
CSIM31
PM34
P34
PM35
P35
PM36
P36
Pin Function
Operation Mode
Stop
CSIE31
MODE1
SCL311
SCL310
P34/SI31
P34
P35/SO31
P35
P36/SCK31
P36
×
×
×
×
×
×
0
×
×
×
Setting prohibited
Other than above
(2) 3-wire serial I/O mode
• Serial interface SIO30
CSIM30
PM20
P20
PM21
P21
PM22
P22
Pin Function
Operation Mode
CSIE30
MODE0
SCL301
SCL300
P20/SI30
SI30
P21/SO30
P21
P22/SCK30
SCK30 input
SCK30 input
SCK30 output
SCK30 output
1
1
1
1
×
×
×
×
×
0
×
0
×
0
×
0
1
1
0
0
×
×
0
0
Slave receive
Slave transmit/transmit and receive
Master receive
1
1
1
1
1
0
1
0
0
0
0
0
SI30Note
SO30
P21
SI30
Other than above
SI30Note
SO30
Master transmit/transmit and receive
Other than above
Setting prohibited
• Serial interface SIO31
CSIM31
PM34
P34
PM35
P35
PM36
P36
Pin Function
Operation Mode
CSIE31
MODE1
SCL311
SCL310
P34/SI31
SI31
P35/SO31
P35
P36/SCK31
SCK31 input
SCK31 input
SCK31 output
SCK31 output
1
1
1
1
×
×
×
×
×
0
×
0
×
0
×
0
1
1
0
0
×
×
0
0
Slave receive
Slave transmit/transmit and receive
Master receive
1
1
1
1
1
0
1
0
0
0
0
0
SI31Note
SO31
P35
SI31
Other than above
SI31Note
SO31
Master transmit/transmit and receive
Other than above
Setting prohibited
Note When using for transmission only, it can be used as P20 or P34.
Remark ×: Don’t care, CSIM30, CSIM31: Serial operation mode registers 30, 31, PM××: Port mode register, P××: Output latch of port
CHAPTER 15 INTERRUPT FUNCTIONS
15.1 Interrupt Function Types
The following three types of interrupt functions are used.
(1) Non-maskable interrupt
This interrupt is acknowledged even in an interrupt disabled state. It does not undergo priority control and is given
top priority over all other interrupt requests. The other interrupt requests are held pending while the nonmaskable
interrupt is serviced.
The non-maskable interrupt generates a standby release signal and releases the HALT mode during main system
clock operation.
The non-maskable interrupt has only interrupt request from the watchdog timer.
(2) Maskable interrupts
These interrupts undergo mask control. Maskable interrupts can be divided into a high interrupt priority group
and a low interrupt priority group by setting the priority specification flag registers (PR0L, PR0H, PR1L).
Multiple high priority interrupts can be applied to low priority interrupts. If two or more interrupts with the same
priority are simultaneously generated, each interrupt has a predetermined priority (see Table 15-1).
The maskable interrupt generates a standby release signal and releases the STOP and HALT modes.
Five external interrupt requests and 13 internal interrupt requests are incorporated as maskable interrupts.
(3) Software interrupt
This is a vectored interrupt to be generated by executing the BRK instruction. It is acknowledged even in an
interrupt disabled state. The software interrupt does not undergo interrupt priority control.
15.2 Interrupt Sources and Configuration
A total of 20 interrupt sources exist among non-maskable, maskable, and software interrupts (see Table 15-1).
Remark A non-maskable interrupt or a maskable interrupt (internal) can be selected as the watchdog timer
interrupt (INTWDT).
256
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
Table 15-1. Interrupt Source List
Vector
Table
Basic
Interrupt Source
Trigger
Interrupt Default
Internal/
External
Configuration
Note 1
Type
Priority
Note 2
Name
Address Type
Non-
—
INTWDT
Watchdog timer overflow
Internal
0004H
(A)
(B)
(C)
maskable
(with watchdog timer mode 1 selected)
Maskable
0
INTWDT
Watchdog timer overflow
(with interval timer mode selected)
1
2
3
4
5
INTP0
INTP1
INTP2
INTP3
INTSER0
Pin input edge detection
External 0006H
0008H
000AH
000CH
Serial interface UART0 reception error
generation
Internal
000EH
(B)
6
7
8
9
INTSR0
INTST0
End of serial interface UART0 reception
End of serial interface UART0 transmission
End of serial interface SIO30 transfer
End of serial interface SIO31 transfer
Reference time interval signal from watch timer
0010H
0012H
0014H
0016H
001AH
001CH
INTCSI30
INTCSI31
INTWTI
10
11
INTTM00
Match between TM0 and CR00
(when CR00 is specified as compare register)
Detection of TI00 or TI01 valid edge
(when CR00 is specified as capture register)
12
INTTM01
Match between TM0 and CR01
001EH
(when CR01 is specified as compare register)
Detection of TI00 valid edge
(when CR01 is specified as capture register)
13
14
15
16
17
—
INTTM50
INTTM51
INTAD0
INTWT
INTKR
Match between TM50 and CR50
Match between TM51 and CR51
End of A/D converter conversion
Watch timer overflow
0020H
0022H
0024H
0026H
Port 4 falling edge detection
BRK instruction execution
External 0028H
003EH
(D)
(E)
Software
BRK
—
Notes 1. The default priority is the priority applicable when two or more maskable interrupts are generated
simultaneously. 0 is the highest priority, and 17 is the lowest.
2. Basic configuration types (A) to (E) correspond to (A) to (E) in Figure 15-1.
User’s Manual U16035EJ5V0UD
257
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-1. Basic Configuration of Interrupt Function (1/2)
(A) Internal non-maskable interrupt
Internal bus
Interrupt
request
Vector table
address generator
Priority controller
Standby release signal
(B) Internal maskable interrupt
Internal bus
MK
IE
PR
ISP
Vector table
address generator
Interrupt
request
Priority controller
IF
Standby release signal
(C) External maskable interrupt (INTP0 to INTP3)
Internal bus
External interrupt edge
enable register
(EGP, EGN)
MK
IE
PR
ISP
Vector table
address generator
Interrupt
request
Edge
detector
Priority controller
IF
Standby release signal
258
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-1. Basic Configuration of Interrupt Function (2/2)
(D) External maskable interrupt (INTKR)
Internal bus
MK
IE
PR
ISP
Interrupt
request
Vector table
address generator
Falling
edge
detector
Priority controller
IF
1 when MEM = 01H
Standby release signal
(E) Software interrupt
Internal bus
Interrupt
request
Vector table
address generator
IF:
IE:
Interrupt request flag
Interrupt enable flag
ISP: In-service priority flag
MK: Interrupt mask flag
PR:
Priority specification flag
MEM: Memory expansion mode register
User’s Manual U16035EJ5V0UD
259
CHAPTER 15 INTERRUPT FUNCTIONS
15.3 Registers Controlling Interrupt Function
The following seven types of registers are used to control the interrupt functions.
•
•
•
•
•
•
•
Interrupt request flag registers (IF0L, IF0H, IF1L)
Interrupt mask flag registers (MK0L, MK0H, MK1L)
Priority specification flag registers (PR0L, PR0H, PR1L)
External interrupt rising edge enable register (EGP)
External interrupt falling edge enable register (EGN)
Memory expansion mode register (MEM)
Program status word (PSW)
Table 15-2 gives a list of interrupt request flags, interrupt mask flags, and priority specification flags corresponding
to interrupt request sources.
Table 15-2. Flags Corresponding to Interrupt Request Sources
Interrupt Source
Interrupt Request Flag
Register
Interrupt Mask Flag
Priority Specification Flag
Register
PR0L
Register
MK0L
Note
INTWDT
WDTIF
PIF0
PIF1
PIF2
PIF3
IF0L
WDTMK
PMK0
WDTPR
PPR0
INTP0
INTP1
PMK1
PPR1
INTP2
PMK2
PPR2
INTP3
PMK3
PPR3
INTSER0
INTSR0
INTST0
SERIF0
SRIF0
STIF0
SERMK0
SRMK0
STMK0
SERPR0
SRPR0
STPR0
INTCSI30
INTCSI31
INTWTI
CSIIF30
CSIIF31
WTIIF
IF0H
CSIMK30
CSIMK31
WTIMK
MK0H
CSIPR30
CSIPR31
WTIPR
PR0H
INTTM00
INTTM01
INTTM50
INTTM51
TMIF00
TMIF01
TMIF50
TMIF51
TMMK00
TMMK01
TMMK50
TMMK51
TMPR00
TMPR01
TMPR50
TMPR51
INTAD0
INTWT
INTKR
ADIF0
WTIF
KRIF
IF1L
ADMK0
WTMK
KRMK
MK1L
ADPR0
WTPR
KRPR
PR1L
Note Interrupt control flag when watchdog timer is used as interval timer
260
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
(1) Interrupt request flag registers (IF0L, IF0H, IF1L)
The interrupt request flags are set to 1 when the corresponding interrupt request is generated or an instruction
is executed. They are cleared to 0 when an instruction is executed upon acknowledgment of an interrupt request
or upon application of RESET input.
IF0L, IF0H, and IF1L are set by a 1-bit or 8-bit memory manipulation instruction. When IF0L and IF0H are
combined to form 16-bit register IF0, they are set by a 16-bit memory manipulation instruction.
RESET input clears these registers to 00H.
Figure 15-2. Format of Interrupt Request Flag Register (IF0L, IF0H, IF1L)
Address: FFE0H After reset: 00H R/W
Symbol
IF0L
<7>
<6>
<5>
<4>
<3>
<2>
<1>
<0>
STIF0
SRIF0
SERIF0
PIF3
PIF2
PIF1
PIF0
WDTIF
Address: FFE1H After reset: 00H R/W
Symbol
IF0H
<7>
<6>
<5>
<4>
<3>
2
0
<1>
<0>
TMIF51
TMIF50
TMIF01
TMIF00
WTIIF
CSIIF31
CSIIF30
Address: FFE2H After reset: 00H R/W
Symbol
IF1L
7
0
6
0
5
0
4
0
3
0
<2>
<1>
<0>
KRIF
WTIF
ADIF0
XXIFX
Interrupt request flag
No interrupt request signal is generated
Interrupt request signal is generated, interrupt request status
0
1
Cautions 1. The WDTIF flag is R/W enabled only when the watchdog timer is used as the interval timer.
If watchdog timer mode 1 is used, set the WDTIF flag to 0.
2. Be sure to set bit 2 of IF0H and bits 3 to 7 of IF1L to 0.
3. When operating a timer, serial interface, or A/D converter after standby release, run it once
after clearing an interrupt request flag. An interrupt request flag may be set by noise.
4. When an interrupt is acknowledged, the interrupt request flag is automatically cleared, and
then processing of the interrupt routine is started.
5. Use the 1-bit memory manipulation instruction (CLR1) for manipulating the flag of the
interrupt request flag register. Use the bit manipulation instruction such as “IF0L.0 = 0;”
or “_asm(“clr1 IF0L, 0”);” for describing in C language because the compiled assembler
needs to be the 1-bit memory manipulation instruction (CLR1).
If a program is described in C language using an 8-bit memory manipulation instruction
such as “IF0L & = 0xfe;” and compiled, the assembler of the following three instructions
is described.
mov
and
mov
a, IF0L
a, #0FEH
IF0L, a
In this case, at the timing between “mov a, IF0L” and “mov IF0L, a”, if the request flag of
another bit of the identical interrupt request flag register (IF0L) is set to 1, it is cleared to
by “mov IF0L, a”. Therefore, care must be exercised when using an 8-bit memory
manipulation instruction in C language.
User’s Manual U16035EJ5V0UD
261
CHAPTER 15 INTERRUPT FUNCTIONS
(2) Interrupt mask flag registers (MK0L, MK0H, MK1L)
The interrupt mask flags are used to enable/disable the corresponding maskable interrupt service.
MK0L, MK0H, and MK1L are set by a 1-bit or 8-bit memory manipulation instruction. When MK0L and MK0H
are combined to form a 16-bit register MK0, they are set by a 16-bit memory manipulation instruction.
RESET input sets these registers to FFH.
Figure 15-3. Format of Interrupt Mask Flag Register (MK0L, MK0H, MK1L)
Address: FFE4H After reset: FFH R/W
Symbol
MK0L
<7>
<6>
<5>
<4>
<3>
<2>
<1>
<0>
STMK0
SRMK0
SERMK0
PMK3
PMK2
PMK1
PMK0
WDTMK
Address: FFE5H After reset: FFH R/W
Symbol
MK0H
<7>
<6>
<5>
<4>
<3>
2
1
<1>
<0>
TMMK51
TMMK50
TMMK01
TMMK00
WTIMK
CSIMK31
CSIMK30
Address: FFE6H After reset: FFH R/W
Symbol
MK1L
7
1
6
1
5
1
4
1
3
1
<2>
<1>
<0>
KRMK
WTMK
ADMK0
XXMKX
Interrupt servicing control
0
1
Interrupt servicing enabled
Interrupt servicing disabled
Cautions 1. If the watchdog timer is used in watchdog timer mode 1, the contents of the WDTMK flag
become undefined when read.
2. Because port 0 pins have an alternate function as external interrupt request input, when
the output level is changed by specifying the output mode of the port function, an interrupt
request flag is set. Therefore, 1 should be set in the interrupt mask flag before using the
output mode.
3. Be sure to set bit 2 of MK0H and bits 3 to 7 of MK1L to 1.
262
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
(3) Priority specification flag registers (PR0L, PR0H, PR1L)
The priority specification flags are used to set the corresponding maskable interrupt priority orders.
PR0L, PR0H, and PR1L are set by a 1-bit or 8-bit memory manipulation instruction. If PR0L and PR0H are
combined to form 16-bit register PR0, they are set by a 16-bit memory manipulation instruction.
RESET input sets these registers to FFH.
Figure 15-4. Format of Priority Specification Flag Register (PR0L, PR0H, PR1L)
Address: FFE8H After reset: FFH R/W
Symbol
PR0L
<7>
<6>
<5>
<4>
<3>
<2>
<1>
<0>
STPR0
SRPR0
SERPR0
PPR3
PPR2
PPR1
PPR0
WDTPR
Address: FFE9H After reset: FFH R/W
Symbol
PR0H
<7>
<6>
<5>
<4>
<3>
2
1
<1>
<0>
TMPR51
TMPR50
TMPR01
TMPR00
WTIPR
CSIPR31
CSIPR30
Address: FFEAH After reset: FFH R/W
Symbol
PR1L
7
1
6
1
5
1
4
1
3
1
<2>
<1>
<0>
KRPR
WTPR
ADPR0
XXPRX
Priority level selection
0
1
High priority level
Low priority level
Cautions 1. When the watchdog timer is used in the watchdog timer mode 1, set 1 in the WDTPR flag.
2. Be sure to set bit 2 of PR0H and bits 3 to 7 of PR1L to 1.
User’s Manual U16035EJ5V0UD
263
CHAPTER 15 INTERRUPT FUNCTIONS
(4) External interrupt rising edge enable register (EGP), external interrupt falling edge enable register (EGN)
These registers specify the valid edge for INTP0 to INTP3.
EGP and EGN are set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears these registers to 00H.
Figure 15-5. Format of External Interrupt Rising Edge Enable Register (EGP) and
External Interrupt Falling Edge Enable Register (EGN)
Address: FF48H After reset: 00H R/W
Symbol
EGP
7
0
6
0
5
0
4
0
3
2
1
0
EGP3
EGP2
EGP1
EGP0
Address: FF49H After reset: 00H R/W
Symbol
EGN
7
0
6
0
5
0
4
0
3
2
1
0
EGN3
EGN2
EGN1
EGN0
EGPn
EGNn
INTPn pin valid edge selection (n = 0 to 3)
0
0
1
1
0
1
0
1
Interrupt disabled
Falling edge
Rising edge
Both rising and falling edges
Caution
When the function is switched from external interrupt request to port, edge detection may be
performed. Therefore, clear EGPn and EGNn to 0 before switching to the port mode.
(5) Memory expansion mode register (MEM)
MEM sets the rising edge detection function of port 4.
MEM is set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears MEM to 00H.
Figure 15-6. Format of Memory Expansion Mode Register (MEM)
Address: FF47H After reset: 00H R/W
Symbol
MEM
7
0
6
0
5
0
4
0
3
0
2
1
0
MM2
MM1
MM0
MM2
MM1
MM0
Single-chip/memory expansion mode selection
0
0
0
0
0
1
Single-chip mode
Port 4 falling edge detection mode
Setting prohibited
Other than above
Caution
When using the falling edge detection function of port 4, be sure to set MEM to 01H.
264
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
(6) Program status word (PSW)
The program status word is a register to hold the instruction execution result and the current status for an interrupt
request. The IE flag to set maskable interrupt enable/disable and the ISP flag to control nesting processing are
mapped.
Besides 8-bit read/write, this register can carry out operations with a bit manipulation instruction and dedicated
instructions (EI and DI). When a vectored interrupt request is acknowledged, if the BRK instruction is executed,
the contents of PSW are automatically saved into a stack and the IE flag is reset to 0. If a maskable interrupt
request is acknowledged, the contents of the priority specification flag of the acknowledged interrupt are
transferred to the ISP flag. The PSW contents are also saved into the stack with the PUSH PSW instruction.
They are reset from the stack with the RETI, RETB, and POP PSW instructions.
RESET input sets PSW to 02H.
Figure 15-7. Format of Program Status Word
After reset
02H
7
6
Z
5
4
3
2
0
1
0
PSW IE
RBS1 AC RBS0
ISP
CY
Used when normal instruction is executed
ISP
Priority of interrupt currently being serviced
0
High-priority interrupt servicing (Low-priority
interrupt disable)
Interrupt request not acknowledged, or low-
priority interrupt servicing (All maskable
interrupts enable)
1
IE
0
Interrupt request acknowledge enable/disable
Disable
Enable
1
User’s Manual U16035EJ5V0UD
265
CHAPTER 15 INTERRUPT FUNCTIONS
15.4 Interrupt Servicing Operations
15.4.1 Non-maskable interrupt request acknowledge operation
A non-maskable interrupt request is unconditionally acknowledged even if in an interrupt acknowledge disable
state. It does not undergo interrupt priority control and has highest priority over all other interrupts.
If a non-maskable interrupt request is acknowledged, the contents are saved into the stacks in the order of PSW,
then PC, the IE flag and ISP flag are reset (0), and the contents of the vector table are loaded into PC and branched.
Due to this, acknowledgment of multiple interrupts is prohibited.
A new non-maskable interrupt request generated during execution of a non-maskable interrupt servicing program
is acknowledged after the current execution of the non-maskable interrupt servicing program is terminated (following
RETI instruction execution) and one main routine instruction is executed. However, if a new non-maskable interrupt
request is generated twice or more during non-maskable interrupt servicing program execution, only one non-
maskable interrupt request is acknowledged after termination of the non-maskable interrupt servicing program
execution. Figures 15-8, 15-9, and 15-10 show the flowchart of the non-maskable interrupt request generation through
acknowledge, acknowledge timing of non-maskable interrupt request, and acknowledge operation at multiple non-
maskable interrupt request generation, respectively.
Caution Be sure to use the RETI instruction to return from a non-maskable interrupt.
266
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-8. Non-Maskable Interrupt Request Generation to Acknowledge Flowchart
Start
WDTM4 = 1
No
(with watchdog timer
mode selected)?
Interval timer
Yes
No
Overflow in WDT?
Yes
WDTM3 = 0
No
(with non-maskable
interrupt selected)?
Reset processing
Yes
Interrupt request generation
No
No
WDT interrupt
servicing?
Interrupt request held pending
Yes
Interrupt
control register not
accessed?
Yes
Start of interrupt servicing
WDTM: Watchdog timer mode register
WDT: Watchdog timer
Figure 15-9. Non-Maskable Interrupt Request Acknowledge Timing
PSW and PC save, jump
to interrupt servicing
Interrupt service
program
CPU processing
WDTIF
Instruction
Instruction
Interrupt request generated during this interval is acknowledged at
WDTIF: Watchdog timer interrupt request flag
.
User’s Manual U16035EJ5V0UD
267
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-10. Non-Maskable Interrupt Request Acknowledge Operation
(a) If a non-maskable interrupt request is generated during non-maskable interrupt servicing program
execution
Main routine
Execution of NMI request <1>
NMI request <2> held pending
NMI request <1>
NMI request <2>
Execution of 1 instruction
Servicing of NMI request <2> that was pending
(b) If two non-maskable interrupt requests are generated during non-maskable interrupt servicing program
execution
Main routine
Execution of NMI request <1>
NMI request <2> held pending
NMI request <3> held pending
NMI request <1>
NMI request <2>
NMI request <3>
Execution of 1 instruction
Servicing of NMI request <2> that was pending
NMI request <3> not acknowledged
(Although two or more NMI requests have been generated,
only one request is acknowledged.)
268
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
15.4.2 Maskable interrupt request acknowledge operation
A maskable interrupt request becomes acknowledgeable when an interrupt request flag is set to 1 and the mask
(MK) flag corresponding to that interrupt request is cleared to 0. A vectored interrupt request is acknowledged if in
the interrupt enable state (when IE flag is set to 1). However, a low-priority interrupt request is not acknowledged
during servicing of a higher priority interrupt request (when the ISP flag is reset to 0).
Moreover, even if the EI instruction is executed during execution of a non-maskable interrupt servicing program,
neither non-maskable interrupt requests nor maskable interrupt requests are acknowledged.
The times from generation of a maskable interrupt request until interrupt servicing is performed are listed in Table
15-3 below.
For the interrupt request acknowledge timing, see Figures 15-12 and 15-13.
Table 15-3. Times from Generation of Maskable Interrupt Until Servicing
Note
Minimum Time
7 clocks
8 clocks
Maximum Time
32 clocks
When ××PR = 0
When ××PR = 1
33 clocks
Note If an interrupt request is generated just before a divide instruction, the wait time becomes longer.
Remark 1 clock: 1/fCPU (fCPU: CPU clock)
If two or more maskable interrupt requests are generated simultaneously, the request with a higher priority level
specified in the priority specification flag is acknowledged first. If two or more maskable interrupt requests have the
same priority level, the request with the highest default priority is acknowledged first.
An interrupt request that is held pending is acknowledged when it becomes acknowledgeable.
Figure 15-11 shows the interrupt request acknowledge algorithm.
If a maskable interrupt request is acknowledged, the contents are saved into the stacks in the order of PSW, then
PC, the IE flag is reset (0), and the contents of the priority specification flag corresponding to the acknowledged
interrupt are transferred to the ISP flag. Further, the vector table data determined for each interrupt request is loaded
into PC and branched.
Return from an interrupt is possible with the RETI instruction.
User’s Manual U16035EJ5V0UD
269
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-11. Interrupt Request Acknowledge Processing Algorithm
Start
No
××IF = 1?
Yes (Interrupt request generation)
No
××MK = 0?
Yes
Interrupt request held pending
Yes (High priority)
××PR = 0?
No (Low priority)
Any high-priority
Yes
Any high-priority
interrupt request among those
simultaneously generated
with ××PR = 0?
Yes
interrupt request among
those simultaneously generated
with ××PR = 0?
Interrupt request held pending
No
Interrupt request held pending
Yes
No
No
IE = 1?
Yes
Any high-priority
interrupt request among
those simultaneously
generated?
Interrupt request held pending
Interrupt request held pending
No
No
IE = 1?
Yes
Vectored interrupt servicing
Interrupt request held pending
No
ISP = 1?
Yes
Interrupt request held pending
Vectored interrupt servicing
××IF: Interrupt request flag
××MK: Interrupt mask flag
××PR: Priority specification flag
IE:
Flag that controls acknowledge of maskable interrupt request (1 = enable, 0 = disable)
Flag that indicates the priority level of the interrupt currently being serviced (0 = high-priority interrupt
servicing, 1 = no interrupt request acknowledged, or low-priority interrupt servicing)
ISP:
270
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-12. Interrupt Request Acknowledge Timing (Minimum Time)
6 clocks
PSW and PC save,
jump to interrupt
servicing
Interrupt servicing
program
CPU processing
Instruction
Instruction
××IF
(××PR = 1)
8 clocks
××IF
(××PR = 0)
7 clocks
Remark 1 clock: 1/fCPU (fCPU: CPU clock)
Figure 15-13. Interrupt Request Acknowledge Timing (Maximum Time)
25 clocks
6 clocks
PSW and PC save,
jump to interrupt
servicing
Interrupt servicing
program
CPU processing
Instruction
Divide instruction
××IF
(××PR = 1)
33 clocks
××IF
(××PR = 0)
32 clocks
Remark 1 clock: 1/fCPU (fCPU: CPU clock)
15.4.3 Software interrupt request acknowledge operation
A software interrupt request is acknowledged by BRK instruction execution. Software interrupts cannot be disabled.
If a software interrupt request is acknowledged, the contents are saved into the stacks in the order of the program
status word (PSW), then program counter (PC), the IE flag is reset (0), and the contents of the vector table (003EH,
003FH) are loaded into PC and branched.
Return from a software interrupt is possible with the RETB instruction.
Caution Do not use the RETI instruction for returning from the software interrupt.
User’s Manual U16035EJ5V0UD
271
CHAPTER 15 INTERRUPT FUNCTIONS
15.4.4 Multiple interrupt servicing
Multiple interrupt servicing occurs when an interrupt request is acknowledged during execution of another interrupt.
Multiple interrupt servicing does not occur unless the interrupt request acknowledge enable state is selected (IE
= 1) (except non-maskable interrupts). Also, when an interrupt request is acknowledged, interrupt request
acknowledge becomes disabled (IE = 0). Therefore, to enable nesting, it is necessary to set (1) the IE flag with the
EI instruction during interrupt servicing to enable interrupt acknowledge.
Moreover, even if interrupts are enabled, multiple interrupt servicing may not be enabled, this being subject to
interrupt priority control. Two types of priority control are available: default priority control and programmable priority
control. Programmable priority control is used for nesting.
In the interrupt enable state, if an interrupt request with a priority equal to or higher than that of the interrupt currently
being serviced is generated, it is acknowledged for multiple interrupt servicing. If an interrupt with a priority lower
than that of the interrupt currently being serviced is generated during interrupt servicing, it is not acknowledged for
multiple interrupt servicing.
Interrupt requests that are not enabled because of the interrupt disable state or they have a lower priority are held
pending. When servicing of the current interrupt ends, the pending interrupt request is acknowledged following
execution of at least one main processing instruction execution.
Multiple interrupt servicing is not possible during non-maskable interrupt servicing.
Table 15-4 shows interrupt requests enabled for multiple interrupt servicing and Figure 15-14 shows multiple
interrupt servicing examples.
Table 15-4. Interrupt Requests Enabled for Multiple Interrupt During Interrupt Servicing
Request for Multiple Interrupts
Non-Maskable
Maskable Interrupt Request
PR = 0 PR = 1
Software
Interrupt
Request
Interrupt Request
Interrupt Being Serviced
IE = 1
IE = 0
IE = 1
IE = 0
Non-maskable interrupt
Maskable interrupt
×
√
√
√
×
√
√
√
×
×
×
×
×
×
√
√
×
×
×
×
√
√
√
√
ISP = 0
ISP = 1
Software interrupt
Remarks 1. √: Nesting enabled
2. ×: Multiple interrupt servicing disabled
3. ISP and IE are flags contained in PSW.
ISP = 0: An interrupt with higher priority is being serviced.
ISP = 1: No interrupt request has been acknowledged, or an interrupt with a lower priority is being
serviced.
IE = 0: Interrupt request acknowledge is disabled.
IE = 1: Interrupt request acknowledge is enabled.
4. PR is a flag contained in PR0L, PR0H, and PR1L.
PR = 0: Higher priority level
PR = 1: Lower priority level
272
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-14. Examples of Multiple Interrupt Servicing (1/2)
Example 1. Multiple interrupt servicing occurs twice
Main processing
EI
INTxx servicing
INTyy servicing
INTzz servicing
IE = 0
IE = 0
IE = 0
EI
EI
INTxx
(PR = 1)
INTyy
(PR = 0)
INTzz
(PR = 0)
RETI
IE = 1
IE = 1
IE = 1
RETI
RETI
During servicing of interrupt INTxx, two interrupt requests, INTyy and INTzz, are acknowledged, and multiple
interrupt servicing takes place. Before each interrupt request is acknowledged, the EI instruction must always be
issued to enable interrupt request acknowledgment.
Example 2. Nesting does not occur due to priority control
Main processing
EI
INTxx servicing
INTyy servicing
IE = 0
INTyy
EI
INTxx
(PR = 0)
(PR = 1)
RETI
IE = 1
1 instruction execution
IE = 0
RETI
IE = 1
Interrupt request INTyy issued during servicing of interrupt INTxx is not acknowledged because its priority is lower
than that of INTxx, and multiple interrupt servicing does not take place. The INTyy interrupt request is held pending,
and is acknowledged following execution of one main processing instruction.
PR = 0: Higher priority level
PR = 1: Lower priority level
IE = 0:
Interrupt request acknowledgment disabled
User’s Manual U16035EJ5V0UD
273
CHAPTER 15 INTERRUPT FUNCTIONS
Figure 15-14. Examples of Multiple Interrupt Servicing (2/2)
Example 3. Multiple interrupt servicing does not occur because interrupts are not enabled
Main processing
INTxx servicing INTyy servicing
IE = 0
EI
INTyy
(PR = 0)
INTxx
(PR = 0)
RETI
IE = 1
IE = 0
1 instruction execution
RETI
IE = 1
Interrupts are not enabled during servicing of interrupt INTxx (EI instruction is not issued), so interrupt request INTyy
is not acknowledged and multiple interrupt servicing does not take place. The INTyy interrupt request is held pending,
and is acknowledged following execution of one main processing instruction.
PR = 0: Higher priority level
IE = 0:
Interrupt request acknowledgment disabled
274
User’s Manual U16035EJ5V0UD
CHAPTER 15 INTERRUPT FUNCTIONS
15.4.5 Interrupt request hold
There are instructions where, even if an interrupt request is issued for them while another instruction is executed,
request acknowledge is held pending until the end of execution of the next instruction. These instructions (interrupt
request hold instructions) are listed below.
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MOV PSW, #byte
MOV A, PSW
MOV PSW, A
MOV1 PSW. bit, CY
MOV1 CY, PSW. bit
AND1 CY, PSW. bit
OR1 CY, PSW. bit
XOR1 CY, PSW. bit
SET1 PSW. bit
CLR1 PSW. bit
RETB
RETI
PUSH PSW
POP PSW
BT PSW. bit, $addr16
BF PSW. bit, $addr16
BTCLR PSW. bit, $addr16
EI
DI
Manipulation instructions for the IF0L, IF0H, IF1L, MK0L, MK0H, MK1L, PR0L, PR0H, and PR1L registers
Caution The BRK instruction is not one of the above-listed interrupt request hold instructions. However,
the software interrupt activated by executing the BRK instruction causes the IE flag to be
cleared to 0. Therefore, even if a maskable interrupt request is generated during execution of
the BRK instruction, the interrupt request is not acknowledged. However, a non-maskable
interrupt request is acknowledged.
Figure 15-15 shows the timing with which interrupt requests are held pending.
Figure 15-15. Interrupt Request Hold
Save PSW and PC, Jump
to interrupt servicing
Interrupt servicing
program
CPU processing
Instruction N
Instruction M
××IF
Remarks 1. Instruction N: Interrupt request hold instruction
2. Instruction M: Instruction other than interrupt request hold instruction
3. The ××PR (priority level) values do not affect the operation of ××IF (interrupt request).
User’s Manual U16035EJ5V0UD
275
CHAPTER 16 STANDBY FUNCTION
16.1 Standby Function and Configuration
16.1.1 Standby function
The standby function is designed to decrease power consumption of the system. The following two modes are
available.
(1) HALT mode
HALT instruction execution sets the HALT mode. The HALT mode is intended to stop the CPU operation clock.
The system clock oscillator continues oscillating. In this mode, power consumption is not decreased as much
as in the STOP mode. However, the HALT mode is effective to restart operation immediately upon interrupt
request and to carry out intermittent operations.
(2) STOP mode
STOP instruction execution sets the STOP mode. In the STOP mode, the main system clock oscillator stops,
stopping the whole system, thereby considerably reducing the CPU power consumption.
Data memory low-voltage hold (down to VDD = 1.6 V) is possible. Thus, the STOP mode is effective to hold data
memory contents with ultra-low power consumption.
Because this mode can be cleared upon interrupt request, it enables intermittent operations to be carried out.
However, because a wait time is required to secure an oscillation stabilization time after the STOP mode is
cleared, select the HALT mode if it is necessary to start processing immediately upon interrupt request.
In either of these two modes, all the contents of registers, flags and data memory just before the standby mode
is set are held. The I/O port output latch and output buffer statuses are also held.
Cautions 1. The STOP mode can be used only when the system operates with the main system clock
(subsystem clock oscillation cannot be stopped). The HALT mode can be used with either
the main system clock or the subsystem clock.
2. When operation is transferred to the STOP mode, be sure to stop the peripheral hardware
operating with the main system clock before executing the STOP instruction.
3. The following sequence is recommended for power consumption reduction of the A/D
converter when the standby function is used: First clear bit 7 (ADCS0) of the A/D converter
mode register 0 (ADM0) to 0 to stop the A/D conversion operation, and then execute the HALT
or STOP instruction.
276
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
16.1.2 Standby function control register
The wait time after the STOP mode is released upon an interrupt request is controlled by the oscillation stabilization
time select register (OSTS).
OSTS is set by an 8-bit memory manipulation instruction.
RESET input sets the value of OSTS to 04H. Therefore, when the STOP mode is released by inputting RESET,
it takes 217/fX until release.
Figure 16-1. Format of Oscillation Stabilization Time Select Register (OSTS)
Address: FFFAH After reset: 04H R/W
Symbol
OSTS
7
0
6
0
5
0
4
0
3
0
2
1
0
OSTS2
OSTS1
OSTS0
OSTS2
OSTS1
OSTS0
Selection of oscillation stabilization time
12
14
15
16
17
0
0
0
0
1
0
0
1
1
0
0
1
0
1
0
2
2
2
2
2
/fX (341 µs)
/fX (1.36 ms)
/fX (2.73 ms)
/fX (5.46 ms)
/fX (10.9 ms)
Other than above
Setting prohibited
Caution The wait time after the STOP mode is released does not include the time (see “a” in the illustration
below) from STOP mode release to clock oscillation start. This applies regardless of whether
STOP mode is released by RESET input or by interrupt request generation.
STOP mode release
X1 pin voltage
waveform
a
Remarks 1. fX: Main system clock oscillation frequency
2. Figures in parentheses are for operation with fX = 12 MHz.
277
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
16.2 Operations of Standby Function
16.2.1 HALT mode
(1) HALT mode setting and operating status
The HALT mode is set by executing the HALT instruction. It can be set with the main system clock or the
subsystem clock.
The operating status in the HALT mode is described below.
Table 16-1. HALT Mode Operating Status
HALT Mode
Setting
During HALT Instruction Execution
Using Main System Clock
During HALT Instruction Execution
Using Subsystem Clock
Without Subsystem
With Subsystem
With Main System
Clock Oscillation
With Main System
Note 1
Note 2
Item
Clock
Clock
Clock Oscillation Stopped
Clock generator
CPU
Both main system clock and subsystem clock can be oscillated. Clock supply to CPU stops.
Operation stops.
Port (output latch)
Status before HALT mode setting is held.
16-bit timer/event
counter 0
Operable
Operation stops.
8-bit timer/event
counters 50, 51
Operable
Operable when TI50,
TI51 are selected as
count clock.
7
Watch timer
Operable when fX/2 is
selected as count clock
Operable
Operable when fXT is
selected as count clock.
Watchdog timer
Clock output
Operable
Operation stops.
7
Operable when fX to fX/2 Operable
is selected as output clock
Operable when fXT is
selected as count clock.
Buzzer output
A/D converter
Serial interface
Operable
BUZ is at low level.
Operation stops.
Operable
Operable during
external clock input
External interrupt
Operable
Notes 1. Including case when external clock is not supplied.
2. Including case when external clock is supplied.
278
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
(2) HALT mode release
The HALT mode can be released with the following three types of sources.
(a) Release by unmasked interrupt request
When an unmasked interrupt request is generated, the HALT mode is released. If interrupt acknowledge
is enabled, vectored interrupt service is carried out. If interrupt acknowledge is disabled, the next address
instruction is executed.
Figure 16-2. HALT Mode Release by Interrupt Request Generation
Interrupt request
HALT instruction
Wait
Standby release
signal
Operation mode
HALT mode
Wait
Operation mode
Oscillation
Clock
Remarks 1. The broken line indicates the case when the interrupt request which has released the standby
mode is acknowledged.
2. Wait times are as follows:
• When vectored interrupt service is carried out:
8 or 9 clocks
• When vectored interrupt service is not carried out: 2 or 3 clocks
(b) Release by non-maskable interrupt request
When a non-maskable interrupt request is generated, the HALT mode is released and vectored interrupt
service is carried out whether interrupt acknowledge is enabled or disabled.
However, a non-maskable interrupt request is not generated during subsystem clock operation.
279
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
(c) Release by RESET input
When RESET signal is input, HALT mode is released. And, as in the case with normal reset operation, a
program is executed after branch to the reset vector address.
Figure 16-3. HALT Mode Release by RESET Input
Wait
X
(217/f
: 10.9 ms)
HALT instruction
RESET
signal
Reset
period
Oscillation stabilization
wait status
Operating mode
HALT mode
Oscillation
Operating mode
Oscillation
stop
Oscillation
Clock
Remarks 1. fX: Main system clock oscillation frequency
2. Values in parentheses are for operation with fX = 12 MHz.
Table 16-2. Operation After HALT Mode Release
Release Source
MK××
PR××
IE
0
1
0
×
1
×
×
×
ISP
×
Operation
Maskable interrupt request
0
0
0
0
Next address instruction execution
Interrupt service execution
×
0
1
1
Next address instruction execution
0
1
0
0
1
1
Interrupt service execution
HALT mode hold
1
×
×
Non-maskable interrupt request
RESET input
—
—
—
—
×
Interrupt service execution
Reset processing
×
×: Don’t care
280
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
16.2.2 STOP mode
(1) STOP mode setting and operating status
The STOP mode is set by executing the STOP instruction. It can be set only with the main system clock.
Cautions 1. When the STOP mode is set, the X2 pin is internally connected to VDD1 via a pull-up resistor
to minimize the leakage current at the crystal oscillator. Thus, do not use the STOP mode
in a system where an external clock is used for the main system clock.
2. Because the interrupt request signal is used to clear the standby mode, if there is an
interrupt source with the interrupt request flag set and the interrupt mask flag reset, the
standby mode is immediately cleared if set. Thus, the STOP mode is reset to the HALT mode
immediately after execution of the STOP instruction. After the wait set using the oscillation
stabilization time select register (OSTS), the operating mode is set.
The operating status in the STOP mode is described below.
Table 16-3. STOP Mode Operating Status
STOP Mode Setting
With Subsystem Clock
Without Subsystem Clock
Item
Clock generator
CPU
Only main system clock oscillation is stopped.
Operation stops.
Port (output latch)
16-bit timer/event counter 0
8-bit timer/event counters 50, 51
Watch timer
Status before STOP mode setting is held.
Operation stops.
Operable only when TI50, TI51 are selected as count clock.
Operable when fXT is selected as count
clock.
Operation stops.
Watchdog timer
Clock output
Operation stops.
Operable when fXT is selected as
output clock.
PCL is at low level.
Buzzer output
A/D converter
BUZ is at low level.
Operation stops.
Serial interface
Other than UART
UART
Operable only when externally supplied input clock is specified as the serial clock.
Operation stops (transmit shift register 0 (TXS0), receive shift register 0 (RX0),
and receive buffer register 0 (RXB0) hold the value just before the clock stop).
External interrupt
Operable
281
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
(2) STOP mode release
The STOP mode can be released by the following two types of sources.
(a) Release by unmasked interrupt request
When an unmasked interrupt request is generated, the STOP mode is released. If interrupt acknowledge
is enabled after the lapse of oscillation stabilization time, vectored interrupt service is carried out. If interrupt
acknowledge is disabled, the next address instruction is executed.
Figure 16-4. STOP Mode Release by Interrupt Request Generation
Interrupt
Wait
request
(Time set by OSTS)
STOP instruction
Standby release
signal
Oscillation stabilization
wait status
Operating mode
Oscillation
STOP mode
Operating mode
Oscillation stop
Oscillation
Clock
Remark The broken line indicates the case when the interrupt request which has released the standby
mode is acknowledged.
282
User’s Manual U16035EJ5V0UD
CHAPTER 16 STANDBY FUNCTION
(b) Release by RESET input
The STOP mode is released when RESET signal is input, and after the lapse of oscillation stabilization time,
reset operation is carried out.
Figure 16-5. STOP Mode Release by RESET Input
Wait
X
(217/f
: 10.9 ms)
STOP instruction
RESET
signal
Reset
period
Oscillation stabilization
wait status
Operating mode
Oscillation
STOP mode
Operating mode
Oscillation
Oscillation stop
Clock
Remarks 1. fX: Main system clock oscillation frequency
2. Values in parentheses are for operation with fX = 12 MHz.
Table 16-4. Operation After STOP Mode Release
Release Source
MK××
PR××
IE
0
1
0
×
1
×
×
ISP
×
Operation
Maskable interrupt request
0
0
0
0
Next address instruction execution
Interrupt service execution
×
0
1
1
Next address instruction execution
0
1
0
0
1
1
Interrupt service execution
STOP mode hold
1
×
×
RESET input
—
—
×
Reset processing
×: Don’t care
283
User’s Manual U16035EJ5V0UD
CHAPTER 17 RESET FUNCTION
The following two operations are available to generate the reset signal.
(1) External reset input via RESET pin
(2) Internal reset by watchdog timer program loop time detection
External reset and internal reset 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
is set to the status shown in Table 17-1. Each pin has high impedance during reset input or during oscillation
stabilization time just after reset clear.
When a high level is input to the RESET pin, the reset is cleared and program execution starts after the lapse
of oscillation stabilization time (217/fX). The reset applied by watchdog timer overflow is automatically cleared after
a reset and program execution starts after the lapse of oscillation stabilization time (217/fX) (see Figures 17-2 to
17-4).
Cautions 1. For an external reset, input a low level for 10 µs or more to the RESET pin.
2. During reset input, main system clock oscillation remains stopped but subsystem clock
oscillation continues.
3. When the STOP mode is cleared by reset, the STOP mode contents are held during reset input.
However, the port pin becomes high-impedance.
Figure 17-1. Block Diagram of Reset Function
RESET
Reset signal
Reset controller
Overflow
Interrupt function
Count clock
Watchdog timer
Stop
User’s Manual U16035EJ5V0UD
284
CHAPTER 17 RESET FUNCTION
Figure 17-2. Timing of Reset by RESET Input
X1
Oscillation
stabilization
time wait
Normal operation
(Reset processing)
Reset period
(Oscillation stop)
Normal operation
RESET
Internal
reset signal
Port pin
Delay
Delay
Hi-Z
Figure 17-3. Timing of Reset Due to Watchdog Timer Overflow
X1
Oscillation
stabilization
time wait
Normal operation
(Reset processing)
Reset period
(Oscillation stop)
Normal operation
Watchdog
timer
overflow
Internal
reset signal
Hi-Z
Port pin
Figure 17-4. Timing of Reset in STOP Mode by RESET Input
X1
STOP instruction execution
Oscillation
Normal operation
(Reset processing)
Stop status
Reset period
stabilization
time wait
Normal operation
(Oscillation stop)
(Oscillation stop)
RESET
Internal
reset signal
Port pin
Delay
Delay
Hi-Z
285
User’s Manual U16035EJ5V0UD
CHAPTER 17 RESET FUNCTION
Table 17-1. Hardware Statuses After Reset (1/2)
Hardware
Status After Reset
Note 1
Program counter (PC)
Stack pointer (SP)
Contents of reset vector table
(0000H, 0001H) are set.
Undefined
02H
Program status word (PSW)
RAM
Note 2
Data memory
Undefined
Note 2
General-purpose register
Undefined
Port (output latch)
00H
FFH
00H
04H
Port mode registers 0, 2 to 5, 7 (PM0, PM2 to PM5, PM7)
Pull-up resistor option registers 0, 2 to 5, 7 (PU0, PU2 to PU5, PU7)
Processor clock control register (PCC)
Note 3
Memory size switching register (IMS)
CFH
Memory expansion mode register (MEM)
00H
04H
Oscillation stabilization time select register (OSTS)
16-bit timer/event counter
Timer counter 0 (TM0)
0000H
Undefined
00H
Capture/compare registers 00, 01 (CR00, CR01)
Prescaler mode register 0 (PRM0)
Capture/compare control register 0 (CRC0)
Mode control register 0 (TMC0)
00H
00H
Output control register 0 (TOC0)
00H
8-bit timer/event counter
Timer counters 50, 51 (TM50, TM51)
Compare registers 50, 51 (CR50, CR51)
Clock select registers 50, 51 (TCL50, TCL51)
Mode control registers 50, 51 (TMC50, TMC51)
Operation mode register (WTM)
00H
Undefined
00H
00H
Watch timer
00H
Watchdog timer
Clock select register (WDCS)
00H
Mode register (WDTM)
00H
Notes 1. During reset input or oscillation stabilization time wait, only the PC contents among the hardware
statuses become undefined. All other hardware statuses remain unchanged after reset.
2. When a reset is executed in the standby mode, the pre-reset status is held even after reset.
3. Although the initial value is CFH, set the following values in the initial settings for each version.
µPD780021AS, 780031AS: 42H
µPD780022AS, 780032AS: 44H
µPD780023AS, 780033AS: C6H
µPD780024AS, 780034AS: C8H
µPD78F0034BS:
Value for mask ROM versions
286
User’s Manual U16035EJ5V0UD
CHAPTER 17 RESET FUNCTION
Table 17-1. Hardware Statuses After Reset (2/2)
Hardware
Status After Reset
Clock output/buzzer output controller Clock output select register (CKS)
00H
00H
00H
00H
00H
00H
00H
FFH
A/D converter
Conversion result register 0 (ADCR0)
Mode register 0 (ADM0)
Analog input channel specification register 0 (ADS0)
Asynchronous serial interface mode register 0 (ASIM0)
Asynchronous serial interface status register 0 (ASIS0)
Baud rate generator control register 0 (BRGC0)
Transmit shift register 0 (TXS0)
Serial interface UART0
Receive buffer register 0 (RXB0)
Serial interfaces SIO30, SIO31
Interrupt
Shift registers 30, 31 (SIO30, SIO31)
Undefined
00H
Operating mode registers 30, 31 (CSIM30, CSIM31)
Request flag registers (IF0L, IF0H, IF1L)
Mask flag registers (MK0L, MK0H, MK1L)
Priority specification flag registers (PR0L, PR0H, PR1L)
External interrupt rising edge enable register (EGP)
External interrupt falling edge enable register (EGN)
00H
FFH
FFH
00H
00H
287
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
The µPD78F0034BS is provided as the flash memory version of the µPD780024AS, 780034AS Subseries.
The µPD78F0034BS is a product that incorporates flash memory in which the program can be written, erased,
and rewritten while it is mounted on the board.
Writing to flash memory can be performed with the memory mounted on the target system (on board). A dedicated
flash programmer is connected to the target system to perform writing.
The following can be considered as the development environment and the applications using flash memory.
• Software can be altered after the µPD78F0034BS is solder-mounted on the target system.
• Small scale production of various models is made easier by differentiating software.
• Data adjustment in starting mass production is made easier.
Table 18-1 shows the differences between the µPD78F0034BS and the mask ROM versions.
Table 18-1. Differences Among µPD78F0034BS and Mask ROM Versions
Item
µPD78F0034BS
Mask ROM Versions
µPD780034AS Subseries
µPD780024AS Subseries
Internal ROM configuration
Internal ROM capacity
Flash memory
Mask ROM
Note
32 KB
µPD780031AS: 8 KB
µPD780032AS: 16 KB
µPD780033AS: 24 KB
µPD780034AS: 32 KB
µPD780021AS: 8 KB
µPD780022AS: 16 KB
µPD780023AS: 24 KB
µPD780024AS: 32 KB
Note
Internal high-speed RAM capacity
1024 bytes
µPD780031AS: 512 bytes
µPD780032AS: 512 bytes
µPD780021AS: 512 bytes
µPD780022AS: 512 bytes
µPD780033AS: 1024 bytes µPD780023AS: 1024 bytes
µPD780034AS: 1024 bytes µPD780024AS: 1024 bytes
Resolution of A/D converter
10 bits
None
8 bits
IC pin
Available
None
VPP pin
Available
Electrical specifications,
Refer to CHAPTER 20 ELECTRICAL SPECIFICATIONS and CHAPTER 22
recommended soldering conditions
RECOMMENDED SOLDERING CONDITIONS.
Note The same capacity as the mask ROM versions can be specified by means of the memory size switching
register (IMS).
Caution
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.
288
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
18.1 Memory Size Switching Register
The µPD78F0034BS allows users to select the internal memory capacity using the memory size switching register
(IMS) so that the same memory map as that of the µPD780021AS, 780022AS, 780023AS, 780024AS and
µPD780031AS, 780032AS, 780033AS, 780034AS with a different size of internal memory capacity can be achieved.
IMS is set by an 8-bit memory manipulation instruction.
RESET input sets IMS to CFH.
Caution
Be sure to set the values of the target mask ROM version as the initial setting of the program.
Reset input initializes IMS to CFH. Also be sure to set the values of the target mask ROM version
after reset.
Figure 18-1. Format of Memory Size Switching Register (IMS)
Address: FFF0H After reset: CFH R/W
Symbol
IMS
7
6
5
4
0
3
2
1
0
RAM2
RAM1
RAM0
ROM3
ROM2
ROM1
ROM0
RAM2
RAM1
RAM0
Internal high-speed RAM capacity selection
0
1
1
1
0
0
512 bytes
1024 bytes
Other than above
Setting prohibited
ROM3
ROM2
ROM1
ROM0
Internal ROM capacity selection
0
0
0
1
1
0
1
1
0
1
1
0
1
0
1
0
0
0
0
1
8 KB
16 KB
24 KB
32 KB
60 KB (setting prohibited)
Setting prohibited
Other than above
The IMS settings to obtain the same memory map as mask ROM versions are shown in Table 18-2.
Table 18-2. Memory Size Switching Register Settings
Target Mask ROM Versions
µPD780021AS, 780031AS
µPD780022AS, 780032AS
µPD780023AS, 780033AS
µPD780024AS, 780034AS
IMS Setting
42H
44H
C6H
C8H
Caution
When using the mask ROM versions, be sure to set the value indicated in Table 18-2 to IMS.
User’s Manual U16035EJ5V0UD
289
CHAPTER 18 µPD78F0034BS
18.2 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 flash memory mounted on the
target system (on-board). A flash memory writing adapter (program 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 low-quantity, varied model production
• Easy data adjustment when starting mass production
18.2.1 Programming environment
The following shows the environment required for µPD78F0034BS flash memory programming.
When Flashpro III or Flashpro IV 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 of Flashpro III/Flashpro IV.
Remark USB is supported by Flashpro IV only.
Figure 18-2. Environment for Writing Program to Flash Memory
VPP
V
DD
SS
Axxxx
RS-232C
USB
Bxxxxx
Cxxxxxx
A
TVE
(FSlTash Pro4)
PG-FP4
V
RESET
Dedicated flash
programmer
µPD78F0034BS
SIO/UART/pseudo 3-wire
Host machine
290
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
18.2.2 Communication mode
Use the communication mode shown in Table 18-3 to perform communication between the dedicated flash
programmer and the µPD78F0034BS.
Table 18-3. Communication Mode List
Note 1
Communication
Mode
Standard (TYPE) Setting
Pins Used
Number
of
Port
Speed
On Target
(CPU
Frequency
Multiply
Rate
V
PP
(COMM PORT)
(SIO CLOCK)
(Flashpro
Clock)
Pulses
CLOCK)
(Multiple Rate)
3-wire serial I/O
(SIO30)
SIO-ch0
2.4 kHz to 625 kHzNote 2 Optional
(100 Hz to 1.25 MHz)Note 2
1 to 10 MHzNote 2 1.0
SI30/P20
0
(SIO ch-0)
SO30/P21
SCK30/P22
3-wire serial I/O
(SIO31)
SIO-ch1
SI31/P34
1
3
(SIO ch-1)
SO31/P35
SCK31/P36
3-wire serial I/O
(SIO30)
SIO-H/S
SI30/P20
SO30/P21
SCK30/P22
HS/P25
(SIO ch-0 +
handshake)
with handshake
Notes 2, 3
UART
UART-ch0
4800 to 76800 Baud
RXD0/P23
TXD0/P24
8
Notes 2, 3
(UART0)
(UART ch-0) (4800 to 76800 bps)
Pseudo 3-wire
serial I/O
Port-ch0
(Port A)
100 Hz to 1500 HzNote 2
(100 Hz to 1.25 MHz)Note 2
P70/TI00/TO0
(serial data
input)
12
P71/TI01
(serial data
output)
P72/TI50/TO50
(serial clock
input)
Notes 1. Selection items for Standard settings on Flashpro IV (TYPE settings on Flashpro III).
2. The possible setting range differs depending on the voltage. For details, refer to CHAPTER 20
ELECTRICAL SPECIFICATIONS.
3. Because factors other than the baud rate error, such as the signal waveform slew, also affect UART
communication, thoroughly evaluate the slew as well as the baud rate error.
Remark Items enclosed in parentheses in the setting item column are the set value and set item of Flashpro III
when they differ from those of Flashpro IV.
Figure 18-3. Communication Mode Selection Format
VPP pulse
10 V
VDD
VPP
VSS
VDD
RESET
VSS
Flash memory write mode
User’s Manual U16035EJ5V0UD
291
CHAPTER 18 µPD78F0034BS
Figure 18-4. Example of Connection with Dedicated Flash Programmer (1/2)
(a) 3-wire serial I/O (SIO3n)
Dedicated flash programmer
PD78F0034BS
µ
VPP
VPP
V
DD
V
DD0Note 1, VDD1Note 1, AVDD
/RESET
SCK
RESET
SCK3n
SI3n
SO/TxD
SI/RxD
CLK
SO3n
X1Note 2
GND
VSS0, VSS1, AVSS, AVREF
Remark n = 0 or 1
(b) 3-wire serial I/O (SIO30) with handshake
Dedicated flash programmer
PD78F0034BS
µ
V
PP
VPP
VDD
V
DD0Note 1 , VDD1Note 1 , AVDD
/RESET
SCK
RESET
SCK30
SI30
SO/TxD
SI/RxD
H/S
SO30
P25 (HS)
X1Note 2
CLK
GND
VSS0, VSS1, AVSS, AVREF
(c) UART (UART0)
Dedicated flash programmer
PD78F0034BS
µ
VPP
VDD
VPP
VDD0Note 1, VDD1Note 1, AVDD
/RESET
SO/TXD
SI/RXD
CLK
RESET
RXD0
TXD0
X1Note 2
GND
VSS0, VSS1, AVSS, AVREF
Notes 1. Even if power is supplied on board, the VDD0 and VDD1 pins must be connected to VDD of the dedicated
flash programmer. Supply the VDD voltage before programming is started.
2. Power can be supplied to the X1 pin on board. In this case, the pin does not need to be connected
to the dedicated flash programmer.
292
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
Figure 18-4. Example of Connection with Dedicated Flash Programmer (2/2)
(d) Pseudo 3-wire serial I/O
Dedicated flash programmer
PD78F0034BS
µ
VPP
VPP
V
DD
V
DD0Note 1, VDD1Note 1, AVDD
/RESET
SCK
RESET
P72 (serial clock input)
P70 (serial data input)
P71 (serial data output)
X1Note 2
SO/TxD
SI/RxD
CLK
GND
VSS0, VSS1, AVSS, AVREF
Notes 1. Even if power is supplied on board, the VDD0 and VDD1 pins must be connected to VDD of the dedicated
flash programmer. Supply the VDD voltage before programming is started.
2. Power can be supplied to the X1 pin on board. In this case, the pin does not need to be connected
to the dedicated flash programmer.
If Flashpro III/Flashpro IV is used as the dedicated flash programmer, the following signals are generated for the
µPD78F0034BS. For details, refer to the manual of Flashpro III/Flashpro IV.
Table 18-4. Pin Connection List
Signal Name
I/O
Pin Function
Pin Name
SIO30
SIO31
SIO30 UART0 Pseudo
(HS)
3-Wire
VPP
VDD
Output
I/O
Write voltage
VPP
Note
Note
Note
Note
Note
VDD voltage generation/ VDD0, VDD1, AVDD
voltage monitoring
GND
−
Ground
VSS0, VSS1, AVSS, AVREF
CLK
Output
Output
Input
Clock output
X1
/RESET
SI/RXD
SO/TXD
SCK
Reset signal
RESET
Reception signal
Transmission signal
Transfer clock
Handshake signal
SO30/SO31/TxD0/P71
SI30/SI31/RxD0/P70
SCK30/SCK31/P72
P25 (HS)
Output
Output
Input
×
×
H/S
×
×
×
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.
User’s Manual U16035EJ5V0UD
293
CHAPTER 18 µPD78F0034BS
18.2.3 On-board pin handling
When performing programming on the target system, provide a connector on the target system to connect the
dedicated flash programmer.
An on-board function that allows switching between normal operation mode and flash memory programming mode
may be required in some cases.
<VPP pin>
In normal operation mode, input 0 V to the VPP pin. In flash memory programming mode, a write voltage of 10.0
V (TYP.) is supplied to the VPP pin, so perform the following.
(1) Connect a pull-down resistor (RVPP = 10 kΩ) to the VPP pin.
(2) Use the jumper on the board to switch the VPP pin input to either the programmer or directly to GND.
A VPP pin connection example is shown below.
Figure 18-5. VPP Pin Connection Example
µ
PD78F0034BS
Connection pin of dedicated
flash programmer
V
PP
Pull-down resistor (RVPP
)
<Serial interface pin>
The following shows the pins used by the serial interface.
Serial Interface
Pins Used
3-wire serial I/O (SIO30)
3-wire serial I/O (SIO31)
SI30/P20, SO30/P21, SCK30/P22
SI31/P34, SO31/P35, SCK31/P36
SI30/P20, SO30/P21, SCK30/P22, HS/P25
3-wire serial I/O (SIO30)
with handshake
UART (UART0)
RXD0/P23, TXD0/P24
Pseudo 3-wire serial I/O
P70/TI00/TO0 (serial data input),
P71/TI01 (serial data output),
P72/TI50/TO50 (serial clock input)
When connecting the dedicated flash programmer to a serial interface pin that is connected to another device
on-board, signal conflict or abnormal operation of the other device may occur. Care must therefore be taken with
such connections.
294
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
(1) Signal conflict
If the dedicated flash programmer (output) is connected to a serial interface pin (input) that is connected to
another device (output), a signal conflict occurs. To prevent this, isolate the connection with the other device
or set the other device to the output high impedance status.
Figure 18-6. Signal Conflict (Input Pin of Serial Interface)
PD78F0034BS
Input pin
µ
Connection pin of dedicated
flash programmer
Signal conflict
Other device
Output pin
In the flash memory programming mode, the signal output by another
device and the signal sent by the dedicated flash programmer conflict,
therefore, isolate the signal of the other device.
(2) Abnormal operation of other device
If the dedicated flash programmer (output or input) is connected to a serial interface pin (input or output) that
is connected to another device (input), a signal is output to the device, which may cause an abnormal operation.
To prevent this abnormal operation, isolate the connection with the other device or set so that the input signals
to the other device are ignored.
Figure 18-7. Abnormal Operation of Other Device
PD78F0034BS
Pin
µ
Connection pin of dedicated
flash programmer
Other device
Input pin
µ
If the signal output by the PD78F0034BS affects another device in the
flash memory programming mode, isolate the signals of the other device.
PD78F0034BS
µ
Connection pin of dedicated
flash programmer
Pin
Other device
Input pin
If the signal output by the dedicated flash programmer affects another
device in the flash memory programming mode, isolate the signals of the
other device.
User’s Manual U16035EJ5V0UD
295
CHAPTER 18 µPD78F0034BS
<RESET pin>
If the reset signal of the dedicated flash programmer is connected to the RESET pin connected to the reset signal
generator on-board, a signal conflict occurs. To prevent this, isolate the connection with the reset signal
generator.
If the reset signal is input from the user system in the flash memory programming mode, a normal programming
operation cannot be performed. Therefore, do not input reset signals from other than the dedicated flash
programmer.
Figure 18-8. Signal Conflict (RESET Pin)
PD78F0034BS
RESET
µ
Connection pin of dedicated
flash programmer
Signal conflict
Reset signal generator
Output pin
The signal output by the reset signal generator and the signal output from
the dedicated flash programmer conflict in the flash memory programming
mode, so isolate the signal of the reset signal generator.
<Port pins>
When the flash memory programming mode is set, all the pins other than those that communicate in flash memory
programming are in the same status as immediately after reset.
If the external device does not recognize initial statuses such as the output high impedance status, therefore,
connect the external device to VDD0 or VSS0 via a resistor.
<Oscillator>
When using the on-board clock, connect X1, X2, XT1, and XT2 as required in the normal operation mode.
When using the clock output of the flash programmer, connect it directly to X1, disconnecting the main oscillator
on-board, and leave the X2 pin open. The subsystem clock conforms to the normal operation mode.
<Power supply>
To use the power output from 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, make connections that accord with the normal operation mode. However,
because the voltage is monitored by the flash programmer, be sure to connect the VDD0, VDD1, VSS0, and VSS1
pins to VDD and GND of the flash programmer.
Supply the same power as in the normal operation mode to the other power supply pins (AVDD, AVREF, and AVSS).
296
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
18.2.4 Connection of adapter for flash writing
The following figure shows an example of the recommended connection when the adapter for flash writing is used.
Figure 18-9. Wiring Example for Flash Writing Adapter in 3-Wire Serial I/O Mode (1/2)
(a) Example for SIO30
VDD (2.7 to 5.5 V)
GND
LVDD2 (LVDD)
VDD
GND
52 51 50 49 48 47 46 45 44 43 42 41
40
1
2
3
4
5
6
7
8
9
10
39
38
37
36
35
34
33
32
31
30
29
28
27
PD78F0034BS
µ
11
12
13
14 15 16 17 18 19 20 21 22 23
25 26
24
SI
SO SCK CLKOUT RESET VPP RESERVE/HS
WRITER INTERFACE
User’s Manual U16035EJ5V0UD
297
CHAPTER 18 µPD78F0034BS
Figure 18-9. Wiring Example for Flash Writing Adapter in 3-Wire Serial I/O Mode (2/2)
(b) Example for SIO31
V
DD (2.7 to 5.5 V)
GND
LVDD2 (LVDD)
VDD
GND
52 51 50 49 48 47 46 45 44 43 42 41
40
1
39
38
37
36
2
3
4
35
34
33
32
31
30
29
28
27
5
6
7
µ
PD78F0034BS
8
9
10
11
12
13
14 15 16 17 18 19 20 21 22 23
25 26
24
SI
SO SCK CLKOUT RESET VPP RESERVE/HS
WRITER INTERFACE
298
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
Figure 18-10. Wiring Example for Flash Writing Adapter in 3-Wire Serial I/O Mode (Using Handshake)
VDD (2.7 to 5.5 V)
GND
LVDD2 (LVDD)
VDD
GND
52 51 50 49 48 47 46 45 44 43 42 41
40
1
2
3
4
5
6
7
8
9
10
39
38
37
36
35
34
33
32
31
30
29
28
27
PD78F0034BS
µ
11
12
13
14 15 16 17 18 19 20 21 22 23
25 26
24
SI
SO SCK CLKOUT RESET VPP RESERVE/HS
WRITER INTERFACE
User’s Manual U16035EJ5V0UD
299
CHAPTER 18 µPD78F0034BS
Figure 18-11. Wiring Example for Flash Writing Adapter in UART Mode
VDD (2.7 to 5.5 V)
GND
LVDD2 (LVDD)
VDD
GND
52 51 50 49 48 47 46 45 44 43 42 41
40
1
2
3
4
5
6
7
8
9
10
39
38
37
36
35
34
33
32
31
30
29
28
27
PD78F0034BS
µ
11
12
13
14 15 16 17 18 19 20 21 22 23
25 26
24
SI
SO SCK CLKOUT RESET VPP RESERVE/HS
WRITER INTERFACE
300
User’s Manual U16035EJ5V0UD
CHAPTER 18 µPD78F0034BS
Figure 18-12. Wiring Example for Flash Writing Adapter in Pseudo 3-Wire Serial I/O Mode
VDD (2.7 to 5.5 V)
GND
LVDD2 (LVDD)
VDD
GND
52 51 50 49 48 47 46 45 44 43 42 41
40
1
2
3
4
5
6
7
8
9
10
39
38
37
36
35
34
33
32
31
30
29
28
27
µ
PD78F0034BS
11
12
13
14 15 16 17 18 19 20 21 22 23
25 26
24
SI
SO SCK CLKOUT RESET VPP RESERVE/HS
WRITER INTERFACE
User’s Manual U16035EJ5V0UD
301
CHAPTER 19 INSTRUCTION SET
This chapter lists each instruction set of the µPD780024AS, 780034AS Subseries in table form. For details of its
operation and operation code, refer to the separate document 78K/0 Series Instructions User’s Manual (U12326E).
19.1 Conventions
19.1.1 Operand identifiers and specification methods
Operands are written in “Operand” column of each instruction in accordance with the specification method of the
instruction operand identifier (refer to the assembler specifications for detail). When there are two or more methods,
select one of them. Alphabetic letters in capitals and symbols, #, !, $ and [ ] are key words and must be written as
they are. Each symbol has the following meaning.
• #: Immediate data specification
• !: Absolute address specification
• $: Relative 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
write the #, !, $, and [ ] symbols.
For operand register identifiers, r and rp, either function names (X, A, C, etc.) or absolute names (names in
parentheses in the table below, R0, R1, R2, etc.) can be used for specification.
Table 19-1. Operand Identifiers and Specification Methods
Identifier
Specification Method
r
X (R0), A (R1), C (R2), B (R3), E (R4), D (R5), L (R6), H (R7)
AX (RP0), BC (RP1), DE (RP2), HL (RP3)
rp
Note
sfr
sfrp
Special function register symbol
Note
Special function register symbol (16-bit manipulatable register even addresses only)
saddr
FE20H to FF1FH Immediate data or labels
saddrp
FE20H to FF1FH Immediate data or labels (even address only)
addr16
0000H to FFFFH Immediate data or labels
(only even addresses for 16-bit data transfer instructions)
0800H to 0FFFH Immediate data or labels
addr11
addr5
0040H to 007FH Immediate data or labels (even address only)
word
byte
bit
16-bit immediate data or label
8-bit immediate data or label
3-bit immediate data or label
RBn
RB0 to RB3
Note Addresses from FFD0H to FFDFH cannot be accessed with these operands.
Remark For special function register symbols, refer to Table 3-5 Special Function Register List.
302
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
19.1.2 Description of “operation” column
A:
A register; 8-bit accumulator
X register
X:
B:
B register
C:
C register
D:
D register
E:
E register
H:
H register
L:
L register
AX:
BC:
DE:
HL:
PC:
SP:
AX register pair; 16-bit accumulator
BC register pair
DE register pair
HL register pair
Program counter
Stack pointer
PSW: Program status word
CY:
AC:
Z:
Carry flag
Auxiliary carry flag
Zero flag
RBS:
IE:
Register bank select flag
Interrupt request enable flag
( ):
Memory contents indicated by address or register contents in parentheses
XH, XL: Higher 8 bits and lower 8 bits of 16-bit register
:
Logical product (AND)
Logical sum (OR)
:
:
Exclusive logical sum (exclusive OR)
Inverted data
:
addr16: 16-bit immediate data or label
jdisp8: Signed 8-bit data (displacement value)
19.1.3 Description of “flag operation” column
(Blank): Not affected
0:
1:
×:
R:
Cleared to 0
Set to 1
Set/cleared according to the result
Previously saved value is restored
303
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
19.2 Operation List
Clock
Byte
Flag
Instruction
Mnemonic
Group
Operands
Operation
Note 1
4
6
–
2
2
4
4
–
–
8
8
–
–
–
4
4
4
4
8
8
6
6
6
6
2
4
–
8
4
4
8
8
8
Note 2
Z
AC CY
8-bit data MOV
r, #byte
saddr, #byte
2
3
3
1
1
2
2
2
2
3
3
3
2
2
1
1
1
1
2
2
1
1
1
1
1
2
2
3
1
1
2
2
2
–
7
7
–
–
5
5
5
5
r ← byte
(saddr) ← byte
sfr ← byte
A ← r
transfer
sfr, #byte
A, r
Note 3
Note 3
r, A
r ← A
A, saddr
saddr, A
A, sfr
A ← (saddr)
(saddr) ← A
A ← sfr
sfr, A
sfr ← A
A, !addr16
!addr16, A
PSW, #byte
A, PSW
9 + n A ← (addr16)
9 + m (addr16) ← A
7
5
5
PSW ← byte
A ← PSW
PSW ← A
×
×
×
×
×
×
PSW, A
A, [DE]
5 + n A ← (DE)
5 + m (DE) ← A
5 + n A ← (HL)
5 + m (HL) ← A
[DE], A
A, [HL]
[HL], A
A, [HL + byte]
[HL + byte], A
A, [HL + B]
[HL + B], A
A, [HL + C]
[HL + C], A
A, r
9 + n A ← (HL + byte)
9 + m (HL + byte) ← A
7 + n A ← (HL + B)
7 + m (HL + B) ← A
7 + n A ← (HL + C)
7 + m (HL + C) ← A
Note 3
XCH
–
6
6
A ↔ r
A, saddr
A, sfr
A ↔ (saddr)
A ↔ (sfr)
A, !addr16
A, [DE]
10 + n + m A ↔ (addr16)
6 + n + m A ↔ (DE)
A, [HL]
6 + n + m A ↔ (HL)
A, [HL + byte]
A, [HL + B]
A, [HL + C]
10 + n + m A ↔ (HL + byte)
10 + n + m A ↔ (HL + B)
10 + n + m A ↔ (HL + C)
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
3. Except r = A
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
4. m is the number of waits when external memory expansion area is written to.
304
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
rp, #word
Operation
Note 1
Note 2
Z
AC CY
16-bit
data
MOVW
3
4
4
2
2
2
2
1
1
3
3
1
2
3
2
2
2
3
1
2
2
2
2
3
2
2
2
3
1
2
2
2
6
8
–
6
6
–
–
4
4
–
10
10
8
rp ← word
saddrp, #word
sfrp, #word
AX, saddrp
saddrp, AX
AX, sfrp
(saddrp) ← word
sfrp ← word
AX ← (saddrp)
(saddrp) ← AX
AX ← sfrp
transfer
8
8
sfrp, AX
8
sfrp ← AX
Note 3
Note 3
AX, rp
–
AX ← rp
rp, AX
–
rp ← AX
AX, !addr16
!addr16, AX
AX, rp
10 12 + 2n AX ← (addr16)
10 12 + 2m (addr16) ← AX
Note 3
Note 4
XCHW
ADD
4
4
6
4
4
4
8
4
8
8
8
4
6
4
4
4
8
4
8
8
8
–
–
8
–
–
5
AX ↔ rp
8-bit
A, #byte
A, CY ← A + byte
(saddr), CY ← (saddr) + byte
A, CY ← A + r
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
operation
saddr, #byte
A, r
r, A
r, CY ← r + A
A, saddr
A, !addr16
A, [HL]
A, CY ← A + (saddr)
9 + n A, CY ← A + (addr16)
5 + n A, CY ← A + (HL)
A, [HL + byte]
A, [HL + B]
A, [HL + C]
A, #byte
9 + n A, CY ← A + (HL + byte)
9 + n A, CY ← A + (HL + B)
9 + n A, CY ← A + (HL + C)
ADDC
–
8
–
–
5
A, CY ← A + byte + CY
(saddr), CY ← (saddr) + byte + CY
A, CY ← A + r + CY
saddr, #byte
A, r
Note 4
r, A
r, CY ← r + A + CY
A, saddr
A, !addr16
A, [HL]
A, CY ← A + (saddr) + CY
9 + n A, CY ← A + (addr16) + CY
5 + n A, CY ← A + (HL) + CY
A, [HL + byte]
A, [HL + B]
A, [HL + C]
9 + n A, CY ← A + (HL + byte) + CY
9 + n A, CY ← A + (HL + B) + CY
9 + n A, CY ← A + (HL + C) + CY
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
3. Only when rp = BC, DE or HL
4. Except r = A
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
4. m is the number of waits when external memory expansion area is written to.
305
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
A, #byte
Operation
A, CY ← A – byte
Note 1
Note 2
Z
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
AC CY
8-bit
SUB
2
3
2
2
2
3
1
2
2
2
2
3
2
2
2
3
1
2
2
2
2
3
2
2
2
3
1
2
2
2
4
–
8
–
–
5
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
operation
saddr, #byte
A, r
6
(saddr), CY ← (saddr) – byte
A, CY ← A – r
Note 3
Note 3
Note 3
4
r, A
4
r, CY ← r – A
A, saddr
A, !addr16
A, [HL]
4
A, CY ← A – (saddr)
8
9 + n A, CY ← A – (addr16)
5 + n A, CY ← A – (HL)
4
A, [HL + byte]
A, [HL + B]
A, [HL + C]
A, #byte
saddr, #byte
A, r
8
9 + n A, CY ← A – (HL + byte)
9 + n A, CY ← A – (HL + B)
9 + n A, CY ← A – (HL + C)
8
8
SUBC
4
–
8
–
–
5
A, CY ← A – byte – CY
(saddr), CY ← (saddr) – byte – CY
A, CY ← A – r – CY
6
4
r, A
4
r, CY ← r – A – CY
A, saddr
A, !addr16
A, [HL]
4
A, CY ← A – (saddr) – CY
8
9 + n A, CY ← A – (addr16) – CY
5 + n A, CY ← A – (HL) – CY
4
A, [HL + byte]
A, [HL + B]
A, [HL + C]
A, #byte
saddr, #byte
A, r
8
9 + n A, CY ← A – (HL + byte) – CY
9 + n A, CY ← A – (HL + B) – CY
9 + n A, CY ← A – (HL + C) – CY
8
8
AND
4
–
8
–
–
5
A ← A byte
6
(saddr) ← (saddr) byte
4
A ← A
r ← r
r
r, A
4
A
A, saddr
A, !addr16
A, [HL]
4
A ← A (saddr)
8
9 + n A ← A (addr16)
5 + n A ← A (HL)
4
A, [HL + byte]
A, [HL + B]
A, [HL + C]
8
9 + n A ← A (HL + byte)
9 + n A ← A (HL + B)
9 + n A ← A (HL + C)
8
8
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
3. Except r = A
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
306
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
A, #byte
Operation
Note 1
Note 2
Z
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
AC CY
8-bit
OR
2
3
2
2
2
3
1
2
2
2
2
3
2
2
2
3
1
2
2
2
2
3
2
2
2
3
1
2
2
2
4
–
8
–
–
5
A ← A byte
(saddr) ← (saddr) byte
operation
saddr, #byte
A, r
6
Note 3
Note 3
Note 3
4
A ← A
r ← r
r
r, A
4
A
A, saddr
A, !addr16
A, [HL]
4
A ← A (saddr)
8
9 + n A ← A (addr16)
5 + n A ← A (HL)
4
A, [HL + byte]
A, [HL + B]
A, [HL + C]
A, #byte
saddr, #byte
A, r
8
9 + n A ← A (HL + byte)
9 + n A ← A (HL + B)
9 + n A ← A (HL + C)
8
8
XOR
4
–
8
–
–
5
A ← A byte
6
(saddr) ← (saddr) byte
4
A ← A
r ← r
r
r, A
4
A
A, saddr
A, !addr16
A, [HL]
4
A ← A (saddr)
8
9 + n A ← A (addr16)
5 + n A ← A (HL)
4
A, [HL + byte]
A, [HL + B]
A, [HL + C]
A, #byte
saddr, #byte
A, r
8
9 + n A ← A (HL + byte)
9 + n A ← A (HL + B)
9 + n A ← A (HL + C)
8
8
CMP
4
–
8
–
–
5
A – byte
(saddr) – byte
A – r
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
6
4
r, A
4
r – A
A, saddr
A, !addr16
A, [HL]
4
A – (saddr)
8
9 + n A – (addr16)
5 + n A – (HL)
4
A, [HL + byte]
A, [HL + B]
A, [HL + C]
8
9 + n A – (HL + byte)
9 + n A – (HL + B)
9 + n A – (HL + C)
8
8
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
3. Except r = A
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
307
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
AX, #word
Operation
AX, CY ← AX + word
Note 1
Note 2
Z
×
×
×
AC CY
16-bit
ADDW
SUBW
CMPW
MULU
DIVUW
INC
3
3
3
2
2
1
2
1
2
1
1
1
1
1
1
2
6
–
–
–
–
–
–
6
–
6
–
–
–
–
–
–
×
×
×
×
×
×
operation
AX, #word
6
AX, CY ← AX – word
AX – word
AX, #word
6
Multiply/
divide
X
16
25
2
AX ← A × X
C
AX (Quotient), C (Remainder) ← AX ÷ C
r ← r + 1
Increment/
decrement
r
×
×
×
×
×
×
×
×
saddr
r
4
(saddr) ← (saddr) + 1
r ← r – 1
DEC
2
saddr
rp
4
(saddr) ← (saddr) – 1
rp ← rp + 1
INCW
DECW
ROR
4
rp
4
rp ← rp – 1
A, 1
A, 1
A, 1
A, 1
[HL]
2
(CY, A7 ← A0, Am – 1 ← Am) × 1 time
(CY, A0 ← A7, Am + 1 ← Am) × 1 time
(CY ← A0, A7 ← CY, Am – 1 ← Am) × 1 time
(CY ← A7, A0 ← CY, Am + 1 ← Am) × 1 time
×
×
×
×
Rotate
ROL
2
RORC
ROLC
ROR4
2
2
10 12 + n + m A3 – 0 ← (HL)3 – 0, (HL)7 – 4 ← A3 – 0,
(HL)3 – 0 ← (HL)7 – 4
ROL4
[HL]
2
2
2
10 12 + n + m A3 – 0 ← (HL)7 – 4, (HL)3 – 0 ← A3 – 0,
(HL)7 – 4 ← (HL)3 – 0
BCD
ADJBA
ADJBS
MOV1
4
–
Decimal Adjust Accumulator after
Addition
×
×
×
×
×
×
adjust
4
–
Decimal Adjust Accumulator after
Subtract
Bit
CY, saddr.bit
CY, sfr.bit
3
3
2
3
2
3
3
2
3
2
6
–
4
–
6
6
–
4
–
6
7
7
–
7
CY ← (saddr.bit)
CY ← sfr.bit
×
×
×
×
×
manipu-
late
CY, A.bit
CY ← A.bit
CY, PSW.bit
CY, [HL].bit
saddr.bit, CY
sfr.bit, CY
CY ← PSW.bit
7 + n CY ← (HL).bit
8
8
–
8
(saddr.bit) ← CY
sfr.bit ← CY
A.bit, CY
A.bit ← CY
PSW.bit, CY
[HL].bit, CY
PSW.bit ← CY
×
×
8 + n + m (HL).bit ← CY
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
4. m is the number of waits when external memory expansion area is written to.
308
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
CY, saddr.bit
Operation
CY ← CY (saddr.bit)
Note 1
Note 2
Z
AC CY
Bit
AND1
3
3
2
3
2
3
3
2
3
2
3
3
2
3
2
2
3
2
2
2
2
3
2
2
2
1
1
1
6
7
7
–
7
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
manipu-
late
CY, sfr.bit
CY, A.bit
CY, PSW.bit
CY, [HL].bit
CY, saddr.bit
CY, sfr.bit
CY, A.bit
CY, PSW.bit
CY, [HL].bit
CY, saddr.bit
CY, sfr.bit
CY, A.bit
CY, PSW. bit
CY, [HL].bit
saddr.bit
sfr.bit
–
CY ← CY sfr.bit
CY ← CY A.bit
CY ← CY PSW.bit
4
–
6
7 + n CY ← CY (HL).bit
OR1
6
7
7
–
7
CY ← CY (saddr.bit)
CY ← CY sfr.bit
CY ← CY A.bit
–
4
–
CY ← CY PSW.bit
6
7 + n CY ← CY (HL).bit
XOR1
SET1
CLR1
6
7
7
–
7
CY ← CY (saddr.bit)
CY ← CY sfr.bit
CY ← CY A.bit
–
4
–
CY ← CY PSW.bit
6
7 + n CY ← CY (HL).bit
4
6
8
–
6
(saddr.bit) ← 1
sfr.bit ← 1
–
A.bit
4
A.bit ← 1
PSW.bit
[HL].bit
–
PSW.bit ← 1
×
×
×
×
×
6
8 + n + m (HL).bit ← 1
saddr.bit
sfr.bit
4
6
8
–
6
(saddr.bit) ← 0
sfr.bit ← 0
–
A.bit
4
A.bit ← 0
PSW.bit
[HL].bit
–
PSW.bit ← 0
×
6
8 + n + m (HL).bit ← 0
SET1
CLR1
NOT1
CY
2
–
–
–
CY ← 1
CY ← 0
CY ← CY
1
0
×
CY
2
CY
2
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
4. m is the number of waits when external memory expansion area is written to.
309
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
Operation
Note 1
Note 2
Z
AC CY
CALL
!addr16
!addr11
3
2
7
–
(SP – 1) ← (PC + 3)
PC ← addr16, SP ← SP – 2
H
, (SP – 2) ← (PC + 3)
L
L
,
,
Call/return
CALLF
CALLT
5
6
–
–
(SP – 1) ← (PC + 2) , (SP – 2) ← (PC + 2)
PC15 – 11 ← 00001, PC10 – 0 ← addr11,
SP ← SP – 2
H
[addr5]
1
1
(SP – 1) ← (PC + 1)
H
, (SP – 2) ← (PC + 1)
L
,
PCH ← (00000000, addr5 + 1),
PCL ← (00000000, addr5),
SP ← SP – 2
BRK
6
–
(SP – 1) ← PSW, (SP – 2) ← (PC + 1)H,
(SP – 3) ← (PC + 1)L, PCH ← (003FH),
PCL ← (003EH), SP ← SP – 3, IE ← 0
RET
1
1
1
6
6
6
–
–
–
PCH ← (SP + 1), PCL ← (SP),
SP ← SP + 2
RETI
RETB
PUSH
PCH ← (SP + 1), PCL ← (SP),
PSW ← (SP + 2), SP ← SP + 3
R
R
R
R
R
R
PCH ← (SP + 1), PCL ← (SP),
PSW ← (SP + 2), SP ← SP + 3
Stack
manipu-
late
PSW
rp
1
1
2
4
–
–
(SP – 1) ← PSW, SP ← SP – 1
(SP – 1) ← rpH, (SP – 2) ← rpL,
SP ← SP – 2
POP
PSW
rp
1
1
2
4
–
–
PSW ← (SP), SP ← SP + 1
R
R
R
rpH ← (SP + 1), rpL ← (SP),
SP ← SP + 2
MOVW
SP, #word
SP, AX
AX, SP
!addr16
$addr16
AX
4
2
2
3
2
2
2
2
2
2
–
–
–
6
6
8
6
6
6
6
10
8
SP ← word
SP ← AX
8
AX ← SP
Uncondi-
tional
BR
–
PC ← addr16
–
PC ← PC + 2 + jdisp8
PCH ← A, PCL ← X
PC ← PC + 2 + jdisp8 if CY = 1
PC ← PC + 2 + jdisp8 if CY = 0
PC ← PC + 2 + jdisp8 if Z = 1
PC ← PC + 2 + jdisp8 if Z = 0
branch
–
Conditional
branch
BC
$addr16
$addr16
$addr16
$addr16
–
BNC
BZ
–
–
BNZ
–
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
310
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
Clock
Byte
Flag
Instruction
Group
Mnemonic
Operands
Operation
Note 1
Note 2
Z
AC CY
Condi-
tional
BT
saddr.bit, $addr16
sfr.bit, $addr16
A.bit, $addr16
3
4
3
3
3
4
4
3
4
3
4
8
9
11
–
PC ← PC + 3 + jdisp8 if (saddr.bit) = 1
PC ← PC + 4 + jdisp8 if sfr.bit = 1
PC ← PC + 3 + jdisp8 if A.bit = 1
PC ← PC + 3 + jdisp8 if PSW.bit = 1
–
branch
8
PSW.bit, $addr16
[HL].bit, $addr16
saddr.bit, $addr16
sfr.bit, $addr16
A.bit, $addr16
–
9
10
10
–
11 + n PC ← PC + 3 + jdisp8 if (HL).bit = 1
BF
11
11
–
PC ← PC + 4 + jdisp8 if (saddr.bit) = 0
PC ← PC + 4 + jdisp8 if sfr.bit = 0
PC ← PC + 3 + jdisp8 if A.bit = 0
PC ← PC + 4 + jdisp8 if PSW. bit = 0
8
PSW.bit, $addr16
[HL].bit, $addr16
saddr.bit, $addr16
–
11
10
10
11 + n PC ← PC + 3 + jdisp8 if (HL).bit = 0
BTCLR
12
12
–
PC ← PC + 4 + jdisp8 if (saddr.bit) = 1
then reset (saddr.bit)
sfr.bit, $addr16
A.bit, $addr16
PSW.bit, $addr16
[HL].bit, $addr16
B, $addr16
4
3
4
3
2
2
3
–
8
–
PC ← PC + 4 + jdisp8 if sfr.bit = 1
then reset sfr.bit
PC ← PC + 3 + jdisp8 if A.bit = 1
then reset A.bit
12
PC ← PC + 4 + jdisp8 if PSW.bit = 1
then reset PSW.bit
×
×
×
10 12 + n + m PC ← PC + 3 + jdisp8 if (HL).bit = 1
then reset (HL).bit
DBNZ
6
6
8
–
–
B ← B – 1, then
PC ← PC + 2 + jdisp8 if B ≠ 0
C, $addr16
C ← C –1, then
PC ← PC + 2 + jdisp8 if C ≠ 0
saddr, $addr16
RBn
10
(saddr) ← (saddr) – 1, then
PC ← PC + 3 + jdisp8 if (saddr) ≠ 0
SEL
NOP
EI
2
1
2
2
2
2
4
2
–
–
6
6
–
–
6
6
–
–
RBS1, 0 ← n
CPU
control
No Operation
IE ← 1 (Enable Interrupt)
IE ← 0 (Disable Interrupt)
Set HALT Mode
DI
HALT
STOP
Set STOP Mode
Notes 1. When the internal high-speed RAM area is accessed or instruction with no data access
2. When an area except the internal high-speed RAM area is accessed
Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control
register (PCC).
2. This clock cycle applies to internal ROM program.
3. n is the number of waits when external memory expansion area is read from.
4. m is the number of waits when external memory expansion area is written to.
311
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
19.3 Instructions Listed by Addressing Type
(1) 8-bit instructions
MOV, XCH, ADD, ADDC, SUB, SUBC, AND, OR, XOR, CMP, MULU, DIVUW, INC, DEC, ROR, ROL, RORC,
ROLC, ROR4, ROL4, PUSH, POP, DBNZ
Second Operand
[HL + byte]
[HL] [HL + B] $addr16
[HL + C]
Note
#byte
A
r
sfr
saddr !addr16 PSW
[DE]
1
None
First Operand
A
ADD
ADDC
SUB
SUBC
AND
OR
MOV MOV MOV MOV MOV MOV MOV MOV
ROR
XCH
ADD
ADDC
SUB
SUBC
AND
OR
XCH
XCH
ADD
XCH
ADD
XCH
XCH
ADD
XCH
ADD
ROL
RORC
ROLC
ADDC ADDC
SUB SUB
SUBC SUBC
ADDC ADDC
SUB SUB
SUBC SUBC
XOR
CMP
AND
OR
AND
OR
AND
OR
AND
OR
XOR
CMP
XOR
XOR
XOR
XOR
CMP CMP
CMP CMP
r
MOV MOV
ADD
INC
DEC
ADDC
SUB
SUBC
AND
OR
XOR
CMP
B, C
sfr
DBNZ
DBNZ
MOV MOV
saddr
MOV MOV
ADD
INC
DEC
ADDC
SUB
SUBC
AND
OR
XOR
CMP
!addr16
PSW
MOV
MOV MOV
PUSH
POP
[DE]
[HL]
MOV
MOV
ROR4
ROL4
[HL + byte]
[HL + B]
MOV
[HL + C]
X
C
MULU
DIVUW
Note Except r = A
312
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
(2) 16-bit instructions
MOVW, XCHW, ADDW, SUBW, CMPW, PUSH, POP, INCW, DECW
Second Operand
Note
#word
AX
rp
sfrp
saddrp
!addr16
SP
None
First Operand
AX
ADDW
MOVW
XCHW
MOVW
MOVW
MOVW
MOVW
SUBW
CMPW
Note
rp
MOVW
MOVW
INCW
DECW
PUSH
POP
sfrp
MOVW
MOVW
MOVW
MOVW
MOVW
MOVW
saddrp
!addr16
SP
MOVW
Note Only when rp = BC, DE, HL
(3) Bit manipulation instructions
MOV1, AND1, OR1, XOR1, SET1, CLR1, NOT1, BT, BF, BTCLR
Second Operand
A.bit
sfr.bit
saddr.bit
PSW.bit
[HL].bit
CY
$addr16
None
First Operand
A.bit
MOV1
BT
SET1
CLR1
BF
BTCLR
sfr.bit
MOV1
MOV1
MOV1
MOV1
BT
SET1
CLR1
BF
BTCLR
saddr.bit
PSW.bit
[HL].bit
CY
BT
SET1
CLR1
BF
BTCLR
BT
SET1
CLR1
BF
BTCLR
BT
SET1
CLR1
BF
BTCLR
MOV1
MOV1
MOV1
AND1
OR1
MOV1
MOV1
SET1
CLR1
NOT1
AND1
OR1
AND1
OR1
AND1
OR1
AND1
OR1
XOR1
XOR1
XOR1
XOR1
XOR1
313
User’s Manual U16035EJ5V0UD
CHAPTER 19 INSTRUCTION SET
(4) Call instructions/branch instructions
CALL, CALLF, CALLT, BR, BC, BNC, BZ, BNZ, BT, BF, BTCLR, DBNZ
Second Operand
AX
!addr16
!addr11
[addr5]
$addr16
First Operand
Basic instruction
BR
CALL
BR
CALLF
CALLT
BR
BC
BNC
BZ
BNZ
Compound
instruction
BT
BF
BTCLR
DBNZ
(5) Other instructions
ADJBA, ADJBS, BRK, RET, RETI, RETB, SEL, NOP, EI, DI, HALT, STOP
314
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Absolute Maximum Ratings (TA = 25°C)
Parameter
Symbol
VDD
Conditions
Ratings
Unit
V
Supply voltage
–0.3 to +6.5
AVDD
AVREF
AVSS
VPP
–0.3 to VDD + 0.3Note 1
–0.3 to VDD + 0.3Note 1
–0.3 to +0.3
V
V
V
µPD78F0034BS only, Note 2
–0.3 to +10.5
V
Input voltage
VI1
P00 to P03, P10 to P13, P20 to P25, P34 to P36, P40 to P47,
P50 to P57, P70 to P75, X1, X2, XT1, XT2, RESET
–0.3 to VDD + 0.3Note 1
V
Output voltage
VO
–0.3 to VDD + 0.3Note 1
V
V
Analog input
voltage
VAN
P10 to P13
Per pin
Analog input pin
AVSS – 0.3 to AVREF + 0.3Note 1
and –0.3 to VDD + 0.3Note 1
Output current,
high
IOH
IOL
–10
–15
–15
20
mA
mA
mA
mA
Total for P00 to P03, P40 to P47, P50 to P57, P70 to P75
Total for P20 to P25, P34 to P36
Output current,
low
Per pin for P00 to P03, P20 to P25, P34 to P36,
P40 to P47, P70 to P75
Per pin for P50 to P57
30
50
mA
mA
mA
mA
mA
°C
Total for P00 to P03, P40 to P47, P70 to P75
Total for P20 to P25
20
Total for P34 to P36
60
Total for P50 to P57
100
Operating ambient TA
temperature
During normal operation
During flash memory programming
Mask ROM version
–40 to +85
+10 to +80
–65 to +150
–40 to +125
°C
Storage
Tstg
°C
temperature
µPD78F0034BS
°C
Note 1. 6.5 V or below
(Note 2 is explained on the following page.)
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 otherwise specified, the characteristic of alternate-function pins are the same as those of port
pins.
315
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Note 2. 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
V
DD
0 V
a
b
VPP
1.8 V
0 V
Capacitance (TA = 25°C, VDD = VSS = 0 V)
Parameter Symbol
Input CIN
Conditions
MIN.
TYP.
MAX.
15
Unit
pF
f = 1 MHz
Unmeasured pins returned to 0 V.
capacitance
I/O
CIO
f = 1 MHz
P00 to P03, P20 to P25,
15
pF
capacitance
Unmeasured pins
returned to 0 V.
P34 to P36, P40 to P47,
P50 to P57, P70 to P75
Remark Unless otherwise specified, the characteristic of alternate-function pins are the same as those of port
pins.
316
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Main System Clock Oscillator Characteristics (TA = –40 to +85°C, VDD = 1.8 to 5.5 V)
Recommended
Resonator
Parameter
Oscillation
frequency (fX)Note 1
Conditions
MIN.
TYP.
MAX.
12.0
Unit
Circuit
1.0
1.0
1.0
Ceramic
4.5 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.5 V
1.8 V ≤ VDD < 3.0 V
After VDD reaches
oscillation voltage range
MIN.
MHz
(VPP
)
X
X2 IC
resonator
8.38
5.0
4
R1
Oscillation
stabilization timeNote 2
ms
C1
C2
1.0
12.0
Crystal
Oscillation
4.5 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.5 V
1.8 V ≤ VDD < 3.0 V
4.0 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.0 V
MHz
(VPP
IC
X2
)
X1
resonator
frequency (fX)Note 1
1.0
1.0
8.38
5.0
10
C1
C2
Oscillation
ms
stabilization timeNote 2
30
External
clock
X1 input
frequency (fX)Note 1
4.5 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.5 V
1.8 V ≤ VDD < 3.0 V
4.5 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.5 V
1.8 V ≤ VDD < 3.0 V
1.0
1.0
1.0
38
12.0
8.38
5.0
MHz
X1
X2
X1 input
500
500
500
ns
high-/low-level width
(tXH, tXL)
50
85
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.
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 VSS1.
• 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 system 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 Pin names in parentheses in the figure are intended for the µPD78F0034BS.
317
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Subsystem Clock Oscillator Characteristics (TA = –40 to +85°C, VDD = 1.8 to 5.5 V)
Recommended
Resonator
Parameter
Conditions
MIN.
32
TYP.
MAX.
35
Unit
kHz
Circuit
(VPP
)
Crystal
Oscillation
32.768
IC
XT2 XT1
Note 1
resonator
frequency (fXT)
R2
C4
C3
4.0 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.0 V
1.2
2
s
Oscillation
Note 2
stabilization time
10
External
clock
XT1 input
38.5
32
12
kHz
Note 1
XT2
XT1
frequency (fXT)
µs
15
XT1 input
high-/low-level width
(tXTH , tXTL)
Notes 1. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
2. Time required to stabilize oscillation after VDD reaches oscillation voltage range MIN.
Cautions 1. When using the subsystem 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 VSS1.
• 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.
Remarks 1. Pin names in parentheses in the figure are intended for the µPD78F0034BS.
2. For the resonator selection and oscillator constant of the subsystem clock, customers are required
to either evaluate the oscillation themselves or apply to the resonator manufacturer for evaluation.
318
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Recommended Oscillator Constant
(a) µPD780021AS, 780022AS, 780023AS, 780024AS, 780031AS, 780032AS, 780033AS, 780034AS
Main system clock: Ceramic resonator (TA = –40 to +85°C)
Manufacturer
Part Number
Frequency
(MHz)
Recommended Circuit Constant
Oscillation Voltage Range
C1 (pF)
100
C2 (pF)
100
R1 (kΩ)
MIN. (V)
1.8
MAX. (V)
5.5
Murata Mfg.
Co., Ltd.
CSBFB1M00J58
1.00
2.2
CSBLA1M00J58
CSTCC2M00G56
CSTLS2M00G56
CSTCC3M58G53
CSTLS3M58G53
CSTCR4M00G53
CSTLS4M00G53
CSTCR4M19G53
CSTLS4M19G53
CSTCR4M91G53
CSTLS4M91G53
CSTCR5M00G53
CSTLS5M00G53
CSTCE8M00G52
CSTLS8M00G53
CSTCE8M38G52
CSTLS8M38G53
CSTCE10M0G52
CSTLS10M0G53
CSTCE12M0G52
CSTLA12M0T55
CCR3.58MC3
1.00
2.00
2.00
3.58
3.58
4.00
4.00
4.19
4.19
4.91
4.91
5.00
5.00
8.00
8.00
8.38
8.38
10.00
10.00
12.00
12.00
3.58
4.19
5.00
8.00
8.38
100
100
2.2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
2.7
2.7
2.7
2.7
3.0
3.0
4.5
4.5
4.5
4.5
1.8
1.8
1.8
2.0
2.0
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
TDK
CCR4.19MC3
CCR5.0MC3
CCR8.0MC5
CCR8.38MC5
Caution
The oscillator constant is a reference value based on evaluation in specific environments by
the resonator manufacturer. If the oscillator characteristics need to be optimized in the actual
application, request the resonator manufacturer for evaluation on the implementation circuit.
Note that the oscillation voltage and oscillation frequency merely indicate the characteristics
of the oscillator. Use the internal operation conditions of the µPD780024AS and µPD780034AS
Subseries within the specifications of the DC and AC characteristics.
319
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
(b) µPD78F0034BS
Main system clock: Ceramic resonator (TA = –40 to +85°C)
Manufacturer
Part Number
Frequency
(MHz)
Recommended Circuit Constant
Oscillation Voltage Range
C1 (pF)
100
C2 (pF)
100
R1 (kΩ)
MIN. (V)
1.9
MAX. (V)
5.5
Murata Mfg.
Co., Ltd.
CSBFB1M00J58
1.00
2.2
CSBLA1M00J58
CSTCC2M00G56
CSTLS2M00G56
CSTCC3M58G53
CSTLS3M58G53
CSTCR4M00G53
CSTLS4M00G53
CSTCR4M19G53
CSTLS4M19G53
CSTCR4M91G53
CSTLS4M91G53
CSTCR5M00G53
CSTLS5M00G53
CSTCE8M00G52
CSTLS8M00G53
CSTLS8M00G53093
CSTCE8M38G52
CSTLS8M38G53
CSTLS8M38G53093
CSTCE10M0G52
CSTLS10M0G53
CSTLS10M0G53093
CSTCE12M0G52
CSTLA12M0T55
CSTLA12M0T55093
1.00
2.00
2.00
3.58
3.58
4.00
4.00
4.19
4.19
4.91
4.91
5.00
5.00
8.00
8.00
8.00
8.38
8.38
8.38
10.00
10.00
10.00
12.00
12.00
12.00
100
100
2.2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1.9
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
1.8
2.7
2.7
2.7
2.7
2.7
3.0
3.0
3.0
4.5
4.5
4.5
4.5
4.5
4.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
5.5
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
On-chip
Caution
The oscillator constant is a reference value based on evaluation in specific environments by
the resonator manufacturer. If the oscillator characteristics need to be optimized in the actual
application, request the resonator manufacturer for evaluation on the implementation circuit.
Note that the oscillation voltage and oscillation frequency merely indicate the characteristics
of the oscillator. Use the internal operation conditions of the µPD780024AS and µPD780034AS
Subseries within the specifications of the DC and AC characteristics.
320
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
DC Characteristics (TA = –40 to +85°C, VDD = 1.8 to 5.5 V) (1/4)
Parameter
Output current,
high
Symbol
Conditions
MIN.
TYP.
MAX.
–1
Unit
mA
mA
mA
IOH
Per pin
All pins
–15
10
Output current,
low
IOL
Per pin for P00 to P03, P20 to P25, P34 to P36,
P40 to P47, P70 to P75
Per pin for P50 to P57
15
20
mA
mA
mA
mA
mA
V
Total for P00 to P03, P40 to P47, P70 to P75
Total for P20 to P25
10
Total for P34 to P36
30
Total for P50 to P57
70
Input voltage,
high
VIH1
P10 to P13, P21, P24, P35,
P40 to P47, P50 to P57, P74,
P75
2.7 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 2.7 V
0.7VDD
0.8VDD
VDD
VDD
V
VIH2
VIH3
VIH4
VIL1
P00 to P03, P20, P22, P23, P25, 2.7 V ≤ VDD ≤ 5.5 V
0.8VDD
VDD
VDD
V
V
V
V
V
V
V
P34, P36, P70 to P73, RESET
1.8 V ≤ VDD < 2.7 V
0.85VDD
X1, X2
2.7 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.0 V
2.7 V ≤ VDD ≤ 5.5 V
V
V
DD – 0.5
DD – 0.2
VDD
VDD
VDD
XT1, XT2
0.8VDD
0.9VDD
0
VDD
Input voltage,
low
P10 to P13, P21, P24, P35,
P40 to P47, P50 to P57, P74,
P75
0.3VDD
1.8 V ≤ VDD < 2.7 V
0
0.2VDD
V
VIL2
VIL3
VIL4
VOH1
P00 to P03, P20, P22, P23, P25, 2.7 V ≤ VDD ≤ 5.5 V
0
0
0
0
0
0
0.2VDD
0.15VDD
0.4
V
V
V
V
V
V
V
V
V
P34, P36, P70 to P73, RESET
X1, X2
1.8 V ≤ VDD < 2.7 V
2.7 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.0 V
4.0 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.0 V
0.2
XT1, XT2
0.2VDD
0.1VDD
VDD
Output voltage,
high
IOH = –1 mA
IOH = –100 µA
P50 to P57
V
DD – 1.0
DD – 0.5
V
VDD
Output voltage,
low
VOL1
VOL2
4.0 V ≤ VDD ≤ 5.5 V,
0.4
2.0
IOL = 15 mA
P00 to P03, P20 to P25, P34 to P36, 4.0 V ≤ VDD ≤ 5.5 V,
0.4
0.5
V
V
P40 to P47, P70 to P75
IOL = 1.6 mA
VOL3
IOL = 400 µA
Remark Unless otherwise specified, the characteristics of alternate-function pins are the same as those of port
pins.
321
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
DC Characteristics (TA = –40 to +85°C, VDD = 1.8 to 5.5 V) (2/4)
Parameter
Symbol
ILIH1
Conditions
MIN.
TYP.
MAX.
3
Unit
Input leakage
current, high
VIN = VDD
P00 to P03, P10 to P13, P20 to P25,
P34 to P36, P40 to P47, P50 to P57,
P70 to P75, RESET
µA
ILIH2
ILIL1
X1, X2, XT1, XT2
20
µA
µA
Input leakage
current, low
VIN = 0 V
P00 to P03, P10 to P13, P20 to P25,
P34 to P36, P40 to P47, P50 to P57,
P70 to P75, RESET
–3
ILIL2
ILOH
X1, X2, XT1, XT2
–20
µA
µA
Output leakage
current, high
VOUT = VDD
VOUT = 0 V
VIN = 0 V,
3
Output leakage
current, low
ILOL
–3
µA
kΩ
Software pull-
up resistance
R2
15
30
90
P00 to P03, P20 to P25, P34 to P36, P40 to P47,
P50 to P57, P70 to P75
Remark Unless otherwise specified, the characteristics of alternate-function pins are the same as those of port
pins.
322
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
DC Characteristics (TA = –40 to +85°C, VDD = 1.8 to 5.5 V) (3/4)
(a) µPD780021AS, 780022AS, 780023AS, 780024AS, 780031AS, 780032AS, 780033AS, 780034AS
Parameter
Power supply
currentNote 1
Symbol
Conditions
MIN.
TYP.
8.5
MAX.
17
Unit
mA
Note 2
IDD1
12.0 MHz
VDD = 5.0 V 10%Note 3 When A/D converter is
crystal oscillation
operating mode
stopped
When A/D converter is
operatingNote 7
9.5
5.5
6.5
3
19
11
13
6
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
8.38 MHz
VDD = 5.0 V 10%Note 3 When A/D converter is
crystal oscillation
operating mode
stopped
When A/D converter is
operatingNote 7
VDD = 3.0 V +10%Notes 3, 6 When A/D converter is
stopped
When A/D converter is
operatingNote 7
4
8
5.0 MHz
VDD = 3.0 V 10%Note 3 When A/D converter is
2
4
crystal oscillation
operating mode
stopped
When A/D converter is
operatingNote 7
3
6
VDD = 2.0 V 10%Note 4 When A/D converter is
0.4
1.4
2
1.5
4.2
4
stopped
When A/D converter is
operatingNote 7
IDD2
12.0 MHz
VDD = 5.0 V 10%Note 3 When peripheral functions
crystal oscillation
HALT mode
are stopped
When peripheral functions
are operating
10
2.2
4.7
1
8.38 MHz
VDD = 5.0 V 10%Note 3 When peripheral functions
1.1
0.5
crystal oscillation
HALT mode
are stopped
When peripheral functions
are operating
VDD = 3.0 V +10%Notes 3, 6 When peripheral functions
are stopped
When peripheral functions
are operating
4
5.0 MHz
VDD = 3.0 V 10%Note 3 When peripheral functions
0.35
0.15
0.7
1.7
0.4
1.1
crystal oscillation
HALT mode
are stopped
When peripheral functions
are operating
VDD = 2.0 V 10%Note 4 When peripheral functions
are stopped
When peripheral functions
are operating
IDD3
IDD4
IDD5
32.768 kHz crystal oscillation
operating modeNote 5
VDD = 5.0 V 10%
VDD = 3.0 V 10%
VDD = 2.0 V 10%
VDD = 5.0 V 10%
VDD = 3.0 V 10%
VDD = 2.0 V 10%
VDD = 5.0 V 10%
VDD = 3.0 V 10%
VDD = 2.0 V 10%
40
20
80
40
20
60
18
10
30
10
10
µA
µA
µA
µA
µA
µA
µA
µA
µA
10
32.768 kHz crystal oscillation
HALT modeNote 5
30
6
2
XT1 = VDD, STOP mode
0.1
0.05
0.05
When feedback resistor is not used
323
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Notes 1. Total current flowing through the internal power supply (VDD0, VDD1) except the current flowing through
pull-up resistors of ports.
2. IDD1 includes the peripheral operation current.
3. When the processor clock control register (PCC) is set to 00H.
4. When PCC is set to 02H.
5. When main system clock operation is stopped.
6. The values show the specifications when VDD = 3.0 to 3.3 V. The values in the TYP. column show the
specifications when VDD = 3.0 V.
7. The current flowing through the AVDD pin is included.
324
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
DC Characteristics (TA = –40 to +85°C, VDD = 1.8 to 5.5 V) (4/4)
(b) µPD78F0034BS
Parameter
Power supply
currentNote 1
Symbol
Conditions
MIN.
TYP.
16
MAX.
32
Unit
mA
Note 2
IDD1
12.0 MHz
V
DD = 5.0 V 10%Note 3 When A/D converter is
crystal oscillation
operating mode
stopped
When A/D converter is
operatingNote 7
17
10.5
11.5
7
34
21
23
14
16
9
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
mA
8.38 MHz
V
DD = 5.0 V 10%Note 3 When A/D converter is
crystal oscillation
operating mode
stopped
When A/D converter is
operatingNote 7
VDD = 3.0 V +10%Notes 3, 6 When A/D converter is
stopped
When A/D converter is
operatingNote 7
8
5.0 MHz
V
V
V
V
DD = 3.0 V 10%Note 3 When A/D converter is
4.5
5.5
1
crystal oscillation
operating mode
stopped
When A/D converter is
operatingNote 7
11
2
DD = 2.0 V 10%Note 4 When A/D converter is
stopped
When A/D converter is
operatingNote 7
2
6
IDD2
12.0 MHz
DD = 5.0 V 10%Note 3 When peripheral functions
2.0
4.0
8.0
2.4
5
crystal oscillation
HALT mode
are stopped
When peripheral functions
are operating
8.38 MHz
DD = 5.0 V 10%Note 3 When peripheral functions
1.2
0.6
0.4
0.2
crystal oscillation
HALT mode
are stopped
When peripheral functions
are operating
VDD = 3.0 V +10%Notes 3, 6 When peripheral functions
1.2
2.4
0.8
1.7
0.4
1.1
are stopped
When peripheral functions
are operating
5.0 MHz
V
V
DD = 3.0 V 10%Note 3 When peripheral functions
crystal oscillation
HALT mode
are stopped
When peripheral functions
are operating
DD = 2.0 V 10%Note 4 When peripheral functions
are stopped
When peripheral functions
are operating
IDD3
IDD4
IDD5
32.768 kHz crystal oscillation
operating modeNote 5
VDD = 5.0 V 10%
VDD = 3.0 V 10%
VDD = 2.0 V 10%
VDD = 5.0 V 10%
VDD = 3.0 V 10%
VDD = 2.0 V 10%
VDD = 5.0 V 10%
VDD = 3.0 V 10%
VDD = 2.0 V 10%
115
95
230
190
150
60
µA
µA
µA
µA
µA
µA
µA
µA
µA
75
32.768 kHz crystal oscillation
HALT modeNote 5
30
6
18
2
10
XT1 = VDD, STOP mode
0.1
0.05
0.05
30
When feedback resistor is not used
10
10
325
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Notes 1. Total current flowing through the internal power supply (VDD0, VDD1) except the current flowing through
pull-up resistors of ports.
2. IDD1 includes the peripheral operation current.
3. When the processor clock control register (PCC) is set to 00H.
4. When PCC is set to 02H.
5. When main system clock operation is stopped.
6. The values show the specifications when VDD = 3.0 to 3.3 V. The values in the TYP. column show the
specifications when VDD = 3.0 V.
7. The current flowing through the AVDD pin is included.
326
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
AC Characteristics
(1) Basic operation (TA = –40 to +85°C, VDD = 1.8 to 5.5 V)
Parameter
Symbol
Conditions
Operating with 4.5 V ≤ VDD ≤ 5.5 V
MIN.
0.166
0.238
0.4
TYP.
MAX.
16
Unit
µs
Cycle time
TCY
(Min. instruction
execution time)
main system clock 3.0 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.0 V
16
µs
16
µs
1.8 V ≤ VDD < 2.7 V
1.6
16
µs
Note 1
Operating with subsystem clock
3.0 V ≤ VDD ≤ 5.5 V
103.9
122
125
µs
Note 2
Note 2
Note 2
TI00, TI01 input
high-/low-level
tTIH0, tTIL0
2/fsam + 0.1
µs
2.7 V ≤ VDD < 3.0 V
2/fsam + 0.2
µs
width
1.8 V ≤ VDD < 2.7 V
2/fsam + 0.5
µs
TI50, TI51 input
frequency
fTI5
2.7 V ≤ VDD ≤ 5.5 V
0
0
4
MHz
kHz
ns
1.8 V ≤ VDD < 2.7 V
275
TI50, TI51 input
tTIH5, tTIL5
2.7 V ≤ VDD ≤ 5.5 V
100
1.8
high-/low-level
width
1.8 V ≤ VDD < 2.7 V
µs
Interrupt request tINTH, tINTL INTP0 to INTP3,
2.7 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 2.7 V
1
2
µs
µs
input high-/low-
P40 to P47
level width
RESET
tRSL
2.7 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 2.7 V
10
20
µs
µs
low-level width
Notes 1. Value when the external clock is used. When a crystal resonator is used, it is 114 µs (MIN.).
2. Selection of fsam = fX, fX/4, fX/64 is possible using bits 0 and 1 (PRM00, PRM01) of prescaler mode register
0 (PRM0). However, if the TI00 valid edge is selected as the count clock, the value becomes fsam =
fX/8.
327
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
TCY vs. VDD (main system clock operation)
16.0
10.0
µ
5.0
Operation
guaranteed
range
2.0
1.6
1.0
0.4
0.238
0.166
0.1
5.5
0
1.0
2.0
3.0
4.0
4.5
Supply voltage VDD [V]
5.0
6.0
1.8
2.7
328
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
(2) Serial interface (TA = –40 to +85°C, VDD = 1.8 to 5.5 V) (1/2)
(a) 3-wire serial I/O mode (SCK3n... Internal clock output)
Parameter
SCK3n
Symbol
Conditions
4.5 V ≤ VDD ≤ 5.5 V
MIN.
666
TYP.
MAX.
Unit
ns
ns
ns
ns
ns
ns
ns
ns
ns
ns
ns
ns
ns
tKCY1
cycle time
3.0 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.0 V
1.8 V ≤ VDD < 2.7 V
3.0 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 3.0 V
3.0 V ≤ VDD ≤ 5.5 V
2.7 V ≤ VDD < 3.0 V
1.8 V ≤ VDD < 2.7 V
4.5 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.5 V
954
1600
3200
SCK3n high-/
low-level width
SI3n setup time
(to SCK3n↑)
tKH1, tKL1
tSIK1
tKCY1/2 – 50
tKCY1/2 – 100
100
150
300
SI3n hold time
(from SCK3n↑)
Delay time from
SCK3n↓ to SO3n
output
tKSI1
300
400
Note
tKSO1
C = 100 pF
4.5 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.5 V
200
300
Note C is the load capacitance of the SCK3n and SO3n output lines.
(b) 3-wire serial I/O mode (SCK3n... External clock input)
Parameter
SCK3n
Symbol
Conditions
4.5 V ≤ VDD ≤ 5.5 V
MIN.
666
TYP.
MAX.
Unit
ns
ns
ns
ns
ns
ns
ns
ns
ns
tKCY2
cycle time
3.0 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.0 V
1.8 V ≤ VDD < 2.7 V
4.5 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.0 V
1.8 V ≤ VDD < 2.7 V
800
1600
3200
333
SCK3n high-/
low-level width
tKH2, tKL2
400
800
1600
100
SI3n setup time
(to SCK3n↑)
SI3n hold time
(from SCK3n↑)
Delay time from
SCK3n↓ to SO3n
output
tSIK2
tKSI2
tKSO2
4.5 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.5 V
300
400
ns
ns
ns
ns
Note
C = 100 pF
4.5 V ≤ VDD ≤ 5.5 V
1.8 V ≤ VDD < 4.5 V
200
300
Note C is the load capacitance of the SO3n output line.
Remark n = 0, 1
329
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
(2) Serial interface (TA = –40 to +85°C, VDD = 1.8 to 5.5 V) (2/2)
(c) UART mode (dedicated baud-rate generator output)
Parameter
Symbol
Conditions
4.5 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.5 V
MIN.
TYP.
MAX.
187500
131031
Unit
bps
bps
Transfer rate
2.7 V ≤ VDD < 3.0 V
1.8 V ≤ VDD < 2.7 V
78125
39063
bps
bps
(d) UART mode (external clock input)
Parameter
ASCK0 cycle time
Symbol
Conditions
MIN.
800
TYP.
MAX.
Unit
ns
tKCY3
4.0 V ≤ VDD ≤ 5.5 V
2.7 V ≤ VDD < 4.0 V
1600
ns
1.8 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
3200
400
ns
ns
ASCK0 high-/low-level width
Transfer rate
tKH3,
tKL3
2.7 V ≤ VDD < 4.0 V
1.8 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
2.7 V ≤ VDD < 4.0 V
1.8 V ≤ VDD < 2.7 V
800
ns
ns
1600
39063
19531
9766
bps
bps
bps
(e) UART mode (infrared data transfer mode)
Parameter
Symbol
Conditions
4.0 V ≤ VDD ≤ 5.5 V
4.0 V ≤ VDD ≤ 5.5 V
4.0 V ≤ VDD ≤ 5.5 V
4.0 V ≤ VDD ≤ 5.5 V
MIN.
TYP.
MAX.
131031
0.87
Unit
bps
%
Transfer rate
Allowable bit rate error
Output pulse width
Input pulse width
1.2
0.24/fbrNote
µs
4/fX
µs
Note fbr: Specified baud rate
330
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
AC Timing Test Points (Excluding X1 and XT1 Inputs)
0.8VDD
0.2VDD
0.8VDD
0.2VDD
Test points
Clock Timing
1/f
X
tXL
tXH
V
V
IH3 (MIN.)
IL3 (MAX.)
X1 input
1/fXT
t
XTL
tXTH
V
V
IH4 (MIN.)
IL4 (MAX.)
XT1 input
TI Timing
tTIL0
t
TIH0
TI00, TI01
1/fTI5
tTIL5
tTIH5
TI50, TI51
331
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Interrupt Request Input Timing
tINTL
t
INTH
INTP0 to INTP3
RESET Input Timing
t
RSL
RESET
Serial Transfer Timing
3-wire serial I/O mode:
t
KCYm
t
KLm
t
KHm
SCK3n
SI3n
t
KSIm
t
SIKm
Input data
tKSOm
SO3n
Output data
Remarks 1. m = 1, 2
2. n = 0, 1
UART mode (external clock input):
KCY3
t
tKH3
t
KL3
ASCK0
332
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
A/D Converter Characteristics
(a) 8-bit A/D converter (µPD780024AS Subseries)
(TA = –40 to +85°C, VDD = AVDD = 1.8 to 5.5 V, AVSS = VSS = 0 V)
Parameter
Symbol
Conditions
MIN.
8
TYP.
8
MAX.
8
Unit
bit
Resolution
Notes 1, 2
Overall error
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
1.8 V ≤ AVREF < 2.7 V
4.5 V ≤ AVDD ≤ 5.5 V
4.0 V ≤ AVDD < 4.5 V
2.7 V ≤ AVDD < 4.0 V
1.8 V ≤ AVDD < 2.7 V
0.4
0.6
1.2
96
%FSR
%FSR
%FSR
µs
Conversion time
tCONV
12
14
17
28
0
96
µs
96
µs
96
µs
Analog input voltage
VAIN
AVREF
AVDD
V
Reference voltage
AVREF
RREF
1.8
20
V
Resistance between AVREF and AVSS
During A/D conversion operation
40
kΩ
Notes 1. Excludes quantization error ( 1/2 LSB).
2. This value is indicated as a ratio (%FSR) to the full-scale value.
333
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
(b) 10-bit A/D converter (µPD780034AS Subseries)
(TA = –40 to +85°C, VDD = AVDD = 1.8 to 5.5 V, AVSS = VSS = 0 V)
Parameter
Symbol
Conditions
MIN.
10
TYP.
10
MAX.
10
Unit
bit
Resolution
Overall errorNotes 1, 2
Conversion time
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
1.8 V ≤ AVREF < 2.7 V
4.5 V ≤ AVDD ≤ 5.5 V
4.0 V ≤ AVDD < 4.5 V
2.7 V ≤ AVDD < 4.0 V
1.8 V ≤ AVDD < 2.7 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
1.8 V ≤ AVREF < 2.7 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
1.8 V ≤ AVREF < 2.7 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
1.8 V ≤ AVREF < 2.7 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
1.8 V ≤ AVREF < 2.7 V
0.2
0.3
0.6
0.4
0.6
1.2
96
%FSR
%FSR
%FSR
µs
tCONV
12
14
17
28
96
µs
96
µs
96
µs
Zero-scale errorNotes 1, 2
0.4
0.6
1.2
0.4
0.6
1.2
2.5
4.5
8.5
1.5
2.0
3.5
AVREF
AVDD
%FSR
%FSR
%FSR
%FSR
%FSR
%FSR
LSB
LSB
LSB
LSB
LSB
LSB
V
Full-scale errorNotes 1, 2
Integral linearity errorNote 1
Differential linearity errorNote 1
Analog input voltage
VAIN
0
Reference voltage
AVREF
RREF
1.8
20
V
Resistance between AVREF and AVSS
During A/D conversion operation
40
kΩ
Notes 1. Excludes quantization error ( 1/2 LSB).
2. This value is indicated as a ratio (%FSR) to the full-scale value.
Remark The impedance of the analog input pins is shown below.
[Equivalent circuit]
R1
R2
ANIn
(n = 0 to 3)
C1
C2
C3
[Parameter value]
(TYP.)
AVDD
2.7 V
4.5 V
R1
R2
C1
C2
C3
12 kΩ
4 kΩ
8.0 kΩ
2.7 kΩ
8.0 pF
8.0 pF
3.0 pF
1.4 pF
2.0 pF
2.0 pF
334
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (T
A
= –40 to +85
°C)
Parameter
Symbol
VDDDR
Conditions
MIN.
1.6
TYP.
MAX.
Unit
V
Data retention power
supply voltage
5.5
30
Data retention power
supply current
IDDDR
VDDDR = 1.6 V
0.1
µA
(Subsystem clock stopped and feedback
resistor disconnected)
Release signal set time
tSREL
tWAIT
0
µs
Oscillation stabilization
wait time
Release by RESET
217/fx
s
Release by interrupt request
Note
s
Note Selection of 212/fX, 214/fX, 215/fX, 216/fX, and 217/fX is possible using bits 0 to 2 (OSTS0 to OSTS2) of the
oscillation stabilization time select register (OSTS).
Data Retention Timing (STOP Mode Release by RESET)
Internal reset operation
HALT mode
Operating mode
STOP mode
Data retention mode
V
DD
VDDDR
tSREL
STOP instruction execution
RESET
t
WAIT
Data Retention Timing (Standby Release Signal: STOP Mode Release by Interrupt Request Signal)
HALT mode
Operating mode
STOP mode
Data retention mode
VDD
VDDDR
tSREL
STOP instruction execution
Standby release signal
(interrupt request)
tWAIT
335
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
Flash Memory Programming Characteristics: µPD78F0034BS
(TA = +10 to +40°C, VDD = AVDD = 1.8 to 5.5 V, VSS = AVSS = 0 V)
(1) Write erase characteristics
Parameter
Symbol
Conditions
4.5 V ≤ VDD ≤ 5.5 V
MIN.
1.0
1.0
1.0
1.0
9.7
TYP.
MAX.
10.0
8.38
5.00
1.25
10.3
30
Unit
MHz
MHz
MHz
MHz
V
Operating frequency
fX
3.0 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.0 V
1.8 V ≤ VDD < 2.7 V
VPP supply voltage
VPP2
IDD
During flash memory programming
10.0
Note 1
VDD supply current
VPP = VPP2 10 MHz
VDD = 5.0 V 10%
mA
crystal oscillation
operating mode
8.38 MHz
VDD = 5.0 V 10%
VDD = 3.0 V 10%
24
17
mA
mA
crystal oscillation
operating mode
VPP supply current
IPP
VPP = VPP2
100
0.201
20
mA
s
Note 2
Step erase time
Ter
0.199
49.4
0.2
50
Note 3
Overall erase time
Tera
Twb
Cwb
When step erase time = 0.2 s
When writeback time = 50 ms
s/chip
ms
Note 4
Writeback time
50.6
60
Number of writebacks
per 1 writeback
Times
Note 5
command
Number of erases/
writebacks
Cerwb
16
Times
Note 6
Step write time
Twr
48
48
50
52
µs
µs
Overall write time per
Twrw
When step write time = 50 µs (1 word = 1
byte)
520
Note 7
word
Number of rewrites per
Cerwr
1 erase + 1 write after erase = 1 rewrite
20
Times/
area
Note 8
chip
Notes 1. The AVDD current and port current (the current flowing through on-chip pull-up resistors) are not
included.
2. The recommended setting value of the step erase time is 0.2 s.
3. The prewrite time before erasure and the erase verify time (writeback time) are not included.
4. The recommended setting value of the writeback time is 50 ms.
5. Writeback is executed once by the issuance of the writeback command. Therefore, the number of retries
must be the maximum value minus the number of commands issued.
6. The recommended setting value of the step write time is 50 µs.
7. The actual write time per word is 100 µs longer. The internal verify time during or after a write is not
included.
8. When a product is first written after shipment, “erase → write” and “write only” are both taken as one
rewrite.
Example: P: Write, E: Erase
Shipped product
→ P → E → P → E → P: 3 rewrites
Shipped product → E → P → E → P → E → P: 3 rewrites
336
User’s Manual U16035EJ5V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS
(2) Serial write operation characteristics
Parameter
Symbol
tDP
Conditions
MIN.
10
TYP.
MAX.
Unit
µs
Set time from VDD↑ to VPP↑
Time from VPP↑ to RESET↑ release
tPR
1.0
1.0
µs
VPP pulse input start time from
tRP
µs
RESET↑
VPP pulse high-/low-level width
tPW
8.0
µs
VPP pulse input end time from
tRPE
20
ms
RESET↑
VPP pulse low-level input voltage
VPP pulse high-level input voltage
VPPL
VPPH
0.8VDD
9.7
VDD
1.2VDD
10.3
V
V
10.0
Flash Memory Write Mode Set Timing
VDD
VDD
0 V
tDP
tRP
t
PW
VPPH
VPP
VPP
VPPL
tPW
tPR
tRPE
V
DD
RESET (input)
0 V
337
User’s Manual U16035EJ5V0UD
CHAPTER 21 PACKAGE DRAWING
52-PIN PLASTIC LQFP (10x10)
A
B
detail of lead end
27
26
39
40
S
P
T
C
D
R
L
52
1
14
13
U
Q
F
J
M
G
I
H
K
M
ITEM MILLIMETERS
A
B
C
D
12.0 0.2
10.0 0.2
10.0 0.2
12.0 0.2
N
S
S
F
G
H
I
1.1
1.1
0.32 0.06
0.13
J
0.65 (T.P.)
1.0 0.2
0.5
K
L
+0.03
0.17
M
–0.05
N
P
Q
0.10
1.4
0.1 0.05
+4°
3°
R
–3°
S
T
1.5 0.1
0.25
U
0.6 0.15
S52GB-65-8ET-2
User’s Manual U16035EJ5V0UD
338
CHAPTER 22 RECOMMENDED SOLDERING CONDITIONS
This product 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 22-1. Surface Mounting Type Soldering Conditions (1/2)
(1) µPD780021ASGB-×××-8ET:
µPD780022ASGB-×××-8ET:
µPD780023ASGB-×××-8ET:
µPD780024ASGB-×××-8ET:
µPD780031ASGB-×××-8ET:
µPD780032ASGB-×××-8ET:
µPD780033ASGB-×××-8ET:
µPD780034ASGB-×××-8ET:
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
µPD780021ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780022ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780023ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780024ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780031ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780032ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780033ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
µPD780034ASGB(A)-×××-8ET: 52-pin plastic LQFP (10 × 10)
Recommended
Soldering Method
Infrared reflow
Soldering Conditions
Condition Symbol
Package peak temperature: 235°C, Time: 30 seconds max.
(at 210°C or higher), Count: Two times or less
IR35-00-2
VPS
Package peak temperature: 215°C, Time: 40 seconds max.
(at 200°C or higher), Count: Two times or less
VP15-00-2
WS60-00-1
Wave soldering
Solder bath temperature: 260°C max., Time: 10 seconds max.,
Count: Once, Preheating temperature: 120°C max. (package surface
temperature)
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).
339
User’s Manual U16035EJ5V0UD
CHAPTER 22 RECOMMENDED SOLDERING CONDITIONS
Table 22-1. Surface Mounting Type Soldering Conditions (2/2)
(2) µPD78F0034BSGB-8ET:
52-pin plastic LQFP (10 × 10)
µPD78F0034BSGB(A)-8ET: 52-pin plastic LQFP (10 × 10)
Recommended
Soldering Method
Infrared reflow
Soldering Conditions
Condition Symbol
Package peak temperature: 235°C, Time: 30 seconds max.
(at 210°C or higher), Count: Two times 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: Two times or less, Exposure limit:
7 daysNote (after that, prebake at 125°C for 10 hours)
VP15-107-2
WS60-107-1
Wave soldering
Solder bath temperature: 260°C max., Time: 10 seconds max.,
Count: Once, Preheating temperature: 120°C max. (package
surface temperature), Exposure limit: 7 daysNote (after that, prebake
at 125°C for 10 hours)
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).
(3) µPD780021ASGB-×××-8ET-A:
µPD780022ASGB-×××-8ET-A:
µPD780023ASGB-×××-8ET-A:
µPD780024ASGB-×××-8ET-A:
µPD780031ASGB-×××-8ET-A:
µPD780032ASGB-×××-8ET-A:
µPD780033ASGB-×××-8ET-A:
µPD780034ASGB-×××-8ET-A:
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
52-pin plastic LQFP (10 × 10)
µPD78F0034BSGB-×××-8ET-A: 52-pin plastic LQFP (10 × 10)
Recommended
Soldering Method
Infrared reflow
Soldering Conditions
Condition Symbol
Package peak temperature: 260°C, Time: 30 seconds max.
(at 210°C or higher), Count: Three times or less, Exposure limit:
7 daysNote (after that, prebake at 125°C for 20 hours)
IR60-207-3
Wave soldering
Partial heating
For details, contact an NEC Electronics sales representative.
––
––
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 with -A at the end of the part number are lead-free products.
340
User’s Manual U16035EJ5V0UD
APPENDIX A DIFFERENCES BETWEEN µPD780024A, 780024AS, 780034A,
AND 780034AS SUBSERIES
Table A-1 shows the major differences between µPD780024A, 780024AS, 780034A, and 780034AS Subseries.
Table A-1. Major Differences Between µPD780024A, 780024AS, 780034A, and 780034AS Subseries (1/2)
Part Number
µPD780024A
µPD780034A
µPD780024AS
µPD780034AS
Item
Subseries
Subseries
Subseries
Subseries
ROM capacity
8 KB/16 KB/24 KB/32 KB
512 bytes/1,024 bytes
Internal high-speed RAM capacity
Flash memory version
µPD78F0034B
µPD780034AY
Subseries
µPD78F0034BS
2
I C bus version
µPD780024AY
Subseries
None
Minimum instruction
execution time
0.166 µs: VDD = 4.5 to 5.5 V
0.238 µs: VDD = 3.0 to 5.5 V
0.400 µs: VDD = 2.7 to 5.5 V
1.60 µs: VDD = 1.8 to 5.5 V
1.8 to 5.5 V
Operating voltage range
I/O ports
Total: 51
Total: 39
Input: 4
I/O: 35
Input: 8
I/O: 43
(5 V tolerance N-ch open drain: 4)
16 bits × 1 ch
Timer/counter
8 bits × 2 ch
Watch timer × 1 ch
Watchdog timer × 1 ch
3-wire serial I/O mode × 2 ch
UART mode × 1 ch
Serial interface
A/D converter
8 bits × 8 ch
10 bits × 8 ch
8 bits × 4 ch
10 bits × 4 ch
Interrupt
Maskable
Internal: 13, external: 5
Non-maskable
Software
1
1
External device expansion Time division method
None
None
function
Expansion up to F7FFH is possible.
Pull-up resistor can be specified for P30 to P33
• 64-pin plastic SDIP
Mask option
Package
52-pin plastic LQFP
• 64-pin plastic QFP
• 64-pin plastic TQFP
• 64-pin plastic LQFP
• 72-pin plastic FBGA
Emulation board
Emulation probe
(conversion adapter)
IE-780034-NS-EM1
• NP-64CW
NP-H52GB-TQ (TGB-052SBP)
• NP-64GC (EV-9200GC-64)
NP-64GC-TQ, NP-H64GC-TQ (TGC-064SAP)
• NP-64GK, NP-H64GK-TQ (TGK-064SBW)
• NP-H64GB-TQ (TGB-064SDP)
* A conversion board is required to connect the
probe to the emulation board.
NP-73F1-CN3 (CSICE73A0909N01,
•
LSPACK73A0909N01, CSSOCKET73A0909N01)
User’s Manual U16035EJ5V0UD
341
APPENDIX A DIFFERENCES BETWEEN µPD780024A, 780024AS, 780034A, AND 780034AS SUBSERIES
Table A-1. Major Differences Between µPD780024A, 780024AS, 780034A, and 780034AS Subseries (2/2)
Part Number
µPD780024A
µPD780034A
µPD780024AS
µPD780034AS
Item
Subseries
Subseries
Subseries
Subseries
Device file
DF780024
DF780034
DF780024
FA-52GB-8ET
DF780034
Flashmemorywritingadapter • FA-64CW
• FA-64GC-8BS-A
• FA-64GC
• FA-64GK-9ET
• FA-64GB-8EU-A
• FA-73F1-CN3-A
342
User’s Manual U16035EJ5V0UD
APPENDIX B DEVELOPMENT TOOLS
The following development tools are available for the development of systems that employ the µPD780024AS,
780034AS Subseries.
Figure B-1 shows the development tool configuration.
Support for PC98-NX series
Unless otherwise specified, products compatible with IBM PC/ATTM computers are compatible with PC98-NX
•
series computers. When using PC98-NX series computers, refer to the explanation for IBM PC/AT computers.
WindowsTM
•
Unless otherwise specified, “Windows” means the following OSs.
• Windows 3.1
• Windows 95
• Windows 98
• Windows 2000
• Windows XP
• Windows NTTM Ver. 4.0
343
User’s Manual U16035EJ5V0UD
APPENDIX B DEVELOPMENT TOOLS
Figure B-1. Development Tool Configuration
Software package
• Software package
Debugging software
Language processing software
• Assembler package
• C compiler package
• Device file
• Integrated debugger
• System simulator
• C library source fileNote 1
Control software
• Project manager
(Windows only)Note 2
Embedded software
• Real-time OS
Host machine (PC or EWS)
Interface adapter,
PC card interface, etc.
Power supply unit
Flash memory
write environment
In-circuit emulator
Emulation board
I/O board
Flash programmer
Flash memory
write adapter
Performance board
Flash memory
Emulation probe
Conversion socket or
conversion adapter
Target system
Notes 1. The C library source file is not included in the software package.
2. The project manager is included in the assembler package.
The project manager is only used for Windows.
344
User’s Manual U16035EJ5V0UD
APPENDIX B DEVELOPMENT TOOLS
B.1 Software Package
SP78K0
This package contains various software tools for 78K/0 Series development.
The following tools are included.
Software package
RA78K0, CC78K0, ID78K0-NS, SM78K0, and various device files
Part Number: µS××××SP78K0
Remark ×××× in the part number differs depending on the OS used.
µS××××SP78K0
××××
AB17
BB17
Host Machine
PC-9800 series,
IBM PC/AT compatibles
OS
Supply Medium
CD-ROM
Windows (Japanese version)
Windows (English version)
B.2 Language Processing Software
This assembler converts programs written in mnemonics into object codes
executable with a microcontroller.
RA78K0
Assembler package
Further, this assembler is provided with functions capable of automatically creating
symbol tables and branch instruction optimization.
This assembler should be used in combination with device file (DF780024 or
DF780034) (sold separately).
<Precaution when using RA78K0 in PC environment>
This assembler package is a DOS-based application. It can also be used in
Windows, however, by using the project manager (included in the assembler
package) on Windows.
Part Number: µS××××RA78K0
This compiler converts programs written in C language into object codes executable
with a microcontroller.
CC78K0
C compiler package
This compiler should be used in combination with an assembler package and device
file (both sold separately).
<Precaution when using CC78K0 in PC environment>
This C compiler package is a DOS-based application. It can also be used in
Windows, however, by using the project manager (included in the assembler
package) on Windows.
Part Number: µS××××CC78K0
Note 1
This file contains information peculiar to the device.
DF780024
Note 1
This device file should be used in combination with tool (RA78K0, CC78K0,
SM78K0, ID78K0-NS, and RX78K0) (all sold separately). The corresponding OS
and host machine differ depending on the tool used.
DF780034
Device file
• DF780024: µPD780024A, 780024AY, 780024AS Subseries
• DF780034: µPD780034A, 780034AY, 780034AS Subseries
Part Number: µS××××DF780024, µS××××DF780034
Note 2
This is a source file of functions configuring the object library included in the C
compiler package.
CC78K0-L
C library source file
This file is required to match the object library included in C compiler package to the
user’s specifications. It does not depend on the operating environment because it is
a source file.
Part Number: µS××××CC78K0-L
User’s Manual U16035EJ5V0UD
345
APPENDIX B DEVELOPMENT TOOLS
Notes 1. The DF780024 and DF780034 can be used in common with the RA78K0, CC78K0, SM78K0, ID78K0-
NS, and RX78K0.
2. CC78K0-L is not included in the software package (SP78K0).
Remark ×××× in the part number differs depending on the host machine and OS used.
µS××××RA78K0
µS××××CC78K0
××××
AB13
BB13
AB17
BB17
3P17
3K17
Host Machine
PC-9800 series,
OS
Supply Medium
3.5-inch 2HD FD
Windows (Japanese version)
Windows (English version)
Windows (Japanese version)
IBM PC/AT compatibles
CD-ROM
Windows (English version)
TM
TM
HP9000 series 700
HP-UX
(Rel. 10.10)
TM
TM
SPARCstation
SunOS
(Rel. 4.1.4),
(Rel. 2.5.1)
TM
Solaris
µS××××DF780024
µS××××DF780034
µS××××CC78K0-L
××××
Host Machine
OS
Supply Medium
AB13
BB13
3P16
3K13
3K15
PC-9800 series,
Windows (Japanese version)
Windows (English version)
HP-UX (Rel. 10.10)
3.5-inch 2HD FD
IBM PC/AT compatibles
HP9000 series 700
SPARCstation
DAT
SunOS (Rel. 4.1.4),
Solaris (Rel. 2.5.1)
3.5-inch 2HD FD
1/4-inch CGMT
B.3 Control Software
Project manager
This is control software designed to enable efficient user program development in the
Windows environment. All operations used in development of a user program, such as
starting the editor, building, and starting the debugger, can be performed from the project
manager.
<Caution>
The project manager is included in the assembler package (RA78K0).
It can only be used in Windows.
346
User’s Manual U16035EJ5V0UD
APPENDIX B DEVELOPMENT TOOLS
B.4 Flash Memory Writing Tools
Flashpro III
Flash programmer dedicated to microcontrollers with on-chip flash memory.
(part number: FL-PR3, PG-FP3)
Flashpro IV
(part number: FL-PR4, PG-FP4)
Flash programmer
FA-52GB-8ET
Flash memory writing adapter used connected to the Flashpro III and Flashpro IV.
Flash memory writing adapter
• FA-52GB-8ET: 52-pin plastic LQFP (GB-8ET type)
Remark FL-PR3, FL-PR4, and FA-52GB-8ET are products of Naito Densei Machida Mfg. Co., Ltd.
Contact: +81-45-475-4191 Naito Densei Machida Mfg. Co., Ltd.
User’s Manual U16035EJ5V0UD
347
APPENDIX B DEVELOPMENT TOOLS
B.5 Debugging Tools (Hardware)
IE-78K0-NS
In-circuit emulator
The in-circuit emulator serves to debug hardware and software when developing
application systems using a 78K/0 Series product. It corresponds to the integrated
debugger (ID78K0-NS). This emulator should be used in combination with a power
supply unit, emulation probe, and interface adapter which is required to connect this
emulator to the host machine.
IE-78K0-NS-PA
Performance board
This board is connected to the IE-78K0-NS to expand its functions. Adding this
board adds a coverage function and enhances debugging functions such as tracer
and timer functions.
IE-78K0-NS-A
A combination of the IE-78K0-NS and IE-78K0-NS-PA.
In-circuit emulator
IE-70000-MC-PS-B
Power supply unit
This adapter is used for supplying power from a receptacle of 100 V to 240 V AC.
IE-70000-98-IF-C
Interface adapter
This adapter is required when using a PC-9800 series computer (except notebook
type) as the host machine (C bus compatible).
IE-70000-CD-IF-A
PC card interface
This is PC card and interface cable required when using a notebook-type computer
as the host machine (PCMCIA socket compatible).
IE-70000-PC-IF-C
Interface adapter
This adapter is required when using an IBM PC/AT compatible computer as the host
machine (ISA bus compatible).
IE-70000-PCI-IF-A
Interface adapter
This adapter is required when using a computer with a PCI bus as the host
machine.
IE-780034-NS-EM1
Emulation Board
This board emulates the operations of the peripheral hardware peculiar to a device. It
should be used in combination with an in-circuit emulator.
780034AS 52Pin Board
Conversion Board
NP-H52GB-TQ
Emulation Probe
TGB-052SBP
Conversion Adapter
This conversion board is used to connect the emulation probe to the emulation board.
This probe is used to connect the in-circuit emulator to a target system and is designed
for use with 52-pin plastic LQFP (GB-8ET type).
This conversion adapter connects the NP-H52GB-TQ to a target system board designed
for a 52-pin plastic LQFP (GB-8ET type).
Remarks 1. NP-H52GB-TQ is a product of Naito Densei Machida Mfg. Co., Ltd.
Inquiry: Naito Densei Machida Mfg. Co., Ltd. (TEL +81-45-475-4191)
2. TGB-052SBP is a product of TOKYO ELETECH CORPORATION.
Inquiry: Daimaru Kogyo, Ltd.: Tokyo Electronics Department (TEL +81-3-3820-7112)
Osaka Electronics Department (TEL +81-6-6244-6672)
3. TGB-052SBP is sold in one units.
348
User’s Manual U16035EJ5V0UD
APPENDIX B DEVELOPMENT TOOLS
B.6 Debugging Tools (Software)
SM78K0
This is a system simulator for the 78K/0 Series. The SM78K0 is Windows-based
software.
System simulator
It is used to perform debugging at the C source level or assembler level while simulating
the operation of the target system on a host machine.
Use of the SM78K0 allows the execution of application logical testing and performance
testing on an independent basis from hardware development, thereby providing higher
development efficiency and software quality.
TheSM78K0shouldbeusedincombinationwiththedevicefile(DF780024orDF780034)
(sold separately).
Part Number: µS××××SM78K0
ID78K0-NS
This debugger supports the in-circuit emulators for the 78K/0 Series. The
ID78K0-NS is Windows-based software.
Integrated debugger
(supporting in-circuit emulators
IE-78K0-NS and IE-78K0-NS-A)
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.
It should be used in combination with the device file (sold separately).
Part Number: µS××××ID78K0-NS
Remark ×××× in the part number differs depending on the host machine and OS used.
µS××××SM78K0
µS××××ID78K0-NS
××××
AB13
BB13
AB17
BB17
Host machine
PC-9800 series,
IBM PC/AT or compatibles
OS
Japanese Windows
Supply medium
3.5-inch 2HD FD
English Windows
Japanese Windows
English Windows
CD-ROM
User’s Manual U16035EJ5V0UD
349
APPENDIX B DEVELOPMENT TOOLS
B.7 Embedded Software
RX78K0
RX78K0 is a real-time OS conforming to the µITRON specifications.
A tool (configurator) for generating the nucleus of RX78K0 and multiple information
tables is supplied.
Real-time OS
It is used in combination with an assembler package (RA78K0) and device file
(DF780024 or DF780034) (both sold separately).
<Precaution when using RX78K0 in PC environment>
The real-time OS is a DOS-based application. It should be used from the DOS prompt
when using in Windows.
Part number: µS××××RX78013-∆∆∆∆
Caution When purchasing the RX78K0, fill in the purchase application form in advance and sign the user
agreement.
Remark ×××× and ∆∆∆∆ in the part number differ depending on the host machine and OS used.
µS××××RX78013-∆∆∆∆
∆∆∆∆
Product Outline
Evaluation object
Maximum Number for Use in Mass Production
Do not use for mass-produced product.
001
100K
001M
010M
S01
Mass-production object
0.1 million units
1 million units
10 million units
Source program
Host Machine
Source program for mass-produced object
××××
AA13
AB13
BB13
OS
Supply Medium
3.5-inch 2HD FD
PC-9800 series
Windows (Japanese version)
Windows (Japanese version)
Windows (English version)
IBM PC/AT compatibles
350
User’s Manual U16035EJ5V0UD
APPENDIX C NOTES ON TARGET SYSTEM DESIGN
The following shows a diagram of the connection conditions between the emulation probe and conversion adapter.
Design your system making allowances for conditions such as the shape of parts mounted on the target system, as
shown below.
Of the products described in this chapter, the emulation probe is a product of Naito Densei Machida Mfg. Co., Ltd.,
and the conversion adapter is a product of TOKYO ELETECH CORPORATION.
Table C-1. Distance Between IE System and Conversion Adapter
Emulation Probe
NP-H52GB-TQ
Conversion Adapter
Distance Between IE System
and Conversion Adapter
TGB-052SBP
370 mm
Figure C-1. Distance Between In-Circuit Emulator and Conversion Adapter (When Using NP-H52GB-TQ)
In-circuit emulator
IE-78K0-NS or IE-78K0-NS-A
Target system
Emulation board
IE-780034-NS-EM1
370 mm
CN2
Emulation probe
NP-H52GB-TQ
Conversion adapter: TGB-052SBP
780034AS 52-pin Board
351
User’s Manual U16035EJ5V0UD
APPENDIX C NOTES ON TARGET SYSTEM DESIGN
Figure C-2. Connection Conditions of Target System (When Using NP-H52GB-TQ)
Emulation board
IE-780034-NS-EM1
Emulation probe
NP-H52GB-TQ
22 mm
Conversion adapter
TGB-052SBP
11 mm
16.45 mm
16.45 mm
42 mm
45 mm
Target system
352
User’s Manual U16035EJ5V0UD
APPENDIX D REGISTER INDEX
D.1 Register Name Index
[A]
A/D conversion result register 0 (ADCR0) … 176, 198
A/D converter mode register 0 (ADM0) … 178, 200
Analog input channel specification register 0 (ADS0) … 179, 201
Asynchronous serial interface mode register 0 (ASIM0) … 222
Asynchronous serial interface status register 0 (ASIS0) … 228
[B]
Baud rate generator control register 0 (BRGC0) … 224
[C]
Capture/compare control register 0 (CRC0) … 109
Clock output select register (CKS) … 170
[E]
8-bit timer compare register 50 (CR50) … 139
8-bit timer compare register 51 (CR51) … 139
8-bit timer counter 50 (TM50) … 139
8-bit timer counter 51 (TM51) … 139
8-bit timer mode control register 50 (TMC50) … 141
8-bit timer mode control register 51 (TMC51) … 141
External interrupt falling edge enable register (EGN) … 264
External interrupt rising edge enable register (EGP) … 264
[I]
Interrupt mask flag register 0H (MK0H) … 262
Interrupt mask flag register 0L (MK0L) … 262
Interrupt mask flag register 1L (MK1L) … 262
Interrupt request flag register 0H (IF0H) … 261
Interrupt request flag register 0L (IF0L) … 261
Interrupt request flag register 1L (IF1L) … 261
[M]
Memory expansion mode register (MEM) … 264
Memory size switching register (IMS) … 289
[O]
Oscillation stabilization time select register (OSTS) … 94, 277
[P]
Port 0 (P0) … 70
Port 1 (P1) … 72
Port 2 (P2) … 73
User’s Manual U16035EJ5V0UD
353
APPENDIX D REGISTER INDEX
Port 3 (P3) … 76
Port 4 (P4) … 79
Port 5 (P5) … 80
Port 7 (P7) … 81
Port mode register 0 (PM0) … 84
Port mode register 2 (PM2) … 84, 225, 250
Port mode register 3 (PM3) … 84, 250
Port mode register 4 (PM4) … 84
Port mode register 5 (PM5) … 84
Port mode register 7 (PM7) … 84, 112, 144, 172
Prescaler mode register 0 (PRM0) … 111
Priority specification flag register 0H (PR0H) … 263
Priority specification flag register 0L (PR0L) … 263
Priority specification flag register 1L (PR1L) … 263
Processor clock control register (PCC) … 92
Program status word (PSW) … 48, 265
Pull-up resistor option register 0 (PU0) … 87
Pull-up resistor option register 2 (PU2) … 87
Pull-up resistor option register 3 (PU3) … 87
Pull-up resistor option register 4 (PU4) … 87
Pull-up resistor option register 5 (PU5) … 87
Pull-up resistor option register 7 (PU7) … 87
[R]
Receive buffer register 0 (RXB0) … 220
Receive shift register 0 (RX0) … 220
[S]
Serial I/O shift register 30 (SIO30) … 246
Serial I/O shift register 31 (SIO31) … 246
Serial operation mode register 30 (CSIM30) … 247
Serial operation mode register 31 (CSIM31) … 247
16-bit timer capture/compare register 00 (CR00) … 106
16-bit timer capture/compare register 01 (CR01) … 107
16-bit timer counter 0 (TM0) … 106
16-bit timer mode control register 0 (TMC0) … 108
16-bit timer output control register 0 (TOC0) … 110
[T]
Timer clock select register 50 (TCL50) … 140
Timer clock select register 51 (TCL51) … 140
Transmit shift register 0 (TXS0) … 220
[W]
Watch timer operation mode register (WTM) … 161
Watchdog timer clock select register (WDCS) … 165
Watchdog timer mode register (WDTM) … 166
354
User’s Manual U16035EJ5V0UD
APPENDIX D REGISTER INDEX
D.2 Register Symbol Index
[A]
ADCR0:
ADM0:
ADS0:
A/D conversion result register 0 … 176, 198
A/D converter mode register 0 … 178, 200
Analog input channel specification register 0 … 179, 201
Asynchronous serial interface mode register 0 … 222
Asynchronous serial interface status register 0 … 228
ASIM0:
ASIS0:
[B]
BRGC0:
Baud rate generator control register 0 … 224
[C]
CKS:
Clock output select register … 170
CR00:
CR01:
CR50:
CR51:
CRC0:
16-bit timer capture/compare register 00 … 106
16-bit timer capture/compare register 01 … 107
8-bit timer compare register 50 … 139
8-bit timer compare register 51 … 139
Capture/compare control register 0 … 109
CSIM30: Serial operation mode register 30 … 247
CSIM31: Serial operation mode register 31 … 247
[E]
EGN:
EGP:
External interrupt falling edge enable register … 264
External interrupt rising edge enable register … 264
[I]
IF0H:
IF0L:
IF1L:
IMS:
Interrupt request flag register 0H … 261
Interrupt request flag register 0L … 261
Interrupt request flag register 1L … 261
Memory size switching register … 289
[M]
MEM:
MK0H:
MK0L:
MK1L:
Memory expansion mode register … 264
Interrupt mask flag register 0H … 262
Interrupt mask flag register 0L … 262
Interrupt mask flag register 1L … 262
[O]
OSTS:
Oscillation stabilization time select register … 94, 277
[P]
P0:
P1:
P2:
P3:
P4:
P5:
Port 0 … 70
Port 1 … 72
Port 2 … 73
Port 3 … 76
Port 4 … 79
Port 5 … 80
355
User’s Manual U16035EJ5V0UD
APPENDIX D REGISTER INDEX
P7:
Port 7 … 81
PCC:
PM0:
PM2:
PM3:
PM4:
PM5:
PM7:
PR0H:
PR0L:
PR1L:
PRM0:
PSW:
PU0:
PU2:
PU3:
PU4:
PU5:
PU7:
Processor clock control register … 92
Port mode register 0 … 84
Port mode register 2 … 84, 225, 250
Port mode register 3 … 84, 250
Port mode register 4 … 84
Port mode register 5 … 84
Port mode register 7 … 84, 112, 144, 172
Priority specification flag register 0H … 263
Priority specification flag register 0L … 263
Priority specification flag register 1L … 263
Prescaler mode register 0 … 111
Program status word … 48, 265
Pull-up resistor option register 0 … 87
Pull-up resistor option register 2 … 87
Pull-up resistor option register 3 … 87
Pull-up resistor option register 4 … 87
Pull-up resistor option register 5 … 87
Pull-up resistor option register 7 … 87
[R]
RXB0:
RX0:
Receive buffer register 0 … 220
Receive shift register 0 … 220
[S]
SIO30:
SIO31:
Serial I/O shift register 30 … 246
Serial I/O shift register 31 … 246
[T]
TCL50:
TCL51:
TM0:
Timer clock select register 50 … 140
Timer clock select register 51 … 140
16-bit timer counter 0 … 106
TM50:
TM51:
TMC0:
TMC50:
TMC51:
TOC0:
TXS0:
8-bit timer counter 50 … 139
8-bit timer counter 51 … 139
16-bit timer mode control register 0 … 108
8-bit timer mode control register 50 … 141
8-bit timer mode control register 51 … 141
16-bit timer output control register 0 … 110
Transmit shift register 0 … 220
[W]
WDCS:
WDTM:
WTM:
Watchdog timer clock select register … 165
Watchdog timer mode register … 166
Watch timer operation mode register … 161
356
User’s Manual U16035EJ5V0UD
APPENDIX E REVISION HISTORY
E.1 Major Revisions in This Edition
Page
Throughout
p. 17
Description
Addition of lead-free products
CHAPTER 1 OUTLINE
• Modification of description in 1.2 Applications
p. 28
p. 53
p. 84
p. 102
CHAPTER 2 PIN FUNCTION
• Modification of AVREF pin function after reset in 2.1 Pin Function List (2) Non-port pins
CHAPTER 3 CPU ARCHITECTURE
• Modification of description in 3.2.3 Special function register (SFR)
CHAPTER 4 PORT FUNCTIONS
• Modification of Caution 2 description in 4.3 Registers Controlling Port Function
CHAPTER 5 CLOCK GENERATOR
• Modification of Table 5-3 Maximum Time Required for CPU Clock Switchover
p. 163
CHAPTER 8 WATCH TIMER
• Modification of Caution description in Figure 8-3 Operation Timing of Watch Timer/Interval Timer
pp. 185, 186, CHAPTER 11 8-BIT A/D CONVERTER (µPD780024AS SUBSERIES)
191, 192,
• Modification of Figure 11-6 A/D Conversion by Hardware Start (When Falling Edge Is Specified)
194
• Modification of Figure 11-7 A/D Conversion by Software Start
• Modification of Figure 11-15 A/D Conversion End Interrupt Request Generation Timing
• Modification of description in 11.6 Cautions for A/D Converter (9) Timing at which A/D conversion result
is undefined and deletion of Figure 11-17 in 3rd edition
• Modification of C1 value in Table 11-3 Resistance and Capacitance of Equivalent Circuit (Reference
Values)
pp. 207, 208 CHAPTER 12 10-BIT A/D CONVERTER (µPD780034AS SUBSERIES)
213, 214,
• Modification of Figure 12-7 A/D Conversion by Hardware Start (When Falling Edge Is Specified)
216
• Modification of Figure 12-8 A/D Conversion by Software Start
• Modification of Figure 12-16 A/D Conversion End Interrupt Request Generation Timing
• Modification of description in 12.6 Cautions for A/D Converter (9) Timing at which A/D conversion result
is undefined and deletion of Figure 12-18 in 3rd edition
• Modification of C1 value in Table 12-3 Resistance and Capacitance of Equivalent Circuit (Reference
Values)
pp. 257, 261, CHAPTER 15 INTERRUPT FUNCTIONS
266, 269 • Modification of description in Table 15-1 Interrupt Source List
• Modification of Caution 5 in Figure 15-2 Format of Interrupt Request Flag Register (IF0L, IF0H, IF1L)
• Modification of description in 15.4.1 Non-maskable interrupt request acknowledge operation
• Modification of description in 15.4.2 Maskable interrupt request acknowledge operation
pp. 291, 292, CHAPTER 18 µPD78F0034BS
293, 296 • Modification of description in Table 18-3 Communication Mode List
• Division of Note in 3rd edition into Notes 1 and 2, and modification of description in Figure 18-4 Example
of Connection with Dedicated Flash Programmer
• Addition of description on voltage monitoring of dedicated flash programmer to <Power supply> in 18.2.3
On-board pin handling.
pp. 303, 310 CHAPTER 19 INSTRUCTION SET
• Deletion of description on NMIS in 19.1.2 Description of “operation” column
• Modification of Operation column of RETI of call/return instructions in 19.2 Operation List
pp. 323, 325, CHAPTER 20 ELECTRICAL SPECIFICATIONS
334
• Modification of description on supply current IDD5 in DC Characteristics (TA = –40 to +85°C, VDD = 1.8 to
5.5 V)
• Modification of C1 value in [Parameter value] of input impedance of analog input pin
p. 343
APPENDIX B DEVELOPMENMT TOOLS
• Addition of Windows XP to Windows
User’s Manual U16035EJ5V0UD
357
APPENDIX E REVISION HISTORY
E.2 Revision History up to Previous Edition
Revisions up to the previous editions are shown below. The “Applied to:” column indicates the chapter in each
edition to which the revision was applied.
(1/3)
Edition
2nd
Major Revision from Previous Edition
• Addition of following products to target devices
Applied to:
Throughout
µPD780021AS(A), 780022AS(A), 780023AS(A), 780024AS(A), 780031AS(A),
780032AS(A), 780033AS(A), 780034AS(A), 78F0034BS(A)
• Change of status of all products from “under development” to “developed”
• Addition of 1.4 Quality Grade
CHAPTER 1 OUTLINE
• Modification of 1.6 78K/0 Series Lineup
• Addition of 1.9 Difference Between Standard Grade and Special Grade
Addition of description to 18.2 Flash Memory Programming
CHAPTER 18
µPD78F0034BS
Addition of chapter
CHAPTER 20
ELECTRICAL
SPECIFICATIONS
Addition of chapter
Addition of chapter
CHAPTER 21
PACKAGE DRAWING
CHAPTER 22
RECOMMENDED
SOLDERING
CONDITIONS
Addition of description to B.2 Flash Memory Writing Tools
APPENDIX B
DEVELOPMENT TOOLS
Addition of chapter
APPENDIX E
REVISION HISTORY
3rd
Addition of description of expanded specification (12 MHz)
Throughout
Revision of 1.6 78K/0 Series Lineup
CHAPTER 1 OUTLINE
Addition of description about pin handling to 2.2.16 VPP (flash memory versions
CHAPTER 2 PIN
FUNCTION
only)
Modification of description in Table 2-1 Pin I/O Circuit Types
Addition of description about programming area to 3.1.2 Internal data memory
CHAPTER 3 CPU
ARCHITECTURE
space
Modification of Figure 3-14 Data to Be Saved to Stack Memory and Figure 3-15
Data to Be Restored from Stack Memory
Modification of [Description example] in 3.4.4 Short direct addressing
Addition of [Illustration] to 3.4.7 Based addressing, 3.4.8 Based indexed
addressing, and 3.4.9 Stack addressing
Modification of port block diagrams (Figure 4-2 to Figure 4-15)
CHAPTER 4 PORT
FUNCTIONS
Addition of Table 4-3 Port Mode Registers and Output Latch Setting When
Alternate Function Is Used
Addition of description of internal feedback resistor and oscillation stabilization time CHAPTER 5 CLOCK
select register (OSTS) to 5.3 Registers Controlling Clock Generator
GENERATOR
358
User’s Manual U16035EJ5V0UD
APPENDIX E REVISION HISTORY
(2/3)
Edition
3rd
Major Revision from Previous Edition
Applied to:
Modification of Figure 6-1 Block Diagram of 16-Bit Timer/Event Counter 0
CHAPTER 6 16-BIT
TIMER/EVENT COUNTER 0
Change of Table 6-2 TI00/TO0/P70 Pin Valid Edge and CR00, CR01 Capture
Trigger and Table 6-3 TI01/P71 Pin Valid Edge and CR00 Capture Trigger in the
previous edition to Table 6-2 CR00 Capture Trigger and Valid Edges of TI00 and
TI01 Pins and Table 6-3 CR01 Capture Trigger and Valid Edge of TI00 Pin
(CRC02 = 1)
Change of explanation order of each function in 6.4 Operations of 16-Bit Timer/
Event Counter 0
Addition of Figure 6-26 PPG Output Configuration Diagram and Figure 6-27 PPG
Output Operation Timing
Addition of 6.5 Program List
Modification of 6.6 (3) Capture register data retention timing
Addition of (11) STOP mode or main system clock stop mode setting
Modification of Figure 7-1 Block Diagram of 8-Bit Timer/Event Counter 50 and
Figure 7-2 Block Diagram of 8-Bit Timer/Event Counter 51
CHAPTER 7 8-BIT
TIMER/EVENT
COUNTERS 50, 51
Deletion of Caution in Figure 7-5 Format of 8-Bit Timer Mode Control Register
5n (TMC5n)
Addition of [Setting] to 7.4.2 Operation as external event counter
Addition of description about frequency to [Setting] in 7.4.3 Operation as
square-wave output (8-bit resolution)
Addition of descriptions about frequency and duty ratio to 7.4.4 Operation as 8-bit
PWM output
Addition of 7.5 Program List
Deletion of 7.5 (2) Operation after compare register change during timer count
operation in the previous edition
Deletion of oscillation stabilization time select register (OSTS) from 9.3 Registers
to Control Watchdog Timer in the previous edition
CHAPTER 9
WATCHDOG TIMER
Modification of Figure 10-1 Block Diagram of Clock Output/Buzzer Output
CHAPTER 10 CLOCK
OUTPUT/BUZZER
OUTPUT CONTROL
CIRCUITS
Controller
Modification of description in 11.2 (3) Sample & hold circuit and (4) Voltage
comparator, and addition of (10) ADTRG pin
CHAPTER 11 8-BIT
A/D CONVERTER
(µPD780024AS
SUBSERIES)
Addition of Table 11-2 Sampling Time and A/D Conversion Start Delay Time of
A/D Converter
Deletion of 11.6 (4) Noise countermeasures (those deleted are added to Figure
11-19 Example of Connecting Capacitor to AVREF Pin and Figure 11-21 Example
of Connection When Signal Source Impedance Is High)
Addition of (14) Input impedance of ANI0 to ANI3 pins
Addition of Figure 12-2 Format of A/D Conversion Result Register 0 (ADCR0)
CHAPTER 12 10-BIT
A/D CONVERTER
Modification of description in 12.2 (3) Sample & hold circuit and (4) Voltage
comparator, and addition of (10) ADTRG pin
(µPD780034AS
SUBSERIES)
Addition of Table 12-2 Sampling Time and A/D Conversion Start Delay Time of
A/D Converter
Deletion of 12.6 (4) Noise countermeasures (those deleted are added to Figure
12-20 Example of Connecting Capacitor to AVREF Pin and Figure 12-22 Example
of Connection When Signal Source Impedance Is High)
Addition of (14) Input impedance of ANI0 to ANI3 pins
359
User’s Manual U16035EJ5V0UD
APPENDIX E REVISION HISTORY
(3/3)
Edition
3rd
Major Revision from Previous Edition
Applied to:
Modification of Figure 13-1 Block Diagram of Serial Interface UART0
CHAPTER 13 SERIAL
INTERFACE UART0
Shift of description about asynchronous serial interface status register 0 (ASIS0)
from 13.3 Registers Controlling Serial Interface UART0 to 13.2 Configuration
of Serial Interface UART0
Addition of Caution to Figure 13-7 Error Tolerance (When k = 0), Including
Sampling Errors
Modification of Caution in Figure 13-10 Timing of Asynchronous Serial Interface
Receive Completion Interrupt Request
Addition of (1) Registers to be used and (3) Relationship between main system
clock and baud rate to 13.4.3 Infrared data transfer mode
Addition of Table 13-6 Register Settings
Modification of Figure 14-1 Block Diagram of Serial Interface SIO3n
CHAPTER 14 SERIAL
INTERFACES SIO30 AND
SIO31
Addition of Notes 1 and 3 and Caution to Figure 14-2 Format of Serial Operation
Mode Register 30 (CSIM30) and Figure 14-3 Format of Serial Operation Mode
Register 31 (CSIM31)
Addition of Table 14-2 Register Settings
Modification of (E) Software interrupt in Figure 15-1 Basic Configuration of
CHAPTER 15
Interrupt Function
INTERRUPT FUNCTIONS
Addition of Caution 5 to Figure 15-2 Format of Interrupt Request Flag Register
(IF0L, IF0H, IF1L)
Addition of Caution to Figure 15-5 Format of External Interrupt Rising Edge
Enable Register (EGP), External Interrupt Falling Edge Enable Register (EGN)
Addition of description and Remark to 15.4.1 Non-maskable interrupt request
acknowledge operation
Addition of description to 15.4.2 Maskable interrupt acknowledge operation
Addition of item to Table 15-4 Interrupt Requests Enabled for Multiple Interrupts
During Interrupt Servicing
Addition of clock output and buzzer output in Table 16-1 HALT Mode Operating
CHAPTER 16 STANDBY
FUNCTION
Status
Modification of clock output in Table 16-3 STOP Mode Operating Status
Modification of chapter
CHAPTER 18
µPD78F0034BS
CHAPTER 20
ELECTRICAL
SPECIFICATIONS
APPENDIX B
DEVELOPMENT TOOLS
Addition of chapter
APPENDIX C NOTES
ON TARGET SYSTEM
DESIGN
360
User’s Manual U16035EJ5V0UD
相关型号:
UPD780031AYCW(A)-XXX
Microcontroller, 8-Bit, MROM, 8.38MHz, MOS, PDIP64, 0.750 INCH, PLASTIC, SDIP-64
NEC
UPD780031AYCW-XXX
Microcontroller, 8-Bit, MROM, 12MHz, MOS, PDIP64, 0.750 INCH, PLASTIC, SDIP-64
NEC
UPD780031AYGB(A)-XXX-8EU
Microcontroller, 8-Bit, MROM, 8.38MHz, MOS, PQFP64, 10 X 10 MM, PLASTIC, LQFP-64
NEC
UPD780031AYGB(A)-XXX-8EU-A
Microcontroller, 8-Bit, MROM, 8.38MHz, MOS, PQFP64, 10 X 10 MM, PLASTIC, LQFP-64
NEC
UPD780031AYGB-XXX-8EU
Microcontroller, 8-Bit, MROM, 12MHz, MOS, PQFP64, 10 X 10 MM, PLASTIC, LQFP-64
RENESAS
UPD780031AYGB-XXX-8EU-A
Microcontroller, 8-Bit, MROM, 12MHz, MOS, PQFP64, 10 X 10 MM, PLASTIC, LQFP-64
RENESAS
UPD780031AYGB-XXX-8EU-A
Microcontroller, 8-Bit, MROM, 12MHz, MOS, PQFP64, 10 X 10 MM, PLASTIC, LQFP-64
NEC
©2020 ICPDF网 联系我们和版权申明