UPD78F9222MC(A)-5A4 [NEC]
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO20, 0.300 INCH, PLASTIC, SSOP-20;型号: | UPD78F9222MC(A)-5A4 |
厂家: | NEC |
描述: | Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO20, 0.300 INCH, PLASTIC, SSOP-20 微控制器 光电二极管 |
文件: | 总410页 (文件大小:4607K) |
中文: | 中文翻译 | 下载: | 下载PDF数据表文档文件 |
User’s Manual
78K0S/KA1+
8-Bit Single-Chip Microcontrollers
µPD78F9221
µPD78F9222
Document No. U16898EJ3V0UD00 (3rd edition)
Date Published July 2005 NS CP(K)
©
2003
Printed in Japan
[MEMO]
2
User’s Manual U16898EJ3V0UD
NOTES FOR CMOS DEVICES
1
VOLTAGE APPLICATION WAVEFORM AT INPUT PIN
Waveform distortion due to input noise or a reflected wave may cause malfunction. If the input of the
CMOS device stays in the area between 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.
3
User’s Manual U16898EJ3V0UD
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.
SuperFlash® is a registered trademark of Silicon Storage Technology, Inc. in several countries including the
United States and Japan.
Caution: This product uses SuperFlash® technology licensed from Silicon Storage Technology, inc.
•
The information in this document is current as of June, 2005. The information is subject to change
without notice. For actual design-in, refer to the latest publications of NEC Electronics data sheets or
data books, etc., for the most up-to-date specifications of NEC Electronics products. Not all
products and/or types are available in every country. Please check with an NEC Electronics sales
representative for availability and additional information.
• No part of this document may be copied or reproduced in any form or by any means without the prior
written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may
appear in this document.
•
NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual
property rights of third parties by or arising from the use of NEC Electronics products listed in this document
or any other liability arising from the use of such products. No license, express, implied or otherwise, is
granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others.
Descriptions of circuits, software and other related information in this document are provided for illustrative
purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of a customer's equipment shall be done under the full
responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by
customers or third parties arising from the use of these circuits, software and information.
•
• While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products,
customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To
minimize risks of damage to property or injury (including death) to persons arising from defects in NEC
Electronics products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment and anti-failure features.
• NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and
"Specific".
The "Specific" quality grade applies only to NEC Electronics products developed based on a customer-
designated "quality assurance program" for a specific application. The recommended applications of an NEC
Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of
each NEC Electronics product before using it in a particular application.
"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
4
User’s Manual U16898EJ3V0UD
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-2445845
NEC Electronics Singapore Pte. Ltd.
Novena Square, Singapore
Tel: 6253-8311
•
•
Tyskland Filial
Taeby, Sweden
Tel: 08-63 80 820
United Kingdom Branch
Milton Keynes, UK
Tel: 01908-691-133
J04.1
5
User’s Manual U16898EJ3V0UD
INTRODUCTION
Target Readers
This manual is intended for user engineers who wish to understand the functions of
the 78K0S/KA1+ in order to design and develop its application systems and programs.
The target devices are the following subseries products.
• 78K0S/KA1+: µPD78F9221(T), 78F9222(T), 78F9221(T2), 78F9222(T2),
78F9221(S), 78F9222(S), 78F9221(R), 78F9222(R), 78F9221(A),
78F9222(A), 78F9221(A2), 78F9222(A2)
Purpose
This manual is intended to give users on understanding of the functions described in
the Organization below.
Organization
Two manuals are available for the 78K0S/KA1+: this manual and the Instruction
Manual (common to the 78K/0S Series).
78K/0S Series
78K0S/KA1+
Instructions
User’s Manual
User’s Manual
• Pin functions
• CPU function
• Internal block functions
• Interrupts
• Instruction set
• Instruction description
• Other internal peripheral functions
• Electrical specifications
How to Use This Manual
It is assumed that the readers of this manual have general knowledge of electrical
engineering, logic circuits, and microcontrollers.
◊ To understand the overall functions of 78K0S/KA1+
→ Read this manual in the order of the CONTENTS. The mark
revised points.
shows major
◊ How to read register formats
→ For a bit number enclosed in a square, the bit name is defined as a reserved
word in the RA78K0S, and is defined as an sfr variable using the #pragma sfr
directive in the CC78K0S.
◊ To learn the detailed functions of a register whose register name is known
→ See APPENDIX C REGISTER INDEX.
◊ To learn the details of the instruction functions of the 78K/0S Series
→ Refer to 78K/0S Series Instructions User’s Manual (U11047E) separately
available.
◊ To learn the electrical specifications of the 78K0S/KA1+
→ See CHAPTER 20 to 22 ELECTRICAL SPECIFICATIONS.
6
User’s Manual U16898EJ3V0UD
Conventions
Data significance:
Higher digits on the left and lower digits on the right
Active low representation: ××× (overscore over pin or signal name)
Note:
Caution:
Remark:
Footnote for item marked with Note in the text
Information requiring particular attention
Supplementary information
Numerical representation: Binary ... ×××× or ××××B
Decimal ... ××××
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
Document No.
This manual
U11047E
78K0S/KA1+ User’s Manual
78K/0S Series Instructions User’s Manual
Documents Related to Development Software Tools (User’s Manuals)
Document Name
Document No.
U16656E
U14877E
U11623E
U16654E
U14872E
U16584E
U17287E
U16934E
RA78K0S Assembler Package
CC78K0S C Compiler
Operation
Language
Structured Assembly Language
Operation
Language
ID78K0S-NS Ver. 2.52 Integrated Debugger
ID78K0S-QB Ver. 2.81 Integrated Debugger
PM plus Ver. 5.20
Operation
Operation
Documents Related to Development Hardware Tools (User’s Manuals)
Document Name
IE-78K0S-NS In-Circuit Emulator
Document No.
U13549E
IE-78K0S-NS-A In-Circuit Emulator
U15207E
QB-78K0SKX1MINI In-Circuit Emulator
U17272E
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document for designing.
7
User’s Manual U16898EJ3V0UD
Documents Related to Flash Memory Writing
Document Name
Document No.
U15260E
PG-FP4 Flash Memory Programmer User’s Manual
PG-FPL2 Flash Memory Programmer User’s Manual
U17307E
Other Related Documents
Document Name
Document No.
X13769X
Note
SEMICONDUCTOR SELECTION GUIDE - Products and Packages -
Semiconductor Device Mount Manual
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.
8
User’s Manual U16898EJ3V0UD
CONTENTS
CHAPTER 1 OVERVIEW.........................................................................................................................15
1.1 Features ......................................................................................................................................15
1.2 Application Fields......................................................................................................................15
1.3 Ordering Information.................................................................................................................16
1.4 Pin Configuration (Top View) ...................................................................................................17
1.5 78K0S/Kx1+ Product Lineup.....................................................................................................18
1.6 Block Diagram............................................................................................................................19
1.7 Functional Outline .....................................................................................................................20
CHAPTER 2 PIN FUNCTIONS...............................................................................................................21
2.1 Pin Function List........................................................................................................................21
2.2 Pin Functions .............................................................................................................................23
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.2.7
2.2.8
2.2.9
2.2.10
P20 to P23 (Port 2)...................................................................................................................... 23
P30, P31, and P34 (Port 3) ......................................................................................................... 23
P40 to P45 (Port 4)...................................................................................................................... 24
P121 to P123 (Port 12)................................................................................................................ 24
P130 (Port 13)............................................................................................................................. 24
RESET ........................................................................................................................................ 24
X1 and X2 ................................................................................................................................... 25
AVREF........................................................................................................................................... 25
VDD .............................................................................................................................................. 25
VSS............................................................................................................................................... 25
2.3 Pin I/O Circuits and Connection of Unused Pins ...................................................................25
CHAPTER 3 CPU ARCHITECTURE......................................................................................................27
3.1 Memory Space............................................................................................................................27
3.1.1
3.1.2
3.1.3
3.1.4
Internal program memory space.................................................................................................. 29
Internal data memory space........................................................................................................ 29
Special function register (SFR) area ........................................................................................... 30
Data memory addressing ............................................................................................................ 30
3.2 Processor Registers..................................................................................................................32
3.2.1
3.2.2
3.2.3
Control registers.......................................................................................................................... 32
General-purpose registers........................................................................................................... 34
Special function registers (SFRs)................................................................................................ 35
3.3 Instruction Address Addressing..............................................................................................38
3.3.1
3.3.2
3.3.3
3.3.4
Relative addressing..................................................................................................................... 38
Immediate addressing................................................................................................................. 39
Table indirect addressing ............................................................................................................ 39
Register addressing .................................................................................................................... 40
3.4 Operand Address Addressing..................................................................................................41
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5
Direct addressing ........................................................................................................................ 41
Short direct addressing ............................................................................................................... 42
Special function register (SFR) addressing ................................................................................. 43
Register addressing .................................................................................................................... 44
Register indirect addressing........................................................................................................ 45
9
User’s Manual U16898EJ3V0UD
3.4.6
3.4.7
Based addressing........................................................................................................................46
Stack addressing.........................................................................................................................47
CHAPTER 4 PORT FUNCTIONS...........................................................................................................48
4.1 Functions of Ports .....................................................................................................................48
4.2 Port Configuration .....................................................................................................................49
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
Port 2...........................................................................................................................................50
Port 3...........................................................................................................................................51
Port 4...........................................................................................................................................53
Port 12.........................................................................................................................................58
Port 13.........................................................................................................................................60
4.3 Registers Controlling Port Functions......................................................................................60
4.4 Operation of Port Function .......................................................................................................65
4.4.1
4.4.2
4.4.3
Writing to I/O port ........................................................................................................................65
Reading from I/O port..................................................................................................................65
Operations on I/O port.................................................................................................................65
CHAPTER 5 CLOCK GENERATORS...................................................................................................66
5.1 Functions of Clock Generators ................................................................................................66
5.1.1
5.1.2
System clock oscillators...............................................................................................................66
Clock oscillator for interval time generation .................................................................................66
5.2 Configuration of Clock Generators..........................................................................................67
5.3 Registers Controlling Clock Generators .................................................................................69
5.4 System Clock Oscillators..........................................................................................................72
5.4.1
5.4.2
5.4.3
5.4.4
High-speed internal oscillator ......................................................................................................72
Crystal/ceramic oscillator.............................................................................................................72
External clock input circuit ...........................................................................................................74
Prescaler .....................................................................................................................................74
5.5 Operation of CPU Clock Generator..........................................................................................75
5.6 Operation of Clock Generator Supplying Clock to Peripheral Hardware.............................80
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00.............................................................................82
6.1 Functions of 16-Bit Timer/Event Counter 00...........................................................................82
6.2 Configuration of 16-Bit Timer/Event Counter 00.....................................................................83
6.3 Registers to Control 16-Bit Timer/Event Counter 00..............................................................87
6.4 Operation of 16-Bit Timer/Event Counter 00 ...........................................................................93
6.4.1
6.4.2
6.4.3
6.4.4
6.4.5
6.4.6
Interval timer operation................................................................................................................93
External event counter operation.................................................................................................95
Pulse width measurement operations..........................................................................................98
Square-wave output operation...................................................................................................106
PPG output operations ..............................................................................................................108
One-shot pulse output operation ...............................................................................................111
6.5 Cautions Related to 16-Bit Timer/Event Counter 00.............................................................116
CHAPTER 7 8-BIT TIMER 80..............................................................................................................122
7.1 Function of 8-Bit Timer 80.......................................................................................................122
7.2 Configuration of 8-Bit Timer 80 ..............................................................................................123
7.3 Register Controlling 8-Bit Timer 80........................................................................................125
10
User’s Manual U16898EJ3V0UD
7.4 Operation of 8-Bit Timer 80.....................................................................................................126
7.4.1
Operation as interval timer ........................................................................................................ 126
7.5 Notes on 8-Bit Timer 80...........................................................................................................128
CHAPTER 8 8-BIT TIMER H1.............................................................................................................129
8.1 Functions of 8-Bit Timer H1....................................................................................................129
8.2 Configuration of 8-Bit Timer H1 .............................................................................................129
8.3 Registers Controlling 8-Bit Timer H1.....................................................................................132
8.4 Operation of 8-Bit Timer H1....................................................................................................135
8.4.1
8.4.2
Operation as interval timer/square-wave output........................................................................ 135
Operation as PWM output mode ............................................................................................... 138
CHAPTER 9 WATCHDOG TIMER.......................................................................................................144
9.1 Functions of Watchdog Timer................................................................................................144
9.2 Configuration of Watchdog Timer..........................................................................................146
9.3 Registers Controlling Watchdog Timer.................................................................................147
9.4 Operation of Watchdog Timer ................................................................................................149
9.4.1
9.4.2
9.4.3
9.4.4
Watchdog timer operation when “low-speed internal oscillator cannot be stopped” is selected by
option byte................................................................................................................................. 149
Watchdog timer operation when “low-speed internal oscillator can be stopped by software” is
selected by option byte.............................................................................................................. 151
Watchdog timer operation in STOP mode (when “low-speed internal oscillator can be stopped by
software” is selected by option byte) ......................................................................................... 153
Watchdog timer operation in HALT mode (when “low-speed internal oscillator can be stopped by
software” is selected by option byte) ......................................................................................... 155
CHAPTER 10 A/D CONVERTER.........................................................................................................156
10.1 Functions of A/D Converter....................................................................................................156
10.2 Configuration of A/D Converter..............................................................................................158
10.3 Registers Used by A/D Converter ..........................................................................................160
10.4 A/D Converter Operations.......................................................................................................165
10.4.1
10.4.2
10.4.3
Basic operations of A/D converter............................................................................................. 165
Input voltage and conversion results......................................................................................... 167
A/D converter operation mode...................................................................................................168
10.5 How to Read A/D Converter Characteristics Table..............................................................170
10.6 Cautions for A/D Converter ....................................................................................................172
CHAPTER 11 SERIAL INTERFACE UART6......................................................................................176
11.1 Functions of Serial Interface UART6 .....................................................................................176
11.2 Configuration of Serial Interface UART6...............................................................................180
11.3 Registers Controlling Serial Interface UART6 ......................................................................183
11.4 Operation of Serial Interface UART6......................................................................................192
11.4.1
11.4.2
11.4.3
Operation stop mode................................................................................................................. 192
Asynchronous serial interface (UART) mode ............................................................................ 193
Dedicated baud rate generator..................................................................................................207
CHAPTER 12 INTERRUPT FUNCTIONS............................................................................................214
12.1 Interrupt Function Types.........................................................................................................214
11
User’s Manual U16898EJ3V0UD
12.2 Interrupt Sources and Configuration.....................................................................................214
12.3 Interrupt Function Control Registers.....................................................................................217
12.4 Interrupt Servicing Operation .................................................................................................222
12.4.1
12.4.2
12.4.3
Maskable interrupt request acknowledgment operation.............................................................222
Multiple interrupt servicing.........................................................................................................224
Interrupt request pending...........................................................................................................226
CHAPTER 13 STANDBY FUNCTION..................................................................................................227
13.1 Standby Function and Configuration.....................................................................................227
13.1.1
13.1.2
Standby function........................................................................................................................227
Registers used during standby ..................................................................................................229
13.2 Standby Function Operation...................................................................................................230
13.2.1
13.2.2
HALT mode ...............................................................................................................................230
STOP mode...............................................................................................................................233
CHAPTER 14 RESET FUNCTION .......................................................................................................237
14.1 Register for Confirming Reset Source...................................................................................244
CHAPTER 15 POWER-ON-CLEAR CIRCUIT .....................................................................................245
15.1 Functions of Power-on-Clear Circuit .....................................................................................245
15.2 Configuration of Power-on-Clear Circuit...............................................................................246
15.3 Operation of Power-on-Clear Circuit......................................................................................246
15.4 Cautions for Power-on-Clear Circuit......................................................................................247
CHAPTER 16 LOW-VOLTAGE DETECTOR .......................................................................................249
16.1 Functions of Low-Voltage Detector........................................................................................249
16.2 Configuration of Low-Voltage Detector .................................................................................249
16.3 Registers Controlling Low-Voltage Detector.........................................................................250
16.4 Operation of Low-Voltage Detector........................................................................................252
16.5 Cautions for Low-Voltage Detector ........................................................................................256
CHAPTER 17 OPTION BYTE................................................................................................................259
17.1 Functions of Option Byte.........................................................................................................259
17.2 Format of Option Byte..............................................................................................................260
CHAPTER 18 FLASH MEMORY..........................................................................................................262
18.1 Features.....................................................................................................................................262
18.2 Memory Configuration .............................................................................................................263
18.3 Functional Outline ....................................................................................................................264
18.4 Writing with Flash Programmer ..............................................................................................265
18.5 Programming Environment .....................................................................................................266
18.6 Pin Connection on Board.........................................................................................................268
18.6.1
18.6.2
18.6.3
18.6.4
X1 and X2 pins ..........................................................................................................................268
RESET pin.................................................................................................................................269
Port pins ....................................................................................................................................270
Power supply.............................................................................................................................270
18.7 On-Board and Off-Board Flash Memory Programming .......................................................271
12
User’s Manual U16898EJ3V0UD
18.7.1
18.7.2
18.7.3
Flash memory programming mode............................................................................................ 271
Communication commands....................................................................................................... 271
Security settings........................................................................................................................ 272
18.8 Flash Memory Programming by Self Writing........................................................................273
18.8.1
18.8.2
18.8.3
18.8.4
18.8.5
18.8.6
18.8.7
18.8.8
18.8.9
Outline of self programming ...................................................................................................... 273
Cautions on self programming function..................................................................................... 276
Registers used for self programming function ........................................................................... 276
Example of shifting normal mode to self programming mode.................................................... 284
Example of shifting self programming mode to normal mode.................................................... 287
Example of block erase operation in self programming mode................................................... 290
Example of block blank check operation in self programming mode ......................................... 293
Example of byte write operation in self programming mode ...................................................... 296
Example of internal verify operation in self programming mode ................................................ 299
18.8.10 Examples of operation when command execution time should be minimized in self programming
mode ......................................................................................................................................... 302
18.8.11 Examples of operation when interrupt-disabled time should be minimized in self programming
mode ......................................................................................................................................... 309
CHAPTER 19 INSTRUCTION SET OVERVIEW.................................................................................320
19.1 Operation ..................................................................................................................................320
19.1.1
19.1.2
19.1.3
Operand identifiers and description methods ............................................................................ 320
Description of “Operation” column............................................................................................. 321
Description of “Flag” column...................................................................................................... 321
19.2 Operation List...........................................................................................................................322
19.3 Instructions Listed by Addressing Type ...............................................................................327
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
...................................................................................................................................................................330
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product) .......................342
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product).......................356
CHAPTER 23 PACKAGE DRAWING ..................................................................................................370
CHAPTER 24 PACKAGE MARKING INFORMATION.........................................................................371
CHAPTER 25 RECOMMENDED SOLDERING CONDITIONS ..........................................................372
APPENDIX A DEVELOPMENT TOOLS ..............................................................................................374
A.1 Software Package....................................................................................................................377
A.2 Language Processing Software.............................................................................................377
A.3 Control Software......................................................................................................................378
A.4 Flash Memory Writing Tools...................................................................................................378
A.5 Debugging Tools (Hardware)..................................................................................................379
A.5.1
A.5.2
When using in-circuit emulator IE-78K0S-NS or IE-78K0S-NS-A.............................................. 379
When using in-circuit emulator QB-78K0SKX1MINI.................................................................. 379
13
User’s Manual U16898EJ3V0UD
A.6 Debugging Tools (Software)...................................................................................................380
APPENDIX B NOTES ON TARGET SYSTEM DESIGN...................................................................381
APPENDIX C REGISTER INDEX .........................................................................................................383
C.1 Register Index (Register Name)..............................................................................................383
C.2 Register Index (Symbol)..........................................................................................................385
APPENDIX D LIST OF CAUTIONS.....................................................................................................387
APPENDIX E REVISION HISTORY......................................................................................................353
E.1 Major Revisions in This Edition..............................................................................................353
E.2 Revision History up to Previous Editions..............................................................................356
14
User’s Manual U16898EJ3V0UD
CHAPTER 1 OVERVIEW
1.1 Features
O Minimum instruction execution time selectable from high speed (0.2 µs) to low speed (3.2 µs) (with CPU clock of
10 MHz)
O General-purpose registers: 8 bits × 8 registers
O ROM and RAM capacities
Item
Program Memory (Flash Memory)
Memory (Internal High-Speed RAM)
Part number
µPD78F9221
µPD78F9222
2 KB
4 KB
128 bytes
256 bytes
O On-chip power-on clear (POC) circuit and low voltage detector (LVI)
O On-chip watchdog timer (operable on internal low-speed internal oscillator clock)
O I/O ports: 17
O Timer: 4 channels
• 16-bit timer/event counter: 1 channel
• 8-bit timer:
• Watchdog timer:
2 channels
1 channel
O Serial interface: UART (LIN (Local Interconnect Network) bus supported) 1 channel
O 10-bit resolution A/D converter: 4 channels
O Supply voltage: VDD = 2.0 to 5.5 VNote
O Operating temperature range: TA = −40 to +85°C ((T) product, (S) product, (R) product, (A) product)
TA = −40 to +125°C ((T2) product, (A2) product)
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on
clear (POC) circuit is 2.1 V 0.1 V.
1.2 Application Fields
O Automotive electronics
• System control of body instrumentation system (such as power windows and keyless entry reception)
• Sub-microcontroller of control system
O Household appliances
• Electric toothbrushes
• Electric shavers
O Toys
O Industrial equipment
• Sensor and switch control
• Power tools
15
User’s Manual U16898EJ3V0UD
CHAPTER 1 OVERVIEW
1.3 Ordering Information
Part Number
µPD78F9 ××× - ×× (×) - ××× -A
Semiconductor component
Blank
-A
Conventional
Lead-free
Quality Grades Manufacturing Process Control Classification
Standard
General management
(T)
(T2)
(S)
Management based on individual contract
(R)
(A)
Management for automotive accessories
Special
−
(A2)
Package type
Plastic SSOP
MC-5A4
Number of pins High-speed RAM Flash memory
221 20 pins
222 20 pins
128 bytes
256 bytes
2 K bytes
4 K bytes
Product type
Flash memory versions
F
Please refer to "Quality Grades on NEC Semiconductor Devices" (Document No. C11531E) published by
NEC Corporation to know the specification of quality grade (standard grade and special grade) on the devices
and its recommended applications.
[Part number list]
µPD78F9221MC(T)-5A4
µPD78F9221MC(T2)-5A4Note µPD78F9222MC(T2)-5A4Note µPD78F9221MC(T2)-5A4-ANote µPD78F9222MC(T2)-5A4-ANote
µPD78F9222MC(T)-5A4
µPD78F9221MC(T)-5A4-A
µPD78F9222MC(T)-5A4-A
µPD78F9221MC(S)-5A4
µPD78F9221MC(R)-5A4
µPD78F9222MC(S)-5A4
µPD78F9222MC(R)-5A4
µPD78F9221MC(S)-5A4-A
µPD78F9221MC(R)-5A4-A
µPD78F9222MC(S)-5A4-A
µPD78F9222MC(R)-5A4-A
µPD78F9221MC(A)-5A4Note µPD78F9222MC(A)-5A4Note µPD78F9221MC(A)-5A4-ANote µPD78F9222MC(A)-5A4-ANote
µPD78F9221MC(A2)-5A4Note µPD78F9222MC(A2)-5A4Note µPD78F9221MC(A2)-5A4-ANote µPD78F9222MC(A2)-5A4-ANote
Note Under development
16
User’s Manual U16898EJ3V0UD
CHAPTER 1 OVERVIEW
1.4 Pin Configuration (Top View)
20-pin plastic SSOP
Note
V
SS
1
2
3
4
5
6
7
8
9
10
AVREF
20
19
18
17
16
15
14
13
12
11
P121/X1
P122/X2
P123
P20/ANI0
P21/ANI1
P22/ANI2
P23/ANI3
P130
V
DD
RESET/P34
P31/TI010/TO00/INTP2
P30/TI000/INTP0
P40
P45
P44/RxD6
P43/TxD6/INTP1
P42/TOH1
P41/INTP3
Note In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to
connect VSS to a stabilized GND (= 0 V).
ANI0 to ANI3:
AVREF:
Analog input
Analog reference voltage
External interrupt input
Port 2
Port 3
Port 4
RESET:
RxD6:
TI000, TI010:
TO00, TOH1:
TxD6:
VDD:
VSS:
X1, X2:
Reset
Receive data
Timer input
Timer output
Transmit data
Power supply
Ground
INTP0 to INTP3:
P20 to P23:
P30, P31, P34:
P40 to P45:
P121 to P123:
P130:
Port 12
Port 13
Crystal oscillator (X1 input clock)
17
User’s Manual U16898EJ3V0UD
CHAPTER 1 OVERVIEW
1.5 78K0S/Kx1+ Product Lineup
The following table shows the product lineup of the 78K0S/Kx1+.
Part Number
78K0S/KY1+
78K0S/KA1+
20 pins
78K0S/KB1+
Item
Number of pins
16 pins
1 KB, 2 KB, 4 KB
128 bytes
30 pins
4 KB, 8 KB
256 bytes
Internal
memory
Flash memory
RAM
2 KB
4 KB
128 bytes
256 bytes
Supply voltage
VDD = 2.0 to 5.5 VNote
Minimum instruction
execution time
0.20 µs (10 MHz, VDD = 4.0 to 5.5 V)
0.33 µs (6 MHz, VDD = 3.0 to 5.5 V)
0.40 µs (5 MHz, VDD = 2.7 to 5.5 V)
1.0 µs (2 MHz, VDD = 2.0 to 5.5 V)
High-speed internal oscillation (8 MHz (TYP.))
Crystal/ceramic oscillation (1 to 10 MHz)
System clock
(oscillation frequency)
External clock input oscillation (1 to 10 MHz)
Clock for TMH1 and WDT
(oscillation frequency)
Low-speed internal oscillation (240 kHz (TYP.))
Port
CMOS I/O
CMOS input
CMOS output
16-bit (TM0)
8-bit (TMH)
8-bit (TM8)
WDT
13
1
15
1
24
1
−
1
1
Timer
1 ch
1 ch
1 ch
1 ch
−
−
Serial interface
A/D converter
LIN-Bus-supporting UART: 1 ch
10 bits: 4 ch (2.7 to 5.5V)
Multiplier (8 bits ⋅ 8 bits)
Interrupts External
Internal
−
Provided
2
5
4
9
Reset
RESET pin
POC
Provided
2.1 V 0.1 V
LVI
Provided (selectable by software)
Provided
WDT
(R) products, (S) products, (T) products, (A) products: TA = −40 to +85°C
(T2) products, (A2) products: TA = −40 to +125°C
Operating temperature range
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V 0.1 V.
18
User’s Manual U16898EJ3V0UD
CHAPTER 1 OVERVIEW
1.6 Block Diagram
TO00/TI010/P31
TI000/P30
4
2
Port 2
Port 3
Port 4
P20 to P23
16-bit timer/event
counter 00
P30, P31
P34
8-bit timer 80
8-bit timer H1
6
3
P40 to P45
P121 to P123
P130
TOH1/P42
78K0S
Flash
memory
core
Port 12
Port 13
CPU
Low-speed
internal oscillator
Watchdog timer
Power on clear/
low voltage
indicator
RxD6/P44
TxD6/P43
POC/LVI
control
Serial interface
UART6
Internal
high-speed
RAM
ANI0/P20 to
4
ANI3/P23
Reset control
A/D converter
AVREF
RESET/P34
X1/P121
INTP0/P30
INTP1/P43
INTP2/P31
INTP3/P41
System control
Interrupt control
X2/P122
High-speed
internal oscillator
Note
SS
V
DD
V
Note In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to
connect VSS to a stabilized GND (= 0 V).
19
User’s Manual U16898EJ3V0UD
CHAPTER 1 OVERVIEW
1.7 Functional Outline
Item
µPD78F9221
µPD78F9222
Internal
memory
Flash memory
2 KB
4 KB
High-speed RAM
128 bytes
64 KB
256 bytes
Memory space
X1 input clock (oscillation frequency)
Crystal/ceramic/external clock input:
10 MHz (VDD = 2.0 to 5.5 V)
Internal
oscillation frequency)
clock
High speed (oscillation
Internal oscillation: 8 MHz (TYP.)
Internal oscillation: 240 kHz (TYP.)
8 bits × 8 registers
Low speed (for TMH1
and WDT)
General-purpose registers
Instruction execution time
I/O port
0.2 µs/0.4 µs/0.8 µs/1.6 µs/3.2 µs (X1 input clock: fX = 10 MHz)
Total:
17 pins
15 pins
1 pin
CMOS I/O:
CMOS input:
CMOS output:
1 pin
Timer
• 16-bit timer/event counter: 1 channel
• 8-bit timer (timer H1):
• 8-bit timer (timer 80):
• Watchdog timer:
1 channel
1 channel
1 channel
Timer output
2 pins (PWM: 1 pin)
A/D converter
Serial interface
10-bit resolution × 4 channels
LIN-bus-supporting UART mode: 1 channel
Vectored
interrupt sources
External
Internal
4
9
• Reset by RESET pin
Reset
• Internal reset by watchdog timer
• Internal reset by power-on clear
• Internal reset by low-voltage detector
Supply voltage
VDD = 2.0 to 5.5 VNote
(R) products, (S) products, (T) products, (A) products: TA = −40 to +85°C
(T2) products, (A2) products: TA = −40 to +125°C
Operating temperature range
Package
20-pin plastic SSOP
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on- clear
(POC) circuit is 2.1 V 0.1 V.
20
User’s Manual U16898EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
2.1 Pin Function List
(1) Port functions
Pin Name
I/O
Function
After Reset
Input
Alternate-
Function Pin
P20 to P23
I/O
I/O
Port 2.
4-bit I/O port.
ANI0 to ANI3
Can be set to input or output mode in 1-bit units.
An on-chip pull-up resistor can be connected by setting software.
P30
P31
Port 3
Can be set to input or output mode in 1- Input
bit units.
An on-chip pull-up resistor can be
connected by setting software.
TI000/INTP0
TI010/TO00/
INTP2
P34Note
P40
Input
I/O
Input only
Input
Input
RESETNote
−
Port 4.
6-bit I/O port.
Can be set to input or output mode in 1-bit units.
An on-chip pull-up resistor can be connected by setting software.
P41
INTP3
TOH1
TxD6/INTP1
RxD6
−
P42
P43
P44
P45
P121Note
P122Note
P123
I/O
Port 12.
3-bit I/O port.
Input
X1Note
X2Note
−
Can be set to input or output mode in 1-bit units.
An on-chip pull-up resistor can be connected only to P123 by
setting software.
P130
Output
Port 13.
Output
−
1-bit output-only port
Note For the setting method for pin functions, see CHAPTER 17 OPTION BYTE.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
21
User’s Manual U16898EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(2) Non-port functions
Pin Name
I/O
Function
After Reset
Input
Alternate-
Function Pin
INTP0
Input
External interrupt input for which the valid edge (rising edge,
falling edge, or both rising and falling edges) can be specified
P30/TI000
P43/TxD6
P31/TI010/TO00
P41
INTP1
INTP2
INTP3
RxD6
TxD6
Input
Serial data input for asynchronous serial interface
Serial data output for asynchronous serial interface
Input
Input
Input
P44
Output
Input
P43/INTP1
P30/INTP0
TI000
External count clock input to 16-bit timer/event counter 00.
Capture trigger input to capture registers (CR000 and CR010) of
16-bit timer/event counter 00
TI010
Capture trigger input to capture register (CR000) of 16-bit
timer/event counter 00
P31/TO00/INTP2
TO00
Output
Output
Input
−
16-bit timer/event counter 00 output
8-bit timer H1 output
Input
Input
Input
−
P31/TI010/INTP2
P42
TOH1
ANI0 to ANI3
Analog input of A/D converter
Reference voltage of A/D converter
System reset input
P20 to P23
AVREF
−
RESETNote
X1Note
Input
Input
−
P34Note
P121Note
Connection of crystal/ceramic resonator for system clock
−
oscillation.
External clock input
X2Note
−
Connection of crystal/ceramic resonator for system clock
oscillation.
−
P122Note
VDD
VSS
−
−
Positive power supply
Ground potential
−
−
−
−
Note For the setting method for pin functions, see CHAPTER 17 OPTION BYTE.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
22
User’s Manual U16898EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
2.2 Pin Functions
2.2.1 P20 to P23 (Port 2)
P20 to P23 constitute a 4-bit I/O port, port 2. In addition to I/O port pins, these pins also have a function to input
analog signals to the A/D converter. These pins can be set to the following operation modes in 1-bit units.
(1) Port mode
P20 to P23 function as a 4-bit I/O port. Each bit of this port can be set to the input or output mode by using
port mode register 2 (PM2). In addition, an on-chip pull-up resistor can be connected to the port by using pull-
up resistor option register 2 (PU2).
(2) Control mode
P20 to P23 function as the analog input pins (ANI0 to ANI3) of the A/D converter. When using these pins as
analog input pins, refer to 10.6 Cautions for A/D converter (5) ANI0/P20 to ANI3/P23.
2.2.2 P30, P31, and P34 (Port 3)
P30 and P31 constitute a 2-bit I/O port, port 3. In addition to I/O port pins, these pins also have functions to
input/output a timer signal, and input an external interrupt request signal.
P34 is a 1-bit input-only port. This pin is also used as a RESET pin, and when the power is turned on, this is the
reset function.
For the setting method for pin functions, see CHAPTER 17 OPTION BYTE.
When P34 is used as an input port pin, connect the pull-up resistor.
P30, P31 and P34 can be set to the following operation modes in 1-bit units.
(1) Port mode
P30 and P31 function as a 2-bit I/O port. Each bit of this port can be set to the input or output mode by using
port mode register 3 (PM3). In addition, an on-chip pull-up resistor can be connected to the port by using pull-
up resistor option register 3 (PU3).
P34 functions as a 1-bit input-only port.
(2) Control mode
P30 and P31 function to input/output signals to/from internal timers, and to input an external interrupt request
signal.
(a) INTP0 and INTP2
These are external interrupt request input pins for which the valid edge (rising edge, falling edge, or both
rising and falling edges) can be specified.
(b) TI000
This pin inputs an external count clock to 16-bit timer/event counter 00, or a capture trigger signal to the
capture registers (CR000 and CR010) of 16-bit timer/event counter 00.
(c) TI010
This pin inputs a capture trigger signal to the capture register (CR000) of 16-bit timer/event counter 00.
(d) TO00
This pin outputs a signal from 16-bit timer/event counter 00.
23
User’s Manual U16898EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
2.2.3 P40 to P45 (Port 4)
P40 to P45 constitute a 6-bit I/O port, port 4. In addition to I/O port pins, these pins also have functions to output a
timer signal, input external interrupt request signals, and input/output the data of the serial interface.
These pins can be set to the following operation modes in 1-bit units.
(1) Port mode
P40 to P45 function as a 6-bit I/O port. Each bit of this port can be set to the input or output mode by using
port mode register 4 (PM4). In addition, an on-chip pull-up resistor can be connected to the port by using pull-
up resistor option register 4 (PU4).
(2) Control mode
P40 to 45 function to output a signal from an internal timer, input external interrupt request signals, and
input/output data of the serial interface.
(a) INTP1 and INTP3
These are external interrupt request input pins for which the valid edge (rising edge, falling edge, or both
rising and falling edges) can be specified.
(b) TOH1
This is the output pin of 8-bit timer H1.
(c) TxD6
This pin outputs serial data from the asynchronous serial interface.
(d) RxD6
This pin inputs serial data to the asynchronous serial interface.
2.2.4 P121 to P123 (Port 12)
P121 to P123 constitute a 3-bit I/O port, port 12.
Each bit of this port can be set to the input or output mode by using port mode register 12 (PM12). An on-chip pull-
up resistor can be connected to P123 by using pull-up resistor option register 12 (PU12).
P121 and P122 also function as the X1 and X2, respectively. For the setting method for pin functions, see
CHAPTER 17 OPTION BYTE.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
2.2.5 P130 (Port 13)
This is a 1-bit output-only port.
2.2.6 RESET
This pin inputs an active-low system reset signal. When the power is turned on, this is the reset function,
regardless of the option byte setting.
24
User’s Manual U16898EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
2.2.7 X1 and X2
These pins connect an oscillator to oscillate the X1 input clock.
X1 and X2 also function as the P121 and P122, respectively. For the setting method for pin functions, see
CHAPTER 17 OPTION BYTE.
Supply an external clock to X1.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
2.2.8 AVREF
This pin inputs a reference voltage to the internal A/D converter. When the A/D converter is not used, connect this
pin to VDD.
2.2.9 VDD
This is the positive power supply pin.
2.2.10 VSS
This is the ground pin.
In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to connect VSS
to a stabilized GND (= 0 V).
2.3 Pin I/O Circuits and Connection of Unused Pins
Table 2-1 shows I/O circuit type of each pin and the connections of unused pins.
For the configuration of the I/O circuit of each type, refer to Figure 2-1.
Table 2-1. Types of Pin I/O Circuits and Connection of Unused Pins
Pin Name
I/O Circuit Type
11
I/O
Recommended Connection of Unused Pin
P20/ANI0 to P23/ANI3
I/O
Input: Independently connect to AVREF or VSS via a resistor.
Output: Leave open.
P30/TI000/INTP0
P31/TI010/TO00/INTP2
P34/RESET
P40
8-A
Input: Independently connect to VDD or VSS via a resistor.
Output: Leave open.
2
Input
I/O
Connect to VDD via a resistor.
8-A
Input: Independently connect to VDD or VSS via a resistor.
Output: Leave open.
P41/INTP3
P42/TOH1
P43/TxD6/INTP1
P44/RxD6
P45
P121/X1
16-B
Input: Independently connect to VSS via a resistor.
Output: Leave open.
P122/X2
P123
8-A
3-C
Input:
Output: Leave open.
Independently connect to VDD or VSS via a resistor.
P130
Output
Input
Leave open.
AVREF
−
Directly connect to VDD.
25
User’s Manual U16898EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
Figure 2-1. Pin I/O Circuits
V
DD
Type 2
Type 11
Pull up
enable
P-ch
AVREF
P-ch
Data
IN
IN/OUT
Output
disable
N-ch
V
SS
Schmitt-triggered input with hysteresis characteristics
Comparator
P-ch
N-ch
+
-
V
SS
AVREF
Input
enable
Type 3-C
Type 16-B
Feedback
cut-off
P-ch
V
DD
P-ch
OSC
enable
Data
OUT
X1,
IN/OUT
X2,
IN/OUT
N-ch
V
SS
V
DD
Data
P-ch
Type 8-A
Output
disable
N-ch
V
DD
V
SS
Pull up
enable
P-ch
VDD
Data
P-ch
N-ch
Data
P-ch
N-ch
IN/OUT
Output
Disable
Output
disable
V
SS
V
SS
26
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1 Memory Space
The 78K0S/KA1+ can access up to 64 KB of memory space. Figures 3-1 and 3-2 show the memory maps.
Figure 3-1. Memory Map (µPD78F9221)
F F F F H
Special function registers
(SFR)
256 × 8 bits
F F 0 0 H
F E F F H
Internal high-speed RAM
128 × 8 bits
F E 8 0 H
F E 7 F H
Use prohibited
Data memory
space
0 7 F F H
0 8 0 0 H
F 7 F F H
Program area
0 0 8 2 H
Protect byte area
Option byte area
0 0 8 1 H
0 0 8 0 H
0 0 7 F H
Program memory
space
Flash memory
2,048 × 8 bits
CALLT table area
Program area
0 0 4 0 H
0 0 3 F H
0 0 2 2 H
0 0 2 1 H
Vector table area
0 0 0 0 H
0 0 0 0 H
Remark The option byte and protect byte are 1 byte each.
27
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-2. Memory Map (µPD78F9222)
F F F F H
Special function registers
(SFR)
256 × 8 bits
F F 0 0 H
F E F F H
Internal high-speed RAM
256 × 8 bits
F E 0 0 H
F D F F H
Use prohibited
Data memory
space
0 F F F H
1 0 0 0 H
0 F F F H
Program area
0 0 8 2 H
0 0 8 1 H
0 0 8 0 H
0 0 7 F H
Protect byte area
Option byte area
Flash memory
4,096 × 8 bits
Program memory
space
CALLT table area
Program area
0 0 4 0 H
0 0 3 F H
0 0 2 2 H
0 0 2 1 H
Vector table area
0 0 0 0 H
0 0 0 0 H
Remark The option byte and protect byte are 1 byte each.
28
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1.1 Internal program memory space
The internal program memory space stores programs and table data. This space is usually addressed by the
program counter (PC).
The 78K0S/KA1+ provides the following internal ROMs (or flash memory) containing the following capacities.
Table 3-1. Internal ROM Capacity
Part Number
Internal ROM
Structure
Flash memory
Capacity
2,048 × 8 bits
4,096 × 8 bits
µPD78F9221
µPD78F9222
The following areas are allocated to the internal program memory space.
(1) Vector table area
The 34-byte area of addresses 0000H to 0021H is reserved as a vector table area. This area stores program
start addresses to be used when branching by Reset or interrupt request generation.
Of a
16-bit address, the lower 8 bits are stored in an even address, and the higher 8 bits are stored in an odd
address.
Table 3-2. Vector Table
Vector Table Address
0000H
Interrupt Request
Vector Table Address
0012H
Interrupt Request
INTAD
Reset
0006H
0008H
000AH
000CH
000EH
0010H
INTLVI
0016H
0018H
001AH
001CH
001EH
0020H
INTP2
INTP0
INTP3
INP1
INTTM80
INTSRE6
INTSR6
INTST6
INTTMH1
INTTM000
INTTM010
Caution No interrupt sources correspond to the vector table address 0014H.
(2) CALLT instruction table area
The subroutine entry address of a 1-byte call instruction (CALLT) can be stored in the 64-byte area of
addresses 0040H to 007FH.
(3) Option byte area
The option byte area is the 1-byte area of address 0080H. For details, refer to CHAPTER 17 OPTION BYTE.
(4) Protect byte area
The protect byte area is the 1-byte area of address 0081H. For details, refer to CHAPTER 18 FLASH
MEMORY.
3.1.2 Internal data memory space
128-byte internal high-speed RAM is provided in the µPD78F9221 and 256-byte in the µPD78F9222.
The internal high-speed RAM can also be used as a stack memory.
29
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1.3 Special function register (SFR) area
Special function registers (SFRs) of on-chip peripheral hardware are allocated to the area of FF00H to FFFFH (see
Table 3-3).
3.1.4 Data memory addressing
The 78K0S/KA1+ is provided with a wide range of addressing modes to make memory manipulation as efficient as
possible. The area (FE80H to FEFFH or FE00H to FEFFH) which contains a data memory and the special function
register area (SFR) can be accessed using a unique addressing mode in accordance with each function. Figures 3-3
and 3-4 illustrate the data memory addressing.
Figure 3-3. Data Memory Addressing (µPD78F9221)
F F F F H
Special function registers (SFR)
SFR addressing
256 × 8 bits
F F 2 0 H
F E 1 F H
F F 0 0 H
F E F F H
Short direct addressing
Internal high-speed RAM
128 × 8 bits
F E 8 0 H
F E 7 F H
Direct addressing
Register indirect addressing
Based addressing
Use prohibted
0 8 0 0 H
0 7 F F H
Flash memory
2,048 × 8 bits
0 0 0 0 H
30
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-4. Data Memory Addressing (µPD78F9222)
F F F F H
Special function registers (SFR)
SFR addressing
256 × 8 bits
F F 2 0 H
F E 1 F H
F F 0 0 H
F E F F H
Short direct addressing
Internal high-speed RAM
256 × 8 bits
F E 2 0 H
F E 1 F H
F E 0 0 H
F D F F H
Direct addressing
Register indirect addressing
Based addressing
Use prohibited
1 0 0 0 H
0 F F F H
Flash memory
4,096 × 8 bits
0 0 0 0 H
31
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2 Processor Registers
The 78K0S/KA1+ provides the following on-chip processor registers.
3.2.1 Control registers
The control registers have special functions to control the program sequence statuses and stack memory. The
control registers include a program counter, a program status word, and a stack pointer.
(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 or register contents are set.
Reset signal generation sets the reset vector table values at addresses 0000H and 0001H to the program
counter.
Figure 3-5. Program Counter Configuration
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.
Program status word contents are stored in stack area upon interrupt request generation or PUSH PSW
instruction execution and are restored upon execution of the RETI and POP PSW instructions.
Reset signal generation sets PSW to 02H.
Figure 3-6. Program Status Word Configuration
7
0
IE
Z
0
AC
0
0
1
CY
PSW
(a) Interrupt enable flag (IE)
This flag controls interrupt request acknowledge operations of the CPU.
When IE = 0, the interrupt disabled (DI) status is set. All interrupt requests are disabled.
When IE = 1, the interrupt enabled (EI) status is set. Interrupt request acknowledgment is controlled with
an interrupt mask flag for various interrupt sources.
This flag is reset to 0 upon DI instruction execution or interrupt acknowledgment and is set to 1 upon EI
instruction execution.
(b) Zero flag (Z)
When the operation result is zero, this flag is set to 1. It is reset to 0 in all other cases.
(c) Auxiliary carry flag (AC)
If the operation result has a carry from bit 3 or a borrow at bit 3, this flag is set to 1. It is reset to 0 in all
other cases.
32
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
(d) Carry flag (CY)
This flag stores overflow and underflow that have occurred upon add/subtract instruction execution. It
stores the shift-out value upon rotate instruction execution and functions as a bit accumulator during bit
operation 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 (Other than the internal high-speed RAM area cannot be set as the stack
area).
Figure 3-7. Stack Pointer Configuration
15
0
SP SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0
The SP is decremented before writing (saving) to the stack memory and is incremented after reading
(restoring) from the stack memory.
Each stack operation saves/restores data as shown in Figures 3-8 and 3-9.
Caution Since reset signal generation makes the SP contents undefined, be sure to initialize the SP
before using the stack memory.
Figure 3-8. Data to Be Saved to Stack Memory
Interrupt
PUSH rp
instruction
CALL, CALLT
instructions
_
_
_
_
SP
SP
SP
SP
SP
3
3
2
1
_
_
_
_
_
_
SP
SP
SP
SP
2
2
1
SP
SP
SP
SP
2
2
1
PC7 to PC0
PC15 to PC8
PSW
Lower half
register pairs
PC7 to PC0
Upper half
register pairs
PC15 to PC8
SP
SP
SP
Figure 3-9. Data to Be Restored from Stack Memory
POP rp
RET instruction
RETI instruction
instruction
Lower half
register pairs
SP
SP
PC7 to PC0
SP
PC7 to PC0
PC15 to PC8
PSW
Upper half
register pairs
PC15 to PC8
SP + 1
SP + 2
SP + 1
SP + 2
SP + 1
SP + 2
SP + 3
SP
SP
SP
33
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2.2 General-purpose registers
A general-purpose register consists of eight 8-bit registers (X, A, C, B, E, D, L, and H).
In addition each register being used as an 8-bit register, two 8-bit registers in pairs can be used as a 16-bit register
(AX, BC, DE, and HL).
Registers 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).
Figure 3-10. General-Purpose Register Configuration
(a) Function names
16-bit processing
8-bit processing
H
HL
L
D
E
DE
BC
AX
B
C
A
X
15
0
7
0
(b) Absolute names
16-bit processing
RP3
8-bit processing
R7
R6
R5
R4
RP2
RP1
RP0
R3
R2
R1
R0
15
0
7
0
34
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2.3 Special function registers (SFRs)
Unlike the general-purpose registers, each special function register has a special function.
The special function registers are allocated to the 256-byte area FF00H to FFFFH.
The special function registers can be manipulated, like the general-purpose registers, with operation, transfer, and
bit manipulation instructions. Manipulatable bit units (1, 8, and 16) differ depending on the special function register
type.
Each manipulation bit unit can be specified as follows.
• 1-bit manipulation
Describes a symbol reserved by the assembler for the 1-bit manipulation instruction operand (sfr.bit). This
manipulation can also be specified with the address and bit.
• 8-bit manipulation
Describes a symbol reserved by the assembler for the 8-bit manipulation instruction operand (sfr). This
manipulation can also be specified with an address.
• 16-bit manipulation
Describes a symbol reserved by the assembler for the 16-bit manipulation instruction operand. When specifying
an address, describe an even address.
Table 3-3 lists the special function registers. The meanings of the symbols in this table are as follows:
• Symbol
Indicates the addresses of the implemented special function registers. It is defined as a reserved word in the
RA78K0S, and is defined as an sfr variable using the #pragma sfr directive in the CC78K0S. Therefore, these
symbols can be used as instruction operands if an assembler or integrated debugger is used.
• R/W
Indicates whether the special function register can be read or written.
R/W: Read/write
R: Read only
W: Write only
• Number of bits manipulated simultaneously
Indicates the bit units (1, 8, and 16) in which the special function register can be manipulated.
• After reset
Indicates the status of the special function register when a reset is input.
35
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
Table 3-3. Special Function Registers (1/2)
Address
Special Function Register (SFR) Name
Symbol
R/W
Number of Bits Manipulated
Simultaneously
After Reset
00H
1 Bit
√
8 Bits
16 Bits
FF02H
FF03H
FF04H
FF0CH
FF0DH
FF0EH
FF0FH
FF12H
FF13H
FF14H
FF15H
FF16H
FF17H
FF18H
FF19H
FF1AH
FF22H
FF23H
FF24H
FF2CH
FF32H
FF33H
FF34H
FF3CH
FF48H
FF49H
FF50H
FF51H
FF54H
FF58H
FF5AH
FF60H
FF61H
FF62H
FF63H
FF70H
Port register 2
P2
R/W
√
√
√
√
√
√
√
−
−
−
−
−
−
−
−
Note 1
Port register 3
P3
√
Port register 4
P4
√
Port register 12
P12
√
Port register 13
P13
√
8-bit timer H compare register 01
8-bit timer H compare register 11
16-bit timer counter 00
CMP01
CMP11
TM00
R/W
R
−
−
Note 2
−
√
0000H
Note 2
16-bit timer capture/compare register 000
16-bit timer capture/compare register 010
10-bit A/D conversion result register
CR000
CR010
ADCR
R/W
−
−
−
−
−
−
√
0000H
Note 2
√
0000H
Note 2
R
√
Undefined
8-bit A/D conversion result register
Port mode register 2
ADCRH
PM2
−
√
√
√
√
√
√
√
√
−
−
√
−
−
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
R/W
FFH
00H
Port mode register 3
PM3
Port mode register 4
PM4
Port mode register 12
PM12
PU2
Pull-up resistance option register 2
Pull-up resistance option register 3
Pull-up resistance option register 4
Pull-up resistance option register 12
Watchdog timer mode register
Watchdog timer enable register
Low voltage detect register
PU3
PU4
PU12
WDTM
WDTE
LVIM
67H
9AH
00HNote 3
Low voltage detection level select register
Reset control flag register
LVIS
RESF
LSRCM
HSRCM
TMC00
PRM00
CRC00
TOC00
TMHMD1
R
00HNote 4
00H
Low-speed internal oscillation mode register
High-speed internal oscillation mode register
16-bit timer mode control register 00
Prescaler mode register 00
R/W
Capture/compare control register 00
16-bit timer output control register 00
8-bit timer H mode register 1
Notes 1. Only P34 is an input-only port.
2. A 16-bit access is possible only by the short direct addressing.
3. Retained only after a reset by LVI.
4. Varies depending on the reset cause.
36
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
Table 3-3. Special Function Registers (2/2)
Address
Special Function Register (SFR) Name
Symbol
R/W
Number of Bits Manipulated
Simultaneously
After Reset
00H
1 Bit
8 Bits
16 Bits
FF80H
FF81H
FF84H
FF8CH
FF90H
A/D converter mode register
Analog input channel specify register
Port mode control register 2
ADM
R/W
√
√
√
√
√
√
√
√
√
√
−
−
−
−
−
ADS
PMC2
ISC
Input switching control register
Asynchronous serial interface operation mode
register 6
ASIM6
01H
FF92H
FF93H
Reception buffer register 6
RXB6
ASIS6
R
−
−
√
√
−
−
FFH
00H
Asynchronous serial interface reception error
status register 6
FF94H
FF95H
Transmission buffer register 6
TXB6
R/W
R
−
−
√
√
−
−
FFH
00H
Asynchronous serial interface transmission status ASIF6
register 6
FF96H
FF97H
FF98H
FFA0H
FFA1H
FFA2H
FFA3H
FFA4H
FFA5H
FFA6H
FFA7H
FFA8H
FFCCH
FFCDH
FFCEH
FFE0H
FFE1H
FFE4H
FFE5H
FFECH
FFEDH
FFF3H
FFF4H
Clock selection register 6
CKSR6
BRGC6
ASICL6
PFCMD
PFS
R/W
−
−
√
−
√
−
√
√
√
√
√
−
√
−
−
√
√
√
√
−
−
√
−
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
√
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
Baud rate generator control register 6
Asynchronous serial interface control register 6
Flash protect command register
Flash status register
FFH
16H
W
Undefined
00H
R/W
Flash programming mode control register
Flash programming command register
Flash address pointer L
FLPMC
FLCMD
FLAPL
FLAPH
FLAPHC
FLAPLC
FLW
Undefined
00H
Undefined
Flash address pointer H
Flash address pointer H compare register
Flash address pointer L compare register
Flash write buffer register
00H
8-bit timer mode control register 80
8-bit compare register 80
TMC80
CR80
W
R
Undefined
00H
8-bit timer counter 80
TM80
Interrupt request flag register 0
Interrupt request flag register 1
Interrupt mask flag register 0
IF0
R/W
IF1
MK0
FFH
00H
02H
Interrupt mask flag register 1
MK1
External interrupt mode register 0
External interrupt mode register 1
Preprocessor clock control register
Oscillation stabilization time selection register
INTM0
INTM1
PPCC
OSTS
Undefined
Note
FFFBH
Processor clock control register
PCC
√
√
−
02H
Note The oscillation stabilization time that elapses after release of reset is selected by the option byte. For
details, refer to CHAPTER 17 OPTION BYTE.
37
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3 Instruction Address Addressing
An instruction address is determined by the program counter (PC) contents. The PC contents are normally
incremented (+1 for each byte) automatically according to the number of bytes of an instruction to be fetched each
time another instruction is executed. When a branch instruction is executed, the branch destination address
information is set to the PC to branch by the following addressing (for details of each instruction, refer to 78K/0S
Series Instructions User’s Manual (U11047E)).
3.3.1 Relative addressing
[Function]
The value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to the start
address of the following instruction is transferred to the program counter (PC) to branch. The displacement
value is treated as signed two’s complement data (–128 to +127) and bit 7 becomes the sign bit. In other words,
the range of branch in relative addressing is between –128 and +127 of the start address of the following
instruction.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
15
15
0
0
...
PC is the start address of
the next instruction of
a BR instruction.
PC
+
8
7
6
α
S
jdisp8
15
0
PC
When S = 0, α indicates that all bits are “0”.
When S = 1, α indicates that all bits are “1”.
38
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3.2 Immediate addressing
[Function]
Immediate data in the instruction word is transferred to the program counter (PC) to branch.
This function is carried out when the CALL !addr16 and BR !addr16 instructions are executed.
CALL !addr16 and BR !addr16 instructions can be used to branch to all the memory spaces.
[Illustration]
In case of CALL !addr16 and BR !addr16 instructions
7
0
PC
CALL or BR
Low addr.
High addr.
PC+1
PC+2
15
8 7
0
PC
3.3.3 Table indirect addressing
[Function]
The table contents (branch destination address) of the particular location to be addressed by the immediate data
of an instruction code from bit 1 to bit 5 are transferred to the program counter (PC) to branch.
Table indirect addressing is carried out when the CALLT [addr5] instruction is executed. This instruction can be
used to branch to all the memory spaces according to the address stored in the memory table 40H to 7FH.
[Illustration]
7
0
6
1
5
1
0
0
Instruction code
Effective address
ta4–0
15
0
8
0
7
0
6
1
5
1
0
0
0
0
0
0
0
0
7
Memory (Table)
Low addr.
0
High addr.
Effective address + 1
15
8
7
0
PC
39
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3.4 Register addressing
[Function]
The register pair (AX) contents to be specified with an instruction word are transferred to the program counter
(PC) to branch.
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
40
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4 Operand Address Addressing
The following methods (addressing) are available to specify the register and memory to undergo manipulation
during instruction execution.
3.4.1 Direct addressing
[Function]
The memory indicated by immediate data in an instruction word is directly addressed.
[Operand format]
Identifier
addr16
Description
Label or 16-bit immediate data
[Description example]
MOV A, !0FE80H; When setting !addr16 to FE80H
Instruction code
0
1
1
0
0
1
1
0
1
0
0
1
1
0
1
0
0
1
0
0
1
1
0
0
OP code
80H
FEH
[Illustration]
7
0
OP code
addr16 (low)
addr16 (high)
Memory
41
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.2 Short direct addressing
[Function]
The memory to be manipulated in the fixed space is directly addressed with the 8-bit data in an instruction word.
The fixed space where this addressing is applied is the 160-byte space FE80H to FF1FH (FE80H to FEFFH
(internal high-speed RAM) + FF00H to FF1FH (special function registers)) for the µPD78F9221, or the 256-byte
space FE20H to FF1FH (FE20H to FEFFH (internal high-speed RAM) + FF00H to FF1FH (special function
registers)) for the µPD78F9222.
The SFR area where short direct addressing is applied (FF00H to FF1FH) is a part of the total SFR area. In this
area, ports which are frequently accessed in a program and a compare register of the timer 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 cleared to 0. When it is at 00H to
1FH, bit 8 is set to 1. See [Illustration] below.
[Operand format]
Identifier
saddr
Description
µPD78F9221: Label or FE80H to FF1FH immediate data
µPD78F9222: Label or FE20H to FF1FH immediate data
saddrp
µPD78F9221: Label or FE80H to FF1FH immediate data (even address only)
µPD78F9222: Label or FE20H to FF1FH immediate data (even address only)
[Description example]
EQU DATA1 0FE90H ; DATA1 shows FE90H of a saddr area,
MOV FE90H, #50H ; When setting saddr to FE90H and the immediate data to 50H
Instruction code
1
1
0
1
0
1
1
0
0
1
1
1
0
0
0
1
0
0
0
0
0
1
0
0
OP code
90H (saddr-offset)
50H (immediate data)
[Illustration]
7
0
OP code
saddr-offset
Short direct memory
15
1
8
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.
42
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.3 Special function register (SFR) addressing
[Function]
A memory-mapped special function register (SFR) is addressed with the 8-bit immediate data in an instruction
word.
This addressing is applied to the 256-byte space FF00H to FFFFH. However, SFRs mapped at FF00H to
FF1FH are accessed with short direct addressing.
[Operand format]
Identifier
sfr
Description
Special function register name
[Description example]
MOV PM0, A; When selecting PM0 for sfr
Instruction code
1
0
1
0
1
1
0
0
0
0
1
0
1
0
1
0
[Illustration]
7
0
OP code
sfr-offset
SFR
15
1
8 7
0
Effective
address
1
1
1
1
1
1
1
43
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.4 Register addressing
[Function]
A general-purpose register is accessed as an operand.
The general-purpose register to be accessed is specified with the register specify code and functional name in
the instruction code.
Register addressing is carried out when an instruction with the following operand format is executed. When an
8-bit register is specified, one of the eight registers is specified with 3 bits in the instruction code.
[Operand format]
Identifier
Description
r
X, A, C, B, E, D, L, H
AX, BC, DE, HL
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 the C register for r
Instruction code
0
0
0
0
0
1
0
0
1
0
0
1
1
0
0
1
Register specify code
Register specify code
INCW DE; When selecting the DE register pair for rp
Instruction code
1
0
0
0
1
0
0
0
44
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.5 Register indirect addressing
[Function]
The memory is addressed with the contents of the register pair specified as an operand. The register pair to be
accessed is specified with the register pair specify code in the instruction code. This addressing can be carried
out for all the memory spaces.
[Operand format]
Identifier
Description
−
[DE], [HL]
[Description example]
MOV A, [DE]; When selecting register pair [DE]
Instruction code
0
0
1
0
1
0
1
1
[Illustration]
15
8
7
7
0
0
DE
D
E
Memory address specified
by register pair DE
The contents of addressed
memory are transferred
7
0
A
45
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.6 Based addressing
[Function]
8-bit immediate data is added to the contents of the base register, that is, the HL register pair, and the sum is
used to address the memory. Addition is performed by expanding the offset data as a positive number to 16 bits.
A carry from the 16th bit is ignored. This addressing can be carried out for all the memory spaces.
[Operand format]
Identifier
Description
−
[HL+byte]
[Description example]
MOV A, [HL+10H]; When setting byte to 10H
Instruction code
0
0
0
0
1
0
0
1
1
0
1
0
0
0
1
0
[Illustration]
16
8
7
0
0
HL
H
L
+10H
7
Memory
The contents of addressed
memory are transferred
7
0
A
46
User’s Manual U16898EJ3V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.7 Stack addressing
[Function]
The stack area is indirectly addressed with the stack pointer (SP) contents.
This addressing method is automatically employed when the PUSH, POP, subroutine call, and return instructions
are executed or the register is saved/restored upon interrupt request generation.
Stack addressing can be used to access the internal high-speed RAM area only.
[Description example]
In the case of PUSH DE
Instruction code
1
0
1
0
1
0
1
0
[Illustration]
7
Memory
0
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
D
E
47
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
4.1 Functions of Ports
The 78K0S/KA1+ has the ports shown in Figure 4-1, which can be used for various control operations. Table 4-1
shows the functions of each port.
In addition to digital I/O port functions, each of these ports has an alternate function. For details, refer to
CHAPTER 2 PIN FUNCTIONS.
Figure 4-1. Port Functions
P20
P23
P40
Port 2
Port 3
Port 4
P30
P31
P34
P45
P121
P123
P130
Port 12
Port 13
48
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Table 4-1. Port Functions
Pin Name
I/O
Function
After Reset
Input
Alternate-
Function Pin
P20 to P23
I/O
I/O
Port 2.
4-bit I/O port.
ANI0 to ANI3
Can be set to input or output mode in 1-bit units.
On-chip pull-up resistor can be connected by setting software.
P30
P31
Port 3
Can be set to input or output mode in 1- Input
bit units.
On-chip pull-up resistor can be
connected by setting software.
TI000/INTP0
TI010/TO00/
INTP2
P34Note
P40
RESETNote
−
Input
I/O
Input only
Input
Input
Port 4.
6-bit I/O port.
Can be set to input or output mode in 1-bit units.
On-chip pull-up resistor can be connected setting software.
P41
INTP3
TOH1
TxD6/INTP1
RxD6
−
P42
P43
P44
P45
P121Note
P122Note
P123
X1Note
X2Note
−
I/O
Port 12.
3-bit I/O port.
Input
Can be set to input or output mode in 1-bit units.
On-chip pull-up resistor can be connected only to P123 by
setting software.
P130
Output
Port 13.
Output
−
1-bit output-only port.
Note For the setting method for pin functions, see CHAPTER 17 OPTION BYTE.
Caution The P121/X1 and P122/X2 pins are pulled down during reset.
Remarks 1. P121 and P122 can be allocated when the high-speed internal oscillation is selected as the system
clock.
2. P122 can be allocated when an external clock is selected as the system clock.
4.2 Port Configuration
Ports consist of the following hardware units.
Table 4-2. Configuration of Ports
Item
Configuration
Port mode registers (PM2, PM3, PM4, PM12)
Control registers
Port registers (P2, P3, P4, P12, P13)
Port mode control register 2 (PMC2)
Pull-up resistor option registers (PU2, PU3, PU4, PU12)
Ports
Total: 17 (CMOS I/O: 15, CMOS input: 1, CMOS output: 1)
Total: 13
Pull-up resistor
49
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.1 Port 2
Port 2 is a 4-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 2 (PM2). When the P20 to P23 pins are used as an input port, an on-chip pull-up resistor can be
connected in 1-bit units by using pull-up resistor option register 2 (PU2).
This port is also used as the analog input pins of the internal A/D converter.
Reset signal generation sets port 2 to the input mode.
Figure 4-2 shows the block diagram of port 2.
Figure 4-2. Block Diagram of P20 to P23
V
DD
WRPU
PU2
PU20 to PU23
P-ch
WRPMC
PMC2
PMC20 to PMC23
RD
WRPORT
WRPM
P2
Output latch
(P20 to P23)
P20/ANI0 to P23/ANI3
PM2
PM20 to PM23
A/D converter
P2:
Port register 2
PU2:
PM2:
Pull-up resistor option register 2
Port mode register 2
PMC2: Port mode control register 2
RD: Read signal
WR××: Write signal
50
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.2 Port 3
Pins P30 and P31 constitute a 2-bit I/O port with an output latch. Each bit of this port can be set to the input or
output mode by using port mode register 3 (PM3). When the P30 to P31 pins are used as an input port, an on-chip
pull-up resistor can be connected in 1-bit units by using pull-up resistor option register 3 (PU3). This port is also used
for both timer I/O and external interrupt request input pin functions.
Reset signal generation sets port 3 to the input mode.
P34 is a 1-bit input-only port. This pin is also used as a RESET pin, and when the power is turned on, this is the
reset function. For the setting method for pin functions, see CHAPTER 17 OPTION BYTE.
When P34 is used as an input port pin, connect the pull-up resistor.
Figures 4-3 to 4-5 show the block diagrams of port 3.
Figure 4-3. Block Diagram of P30
V
DD
WRPU
PU3
PU30
P-ch
Alternate
function
RD
WRPORT
P3
Output latch
(P30)
P30/TI000/INTP0
WRPM
PM3
PM30
P3:
Port register 3
PU3:
PM3:
RD:
Pull-up resistor option register 3
Port mode register 3
Read signal
WR××: Write signal
51
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-4. Block Diagram of P31
V
DD
WRPU
PU3
PU31
P-ch
Alternate
function
RD
WRPORT
P3
Output latch
(P31)
P31/TI010/TO00/INTP2
WRPM
PM3
PM31
Alternate
function
P3:
Port register 3
PU3:
PM3:
RD:
Pull-up resistor option register 3
Port mode register 3
Read signal
WR××: Write signal
52
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-5. Block Diagram of P34
RD
P34/RESET
Reset
Option
byte
RD:
Read signal
Caution Because the P34 pin functions alternately as the RESET pin, if it is used as an input port pin, the
function to input an external reset signal to the RESET pin cannot be used. The function of the
port is selected by the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
Also, since the option byte is referenced after the reset release, if low level is input to the RESET
pin before the referencing, then the reset state is not released. When it is used as an input port
pin, connect the pull-up resistor.
4.2.3 Port 4
Port 4 is a 6-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 4 (PM4). When the P40 to P45 pins are used as an input port, an on-chip pull-up resistor can be
connected in 1-bit units by using pull-up resistor option register 4 (PU4).
Alternate functions include external interrupt request input, serial interface data I/O, and timer output.
Reset signal generation sets port 4 to the input mode.
Figures 4-6 to 4-9 show the block diagrams of port 4.
53
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-6. Block Diagram of P40 and P45
V
DD
WRPU
PU4
PU40, PU45
P-ch
RD
WRPORT
P4
Output latch
(P40, P45)
P40, P45
WRPM
PM4
PM40, PM45
P4:
Port register 4
PU4:
PM4:
RD:
Pull-up resistor option register 4
Port mode register 4
Read signal
WR××: Write signal
54
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-7. Block Diagram of P41 and P44
V
DD
WRPU
PU4
PU41, PU44
P-ch
Alternate
function
RD
WRPORT
P4
Output latch
(P41, P44)
P41/INTP3,
P44/RxD6
WRPM
PM4
PM41, PM44
P4:
Port register 4
PU4:
PM4:
RD:
Pull-up resistor option register 4
Port mode register 4
Read signal
WR××: Write signal
55
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-8. Block Diagram of P42
V
DD
WRPU
PU4
PU42
P-ch
RD
WRPORT
P4
Output latch
(P42)
P42/TOH1
WRPM
PM4
PM42
Alternate
function
P4:
Port register 4
PU4:
PM4:
RD:
Pull-up resistor option register 4
Port mode register 4
Read signal
WR××: Write signal
56
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-9. Block Diagram of P43
V
DD
WRPU
PU4
PU43
P-ch
Alternate
function
RD
WRPORT
P4
Output latch
(P43)
P43/TxD6/INTP1
WRPM
PM4
PM43
Alternate
function
P4:
Port register 4
PU4:
PM4:
RD:
Pull-up resistor option register 4
Port mode register 4
Read signal
WR××: Write signal
57
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.4 Port 12
Port 12 is a 3-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 12 (PM12). When the P123 pin is used as an input port, an on-chip pull-up resistor can be
connected by using pull-up resistor option register 12 (PU12).
The P121 and P122 pins are also used as the X1 and X2 pins of the system clock oscillator. The functions of the
P121 and P122 pins differ, therefore, depending on the selected system clock oscillator. The following three system
clock oscillators can be used.
(1) High-speed internal oscillator
The P121 and P122 pins can be used as I/O port pins.
(2) Crystal/ceramic oscillator
The P121 and P122 pins cannot be used as I/O port pins because they are used as the X1 and X2 pins.
(3) External clock input
The P121 pin is used as the X1 pin to input an external clock, and therefore it cannot be used as an I/O port pin.
The P122 pin can be used as an I/O port pin.
The system clock oscillation is selected by the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
Reset signal generation sets port 12 to the input mode.
Figures 4-10 and 4-11 show the block diagrams of port 12.
Figure 4-10. Block Diagram of P121 and P122
RD
WRPORT
P12
Output latch
(P121, P122)
P121/X1,
P122/X2
WRPM
PM12
PM121, PM122
P12:
PM12: Port mode register 12
RD: Read signal
WR××: Write signal
Port register 12
58
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-11. Block Diagram of P123
V
DD
WRPU
PU12
PU123
P-ch
RD
WRPORT
P12
Output latch
(P123)
P123
WRPM
PM12
PM123
P12:
Port register 12
PU12: Pull-up resistor option register 12
PM12: Port mode register 12
RD:
Read signal
WR××: Write signal
59
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.5 Port 13
This is a 1-bit output-only port.
Figure 4-12 shows the block diagram of port 13.
Figure 4-12. Block Diagram of P130
RD
WRPORT
P13
Output latch
(P130)
P130
P13:
RD:
Port register 13
Read signal
WR××: Write signal
Remark When a reset is input, P130 outputs a low level. If P130 outputs a high level immediately after
reset is released, the output signal of P130 can be used as a dummy CPU reset signal.
4.3 Registers Controlling Port Functions
The ports are controlled by the following four types of registers.
• Port mode registers (PM2, PM3, PM4, PM12)
• Port registers (P2, P3, P4, P12, P13)
• Port mode control register 2 (PMC2)
• Pull-up resistor option registers (PU2, PU3, PU4, PU12)
(1) Port mode registers (PM2, PM3, PM4, PM12)
These registers are used to set the corresponding port to the input or output mode in 1-bit units.
Each port mode register can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets these registers to FFH.
When a port pin is used as an alternate-function pin, set its port mode register and output latch as shown in
Table 4-3.
Caution Because P30, P31, and P43 are also used as external interrupt pins, the corresponding
interrupt request flag is set if each of these pins is set to the output mode and its output level
is changed. To use the port pin in the output mode, therefore, set the corresponding
interrupt mask flag to 1 in advance.
60
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-13. Format of Port Mode Register
Address: FF22H After reset: FFH R/W
Symbol
PM2
7
1
6
1
5
1
4
1
3
2
1
0
PM23
PM22
PM21
PM20
Address: FF23H After reset: FFH R/W
Symbol
PM3
7
1
6
1
5
1
4
1
3
1
2
1
1
0
PM31
PM30
Address: FF24H After reset: FFH R/W
Symbol
PM4
7
1
6
1
5
4
3
2
1
0
PM45
PM44
PM43
PM42
PM41
PM40
Address: FF2CH After reset: FFH R/W
Symbol
PM12
7
1
6
1
5
1
4
1
3
2
1
0
1
PM123
PM122
PM121
PMmn
Selection of I/O mode of Pmn pin (m = 2, 3, 4, or 12; n = 0 to 5)
0
1
Output mode (output buffer ON)
Input mode (output buffer OFF)
(2) Port registers (P2, P3, P4, P12, P13)
These registers are used to write data to be output from the corresponding port pin to an external device
connected to the chip.
When a port register is read, the pin level is read in the input mode, and the value of the output latch of the
port is read in the output mode.
P20 to P23, P30, P31, P34, P40 to P45, P121 to P123, and P130 are set by using a 1-bit or 8-bit memory
manipulation instruction.
Reset signal generation sets these registers to 00H.
61
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-14. Format of Port Register
Address: FF02H After reset: 00H (Output latch) R/W
Symbol
P2
7
0
6
0
5
0
4
0
3
2
1
0
P23
P22
P21
P20
Address: FF03H After reset: 00HNote (Output latch) R/WNote
Symbol
P3
7
0
6
0
5
0
4
3
0
2
0
1
0
P34
P31
P30
Address: FF04H After reset: 00H (Output latch) R/W
Symbol
P4
7
0
6
0
5
4
3
2
1
0
P45
P44
P43
P42
P41
P40
Address: FF0CH After reset: 00H (Output latch) R/W
Symbol
P12
7
0
6
0
5
0
4
0
3
2
1
0
0
P123
P122
P121
Address: FF0DH After reset: 00H (Output latch) R/W
Symbol
P13
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
P130
Pmn
m = 2, 3, 4, 12, or 13; n = 0-5
Controls of output data (in output mode) Input data read (in input mode)
Output 0 Input low level
Output 1 Input high level
0
1
Note Because P34 is read-only, its reset value is undefined.
(3) Port mode control register 2 (PMC2)
This register specifies the port mode or A/D converter mode.
Each bit of the PMC2 register corresponds to each pin of port 2 and can be specified in 1-bit units.
PMC2 is set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets PMC2 to 00H.
62
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-15. Format of Port Mode Control Register 2
Address: FF84H After reset: 00H R/W
Symbol
PMC2
7
0
6
0
5
0
4
0
3
2
1
0
PMC23
PMC22
PMC21
PMC20
PMC2n
Specification of operation mode (n = 0 to 3)
0
1
Port mode
A/D converter mode
Table 4-3. Setting of Port Mode Register, Port Register (Output Latch), and Port Mode Control Register
When Alternate Function Is Used
Port Name
Alternate-Function Pin
Name
PM××
P××
PMC2n
(n = 0 to 3)
I/O
P20 to P23
ANI0 to ANI3
TI000
Input
Input
Input
1
1
1
0
1
1
1
0
0
1
1
×
×
×
0
×
×
×
0
1
×
×
1
−
−
−
−
−
−
−
−
−
−
P30
INTP0
TO00
P31
Output
Input
TI010
INTP2
INTP3
TOH1
Input
P41
P42
P43
Input
Output
Output
Input
TxD6
INTP1
RxD6
P44
Input
Remark ×:
don’t care
PM××: Port mode register, P××: Port register (output latch of port)
PMC2×: Port mode control register
63
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
(4) Pull-up resistor option registers (PU2, PU3, PU4, PU12)
These registers are used to specify whether an on-chip pull-up resistor is connected to P20 to P23, P30, P31,
P40 to P45, and P123. By setting PU2, PU3, PU4, or PU12, an on-chip pull-up resistor can be connected to
the port pin corresponding to the bit of PU2, PU3, PU4, or PU12.
PU2, PU3, PU4, and PU12 are set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation set these registers to 00H.
Figure 4-16. Format of Pull-up Resistor Option Register
Address: FF32H After reset: 00H R/W
Symbol
PU2
7
0
6
0
5
0
4
0
3
2
1
0
PU23
PU22
PU21
PU20
Address: FF33H After reset: 00H R/W
Symbol
PU3
7
0
6
0
5
0
4
0
3
0
2
0
1
0
PU31
PU30
Address: FF34H After reset: 00H R/W
Symbol
PU4
7
0
6
0
5
4
3
2
1
0
PU45
PU44
PU43
PU42
PU41
PU40
Address: FF3CH After reset: 00H R/W
Symbol
PU12
7
0
6
0
5
0
4
0
3
2
0
1
0
0
0
PU123
PUmn
Selection of connection of on-chip pull-up resistor of Pmn (m = 2, 3, 4, or 12; n = 0 to 5)
Does not connect on-chip pull-up resistor
0
1
Connects on-chip pull-up resistor
64
User’s Manual U16898EJ3V0UD
CHAPTER 4 PORT FUNCTIONS
4.4 Operation of Port Function
The operation of a port differs, as follows, depending on the setting of the I/O mode.
Caution Although a 1-bit memory manipulation instruction manipulates 1 bit, it accesses a port in 8-bit
units. Therefore, the contents of the output latch of a pin in the input mode, even if it is not
subject to manipulation by the instruction, are undefined in a port with a mixture of inputs and
outputs.
4.4.1 Writing to I/O port
(1) In output mode
The data can be written to the output latch by a transfer instruction. In addition, the data of the output latch are
output from the pin. Once data is written to the output latch, it is retained until new data is written to the output
latch.
When a reset signal is generated, cleans the data in the output latch.
(2) In input mode
The data can be written to the output latch by a transfer instruction. Because the output buffer is off, however,
the pin status remains unchanged.
Once data is written to the output latch, it is retained until new data is written to the output latch.
When a reset signal is generated, cleans the data in the output latch.
4.4.2 Reading from I/O port
(1) In output mode
The data of the output latch can be read by a transfer instruction. The data of the output latch remain unchanged.
(2) In input mode
The pin status can be read by a transfer instruction. The contents of the output latch remain unchanged.
4.4.3 Operations on I/O port
(1) In output mode
An operation is performed on the data of the output latch. The result is written to the output latch. The data of the
output latch are output from the pin.
Once data is written to the output latch, it is retained until new data is written to the output latch.
When a reset signal is generated, cleans the data in the output latch.
(2) In input mode
The pin level is read and an operation is performed on its data. The operation result is written to the output latch.
However, the pin status remains unchanged because the output buffer is off.
When a reset signal is generated, cleans the data in the output latch.
65
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
5.1 Functions of Clock Generators
The clock generators include a circuit that generates a clock (system clock) to be supplied to the CPU and
peripheral hardware, and a circuit that generates a clock (interval time generation clock) to be supplied to the
watchdog timer and 8-bit timer H1 (TMH1).
5.1.1 System clock oscillators
The following three types of system clock oscillators are used.
• High-speed internal oscillator
This circuit internally oscillates a clock of 8 MHz (TYP.). Its oscillation can be stopped by execution of the STOP
instruction.
If the high-speed internal oscillator is selected to supply the system clock, the X1 and X2 pins can be used as I/O
port pins.
• Crystal/ceramic oscillator
This circuit oscillates a clock with a crystal/ceramic oscillator connected across the X1 and X2 pins. It can
oscillate a clock of 1 to 10 MHz. Oscillation of this circuit can be stopped by execution of the STOP instruction.
• External clock input circuit
This circuit supplies a clock from an external IC to the X1 pin. A clock of 1 to 10 MHz can be supplied. Internal
clock supply can be stopped by execution of the STOP instruction.
If the external clock input is selected as the system clock, the X2 pin can be used as an I/O port pin.
The system clock source is selected by using the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
When using the X1 and X2 pins as I/O port pins, refer to CHAPTER 4 PORT FUNCTIONS for details.
5.1.2 Clock oscillator for interval time generation
The following circuit is used as a clock oscillator for interval time generation.
• Low-speed internal oscillator
This circuit oscillates a clock of 240 kHz (TYP.). Its oscillation can be stopped by using the low-speed internal
oscillation mode register (LSRCM) when it is specified by the option byte that its oscillation can be stopped by
software.
66
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
5.2 Configuration of Clock Generators
The clock generators consist of the following hardware.
Table 5-1. Configuration of Clock Generators
Item
Configuration
Control registers
Processor clock control register (PCC)
Preprocessor clock control register (PPCC)
Low-speed internal oscillation mode register (LSRCM)
Oscillation stabilization time select register (OSTS)
Oscillators
Crystal/ceramic oscillator
High-speed internal oscillator
External clock input circuit
Low-speed internal oscillator
67
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-1. Block Diagram of Clock Generators
Internal bus
Oscillation stabilization
time select register (OSTS)
Processor clock
control register (PCC)
Preprocessor clock
control register (PPCC)
OSTS1 OSTS0
PPCC1 PPCC0
PCC1
System clock oscillation
stabilization time counter
Controller
C
P
U
CPU clock
(fCPU
)
STOP
Watchdog timer
Prescaler
System clock
oscillatorNote
X1/P121
X2/P122
Crystal/ceramic
oscillation
f
X
f
X
fX
2
22
External clock
input
High-speed
internal
oscillation
f
XP
22
f
XP
Prescaler
Clock to peripheral
hardware (fXP
)
Low-speed
internal
oscillator
f
RL
8-bit timer H1,
watchdog timer
Option byte
1: Cannot be stopped.
0: Can be stopped.
LSRSTOP
Low-speed internal oscillation
mode register (LSRCM)
Internal bus
Note Select the high-speed internal oscillator, crystal/ceramic oscillator, or external clock input circuit as the
system clock source by using the option byte.
68
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
5.3 Registers Controlling Clock Generators
The clock generators are controlled by the following four registers.
• Processor clock control register (PCC)
• Preprocessor clock control register (PPCC)
• Low-speed internal oscillation mode register (LSRCM)
• Oscillation stabilization time select register (OSTS)
(1) Processor clock control register (PCC) and preprocessor clock control register (PPCC)
These registers are used to specify the division ratio of the system clock.
PCC and PPCC are set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets PCC and PPCC to 02H.
Figure 5-2. Format of Processor Clock Control Register (PCC)
Address: FFFBH After reset: 02H R/W
Symbol
PCC
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
PCC1
Figure 5-3. Format of Preprocessor Clock Control Register (PPCC)
Address: FFF3H After reset: 02H R/W
Symbol
PPCC
7
0
6
0
5
0
4
0
3
0
2
0
1
0
PPCC1
PPCC0
PPCC1
PPCC0
PCC1
Selection of CPU clock (fCPU)
0
0
0
1
0
1
0
0
0
1
0
1
1
fX
1
fX/2 Note 1
fX/22
fX/22 Note 2
fX/23 Note 1
fX/24 Note 2
Setting prohibited
0
0
1
0
Other than above
Notes 1. If PPCC = 01H, the clock (fXP) supplied to the peripheral hardware is fX/2.
2. If PPCC = 02H, the clock (fXP) supplied to the peripheral hardware is fX/22.
69
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
The fastest instruction of the 78K0S/KA1+ is executed in two CPU clocks. Therefore, the relationship between the
CPU clock (fCPU) and the minimum instruction execution time is as shown in Table 5-2.
Table 5-2. Relationship Between CPU Clock and Minimum Instruction Execution Time
CPU Clock (fCPU) Note
Minimum Instruction Execution Time: 2/fCPU
High-speed internal oscillation clock
(at 8.0 MHz (TYP.))
Crystal/ceramic oscillation clock
or external clock input (at 10.0 MHz)
fX
0.25 µs
0.5 µs
1.0 µs
2.0 µs
4.0 µs
0.2 µs
fX/2
fX/22
fX/23
fX/24
0.4 µs
0.8 µs
1.6 µs
3.2 µs
Note The CPU clock (high-speed internal oscillation clock, crystal/ceramic oscillation clock, or external clock
input) is selected by the option byte.
(2) Low-speed internal oscillation mode register (LSRCM)
This register is used to select the operation mode of the low-speed internal oscillator (240 kHz (TYP.)).
This register is valid when it is specified by the option byte that the low-speed internal oscillator can be stopped
by software. If it is specified by the option byte that the low-speed internal oscillator cannot be stopped by
software, setting of this register is invalid, and the low-speed internal oscillator continues oscillating. In addition,
the source clock of WDT is fixed to the low-speed internal oscillator. For details, refer to CHAPTER 9
WATCHDOG TIMER.
LSRCM can be set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets LSRCM to 00H.
Figure 5-4. Format of Low-Speed internal oscillation Mode Register (LSRCM)
Address: FF58H After reset: 00H R/W
Symbol
LSRCM
7
0
6
0
5
0
4
0
3
0
2
0
1
0
<0>
LSRSTOP
LSRSTOP
Oscillation/stop of low-speed internal oscillator
0
1
Low-speed internal oscillates
Low-speed internal oscillator stops
70
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
(3) Oscillation stabilization time select register (OSTS)
This register is used to select oscillation stabilization time of the clock supplied from the oscillator when the STOP
mode is released. The wait time set by OSTS is valid only when the crystal/ceramic oscillation clock is selected
as the system clock and after the STOP mode is released. If the high-speed internal oscillator or external clock
input is selected as the system clock source, no wait time elapses.
The system clock oscillator and the oscillation stabilization time that elapses after power application or release of
reset are selected by the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
OSTS is set by using an 8-bit memory manipulation instruction.
Figure 5-5. Format of Oscillation Stabilization Time Select Register (OSTS)
Address: FFF4H After reset: Undefined R/W
Symbol
OSTS
7
0
6
0
5
0
4
0
3
0
2
0
1
0
OSTS1
OSTS0
OSTS1
OSTS0
Selection of oscillation stabilization time
0
0
1
1
0
1
0
1
210/fX (102.4 µs)
212/fX (409.6 µs)
215/fX (3.27 ms)
217/fX (13.1 ms)
Cautions 1. To set and then release the STOP mode, set the oscillation stabilization time as follows.
Expected oscillation stabilization time of resonator ≤ Oscillation stabilization time set by
OSTS
2. The wait time after the STOP mode is released does not include the time from the release of
the STOP mode to the start of clock oscillation (“a” in the figure below), regardless of
whether STOP mode was released by reset signal generation or interrupt generation.
STOP mode is released
Voltage
waveform
of X1 pin
a
3. The oscillation stabilization time that elapses on power application or after release of reset is
selected by the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
Remarks 1. ( ): fX = 10 MHz
2. Determine the oscillation stabilization time of the resonator by checking the characteristics of the
resonator to be used.
71
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
5.4 System Clock Oscillators
The following three types of system clock oscillators are available.
• High-speed internal oscillator:
• Crystal/ceramic oscillator:
• External clock input circuit:
Internally oscillates a clock of 8 MHz (TYP.).
Oscillates a clock of 1 to 10 MHz.
Supplies a clock of 1 to 10 MHz to the X1 pin.
5.4.1 High-speed internal oscillator
The 78K0S/KA1+ includes a high-speed internal oscillator (8 MHz (TYP.)).
If the high-speed internal oscillation is selected by the option byte as the clock source, the X1 and X2 pins can be
used as I/O port pins.
For details of the option byte, refer to CHAPTER 17 OPTION BYTE. For details of I/O ports, refer to CHAPTER 4
PORT FUNCTIONS.
5.4.2 Crystal/ceramic oscillator
The crystal/ceramic oscillator oscillates using a crystal or ceramic resonator connected between the X1 and X2
pins.
If the crystal/ceramic oscillator is selected by the option byte as the system clock source, the X1 and X2 pins are
used as crystal or ceramic resonator connection pins.
For details of the option byte, refer to CHAPTER 17 OPTION BYTE. For details of I/O ports, refer to CHAPTER 4
PORT FUNCTIONS.
Figure 5-6 shows the external circuit of the crystal/ceramic oscillator.
Figure 5-6. External Circuit of Crystal/Ceramic Oscillator
V
SS
X1
X2
Crystal resonator
or ceramic resonator
Caution When using the crystal/ceramic oscillator, wire as follows in the area enclosed by the broken
lines in Figure 5-6 to avoid an adverse effect from wiring capacitance.
• Keep the wiring length as short as possible.
• Do not cross the wiring with the other signal lines. Do not route the wiring near a signal line
through which a high fluctuating current flows.
• Always make the ground point of the oscillator capacitor the same potential as VSS. Do not
ground the capacitor to a ground pattern through which a high current flows.
• Do not fetch signals from the oscillator.
72
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-7 shows examples of incorrect resonator connection.
Figure 5-7. Examples of Incorrect Resonator Connection (1/2)
(a) Too long wiring of connected circuit (b) Crossed signal lines
PORT
X2
V
SS
X1
X2
V
SS
X1
(d) Current flowing through ground line of oscillator
(Potential at points A, B, and C fluctuates.)
(c) Wiring near high fluctuating current
V
DD
PORT
X2
V
SS
X1
X2
X1
VSS
A
B
C
High current
73
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-7. Examples of Incorrect Resonator Connection (2/2)
(e) Signals are fetched
V
SS
X1
X2
5.4.3 External clock input circuit
This circuit supplies a clock from an external IC to the X1 pin.
If external clock input is selected by the option byte as the system clock source, the X2 pin can be used as an I/O
port pin.
For details of the option byte, refer to CHAPTER 17 OPTION BYTE. For details of I/O ports, refer to CHAPTER 4
PORT FUNCTIONS.
5.4.4 Prescaler
The prescaler divides the clock (fX) output by the system clock oscillator to generate a clock (fXP) to be supplied to
the peripheral hardware. It also divides the clock to peripheral hardware (fXP) to generate a clock to be supplied to the
CPU.
Remark The clock output by the oscillator selected by the option byte (high-speed internal oscillator,
crystal/ceramic oscillator, or external clock input circuit) is divided. For details of the option byte, refer to
CHAPTER 17 OPTION BYTE.
74
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
5.5 Operation of CPU Clock Generator
A clock (fCPU) is supplied to the CPU from the system clock (fX) oscillated by one of the following three types of
oscillators.
• High-speed internal oscillator:
• Crystal/ceramic oscillator:
• External clock input circuit:
Internally oscillates a clock of 8 MHz (TYP.).
Oscillates a clock of 1 to 10 MHz.
Supplies a clock of 1 to 10 MHz to X1 pin.
The system clock oscillator is selected by the option byte. For details of the option byte, refer to CHAPTER 17
OPTION BYTE.
(1) High-speed internal oscillator
When the high-speed internal oscillation is selected by the option byte, the following is possible.
• Shortening of start time
If the high-speed internal oscillator is selected as the oscillator, the CPU can be started without having to wait
for the oscillation stabilization time of the system clock. Therefore, the start time can be shortened.
• Improvement of expandability
If the high-speed internal oscillator is selected as the oscillator, the X1 and X2 pins can be used as I/O port
pins. For details, refer to CHAPTER 4 PORT FUNCTIONS.
Figures 5-8 and 5-9 show the timing chart and status transition diagram of the default start by the high-speed
internal oscillation.
Remark When the high-speed internal oscillation is used, the clock accuracy is 5%.
Figure 5-8. Timing Chart of Default Start by High-Speed Internal Oscillation
(a)
V
DD
RESET
H
Internal reset
(b)
System clock
CPU clock
High-speed internal oscillation clock
PCC = 02H, PPCC = 02H
Option byte is read.
System clock is selected.
(Operation stopsNote
)
Note Operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
75
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
(a) The internal reset signal is generated by the power-on clear function on power application, the option byte is
referenced after reset, and the system clock is selected.
(b) The option byte is referenced and the system clock is selected. Then the high-speed internal oscillation
clock operates as the system clock.
Figure 5-9. Status Transition of Default Start by High-Speed internal oscillation
Power
application
V
DD > 2.1 V 0.1 V
Reset by
power-on clear
Reset signal
High-speed internal
oscillator selected
by option byte
Start with PCC = 02H,
PPCC = 02H
Clock division ratio
variable during
CPU operation
Interrupt
Interrupt
HALT
instruction
STOP
instruction
HALT
STOP
Remark PCC: Processor clock control register
PPCC: Preprocessor clock control register
(2) Crystal/ceramic oscillator
If crystal/ceramic oscillation is selected by the option byte, a clock frequency of 1 to 10 MHz can be selected and
the accuracy of processing is improved because the frequency deviation is small, as compared with high-speed
internal oscillation (8 MHz (TYP.)).
Figures 5-10 and 5-11 show the timing chart and status transition diagram of default start by the crystal/ceramic
oscillator.
76
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-10. Timing Chart of Default Start by Crystal/Ceramic Oscillator
(a)
V
DD
RESET
H
Internal reset
(b)
System clock
CPU clock
(c)
Crystal/ceramic
oscillator clock
PCC = 02H, PPCC = 02H
Option byte is read.
Clock oscillation
stabilization
timeNote 2
System clock is selected.
(Operation stopsNote 1
)
Notes 1. Operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. The clock oscillation stabilization time for default start is selected by the option byte. For details, refer
to CHAPTER 17 OPTION BYTE. The oscillation stabilization time that elapses after the STOP mode
is released is selected by the oscillation stabilization time select register (OSTS).
(a) The internal reset signal is generated by the power-on clear function on power application, the option byte is
referenced after reset, and the system clock is selected.
(b) After high-speed internal oscillation clock is generated, the option byte is referenced and the system clock is
selected. In this case, the crystal/ceramic oscillator clock is selected as the system clock.
(c) If the system clock is the crystal/ceramic oscillator clock, it starts operating as the CPU clock after clock
oscillation is stabilized. The wait time is selected by the option byte. For details, refer to CHAPTER 17
OPTION BYTE.
77
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-11. Status Transition of Default Start by Crystal/Ceramic Oscillation
Power
application
V
DD > 2.1 V 0.1 V
Reset by
power-on clear
Reset signal
Crystal/ceramic
oscillation selected
by option byte
Wait for clock
oscillation stabilization
Start with PCC = 02H,
PPCC = 02H
Clock division ratio
variable during
CPU operation
Interrupt
Interrupt
HALT
instruction
STOP
instruction
HALT
STOP
Remark PCC: Processor clock control register
PPCC: Preprocessor clock control register
(3) External clock input circuit
If external clock input is selected by the option byte, the following is possible.
• High-speed operation
The accuracy of processing is improved as compared with high-speed internal oscillation (8 MHz (TYP.))
because an oscillation frequency of 1 to 10 MHz can be selected and an external clock with a small frequency
deviation can be supplied.
• Improvement of expandability
If the external clock input circuit is selected as the oscillator, the X2 pin can be used as an I/O port pin. For
details, refer to CHAPTER 4 PORT FUNCTIONS.
Figures 5-12 and 5-13 show the timing chart and status transition diagram of default start by external clock input.
78
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-12. Timing of Default Start by External Clock Input
(a)
V
DD
RESET
H
Internal reset
(b)
System clock
CPU clock
External clock input
PCC = 02H, PPCC = 02H
Option byte is read.
System clock is selected.
(Operation stopsNote
)
Note Operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
(a) The internal reset signal is generated by the power-on clear function on power application, the option byte is
referenced after reset, and the system clock is selected.
(b) The option byte is referenced and the system clock is selected. Then the external clock operates as the
system clock.
Figure 5-13. Status Transition of Default Start by External Clock Input
Power
application
V
DD > 2.1 V 0.1 V
Reset by
power-on clear
Reset signal
External clock input
selected by option byte
Start with PCC = 02H,
PPCC = 02H
Clock division ratio
variable during
CPU operation
Interrupt
Interrupt
HALT
instruction
STOP
instruction
HALT
STOP
Remark PCC: Processor clock control register
PPCC: Preprocessor clock control register
79
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
5.6 Operation of Clock Generator Supplying Clock to Peripheral Hardware
The following two types of clocks are supplied to the peripheral hardware.
• Clock to peripheral hardware (fXP)
• Low-speed internal oscillation clock (fRL)
(1) Clock to peripheral hardware
The clock to the peripheral hardware is supplied by dividing the system clock (fX). The division ratio is selected
by the pre-processor clock control register (PPCC).
Three types of frequencies are selectable: “fX”, “fX/2”, and “fX/22”. Table 5-3 lists the clocks supplied to the
peripheral hardware.
Table 5-3. Clocks to Peripheral Hardware
PPCC1
PPCC0
Selection of clock to peripheral hardware (fXP)
0
0
1
1
0
1
0
1
fX
fX/2
fX/22
Setting prohibited
(2) Low-speed internal oscillation clock
The low-speed internal oscillator of the clock oscillator for interval time generation is always started after release
of reset, and oscillates at 240 kHz (TYP.).
It can be specified by the option byte whether the low-speed internal oscillator can or cannot be stopped by
software. If it is specified that the low-speed internal oscillator can be stopped by software, oscillation can be
started or stopped by using the low-speed internal oscillation mode register (LSRCM). If it is specified that it
cannot be stopped by software, the clock source of WDT is fixed to the low-speed internal oscillation clock (fRL).
The low-speed internal oscillator is independent of the CPU clock. If it is used as the source clock of WDT,
therefore, a hang-up can be detected even if the CPU clock is stopped. If the low-speed internal oscillator is used
as a count clock source of 8-bit timer H1, 8-bit timer H1 can operate even in the standby status.
Table 5-4 shows the operation status of the low-speed internal oscillator when it is selected as the source clock of
WDT and the count clock of 8-bit timer H1. Figure 5-14 shows the status transition of the low-speed internal
oscillator.
Table 5-4. Operation Status of Low-Speed Internal Oscillator
Option Byte Setting
CPU Status
WDT Status
Stopped
TMH1 Status
Stopped
Can be stopped by
LSRSTOP = 1
LSRSTOP = 0
LSRSTOP = 1
LSRSTOP = 0
Operation mode
software
Operates
Stopped
Stopped
Operates
Operates
Stopped
Operates
Standby
Cannot be stopped
Operation mode
Standby
80
User’s Manual U16898EJ3V0UD
CHAPTER 5 CLOCK GENERATORS
Figure 5-14. Status Transition of Low-Speed Internal Oscillation
Power
application
V
DD > 2.1 V 0.1 V
Reset by
power-on clear
Reset signal
Select by option byte
if low-speed internal oscillator
can be stopped or not
Can be stopped
Cannot be stopped
Clock source of
WDT is selected
by softwareNote
Clock source of
WDT is fixed to fRL
Low-speed internal
oscillator cannot be stopped
Low-speed internal
oscillator can be stopped
LSRSTOP = 1
LSRSTOP = 0
Low-speed internal
oscillator stops
Note The clock source of the watchdog timer (WDT) is selected from fX or fRL, or it may be stopped. For details,
refer to CHAPTER 9 WATCHDOG TIMER.
81
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.1 Functions of 16-Bit Timer/Event Counter 00
16-bit timer/event counter 00 has the following functions.
(1) Interval timer
16-bit timer/event counter 00 generates interrupt requests at the preset time interval.
• Number of counts: 2 to 65536
(2) External event counter
16-bit timer/event counter 00 can measure the number of pulses with a high-/low-level width of valid level
pulse width or more of a signal input externally.
• Valid level pulse width: 2/fXP or more
(3) Pulse width measurement
16-bit timer/event counter 00 can measure the pulse width of an externally input signal.
• Valid level pulse width: 2/fXP or more
(4) Square-wave output
16-bit timer/event counter 00 can output a square wave with any selected frequency.
• Cycle: (2 to 65536) × 2 × count clock cycle
(5) PPG output
16-bit timer/event counter 00 can output a square wave that have arbitrary cycle and pulse width.
• 1 < Pulse width < Cycle ≤ 65536
(6) One-shot pulse output
16-bit timer/event counter 00 can output a one-shot pulse for which output pulse width can be set to any
desired value.
82
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.2 Configuration of 16-Bit Timer/Event Counter 00
16-bit timer/event counter 00 consists of the following hardware.
Table 6-1. Configuration of 16-Bit Timer/Event Counter 00
Item
Timer counter
Register
Configuration
16-bit timer counter 00 (TM00)
16-bit timer capture/compare registers 000, 010 (CR000, CR010)
Timer input
Timer output
Control registers
TI000, TI010
TO00, output controller
16-bit timer mode control register 00 (TMC00)
Capture/compare control register 00 (CRC00)
16-bit timer output control register 00 (TOC00)
Prescaler mode register 00 (PRM00)
Port mode register 3 (PM3)
Port register 3 (P3)
Figures 6-1 shows a block diagram of these counters.
Figure 6-1. Block Diagram of 16-Bit Timer/Event Counter 00
Internal bus
Capture/compare control
register 00 (CRC00)
CRC002CRC001 CRC000
INTTM000
16-bit timer capture/compare
register 000 (CR000)
Noise
elimi-
nator
TI010/TO00/
INTP2/P31
Match
f
XP
f
f
XP/22
XP/28
16-bit timer counter 00
(TM00)
Clear
Output
controller
TO00/TI010/
INTP2/P31
Match
Noise
elimi-
nator
2
f
X
Output latch
(P31)
PM31
Noise
elimi-
nator
16-bit timer capture/compare
register 010 (CR010)
TI000/INTP0/P30
INTTM010
CRC002
PRM001
TMC003 TMC002 TMC001OVF00 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00
PRM000
16-bit timer output
control register 00
(TOC00)
16-bit timer mode
control register 00
(TMC00)
Prescaler mode
register 00 (PRM00)
Internal bus
83
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(1) 16-bit timer counter 00 (TM00)
TM00 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.
Figure 6-2. Format of 16-Bit Timer Counter 00 (TM00)
Address: FF12H, FF13H After reset: 0000H
R
Symbol
FF13H
FF12H
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
TM00
The count value is reset to 0000H in the following cases.
<1> At reset input
<2> If TMC003 and TMC002 are cleared
<3> If the valid edge of TI000 is input in the clear & start mode entered by inputting the valid edge of TI000
<4> If TM00 and CR000 match in the clear & start mode entered on a match between TM00 and CR000
<5> If OSPT00 is set to 1 in the one-shot pulse output mode
Cautions 1. Even if TM00 is read, the value is not captured by CR010.
2. When TM00 is read, count misses do not occur, since the input of the count clock is
temporarily stopped and then resumed after the read.
(2) 16-bit timer capture/compare register 000 (CR000)
CR000 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 (CRC000) of capture/compare control
register 00 (CRC00).
CR000 is set by 16-bit memory manipulation instruction.
A reset signal generation clears CR000 to 0000H.
Figure 6-3. Format of 16-Bit Timer Capture/Compare Register 000 (CR000)
Address: FF14H, FF15H After reset: 0000H R/W
Symbol
FF15H
FF14H
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
CR000
•
•
When CR000 is used as a compare register
The value set in CR000 is constantly compared with the 16-bit timer/counter 00 (TM00) count value, and an
interrupt request (INTTM000) is generated if they match. It can also be used as the register that holds the
interval time then TM00 is set to interval timer operation.
When CR000 is used as a capture register
It is possible to select the valid edge of the TI000 pin or the TI010 pin as the capture trigger. Setting of the
TI000 or TI010 valid edge is performed by means of prescaler mode register 00 (PRM00) (refer to Table 6-
2).
84
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Table 6-2. CR000 Capture Trigger and Valid Edges of TI000 and TI010 Pins
(1) TI000 pin valid edge selected as capture trigger (CRC001 = 1, CRC000 = 1)
CR000 Capture Trigger
TI000 Pin Valid Edge
ES010
ES000
Falling edge
Rising edge
Falling edge
0
0
1
1
0
1
Rising edge
No capture operation
Both rising and falling edges
(2) TI010 pin valid edge selected as capture trigger (CRC001 = 0, CRC000 = 1)
CR000 Capture Trigger
TI010 Pin Valid Edge
ES110
ES100
Falling edge
Falling edge
Rising edge
0
0
1
0
1
1
Rising edge
Both rising and falling edges
Both rising and falling edges
Remarks 1. Setting ES010, ES000 = 1, 0 and ES110, ES100 = 1, 0 is prohibited.
2. ES010, ES000:
Bits 5 and 4 of prescaler mode register 00 (PRM00)
ES110, ES100:
Bits 7 and 6 of prescaler mode register 00 (PRM00)
CRC001, CRC000: Bits 1 and 0 of capture/compare control register 00 (CRC00)
Cautions 1. Set CR000 to other than 0000H in the clear & start mode entered on match between TM00
and CR000. This means a 1-pulse count operation cannot be performed when this
register is used as an external event counter. However, in the free-running mode and in
the clear & start mode using the valid edge of TI000 pin, if CR000 is set to 0000H, an
interrupt request (INTTM000) is generated when CR000 changes from 0000H to 0001H
following overflow (FFFFH).
2. If the new value of CR000 is less than the value of 16-bit timer counter 0 (TM00), TM00
continues counting, overflows, and then starts counting from 0 again. If the new value of
CR000 is less than the old value, therefore, the timer must be reset to be restarted after
the value of CR000 is changed.
3. The value of CR000 after 16-bit timer/event counter 00 has stopped is not guaranteed.
4. The capture operation may not be performed for CR000 set in compare mode even if a
capture trigger is input.
5. When P31 is used as the input pin for the valid edge of TI010, it cannot be used as a timer
output (TO00). Moreover, when P31 is used as TO00, it cannot be used as the input pin
for the valid edge of TI010.
6. If the register read period and the input of the capture trigger conflict when CR000 is
used as a capture register, the capture trigger input takes precedence and the read data
is undefined. Also, if the count stop of the timer and the input of the capture trigger
conflict, the capture trigger is undefined.
7. Changing the CR000 setting may cause a malfunction. To change the setting, refer to 6.5
Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare register
during timer operation.
85
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(3) 16-bit capture/compare register 010 (CR010)
CR010 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 a compare register is set by bit 2 (CRC002) of capture/compare control
register 00 (CRC00).
CR010 is set by 16-bit memory manipulation instruction.
Reset signal generation clears CR010 to 0000H.
Figure 6-4. Format of 16-Bit Timer Capture/Compare Register 010 (CR010)
Address: FF16H, FF17H After reset: 0000H R/W
Symbol
FF17H
FF16H
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
CR010
•
•
When CR010 is used as a compare register
The value set in CR010 is constantly compared with the 16-bit timer counter 00 (TM00) count value, and an
interrupt request (INTTM010) is generated if they match.
When CR010 is used as a capture register
It is possible to select the valid edge of the TI000 pin as the capture trigger. The TI000 valid edge is set by
means of prescaler mode register 00 (PRM00) (refer to Table 6-3).
Table 6-3. CR010 Capture Trigger and Valid Edge of TI000 Pin (CRC002 = 1)
CR010 Capture Trigger
TI000 Pin Valid Edge
ES010
ES000
Falling edge
Falling edge
Rising edge
0
0
1
0
1
1
Rising edge
Both rising and falling edges
Both rising and falling edges
Remarks 1. Setting ES010, ES000 = 1, 0 is prohibited.
2. ES010, ES000: Bits 5 and 4 of prescaler mode register 00 (PRM00)
CRC002: Bit 2 of capture/compare control register 00 (CRC00)
Cautions 1. In the free-running mode and in the clear & start mode using the valid edge of the TI000
pin, if CR010 is set to 0000H, an interrupt request (INTTM010) is generated when CR010
changes from 0000H to 0001H following overflow (FFFFH).
2. If the new value of CR010 is less than the value of 16-bit timer counter 0 (TM00), TM00
continues counting, overflows, and then starts counting from 0 again. If the new value of
CR010 is less than the old value, therefore, the timer must be reset to be restarted after
the value of CR010 is changed.
3. The value of CR010 after 16-bit timer/event counter 00 has stopped is not guaranteed.
4. The capture operation may not be performed for CR010 set in compare mode even if a
capture trigger is input.
5. If the register read period and the input of the capture trigger conflict when CR010 is
used as a capture register, the capture trigger input takes precedence and the read data
is undefined. Also, if the timer count stop and the input of the capture trigger conflict,
the capture data is undefined.
6. Changing the CR010 setting during TM00 operation may cause a malfunction. To change
the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing
compare register during timer operation.
86
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.3 Registers to Control 16-Bit Timer/Event Counter 00
The following six types of registers are used to control 16-bit timer/event counter 00.
• 16-bit timer mode control register 00 (TMC00)
• Capture/compare control register 00 (CRC00)
• 16-bit timer output control register 00 (TOC00)
• Prescaler mode register 00 (PRM00)
• Port mode register 3 (PM3)
• Port register 3 (P3)
(1) 16-bit timer mode control register 00 (TMC00)
This register sets the 16-bit timer operating mode, the 16-bit timer counter 00 (TM00) clear mode, and output
timing, and detects an overflow.
TMC00 is set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets the value of TMC00 to 00H.
Caution 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and TMC003
(operation stop mode) are set to a value other than 0, 0, respectively. Set TMC002 and
TMC003 to 0, 0 to stop the operation.
87
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-5. Format of 16-Bit Timer Mode Control Register 00 (TMC00)
Address: FF60H After reset: 00H R/W
Symbol
TMC00
7
0
6
0
5
0
4
0
3
2
1
<0>
TMC003TMC002TMC001 OVF00
TMC003 TMC002 TMC001
Operating mode and clear
mode selection
TO00 inversion timing selection
No change
Interrupt request generation
Not generated
0
0
0
0
0
1
0
1
0
Operation stop
(TM00 cleared to 0)
Free-running mode
Match between TM00 and
CR000 or match between
TM00 and CR010
<When operating as compare
register>
Generated on match between
TM00 and CR000, or match
between TM00 and CR010
<When operating as capture
register>
0
1
1
Match between TM00 and
CR000, match between TM00
and CR010 or TI000 pin valid
edge
Generated on TI000 pin and
TI010 pin valid edge
1
1
1
0
0
1
0
1
0
Clear & start occurs on valid
edge of TI000 pin
−
Clear & start occurs on match
between TM00 and CR000
Match between TM00 and
CR000 or match between
TM00 and CR010
1
1
1
Match between TM00 and
CR000, match between TM00
and CR010 or TI000 pin valid
edge
OVF00
Overflow detection of 16-bit timer counter 00 (TM00)
0
1
Overflow not detected
Overflow detected
Cautions 1. The timer operation must be stopped before writing to bits other than the OVF00 flag.
2. If the timer is stopped, timer counts and timer interrupts do not occur, even if a signal is
input to the TI000/TI010 pins.
3. Except when TI000 pin valid edge is selected as the count clock, stop the timer operation
before setting STOP mode or system clock stop mode; otherwise the timer may malfunction
when the system clock starts.
4. Set the valid edge of the TI000 pin with bits 4 and 5 of prescaler mode register 00 (PRM00)
after stopping the timer operation.
5. If the clear & start mode entered on a match between TM00 and CR000, clear & start mode at
the valid edge of the TI000 pin, or free-running mode is selected, when the set value of CR000
is FFFFH and the TM00 value changes from FFFFH to 0000H, the OVF00 flag is set to 1.
6. Even if the OVF00 flag is cleared before the next count clock is counted (before TM00
becomes 0001H) after the occurrence of a TM00 overflow, the OVF00 flag is re-set newly and
clear is disabled.
7. The capture operation is performed at the fall of the count clock. An interrupt request input
(INTTM0n0), however, occurs at the rise of the next count clock.
Remark TM00: 16-bit timer counter 00
CR000: 16-bit timer capture/compare register 000
CR010: 16-bit timer capture/compare register 010
88
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(2) Capture/compare control register 00 (CRC00)
This register controls the operation of the 16-bit capture/compare registers (CR000, CR010).
CRC00 is set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets the value of CRC00 to 00H.
Figure 6-6. Format of Capture/Compare Control Register 00 (CRC00)
Address: FF62H After reset: 00H R/W
Symbol
CRC00
7
0
6
0
5
0
4
0
3
0
2
1
0
CRC002
CRC001
CRC000
CRC002
CR010 operating mode selection
0
1
Operate as compare register
Operate as capture register
CRC001
CR000 capture trigger selection
0
1
Capture on valid edge of TI010 pin
Capture on valid edge of TI000 pin by reverse phaseNote
CRC000
CR000 operating mode selection
Operate as compare register
0
1
Operate as capture register
Note When the CRC001 bit value is 1, capture is not performed if both the rising and falling edges have been
selected as the valid edges of the TI000 pin.
Cautions 1. The timer operation must be stopped before setting CRC00.
2. When the clear & start mode entered on a match between TM00 and CR000 is selected by
16-bit timer mode control register 00 (TMC00), CR000 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 00
(PRM00) (refer to Figure 6-17).
89
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(3) 16-bit timer output control register 00 (TOC00)
This register controls the operation of the 16-bit timer/event counter output controller. It sets timer output F/F
set/reset, output inversion enable/disable, 16-bit timer/event counter 00 timer output enable/disable, one-shot
pulse output operation enable/disable, and output trigger of one-shot pulse by software.
TOC00 is set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets the value of TOC00 to 00H.
Figure 6-7. Format of 16-Bit Timer Output Control Register 00 (TOC00)
Address: FF63H After reset: 00H R/W
Symbol
TOC00
7
0
<6>
<5>
4
<3>
<2>
1
<0>
OSPT00
OSPE00
TOC004
LVS00
LVR00
TOC001
TOE00
OSPT00
One-shot pulse output trigger control via software
0
1
No one-shot pulse output trigger
One-shot pulse output trigger
OSPE00
One-shot pulse output operation control
0
1
Successive pulse output mode
One-shot pulse output modeNote
TOC004
Timer output F/F control using match of CR010 and TM00
0
1
Disables inversion operation
Enables inversion operation
LVS00
LVR00
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
TOC001
Timer output F/F control using match of CR000 and TM00
0
1
Disables inversion operation
Enables inversion operation
TOE00
Timer output control
0
1
Disables output (output fixed to level 0)
Enables output
Note The one-shot pulse output mode operates correctly only in the free-running mode and the mode in which
clear & start occurs at the TI000 pin valid edge. In the mode in which clear & start occurs on a match
between TM00 and CR000, one-shot pulse output is not possible because an overflow does not occur.
Cautions 1. Timer operation must be stopped before setting other than OSPT00.
2. If LVS00 and LVR00 are read, 0 is read.
3. OSPT00 is automatically cleared after data is set, so 0 is read.
4. Do not set OSPT00 to 1 other than in one-shot pulse output mode.
5. A write interval of two cycles or more of the count clock selected by prescaler mode register
00 (PRM00) is required, when OSPT00 is set to 1 successively.
6. When the TOE00 is 0, set the TOE00, LVS00, and LVR00 at the same time with the 8-bit
memory manipulation instruction. When the TOE00 is 1, the LVS00 and LVR00 can be set
with the 1-bit memory manipulation instruction.
90
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(4) Prescaler mode register 00 (PRM00)
This register is used to set the 16-bit timer counter 00 (TM00) count clock and the TI000, TI010 pin input valid
edges.
PRM00 is set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets the value of PRM00 to 00H.
Figure 6-8. Format of Prescaler Mode Register 00 (PRM00)
Address: FF61H After reset: 00H R/W
Symbol
PRM00
7
6
5
4
3
0
2
0
1
0
ES110
ES100
ES010
ES000
PRM001
PRM000
ES110
ES100
TI010 pin valid edge selection
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both falling and rising edges
ES010
ES000
TI000 pin valid edge selection
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both falling and rising edges
PRM001
PRM000
Count clock selection
0
0
1
1
0
1
0
1
fXP (10 MHz)
fXP/22 (2.5 MHz)
fXP/28 (39.06 kHz)
TI000 pin valid edgeNote
Remarks 1. fXP: Oscillation frequency of clock supplied to peripheral hardware
2. ( ): fXP = 10 MHz
Note The external clock requires a pulse longer than two cycles of the internal count clock (fXP).
91
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Cautions 1. Always set data to PRM00 after stopping the timer operation.
2. If the valid edge of the TI000 pin is to be set as the count clock, do not set the clear/start
mode and the capture trigger at the valid edge of the TI000 pin.
3. In the following cases, note with caution that the valid edge of the TI0n0 pin is detected.
<1> Immediately after a system reset, if a high level is input to the TI0n0 pin, the
operation of the 16-bit timer counter 00 (TM00) is enabled
→ If the rising edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a rising edge is detected immediately after the TM00 operation is
enabled.
<2> If the TM00 operation is stopped while the TI0n0 pin is high level, TM00 operation is
then enabled after a low level is input to the TI0n0 pin
→ If the falling edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a falling edge is detected immediately after the TM00 operation is
enabled.
<3> If the TM00 operation is stopped while the TI0n0 pin is low level, TM00 operation is
then enabled after a high level is input to the TI0n0 pin
→ If the rising edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a rising edge is detected immediately after the TM00 operation is
enabled.
4. The sampling clock used to eliminate noise differs when a TI000 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 fXP, and in the latter case the count clock is selected by prescaler mode register 00
(PRM00). 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.
5. When using P31 as the input pin (TI010) of the valid edge, it cannot be used as a timer
output (TO00). When using P31 as the timer output pin (TO00), it cannot be used as the
input pin (TI010) of the valid edge.
Remark n = 0, 1
(5) Port mode register 3 (PM3)
This register sets port 3 input/output in 1-bit units.
When using the P31/TO00/TI010/INTP2 pin for timer output, set PM31 and the output latch of P31 to 0.
When using the P30/TI000/INTP0 and P31/TO00/TI010/INTP2 pins as a timer input, set PM30 and PM31 to 1.
At this time, the output latches of P30 and P31 can be either 0 or 1.
PM3 is set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets the value of PM3 to FFH.
Figure 6-9. Format of Port Mode Register 3 (PM3)
Address: FF23H After reset: FFH R/W
Symbol
PM3
7
1
6
1
5
1
4
1
3
1
2
1
1
0
PM31 PM30
PM3n P3n pin I/O mode selection (n = 0 or 1)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
92
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.4 Operation of 16-Bit Timer/Event Counter 00
6.4.1 Interval timer operation
Setting 16-bit timer mode control register 00 (TMC00) and capture/compare control register 00 (CRC00) as shown
in Figure 6-10 allows operation as an interval timer.
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figure 6-10 for the set value).
<2> Set any value to the CR000 register.
<3> Set the count clock by using the PRM00 register.
<4> Set the TMC00 register to start the operation (see Figure 6-10 for the set value).
Caution Changing the CR000 setting during TM00 operation may cause a malfunction. To change the
setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare
register during timer operation.
Remark For how to enable the INTTM000 interrupt, see CHAPTER 12 INTERRUPT FUNCTIONS.
Interrupt requests are generated repeatedly using the count value set in 16-bit timer capture/compare register 000
(CR000) beforehand as the interval.
When the count value of 16-bit timer counter 00 (TM00) matches the value set to CR000, counting continues with
the TM00 value cleared to 0 and the interrupt request signal (INTTM000) is generated.
The count clock of the 16-bit timer/event counter can be selected using bits 0 and 1 (PRM000, PRM001) of
prescaler mode register 00 (PRM00).
93
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-10. Control Register Settings for Interval Timer Operation
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
0/1
0/1
0
CR000 used as compare register
(b) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
0
PRM001 PRM000
PRM00 0/1
0/1
0/1
0/1
0/1
0/1
Selects count clock.
Setting invalid (setting “10” is prohibited.)
Setting invalid (setting “10” is prohibited.)
(c) 16-bit timer mode control register 00 (TMC00)
7
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
1
0/1
0
Clears and starts on match between TM00 and CR000.
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with the interval timer. See the
description of the respective control registers for details.
Figure 6-11. Interval Timer Configuration Diagram
16-bit timer capture/compare
register 000 (CR000)
INTTM000
f
XP
f
f
XP/22
XP/28
Note
16-bit timer counter 00
(TM00)
OVF00
Noise
eliminator
TI000/INTP0/P30
Clear
circuit
f
XP
Note OVF00 is set to 1 only when 16-bit timer capture/compare register 000 is set to FFFFH.
94
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-12. Timing of Interval Timer Operation
t
Count clock
TM00 count value
0000H
0001H
N
0000H 0001H
N
0000H 0001H
N
N
Timer operation enabled
N
Clear
Clear
N
N
CR000
INTTM000
Interrupt request generated
Interrupt request generated
Remark Interval time = (N + 1) × t
N = 0001H to FFFFH (settable range)
When the compare register is changed during timer count operation, if the value after 16-bit timer capture/compare
register 000 (CR000) is changed is smaller than that of 16-bit timer counter 00 (TM00), TM00 continues counting,
overflows and then restarts counting from 0. Thus, if the value (M) after the CR000 change is smaller than that (N)
before the change, it is necessary to restart the timer after changing CR000.
Figure 6-13. Timing After Change of Compare Register During Timer Count Operation (N → M: N > M)
Count clock
N
M
CR000
X – 1
X
FFFFH
0000H
0001H
0002H
TM00 count value
Remark N > X > M
6.4.2 External event counter operation
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figure 6-14 for the set value).
<2> Set the count clock by using the PRM00 register.
<3> Set any value to the CR000 register (0000H cannot be set).
<4> Set the TMC00 register to start the operation (see Figure 6-14 for the set value).
Remarks 1. For the setting of the TI000 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 interrupt, see CHAPTER 12 INTERRUPT FUNCTIONS.
95
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
The external event counter counts the number of external clock pulses to be input to the TI000 pin with using 16-bit
timer counter 00 (TM00).
TM00 is incremented each time the valid edge specified by prescaler mode register 00 (PRM00) is input.
When the TM00 count value matches the 16-bit timer capture/compare register 000 (CR000) value, TM00 is
cleared to 0 and the interrupt request signal (INTTM000) is generated.
Input a value other than 0000H to CR000. (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 (ES000 and ES010) of
prescaler mode register 00 (PRM00).
Because an operation is carried out only when the valid edge of the TI000 pin is detected twice after sampling with
the internal clock (fXP), noise with a short pulse width can be removed.
Figure 6-14. Control Register Settings in External Event Counter Mode (with Rising Edge Specified)
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
0/1
0/1
0
CR000 used as compare register
(b) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
0
PRM001 PRM000
PRM00 0/1
0/1
0
1
1
1
Selects external clock.
Specifies rising edge for pulse width detection.
Setting invalid (setting “10” is prohibited.)
(c) 16-bit timer mode control register 00 (TMC00)
7
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
1
0/1
0
Clears and starts on match between TM00 and CR000.
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with the external event counter.
See the description of the respective control registers for details.
96
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-15. External Event Counter Configuration Diagram
Internal bus
16-bit timer capture/compare
register 000 (CR000)
Match
Clear
INTTM000
OVF00Note
f
XP
16-bit timer counter 00 (TM00)
Noise eliminator
Valid edge of TI000
Note OVF00 is 1 only when 16-bit timer capture/compare register 000 is set to FFFFH.
Figure 6-16. External Event Counter Operation Timing (with Rising Edge Specified)
(1) INTTM000 generation timing immediately after operation starts
Counting is started after a valid edge is detected twice.
Timer operation starts
Count starts
TI000 pin input
TM00 count value
CR000
2
3
1
0000H 0001H 0002H 0003H
N
N
–2
N–1
N
0000H 0001H 0002H
INTTM000
(2) INTTM000 generation timing after INTTM000 has been generated twice
TI000 pin input
TM00 count value
CR000
N
0000H 0001H 0002H 0003H 0004H
N
N
–1
N
0000H 0001H 0002H 0003H
INTTM000
Caution When reading the external event counter count value, TM00 should be read.
97
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.4.3 Pulse width measurement operations
It is possible to measure the pulse width of the signals input to the TI000 pin and TI010 pin using 16-bit timer
counter 00 (TM00).
There are two measurement methods: measuring with TM00 used in free-running mode, and measuring by
restarting the timer in synchronization with the edge of the signal input to the TI000 pin.
When an interrupt occurs, read the valid value of the capture register, check the overflow flag, and then calculate
the necessary pulse width. Clear the overflow flag after checking it.
The capture operation is not performed until the signal pulse width is sampled in the count clock cycle selected by
prescaler mode register 00 (PRM00) and the valid level of the TI000 or TI010 pin is detected twice, thus eliminating
noise with a short pulse width.
Figure 6-17. CR010 Capture Operation with Rising Edge Specified
Count clock
TM00
N − 3
N − 2
N − 1
N
N + 1
TI000
Rising edge detection
N
CR010
INTTM010
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figures 6-18, 6-21, 6-23, and 6-25 for the set value).
<2> Set the count clock by using the PRM00 register.
<3> Set the TMC00 register to start the operation (see Figures 6-18, 6-21, 6-23, and 6-25 for the set value).
Caution To use two capture registers, set the TI000 and TI010 pins.
Remarks 1. For the setting of the TI000 (or TI010) pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 (or INTTM010) interrupt, see CHAPTER 12 INTERRUPT
FUNCTIONS.
98
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(1) Pulse width measurement with free-running counter and one capture register
Specify both the rising and falling edges as the valid edges of the TI000 pin, by using bits 4 and 5 (ES000 and
ES010) of PRM00.
When 16-bit timer counter 00 (TM00) is operated in free-running mode, and the valid edge specified by
PRM00 is input, the value of TM00 is taken into 16-bit timer capture/compare register 010 (CR010) and an
external interrupt request signal (INTTM010) is set.
Sampling is performed using the count clock selected by PRM00, and a capture operation is only performed
when a valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width.
Caution The measurable pulse width in this operation example is up to 1 cycle of the timer counter.
Figure 6-18. Control Register Settings for Pulse Width Measurement with Free-Running Counter
and One Capture Register (When TI000 and CR010 Are Used)
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
1
0/1
0
CR000 used as compare register
CR010 used as capture register
(b) Prescaler mode register 00 (PRM00)
ES101 ES100 ES010 ES000
PRM00 0/1 0/1
3
0
2
0
PRM001 PRM000
1
1
0/1
0/1
Selects count clock (setting “11” is prohibited).
Specifies both edges for pulse width detection.
Setting invalid (setting “10” is prohibited.)
(c) 16-bit timer mode control register 00 (TMC00)
7
0
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
0/1
0
Free-running mode
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
99
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-19. Configuration Diagram for Pulse Width Measurement by Free-Running Counter
f
XP
XP/22
XP/26
16-bit timer/counter 00
(TM00)
f
f
16-bit timer capture/compare
register 010 (CR010)
TI000/INTP0/P30
INTTM010
Internal bus
Figure 6-20. Timing of Pulse Width Measurement Operation by 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
TM00 count value
TI000 pin input
CR010 capture value
INTTM010
D0
D1
D2
D3
(D1 − D0) × t
(D2 − D1) × tNote
(D3 − D2) × t
Note The carry flag is set to 1. Ignore this setting.
(2) Measurement of two pulse widths with free-running counter
When 16-bit timer counter 00 (TM00) is operated in free-running mode, it is possible to simultaneously
measure the pulse widths of the two signals input to the TI000 pin and the TI010 pin.
Specify both the rising and falling edges as the valid edges of the TI000 and TI010 pins, by using bits 4 and 5
(ES000 and ES010) and bits 6 and 7 (ES100 and ES110) of PRM00.
When the valid edge specified by bits 4 and 5 (ES000 and ES010) of PRM00 is input to the TI000 pin, the
value of TM00 is taken into 16-bit timer capture/compare register 000 (CR010) and an interrupt request signal
(INTTM010) is set.
Also, when the valid edge specified by bits 6 and 7 (ES100 and ES110) of PRM00 is input to the TI010 pin, the
value of TM00 is taken into 16-bit timer capture/compare register 000 (CR000) and an interrupt request signal
(INTTM000) is set.
Sampling is performed using the count clock cycle selected by prescaler mode register 00 (PRM00), and a
capture operation is only performed when a valid level of the TI000 or TI010 pin is detected twice, thus
eliminating noise with a short pulse width.
100
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Caution The measurable pulse width in this operation example is up to 1 cycle of the timer counter.
Figure 6-21. Control Register Settings for Measurement of Two Pulse Widths with Free-Running Counter
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
1
0
1
CR000 used as capture register
Captures valid edge of TI010 pin to CR000.
CR010 used as capture register
(b) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
0
PRM001 PRM000
PRM00
1
1
1
1
0/1
0/1
Selects count clock (setting “11” is prohibited).
Specifies both edges for pulse width detection.
Specifies both edges for pulse width detection.
(c) 16-bit timer mode control register 00 (TMC00)
7
0
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
0/1
0
Free-running mode
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
101
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-22. 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
TM00 count value
TI000 pin input
CR010 capture value
INTTM010
D0
D1
D2
TI010 pin input
CR000 capture value
INTTM000
D1
D2 + 1
(D1 − D0) × t
(D2 − D1) × tNote
(D3 − D2) × t
((D2 + 1) − D1) × tNote
Note The carry flag is set to 1. Ignore this setting.
(3) Pulse width measurement with free-running counter and two capture registers
When 16-bit timer counter 00 (TM00) is operated in free-running mode, it is possible to measure the pulse
width of the signal input to the TI000 pin.
Specify both the rising and falling edges as the valid edges of the TI000 pin, by using bits 4 and 5 (ES000 and
ES010) of PRM00.
When the valid edge specified by bits 4 and 5 (ES000 and ES010) of PRM00 is input to the TI010 pin, the
value of TM00 is taken into 16-bit timer capture/compare register 000 (CR010) and an interrupt request signal
(INTTM010) is set.
Also, when the inverse edge to that of the capture operation is input into CR010, the value of TM00 is taken
into 16-bit timer capture/compare register 000 (CR000).
Sampling is performed using the count clock cycle selected by prescaler mode register 00 (PRM00), and a
capture operation is only performed when a valid level of the TI000 pin is detected twice, thus eliminating
noise with a short pulse width.
Caution The measurable pulse width in this operation example is up to 1 cycle of the timer counter.
102
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-23. Control Register Settings for Pulse Width Measurement with Free-Running Counter and
Two Capture Registers (with Rising Edge Specified)
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
1
1
1
CR000 used as capture register
Captures to CR000 at inverse edge
to valid edge of TI000Note
.
CR010 used as capture register
(b) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
0
PRM001 PRM000
PRM00 0/1
0/1
0
1
0/1
0/1
Selects count clock (setting “11” is prohibited).
Specifies rising edge for pulse width detection.
Setting invalid (setting “10” is prohibited.)
(c) 16-bit timer mode control register 00 (TMC00)
7
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
0
1
0/1
0
Free-running mode
Note If the valid edge of TI000 pin is specified to be both the rising and falling edges, 16-bit timer
capture/compare register 000 (CR000) cannot perform the capture operation. When the CRC001 bit value
is 1, the TM00 count value is not captured in the CR000 register when a valid edge of the TI010 pin is
detected, but the input from the TI010 pin can be used as an external interrupt source because INTTM000 is
generated at that timing.
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with pulse width measurement.
See the description of the respective control registers for details.
103
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-24. Timing of Pulse Width Measurement Operation by Free-Running Counter
and Two Capture Registers (with Rising Edge Specified)
t
Count clock
TM00 count value
TI000 pin input
0000H 0001H
D0 D0 + 1
D1 D1 + 1
FFFFH 0000H
D2 D2 + 1
D3
CR010 capture value
CR000 capture value
INTTM010
D0
D2
D1
D3
(D1 − D0) × t
(D2 − D1) × tNote
(D3 − D2) × t
Note The carry flag is set to 1. Ignore this setting.
(4) Pulse width measurement by means of restart
Specify both the rising and falling edges as the valid edges of the TI000 pin, by using bits 4 and 5 (ES000 and
ES010) of PRM00.
When a valid edge of the TI000 pin is detected, the count value of 16-bit timer/counter 00 (TM00) is taken into
16-bit timer capture/compare register 010 (CR010), and then the pulse width of the signal input to the TI000
pin is measured by clearing TM00 and restarting the count.
Sampling is performed at the interval selected by prescaler mode register 00 (PRM00) and a capture operation
is only performed when a valid level of the TI000 pin is detected twice, thus eliminating noise with a short
pulse width.
Caution The measurable pulse width in this operation example is up to 1 cycle of the timer counter.
Figure 6-25. Control Register Settings for Pulse Width Measurement by Means of Restart
(with Rising Edge Specified) (1/2)
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
1
1
1
CR000 used as capture register
Captures to CR000 at inverse edge to valid edge of TI000Note
.
CR010 used as capture register
104
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-25. Control Register Settings for Pulse Width Measurement by Means of Restart
(with Rising Edge Specified) (2/2)
(b) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
0
PRM001 PRM000
PRM00 0/1
0/1
0
1
0/1
0/1
Selects count clock (setting “11” is prohibited).
Specifies rising edge for pulse width detection.
Setting invalid (setting “10” is prohibited.)
(c) 16-bit timer mode control register 00 (TMC00)
7
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
0
0/1
0
Clears and starts at valid edge of TI000 pin.
Note If the valid edge of TI000 pin is specified to be both the rising and falling edges, 16-bit timer
capture/compare register 000 (CR000) cannot perform the capture operation.
Figure 6-26. 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
TM00 count value
TI000 pin input
CR010 capture value
D0
D2
D1
CR000 capture value
INTTM010
(D1 + 1) × t
(D2 + 1) × t
105
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.4.4 Square-wave output operation
Setting
The basic operation setting procedure is as follows.
<1> Set the count clock by using the PRM00 register.
<2> Set the CRC00 register (see Figure 6-27 for the set value).
<3> Set the TOC00 register (see Figure 6-27 for the set value).
<4> Set any value to the CR000 register (0000H cannot be set).
<5> Set the TMC00 register to start the operation (see Figure 6-27 for the set value).
Caution Changing the CR000 setting during TM00 operation may cause a malfunction. To change the
setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare
register during timer operation.
Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 interrupt, see CHAPTER 12 INTERRUPT FUNCTIONS.
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 000 (CR000).
The TO00 pin output status is reversed at intervals determined by the count value preset to CR000 + 1 by setting
bit 0 (TOE00) and bit 1 (TOC001) of 16-bit timer output control register 00 (TOC00) to 1. This enables a square wave
with any selected frequency to be output.
Figure 6-27. Control Register Settings in Square-Wave Output Mode (1/2)
(a) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
0
PRM001 PRM000
PRM00 0/1
0/1
0/1
0/1
0/1
0/1
Selects count clock.
Setting invalid (setting “10” is prohibited.)
Setting invalid (setting “10” is prohibited.)
(b) Capture/compare control register 00 (CRC00)
7
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
0
0/1
0/1
0
CR000 used as compare register
106
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-27. Control Register Settings in Square-Wave Output Mode (2/2)
(c) 16-bit timer output control register 00 (TOC00)
7
0
OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00
TOC00
0
0
0
0/1
0/1
1
1
Enables TO00 output.
Inverts output on match between TM00 and CR000.
Specifies initial value of TO00 output F/F (setting “11” is prohibited).
Does not invert output on match between TM00 and CR010.
Disables one-shot pulse output.
(d) 16-bit timer mode control register 00 (TMC00)
7
0
6
5
4
TMC003 TMC002 TMC001 OVF00
TMC00
0
0
0
1
1
0
0
Clears and starts on match between TM00 and CR000.
Remark 0/1: Setting 0 or 1 allows another function to be used simultaneously with square-wave output. See the
description of the respective control registers for details.
Figure 6-28. Square-Wave Output Operation Timing
Count clock
TM00 count value
CR000
0000H 0001H 0002H
N − 1
N
0000H 0001H 0002H
N − 1
N
0000H
N
INTTM000
TO00 pin output
107
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.4.5 PPG output operations
Setting 16-bit timer mode control register 00 (TMC00) and capture/compare control register 00 (CRC00) as shown
in Figure 6-29 allows operation as PPG (Programmable Pulse Generator) output.
Setting
The basic operation setting procedure is as follows.
<1> Set the CRC00 register (see Figure 6-29 for the set value).
<2> Set any value to the CR000 register as the cycle.
<3> Set any value to the CR010 register as the duty factor.
<4> Set the TOC00 register (see Figure 6-29 for the set value).
<5> Set the count clock by using the PRM00 register.
<6> Set the TMC00 register to start the operation (see Figure 6-29 for the set value).
Caution Changing the CRC0n0 setting during TM00 operation may cause a malfunction. To change the
setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing compare
register during timer operation.
Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 interrupt, see CHAPTER 12 INTERRUPT FUNCTIONS.
3. n = 0 or 1
In the PPG output operation, rectangular waves are output from the TO00 pin with the pulse width and the cycle
that correspond to the count values preset in 16-bit timer capture/compare register 010 (CR010) and in 16-bit timer
capture/compare register 000 (CR000), respectively.
108
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-29. Control Register Settings for PPG Output Operation
(a) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
CRC00
0
×
0
CR000 used as compare register
CR010 used as compare register
(b) 16-bit timer output control register 00 (TOC00)
7
OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00
TOC00
0
0
0
1
0/1
0/1
1
1
Enables TO00 output.
Inverts output on match between TM00 and CR000.
Specifies initial value of TO00 output F/F (setting "11" is prohibited).
Inverts output on match between TM00 and CR010.
Disables one-shot pulse output.
(c) Prescaler mode register 00 (PRM00)
ES110 ES100 ES010 ES000
3
0
2
PRM001 PRM000
PRM00 0/1
0/1
0/1
0/1
0
0/1
0/1
Selects count clock.
Setting invalid (setting “10” is prohibited.)
Setting invalid (setting “10” is prohibited.)
(d) 16-bit timer mode control register 00 (TMC00)
7
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
1
0
0
Clears and starts on match between TM00 and CR000.
Cautions 1. Values in the following range should be set in CR000 and CR010.
0000H < CR010 < CR000 ≤ FFFFH
2. The cycle of the pulse generated through PPG output (CR000 setting value + 1) has a duty of
(CR010 setting value + 1)/(CR000 setting value + 1).
Remark ×: Don’t care
109
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-30. Configuration Diagram of PPG Output
16-bit timer capture/compare
register 000 (CR000)
f
XP
f
f
XP/22
XP/28
Clear
circuit
16-bit timer counter 00
(TM00)
Noise
eliminator
TI000/INTP0/P30
TO00/TI010/
INTP2/P31
f
XP
16-bit timer capture/compare
register 010 (CR010)
Figure 6-31. PPG Output Operation Timing
t
Count clock
TM00 count value
0000H 0001H
M − 1
M
0000H 0001H
N
N − 1
N
Clear
Clear
CR000 capture value
CR010 capture value
TO00
N
M
Pulse width: (M + 1) × t
1 cycle: (N + 1) × t
Remark 0000H < M < N ≤ FFFFH
110
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.4.6 One-shot pulse output operation
16-bit timer/event counter 00 can output a one-shot pulse in synchronization with a software trigger or an external
trigger (TI000 pin input).
Setting
The basic operation setting procedure is as follows.
<1> Set the count clock by using the PRM00 register.
<2> Set the CRC00 register (see Figures 6-32 and 6-34 for the set value).
<3> Set the TOC00 register (see Figures 6-32 and 6-34 for the set value).
<4> Set any value to the CR000 and CR010 registers (0000H cannot be set).
<5> Set the TMC00 register to start the operation (see Figures 6-32 and 6-34 for the set value).
Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 3 (PM3).
2. For how to enable the INTTM000 (if necessary, INTTM010) interrupt, see CHAPTER 12
INTERRUPT FUNCTIONS.
(1) One-shot pulse output with software trigger
A one-shot pulse can be output from the TO00 pin by setting 16-bit timer mode control register 00 (TMC00),
capture/compare control register 00 (CRC00), and 16-bit timer output control register 00 (TOC00) as shown in
Figure 6-32, and by setting bit 6 (OSPT00) of the TOC00 register to 1 by software.
By setting the OSPT00 bit to 1, 16-bit timer/event counter 00 is cleared and started, and its output becomes
active at the count value (N) set in advance to 16-bit timer capture/compare register 010 (CR010). After that,
the output becomes inactive at the count value (M) set in advance to 16-bit timer capture/compare register 000
(CR000)Note
.
Even after the one-shot pulse has been output, the TM00 register continues its operation. To stop the TM00
register, the TMC003 and TMC002 bits of the TMC00 register must be cleared to 00.
Note The case where N < M is described here. When N > M, the output becomes active with the CR000
register and inactive with the CR010 register. Do not set N to M.
Cautions 1. Do not set the OSPT00 bit to 1 again while the one-shot pulse is being output. To output the
one-shot pulse again, wait until the current one-shot pulse output is completed.
2. When using the one-shot pulse output of 16-bit timer/event counter 00 with a software
trigger, do not change the level of the TI000 pin or its alternate-function port pin.
Because the external trigger is valid even in this case, the timer is cleared and started even
at the level of the TI000 pin or its alternate-function port pin, resulting in the output of a
pulse at an undesired timing.
111
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-32. Control Register Settings for One-Shot Pulse Output with Software Trigger
(a) Prescaler mode register 00 (PRM00)
ES110
0/1
ES100
0/1
ES010
0/1
ES000
0/1
3
0
2
0
PRM001 PRM010
0/1 0/1
PRM00
Selects count clock.
Setting invalid
(setting “10” is prohibited.)
Setting invalid
(setting “10” is prohibited.)
(b) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
0/1
CRC00
0
0
CR000 as compare register
CR010 as compare register
(c) 16-bit timer output control register 00 (TOC00)
7
0
OSPT00 OSPE00 TOC004 LVS00
0/1
LVR00 TOC001 TOE00
0/1
TOC00
0
1
1
1
1
Enables TO00 output.
Inverts output upon match
between TM00 and CR000.
Specifies initial value of
TO00 output F/F (setting “11” is prohibited.)
Inverts output upon match
between TM00 and CR010.
Sets one-shot pulse output mode.
Set to 1 for output.
(d) 16-bit timer mode control register 00 (TMC00)
7
0
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
0
1
0
0
Free-running mode
Caution Do not set 0000H to the CR000 and CR010 registers.
112
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-33. Timing of One-Shot Pulse Output Operation with Software Trigger
Set TMC00 to 04H
(TM00 count starts)
Count clock
TM00 count
CR010 set value
CR000 set value
0000H 0001H
N
N + 1 0000H
N − 1
N
N
M − 1
M
M + 1 M + 2
N
N
N
M
M
M
M
OSPT00
INTTM010
INTTM000
TO00 pin output
Caution 16-bit timer counter 00 starts operating as soon as a value other than 00 (operation stop
mode) is set to the TMC003 and TMC002 bits.
Remark N < M
(2) One-shot pulse output with external trigger
A one-shot pulse can be output from the TO00 pin by setting 16-bit timer mode control register 00 (TMC00),
capture/compare control register 00 (CRC00), and 16-bit timer output control register 00 (TOC00) as shown in
Figure 6-34, and by using the valid edge of the TI000 pin as an external trigger.
The valid edge of the TI000 pin is specified by bits 4 and 5 (ES000, ES010) of prescaler mode register 00
(PRM00). The rising, falling, or both the rising and falling edges can be specified.
When the valid edge of the TI000 pin is detected, the 16-bit timer/event counter is cleared and started, and the
output becomes active at the count value set in advance to 16-bit timer capture/compare register 010
(CR010). After that, the output becomes inactive at the count value set in advance to 16-bit timer
capture/compare register 000 (CR000)Note
.
Note The case where N < M is described here. When N > M, the output becomes active with the CR000
register and inactive with the CR010 register. Do not set N to M.
Caution Do not input the external trigger again while the one-shot pulse is output. To output the one-
shot pulse again, wait until the current one-shot pulse output is completed.
113
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-34. Control Register Settings for One-Shot Pulse Output with External Trigger
(with Rising Edge Specified)
(a) Prescaler mode register 00 (PRM00)
ES110
0/1
ES100
0/1
ES010
0
ES000
1
3
0
2
0
PRM001 PRM000
0/1 0/1
PRM00
Selects count clock
(setting “11” is prohibited).
Specifies the rising edge
for pulse width detection.
Setting invalid
(setting “10” is prohibited.)
(b) Capture/compare control register 00 (CRC00)
7
0
6
0
5
0
4
0
3
0
CRC002 CRC001 CRC000
0/1
CRC00
0
0
CR000 used as compare register
CR010 used as compare register
(c) 16-bit timer output control register 00 (TOC00)
7
0
OSPT00 OSPE00 TOC004 LVS00
0/1
LVR00 TOC001 TOE00
0/1
TOC00
0
1
1
1
1
Enables TO00 output.
Inverts output upon match
between TM00 and CR000.
Specifies initial value of
TO00 output F/F (setting “11” is prohibited.)
Inverts output upon match
between TM00 and CR010.
Sets one-shot pulse output mode.
(d) 16-bit timer mode control register 00 (TMC00)
7
0
6
0
5
0
4
0
TMC003 TMC002 TMC001 OVF00
TMC00
1
0
0
0
Clears and starts at
valid edge of TI000 pin.
Caution Do not set the CR000 and CR010 registers to 0000H.
114
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
Figure 6-35. Timing of One-Shot Pulse Output Operation with External Trigger (with Rising Edge Specified)
When TMC00 is set to 08H
(TM00 count starts)
t
Count clock
TM00 count value
CR010 set value
CR000 set value
0000H 0001H
0000H
N
N
N + 1 N + 2
M − 2 M − 1
M
M + 1 M + 2
N
N
N
M
M
M
M
TI000 pin input
INTTM010
INTTM000
TO00 pin output
Caution 16-bit timer counter 00 starts operating as soon as a value other than 00 (operation stop mode) is
set to the TMC002 and TMC003 bits.
Remark N < M
115
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
6.5 Cautions Related to 16-Bit Timer/Event Counter 00
(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 00 (TM00) is started asynchronously to the count clock.
Figure 6-36. Start Timing of 16-Bit Timer Counter 00 (TM00)
Count clock
0000H
0001H
0002H
0003H
0004H
TM00 count value
Timer start
(2) 16-bit timer counter 00 (TM00) operation
<1> 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and TMC003 (operation stop
mode) are set to a value other than 0, 0, respectively. Set TMC002 and TMC003 to 0, 0 to stop the
operation.
<2> Even if TM00 is read, the value is not captured by 16-bit timer capture/compare register 010 (CR010).
<3> When TM00 is read, count misses do not occur, since the input of the count clock is temporarily stopped
and then resumed after the read.
<4> If the timer is stopped, timer counts and timer interrupts do not occur, even if a signal is input to the
TI000/TI010 pins.
(3) Setting of 16-bit timer capture/compare registers 000, 010 (CR000, CR010)
<1> Set 16-bit timer capture/compare register 000 (CR000) to other than 0000H in the clear & start mode
entered on match between TM00 and CR000. This means a 1-pulse count operation cannot be
performed when this register is used as an external event counter.
<2> When the clear & start mode entered on a match between TM00 and CR000 is selected, CR000 should
not be specified as a capture register.
<3> In the free-running mode and in the clear & start mode using the valid edge of the TI000 pin, if CR0n0 is
set to 0000H, an interrupt request (INTTM0n0) is generated when CR0n0 changes from 0000H to
0001H following overflow (FFFFH).
<4> If the new value of CR0n0 is less than the value of TM00, TM00 continues counting, overflows, and then
starts counting from 0 again. If the new value of CR0n0 is less than the old value, therefore, the timer
must be reset to be restarted after the value of CR0n0 is changed.
116
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(4) Capture register data retention
The values of 16-bit timer capture/compare register 0n0 (CR0n0) after 16-bit timer/event counter 00 has
stopped are not guaranteed.
Remark n = 0, 1
(5) Setting of 16-bit timer mode control register 00 (TMC00)
The timer operation must be stopped before writing to bits other than the OVF00 flag.
(6) Setting of capture/compare control register 00 (CRC00)
The timer operation must be stopped before setting CRC00.
(7) Setting of 16-bit timer output control register 00 (TOC00)
<1> Timer operation must be stopped before setting other than OSPT00.
<2> If LVS00 and LVR00 are read, 0 is read.
<3> OSPT00 is automatically cleared after data is set, so 0 is read.
<4> Do not set OSPT00 to 1 other than in one-shot pulse output mode.
<5> A write interval of two cycles or more of the count clock selected by prescaler mode register 00 (PRM00)
is required, when OSPT00 is set to 1 successively.
(8) Setting of prescaler mode register 00 (PRM00)
Always set data to PRM00 after stopping the timer operation.
(9) Valid edge setting
Set the valid edge of the TI000 pin with bits 4 and 5 (ES000 and ES010) of prescaler mode register 00
(PRM00) after stopping the timer operation.
(10) One-shot pulse output
One-shot pulse output normally operates only in the free-running mode or in the clear & start mode at the valid
edge of the TI000 pin. Because an overflow does not occur in the clear & start mode on a match between
TM00 and CR000, one-shot pulse output is not possible.
(11) One-shot pulse output by software
<1> Do not set the OSPT00 bit to 1 again while the one-shot pulse is being output. To output the one-shot
pulse again, wait until the current one-shot pulse output is completed.
<2> When using the one-shot pulse output of 16-bit timer/event counter 00 with a software trigger, do not
change the level of the TI000 pin or its alternate function port pin. Because the external trigger is valid
even in this case, the timer is cleared and started even at the level of the TI000 pin or its alternate
function port pin, resulting in the output of a pulse at an undesired timing.
<3> Do not set the 16-bit timer capture/compare registers 000 and 010 (CR000 and CR010) to 0000H.
117
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(12) One-shot pulse output with external trigger
<1> Do not input the external trigger again while the one-shot pulse is output. To output the one-shot pulse
again, wait until the current one-shot pulse output is completed.
<2> Do not set the 16-bit timer capture/compare registers 000 and 010 (CR000 and CR010) to 0000H.
(13) Operation of OVF00 flag
<1> The OVF00 flag is also set to 1 in the following case.
Either of the clear & start mode entered on a match between TM00 and CR000, clear & start at the valid
edge of the TI000 pin, or free-running mode is selected.
↓
CR000 is set to FFFFH.
↓
When TM00 is counted up from FFFFH to 0000H.
Figure 6-37. Operation Timing of OVF00 Flag
Count clock
CR000
TM00
FFFFH
FFFEH
FFFFH
0000H
0001H
OVF00
INTTM000
<2> Even if the OVF00 flag is cleared before the next count clock is counted (before TM00 becomes 0001H)
after the occurrence of a TM00 overflow, the OVF00 flag is re-set newly and clear is disabled.
118
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(14) Conflicting operations
If the register read period and the input of the capture trigger conflict when CR000/CR010 is used as a capture
register, the capture trigger input takes precedence and the read data is undefined. Also, if the count stop of
the timer and the input of the capture trigger conflict, the captured data is undefined.
Figure 6-38. Capture Register Data Retention Timing
Count clock
N
N + 1
N + 2
M
M + 1
M + 2
TM00 count value
Edge input
INTTM010
Capture read signal
CR010 capture value
X
N + 2
M + 1
Capture
Capture, but
read value is
not guaranteed
(15) Capture operation
<1> If the valid edge of the TI000 pin is to be set as the count clock, do not set the clear/start mode and the
capture trigger at the valid edge of the TI000 pin.
<2> When the CRC001 bit value is 1, capture is not performed in the CR000 register if both the rising and
falling edges have been selected as the valid edges of the TI000 pin.
<3> When the CRC001 bit value is 1, the TM00 count value is not captured in the CR000 register when a
valid edge of the TI010 pin is detected, but the input from the TI010 pin can be used as an external
interrupt source because INTTM000 is generated at that timing.
<4> 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 00 (PRM00).
<5> The capture operation is performed at the fall of the count clock. A interrupt request input (INTTM0n0),
however, occurs at the rise of the next count clock.
<6> To use two capture registers, set the TI000 and TI010 pins.
(16) Compare operation
The capture operation may not be performed for CR0n0 set in compare mode even if a capture trigger is input.
Remark n = 0, 1
119
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(17) Changing compare register during timer operation
<1> With the 16-bit timer capture/compare register 0n0 (CR0n0) used as a compare register, when changing
CR0n0 around the timing of a match between 16-bit timer counter 00 (TM00) and 16-bit timer
capture/compare register 0n0 (CR0n0) during timer counting, the change timing may conflict with the
timing of the match, so the operation is not guaranteed in such cases. To change CR0n0 during timer
counting, INTTM000 interrupt servicing performs the following operation.
<Changing cycle (CR000)>
1. Disable the timer output inversion operation at the match between TM00 and CR000 (TOC001 = 0).
2. Disable the INTTM000 interrupt (TMMK000 = 1).
3. Rewrite CR000.
4. Wait for 1 cycle of the TM00 count clock.
5. Enable the timer output inversion operation at the match between TM00 and CR000 (TOC001 = 1).
6. Clear the interrupt request flag of INTTM000 (TMIF000 = 0).
7. Enable the INTTM000 interrupt (TMMK000 = 0).
<Changing duty (CR010)>
1. Disable the timer output inversion operation at the match between TM00 and CR010 (TOC004 = 0).
2. Disable the INTTM000 interrupt (TMMK000 = 1).
3. Rewrite CR010.
4. Wait for 1 cycle of the TM00 count clock.
5. Enable the timer output inversion operation at the match between TM00 and CR010 (TOC004 = 1).
6. Clear the interrupt request flag of INTTM000 (TMIF000 = 0).
7. Enable the INTTM000 interrupt (TMMK000 = 0).
While interrupts and timer output inversion are disabled (1 to 4 above), timer counting is continued. If
the value to be set in CR0n0 is small, the value of TM00 may exceed CR0n0. Therefore, set the value,
considering the time lapse of the timer clock and CPU clock after an INTTM000 interrupt has been
generated.
Remark n = 0, 1
<2> If CR010 is changed during timer counting without performing processing <1> above, the value in
CR010 may be rewritten twice or more, causing an inversion of the output level of the TO00 pin at each
rewrite.
120
User’s Manual U16898EJ3V0UD
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00
(18) Edge detection
<1> In the following cases, note with caution that the valid edge of the TI0n0 pin is detected.
(a) Immediately after a system reset, if a high level is input to the TI0n0 pin, the operation of the 16-bit
timer counter 00 (TM00) is enabled
→ If the rising edge or both rising and falling edges are specified as the valid edge of the TI0n0 pin,
a rising edge is detected immediately after the TM00 operation is enabled.
(b) If the TM00 operation is stopped while the TI0n0 pin is high level, TM00 operation is then enabled
after a low level is input to the TI0n0 pin
→ If the falling edge or both rising and falling edges are specified as the valid edge of the TI0n0 pin,
a falling edge is detected immediately after the TM00 operation is enabled.
(c) When the TM00 operation is stopped while the TI0n0 pin is low level, TM00 operation is then
enabled after a high level is input to the TI0n0 pin
→ If the rising edge or both rising and falling edges are specified as the valid edge, of the TI0n0 pin,
a rising edge is detected immediately after the TM00 operation is enabled.
Remark n = 0, 1
<2> The sampling clock used to remove noise differs when a TI000 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 fXP, and in the latter case the
count clock is selected by prescaler mode register 00 (PRM00). 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.
(19) External event counter
<1> The timing of the count start is after two valid edge detections.
<2> When reading the external event counter count value, TM00 should be read.
(20) PPG output
<1> Values in the following range should be set in CR000 and CR010:
0000H < CR010 < CR000 ≤ FFFFH
<2> The cycle of the pulse generated through PPG output (CR000 setting value + 1) has a duty of (CR010
setting value + 1)/(CR000 setting value + 1).
(21) STOP mode or system clock stop mode setting
Except when TI000 pin valid edge is selected as the count clock, stop the timer operation before setting STOP
mode or system clock stop mode; otherwise the timer may malfunction when the system clock starts.
(22) P31/TI010/TO00 pin
When using P31 as the input pin (TI010) of the valid edge, it cannot be used as a timer output pin (TO00).
When using P31 as the timer output pin (TO00), it cannot be used as the input pin (TI010) of the valid edge.
121
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
7.1 Function of 8-Bit Timer 80
8-bit timer 80 has an 8-bit interval timer function and generates an interrupt at intervals specified in advance.
Table 7-1. Interval Time of 8-Bit Timer 80
Minimum Interval Time
26/fXP (8 µs)
28/fXP (32 µs)
210/fXP (128 µs)
216/fXP (8.19 ms)
26/fXP (6.4 µs)
28/fXP (25.6 µs)
210/fXP (102 µs)
216/fXP (6.55 ms)
Maximum Interval Time
214/fXP (2.05 ms)
216/fXP (8.19 ms)
218/fXP (32.7 ms)
224/fXP (2.01 s)
214/fXP (1.64 ms)
216/fXP (6.55 ms)
218/fXP (26.2 ms)
224/fXP (1.68 s)
Resolution
26/fXP (8 µs)
28/fXP (32 µs)
210/fXP (128 µs)
216/fXP (8.19 ms)
26/fXP (6.4 µs)
28/fXP (25.6 µs)
210/fXP (102 µs)
216/fXP (6.55 ms)
fXP = 8.0 MHz
fXP = 10.0 MHz
Remark fXP: Oscillation frequency of clock to peripheral hardware
122
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
7.2 Configuration of 8-Bit Timer 80
8-bit timer 80 consists of the following hardware.
Table 7-2. Configuration of 8-Bit Timer 80
Item
Timer counter
Configuration
8-bit timer counter 80 (TM80)
Register
8-bit compare register 80 (CR80)
Control register
8-bit timer mode control register 80 (TMC80)
Figure 7-1. Block Diagram of 8-Bit Timer 80
Internal bus
8-bit compare register 80
(CR80)
Match
INTTM80
f
f
XP/26
XP/28
Clear
8-bit timer/counter 80
(TM80)
f
XP/210
XP/216
f
TCE80 TCL801 TCL800
8-bit timer mode control
register 80 (TMC80)
Internal bus
Remark fXP: Oscillation frequency of clock to peripheral hardware
123
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
(1) 8-bit compare register 80 (CR80)
This 8-bit register always compares its set value with the count value of 8-bit timer/counter 80 (TM80). It
generates an interrupt request signal (INTTM80) if the two values match.
CR80 is set by using an 8-bit memory manipulation instruction. A value of 00H to FFH can be set to this
register.
Reset signal generation makes the contents of this register undefined.
Figure 7-2. Format of 8-Bit Compare Register 80 (CR80)
Address: FFCDH
After reset: Undefined
W
Symbol
CR80
7
6
5
4
3
2
1
0
Caution When changing the value of CR80, be sure to stop the timer operation. If the value of CR80
is changed with the timer operation enabled, a match interrupt request signal is generated
immediately and the timer may be cleared.
(2) 8-bit timer/counter 80 (TM80)
This 8-bit register counts the count pulses.
The value of TM80 can be read by using an 8-bit memory manipulation instruction.
Reset signal generation clears TM80 to 00H.
Figure 7-3. Format of 8-Bit Timer Counter 80 (TM80)
Address: FFCEH
After reset: 00H
R
Symbol
TM80
7
6
5
4
3
2
1
0
124
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
7.3 Register Controlling 8-Bit Timer 80
8-bit timer 80 is controlled by 8-bit timer mode control register 80 (TMC80).
(1) 8-bit timer mode control register 80 (TMC80)
This register is used to enable or stop the operation of 8-bit timer/counter 80 (TM80), and to set the count
clock of TM80.
This register is set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears TMC80 to 00H.
Figure 7-4. Format of 8-Bit Timer Mode Control Register 80 (TMC80)
Address: FFCCH
After reset: 00H
R/W
Symbol
TMC80
<7>
6
0
5
4
0
3
0
2
1
0
0
TCE80
0
TCL801
TCL800
TCE80
Control of operation of TM80
0
1
Stop operation (clear TM80 to 00H).
Enable operation.
TCL801
TCL800
Selection of count clock of 8-bit timer 80
fXP = 8.0 MHz
156.3 kHz
39.06 kHz
9.77 kHz
fXP = 10.0 MHz
0
0
1
1
0
1
0
1
fXP/26
fXP/28
fXP/210
fXP/216
125 kHz
31.25 kHz
7.81 kHz
0.12 kHz
0.15 kHz
Cautions 1. Be sure to set TMC80 after stopping the timer operation.
2. Be sure to clear bits 0 and 6 to 0.
Remark fXP: Oscillation frequency of clock to peripheral hardware
125
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
7.4 Operation of 8-Bit Timer 80
7.4.1 Operation as interval timer
When 8-bit timer 80 operates as an interval timer, it can repeatedly generate an interrupt at intervals specified by
the count value set in advance to 8-bit compare register 80 (CR80).
To use 8-bit timer 80 as an interval timer, make the following setting.
<1> Disable the operation of 8-bit timer counter 80 (clear TCE80 (bit 7 of 8-bit timer mode control register 80
(TMC80)) to 0).
<2> Set the count clock of 8-bit timer 80 (refer to Tables 7-3 and 7-4).
<3> Set the count value to CR80.
<4> Enable the operation of TM80 (set TCE80 to 1).
When the count value of 8-bit timer counter 80 (TM80) matches the set value of CR80, the value of TM80 is
cleared to 00H and counting is continued. At the same time, an interrupt request signal (INTTM80) is generated.
Tables 7-3 and 7-4 show the interval time, and Figure 7-5 shows the timing of the interval timer operation.
Cautions 1. When changing the value of CR80, be sure to stop the timer operation. If the value of CR80 is
changed with the timer operation enabled, a match interrupt request signal may be generated
immediately.
2. If the count clock of TMC80 is set and the operation of TM80 is enabled at the same time by
using an 8-bit memory manipulation instruction, the error of one cycle after the timer is
started may be 1 clock or more (refer to 7.5 (1) Error when timer starts). Therefore, be sure to
follow the above sequence when using TM80 as an interval timer.
Table 7-3. Interval Time of 8-Bit Timer 80 (fXP = 8.0 MHz)
TCL801
TCL800
Minimum Interval Time
26/fXP (8 µs)
28/fXP (32 µs)
210/fXP (128 µs)
216/fXP (8.19 ms)
Maximum Interval Time
214/fXP (2.05 ms)
216/fXP (8.19 ms)
218/fXP (32.7 ms)
224/fXP (2.01 s)
Resolution
26/fXP (8 µs)
28/fXP (32 µs)
210/fXP (128 µs)
216/fXP (8.19 ms)
0
0
1
1
0
1
0
1
Remark fXP: Oscillation frequency of clock to peripheral hardware
Table 7-4. Interval Time of 8-Bit Timer 80 (fXP = 10.0 MHz)
TCL801
TCL800
Minimum Interval Time
26/fXP (6.4 µs)
28/fXP (25.6 µs)
210/fXP (102 µs)
216/fXP (6.55 ms)
Maximum Interval Time
214/fXP (1.64 ms)
216/fXP (6.55 ms)
218/fXP (26.2 ms)
224/fXP (1.68 s)
Resolution
26/fXP (6.4 µs)
28/fXP (25.6 µs)
210/fXP (102 µs)
216/fXP (6.55 ms)
0
0
1
1
0
1
0
1
Remark fXP: Oscillation frequency of clock to peripheral hardware
126
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
Figure 7-5. Timing of Interval Timer Operation
t
Count clock
TM80 count value
00H
01H
N
00H 01H
Clear
N
00H 01H
Clear
N
CR80
N
N
N
N
TCE80
Count start
INTTM80
Interrupt request generated
Interval time
Interrupt request generated
Interval time
Remark Interval time = (N + 1) × t
N = 00H to FFH
127
User’s Manual U16898EJ3V0UD
CHAPTER 7 8-BIT TIMER 80
7.5 Notes on 8-Bit Timer 80
(1) Error when timer starts
The time from starting the timer to generation of the match signal includes an error of up to 1.5 clocks. This is
because, if the timer is started while the count clock is high, the rising edge may be immediately detected and
the counter may be incremented (refer to Figure 7-6).
Figure 7-6. Case Where Error of 1.5 Clocks (Max.) Occurs
Delay A
Count pulse
8-bit timer counter 80
(TM80)
Selected clock
TCE80
Clear signal
Delay B
Selected clock
TCE80
Clear signal
Count pulse
...
TM80 count value
00H
01H
Delay A
02H
03H
Delay B
If the timer is started when the selected clock is high
and if delay A > delay B, an error of up to 1.5 clocks occurs.
(2) Setting of 8-bit compare register 80
8-bit compare register 80 (CR80) can be set to 00H.
(3) Note on setting STOP mode
Before executing the STOP instruction, be sure to stop the timer operation (TCE80 = 0).
128
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
8.1 Functions of 8-Bit Timer H1
8-bit timer H1 has the following functions.
•
•
•
Interval timer
PWM output mode
Square-wave output
8.2 Configuration of 8-Bit Timer H1
8-bit timer H1 consists of the following hardware.
Table 8-1. Configuration of 8-Bit Timer H1
Item
Timer register
Registers
Configuration
8-bit timer counter H1
8-bit timer H compare register 01 (CMP01)
8-bit timer H compare register 11 (CMP11)
Timer output
TOH1
Control registers
8-bit timer H mode register 1 (TMHMD1)
Port mode register 4 (PM4)
Port register 4 (P4)
Figure 8-1 shows a block diagram.
129
User’s Manual U16898EJ3V0UD
Figure 8-1. Block Diagram of 8-Bit Timer H1
Internal bus
8-bit timer H mode register 1
(TMHMD1)
8-bit timer H
compare register
11 (CMP11)
8-bit timer H
compare register
01 (CMP01)
TMHE1 CKS12 CKS11 CKS10 TMMD11 TMMD10 TOLEV1 TOEN1
3
2
Decoder
TOH1/P42
Selector
Output latch
(P42)
F/F
R
Match
Level
inversion
PM42
Interrupt
generator
Output
controller
f
XP
f
f
f
XP/22
XP/24
XP/26
8-bit timer
counter H1
f
XP/212
Clear
f
RL/27
PWM mode signal
1
0
Timer H enable signal
INTTMH1
CHAPTER 8 8-BIT TIMER H1
(1) 8-bit timer H compare register 01 (CMP01)
This register can be read or written by an 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
Figure 8-2. Format of 8-Bit Timer H Compare Register 01 (CMP01)
Address: FF0EH After reset: 00H R/W
Symbol
CMP01
7
5
3
2
1
0
6
4
Caution CMP01 cannot be rewritten during timer count operation.
(2) 8-bit timer H compare register 11 (CMP11)
This register can be read or written by an 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
Figure 8-3. Format of 8-Bit Timer H Compare Register 11 (CMP11)
Address: FF0FH After reset: 00H R/W
Symbol
CMP11
7
5
3
2
1
0
6
4
CMP11 can be rewritten during timer count operation.
If the CMP11 value is rewritten during timer operation, the compare value after the rewrite takes effect at the timing
at which the count value and the compare value before the rewrite match. If the timing at which the count value and
compare value match conflicts with the timing of the writing from the CPU to CMP11, the compare value after the
rewrite takes effect at the timing at which the next count value and the compare value before the rewrite match.
Caution In the PWM output mode, be sure to set CMP11 when starting the timer count operation (TMHE1
= 1) after the timer count operation was stopped (TMHE1 = 0) (be sure to set again even if setting
the same value to CMP11).
131
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
8.3 Registers Controlling 8-Bit Timer H1
The following three registers are used to control 8-Bit Timer H1.
• 8-bit timer H mode register 1 (TMHMD1)
• Port mode register 4 (PM4)
• Port register 4 (P4)
(1) 8-bit timer H mode register 1 (TMHMD1)
This register controls the mode of timer H.
This register can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
132
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
Figure 8-4. Format of 8-Bit Timer H Mode Register 1 (TMHMD1)
Address: FF70H After reset: 00H R/W
<7>
5
3
2
<1>
<0>
6
4
Symbol
TMHMD1
TMHE1 CKS12
CKS11 CKS10 TMMD11 TMMD10 TOLEV1 TOEN1
TMHE1
Timer operation enable
0
1
Stop timer count operation (counter is cleared to 0)
Enable timer count operation (count operation started by inputting clock)
CKS12
CKS11
CKS10
Count clock (fCNT) selection
(10 MHz)
0
0
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
f
f
f
f
f
f
XP
XP/22 (2.5 MHz)
XP/24 (625 kHz)
XP/26 (156.25 kHz)
XP/212 (2.44 kHz)
RL/27 (1.88 kHz (TYP.))
Other than above
Setting prohibited
TMMD11 TMMD10
Timer operation mode
0
1
0
0
Interval timer mode
PWM output mode
Other than above Setting prohibited
TOLEV1
Timer output level control (in default mode)
0
1
Low level
High level
TOEN1
Timer output control
0
1
Disable output
Enable output
Cautions 1. When TMHE1 = 1, setting the other bits of the TMHMD1 register is prohibited.
2. In the PWM output mode, be sure to set 8-bit timer H compare register 11 (CMP11) when
starting the timer count operation (TMHE1 = 1) after the timer count operation was stopped
(TMHE1 = 0) (be sure to set again even if setting the same value to the CMP11 register).
Remarks 1. fXP: Oscillation frequency of clock to peripheral hardware
2. fRL: Low-speed internal oscillation clock oscillation frequency
3. Figures in parentheses apply to operation at fXP = 10 MHz, fRL = 240 kHz (TYP.).
133
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
(2) Port mode register 4 (PM4)
This register sets port 4 input/output in 1-bit units.
When using the P42/TOH1 pin for timer output, clear PM42 and the output latch of P42 to 0.
PM4 can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets this register to FFH.
Figure 8-5. Format of Port Mode Register 4 (PM4)
Address: FF24H After reset: FFH R/W
Symbol
PM4
7
1
6
1
5
4
3
2
1
0
PM45
PM44
PM43
PM42
PM41
PM40
PM4n
P4n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
134
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
8.4 Operation of 8-Bit Timer H1
8.4.1 Operation as interval timer/square-wave output
When 8-bit timer counter H1 and compare register 01 (CMP01) match, an interrupt request signal (INTTMH1) is
generated and 8-bit timer counter H1 is cleared to 00H.
Compare register 11 (CMP11) is not used in interval timer mode. Since a match of 8-bit timer counter H1 and the
CMP11 register is not detected even if the CMP11 register is set, timer output is not affected.
By setting bit 0 (TOEN1) of timer H mode register 1 (TMHMD1) to 1, a square wave of any frequency (duty = 50%)
is output from TOH1.
(1) Usage
Generates the INTTMH1 signal repeatedly at the same interval.
<1> Set each register.
Figure 8-6. Register Setting During Interval Timer/Square-Wave Output Operation
(i) Setting timer H mode register 1 (TMHMD1)
TMHE1
0
CKS12 CKS11
0/1 0/1
CKS10 TMMD11 TMMD10 TOLEV1 TOEN1
0/1 0/1 0/1
TMHMD1
0
0
Timer output setting
Timer output level inversion setting
Interval timer mode setting
Count clock (fCNT) selection
Count operation stopped
(ii) CMP01 register setting
Compare value (N)
•
<2> Count operation starts when TMHE1 = 1.
<3> When the values of 8-bit timer counter H1 and the CMP01 register match, the INTTMH1 signal is generated
and 8-bit timer counter H1 is cleared to 00H.
Interval time = (N +1)/fCNT
<4> Subsequently, the INTTMH1 signal is generated at the same interval. To stop the count operation, clear
TMHE1 to 0.
135
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
(2) Timing chart
The timing of the interval timer/square-wave output operation is shown below.
Figure 8-7. Timing of Interval Timer/Square-Wave Output Operation (1/2)
(a) Basic operation (01H ≤ CMP01 ≤ FEH)
Count clock
Count start
00H
01H
N
N
00H
Clear
01H
N
00H 01H 00H
Clear
8-bit timer counter H1
CMP01
TMHE1
INTTMH1
TOH1
Interval time
<1>
<2>
Level inversion,
<3>
<2>
Level inversion,
match interrupt occurrence,
8-bit timer counter H1 clear
match interrupt occurrence,
8-bit timer counter H1 clear
<1> The count operation is enabled by setting the TMHE1 bit to 1. The count clock starts counting no more than
1 clock after the operation is enabled.
<2> When the values of 8-bit timer counter H1 and the CMP01 register match, the value of 8-bit timer counter H1
is cleared, the TOH1 output level is inverted, and the INTTMH1 signal is output.
<3> The INTTMH1 signal and TOH1 output become inactive by clearing the TMHE1 bit to 0 during timer H1
operation. If these are inactive from the first, the level is retained.
Remark 01H ≤ N ≤ FEH
136
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
Figure 8-7. Timing of Interval Timer/Square-Wave Output Operation (2/2)
(b) Operation when CMP01 = FFH
Count clock
Count start
00H
00H
01H
FEH
FFH
00H
FEH
FFH
8-bit timer counter H1
Clear
Clear
FFH
CMP01
TMHE1
INTTMH1
TOH1
Interval time
(c) Operation when CMP01 = 00H
Count clock
Count start
00H
00H
8-bit timer counter H1
CMP01
TMHE1
INTTMH1
TOH1
Interval time
137
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
8.4.2 Operation as PWM output mode
In PWM output mode, a pulse with an arbitrary duty and arbitrary cycle can be output.
8-bit timer compare register 01 (CMP01) controls the cycle of timer output (TOH1). Rewriting the CMP01 register
during timer operation is prohibited.
8-bit timer compare register 11 (CMP11) controls the duty of timer output (TOH1). Rewriting the CMP11 register
during timer operation is possible.
The operation in PWM output mode is as follows.
TOH1 output becomes active and 8-bit timer counter H1 is cleared to 0 when 8-bit timer counter H1 and the
CMP01 register match after the timer count is started. TOH1 output becomes inactive when 8-bit timer counter H1
and the CMP11 register match.
(1) Usage
In PWM output mode, a pulse for which an arbitrary duty and arbitrary cycle can be set is output.
<1> Set each register.
Figure 8-8. Register Setting in PWM Output Mode
(i) Setting timer H mode register 1 (TMHMD1)
TMHE1
0
CKS12 CKS11
0/1 0/1
CKS10 TMMD11 TMMD10 TOLEV1 TOEN1
0/1 0/1
TMHMD1
1
0
1
Timer output enabled
Timer output level inversion setting
PWM output mode selection
Count clock (fCNT) selection
Count operation stopped
(ii) Setting CMP01 register
• Compare value (N): Cycle setting
(iii) Setting CMP11 register
• Compare value (M): Duty setting
Remark 00H ≤ CMP11 (M) < CMP01 (N) ≤ FFH
<2> The count operation starts when TMHE1 = 1.
<3> The CMP01 register is the compare register that is to be compared first after count operation is enabled.
When the values of 8-bit timer counter H1 and the CMP01 register match, 8-bit timer counter H1 is cleared,
an interrupt request signal (INTTMH1) is generated, and TOH1 output becomes active. At the same time,
the compare register to be compared with 8-bit timer counter H1 is changed from the CMP01 register to the
CMP11 register.
138
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
<4> When 8-bit timer counter H1 and the CMP11 register match, TOH1 output becomes inactive and the
compare register to be compared with 8-bit timer counter H1 is changed from the CMP11 register to the
CMP01 register. At this time, 8-bit timer counter H1 is not cleared and the INTTMH1 signal is not
generated.
<5> By performing procedures <3> and <4> repeatedly, a pulse with an arbitrary duty can be obtained.
<6> To stop the count operation, set TMHE1 = 0.
If the setting value of the CMP01 register is N, the setting value of the CMP11 register is M, and the count clock
frequency is fCNT, the PWM pulse output cycle and duty are as follows.
PWM pulse output cycle = (N+1)/fCNT
Duty = Active width : Total width of PWM = (M + 1) : (N + 1)
Cautions 1. In PWM output mode, the setting value for the CMP11 register can be changed during timer
count operation. However, three operation clocks (signal selected using the CKS12 to
CKS10 bits of the TMHMD1 register) or more are required to transfer the register value after
rewriting the CMP11 register value.
2. Be sure to set the CMP11 register when starting the timer count operation (TMHE1 = 1) after
the timer count operation was stopped (TMHE1 = 0) (be sure to set again even if setting the
same value to the CMP11 register).
139
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
(2) Timing chart
The operation timing in PWM output mode is shown below.
Caution Make sure that the CMP11 register setting value (M) and CMP01 register setting value (N) are
within the following range.
00H ≤ CMP11 (M) < CMP01 (N) ≤ FFH
Figure 8-9. Operation Timing in PWM Output Mode (1/4)
(a) Basic operation (00H < CMP11 < CMP01 < FFH)
Count clock
00H 01H
A5H 00H 01H 02H
A5H 00H 01H 02H
A5H 00H
8-bit timer counter H1
A5H
01H
CMP01
CMP11
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
<4>
<2>
<3>
<1>
TOH1
(TOLEV1 = 1)
<1> The count operation is enabled by setting the TMHE1 bit to 1. Start 8-bit timer counter H1 by masking one
count clock to count up. At this time, TOH1 output remains inactive (when TOLEV1 = 0).
<2> When the values of 8-bit timer counter H1 and the CMP01 register match, the TOH1 output level is inverted,
the value of 8-bit timer counter H1 is cleared, and the INTTMH1 signal is output.
<3> When the values of 8-bit timer counter H1 and the CMP11 register match, the level of the TOH1 output is
returned. At this time, the 8-bit timer counter value is not cleared and the INTTMH1 signal is not output.
<4> Clearing the TMHE1 bit to 0 during timer H1 operation makes the INTTMH1 signal and TOH1 output inactive.
140
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
Figure 8-9. Operation Timing in PWM Output Mode (2/4)
(b) Operation when CMP01 = FFH, CMP11 = 00H
Count clock
8-bit timer counter H1
00H 01H
FFH 00H 01H 02H
FFH 00H 01H 02H
FFH 00H
FFH
00H
CMP01
CMP11
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
(c) Operation when CMP01 = FFH, CMP11 = FEH
Count clock
00H 01H
FEH FFH 00H 01H
FEH FFH 00H 01H
FEH FFH 00H
8-bit timer counter H1
FFH
FEH
CMP01
CMP11
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
141
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
Figure 8-9. Operation Timing in PWM Output Mode (3/4)
(d) Operation when CMP01 = 01H, CMP11 = 00H
Count clock
00H 01H 00H 01H 00H
00H 01H 00H 01H
8-bit timer counter H1
CMP01
01H
00H
CMP11
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
142
User’s Manual U16898EJ3V0UD
CHAPTER 8 8-BIT TIMER H1
Figure 8-9. Operation Timing in PWM Output Mode (4/4)
(e) Operation by changing CMP11 (CMP11 = 02H → 03H, CMP01 = A5H)
Count clock
8-bit timer counter H1
00H 01H 02H
80H
A5H 00H 01H 02H 03H
A5H 00H 01H 02H 03H
A5H 00H
A5H
03H
CMP01
CMP11
02H
02H (03H)
<2>'
<2>
TMHE1
INTTMH1
TOH1
(TOLEV1 = 0)
<4>
<3>
<6>
<5>
<1>
<1> The count operation is enabled by setting TMHE1 = 1. Start 8-bit timer counter H1 by masking one count
clock to count up. At this time, the TOH1 output remains inactive (when TOLEV1 = 0).
<2> The CMP11 register value can be changed during timer counter operation. This operation is asynchronous
to the count clock.
<3> When the values of 8-bit timer counter H1 and the CMP01 register match, the value of 8-bit timer counter H1
is cleared, the TOH1 output becomes active, and the INTTMH1 signal is output.
<4> If the CMP11 register value is changed, the value is latched and not transferred to the register. When the
values of 8-bit timer counter H1 and the CMP11 register before the change match, the value is transferred to
the CMP11 register and the CMP11 register value is changed (<2>’).
However, three count clocks or more are required from when the CMP11 register value is changed to when
the value is transferred to the register. If a match signal is generated within three count clocks, the changed
value cannot be transferred to the register.
<5> When the values of 8-bit timer counter H1 and the CMP11 register after the change match, the TOH1 output
becomes inactive. 8-bit timer counter H1 is not cleared and the INTTMH1 signal is not generated.
<6> Clearing the TMHE1 bit to 0 during timer H1 operation makes the INTTMH1 signal and TOH1 output inactive.
143
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.1 Functions of Watchdog Timer
The watchdog timer is used to detect an inadvertent program loop. If a program loop is detected, an internal reset
signal is generated.
When a reset occurs due to the watchdog timer, bit 4 (WDTRF) of the reset control flag register (RESF) is set to 1.
For details of RESF, see CHAPTER 14 RESET FUNCTION.
Table 9-1. Loop Detection Time of Watchdog Timer
Loop Detection Time
During Low-Speed Internal oscillation Clock Operation
211/fRL (4.27 ms)
During System Clock Operation
213/fX (819.2 µs)
212/fRL (8.53 ms)
213/fRL (17.07 ms)
214/fRL (34.13 ms)
215/fRL (68.27 ms)
216/fRL (136.53 ms)
217/fRL (273.07 ms)
218/fRL (546.13 ms)
214/fX (1.64 ms)
215/fX (3.28 ms)
216/fX (6.55 ms)
217/fX (13.11 ms)
218/fX (26.21 ms)
219/fX (52.43 ms)
220/fX (104.86 ms)
Remarks 1. fRL: Low-speed internal oscillation clock oscillation frequency
2. fX: Oscillation frequency of system clock
3. Figures in parentheses apply to operation at fRL = 480 kHz (MAX.), fX = 10 MHz.
The operation mode of the watchdog timer (WDT) is switched according to the option byte setting of the on-chip
low-speed internal oscillator as shown in Table 9-2.
144
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
Table 9-2. Option Byte Setting and Watchdog Timer Operation Mode
Option Byte Setting
Low-Speed Internal Oscillator Cannot Be Stopped Low-Speed Internal Oscillator Can Be Stopped by Software
Note 1
Watchdog timer clock
source
Fixed to fRL
.
• Selectable by software (fX, fRL or stopped)
• When reset is released: fRL
Operation after reset
Operation starts with the maximum interval
(218/fRL).
Operation starts with the maximum interval
(218/fRL).
Operation mode
selection
The interval can be changed only once.
The clock selection/interval can be changed only
once.
The watchdog timer can be stoppedNote 2
.
Features
The watchdog timer cannot be stopped.
Notes 1. As long as power is being supplied, low-speed internal oscillator cannot be stopped (except in the reset
period).
2. The conditions under which clock supply to the watchdog timer is stopped differ depending on the
clock source of the watchdog timer.
<1> If the clock source is fX, clock supply to the watchdog timer is stopped under the following
conditions.
• When fX is stopped
• In HALT/STOP mode
• During oscillation stabilization time
<2> If the clock source is fRL, clock supply to the watchdog timer is stopped under the following
conditions.
• If the CPU clock is fX and if fRL is stopped by software before execution of the STOP instruction
• In HALT/STOP mode
Remarks 1. fRL: Low-speed internal oscillation clock oscillation frequency
2. fX: Oscillation frequency of system clock
145
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.2 Configuration of Watchdog Timer
The watchdog timer consists of the following hardware.
Table 9-3. Configuration of Watchdog Timer
Item
Configuration
Control registers
Watchdog timer mode register (WDTM)
Watchdog timer enable register (WDTE)
Figure 9-1. Block Diagram of Watchdog Timer
211/fRL to
218/fRL
Clock
input
f
RL/22
Output
controller
16-bit
counter
Internal reset signal
Selector
f
/24
X
or
controller
213/f
220/f
X
X
to
2
3
Clear
Option byte
(to set “low-speed
internal oscillator cannot be
stopped” or “low-speed
internal oscillator can be
stopped by software”)
0
1
1
WDCS4 WDCS3 WDCS2 WDCS1 WDCS0
Watchdog timer enable
register (WDTE)
Watchdog timer mode
register (WDTM)
Internal bus
Remarks 1. fRL: Low-speed internal oscillation clock oscillation frequency
2. fX: System clock oscillation frequency
146
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.3 Registers Controlling Watchdog Timer
The watchdog timer is controlled by the following two registers.
•
•
Watchdog timer mode register (WDTM)
Watchdog timer enable register (WDTE)
(1) Watchdog timer mode register (WDTM)
This register sets the overflow time and operation clock of the watchdog timer.
This register can be set by an 8-bit memory manipulation instruction and can be read many times, but can be
written only once after reset is released.
Reset signal generation sets this register to 67H.
Figure 9-2. Format of Watchdog Timer Mode Register (WDTM)
Address: FF48H After reset: 67H R/W
7
0
6
1
5
1
4
3
2
1
0
Symbol
WDTM
WDCS4
WDCS3
WDCS2
WDCS1
WDCS0
WDCS4Note 1 WDCS3Note 1
Operation clock selection
0
0
1
0
1
×
Low-speed internal oscillation clock (fRL)
System Clock (fX)
Watchdog timer operation stopped
WDCS2Note 2 WDCS1Note 2 WDCS0Note 2
Overflow time setting
During low-speed internal
oscillation clock operation
During system clock operation
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
211/fRL (4.27 ms)
212/fRL (8.53 ms)
213/fRL (17.07 ms)
214/fRL (34.13 ms)
215/fRL (68.27 ms)
216/fRL (136.53 ms)
217/fRL (273.07 ms)
218/fRL (546.13 ms)
213/fX (819.2 µs)
214/fX (1.64 ms)
215/fX (3.28 ms)
216/fX (6.55 ms)
217/fX (13.11 ms)
218/fX (26.21 ms)
219/fX (52.43 ms)
220/fX (104.86 ms)
Notes 1. If “low-speed internal oscillator cannot be stopped” is specified by the option byte, this cannot
be set. The low-speed internal oscillation clock will be selected no matter what value is
written.
2. Reset is released at the maximum cycle (WDCS2, 1, 0 = 1, 1, 1).
147
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
Cautions 1. Set bits 7, 6, and 5 to 0, 1, and 1, respectively. Do not set the other values.
2. After reset is released, WDTM can be written only once by an 8-bit memory
manipulation instruction. If writing is attempted a second time, an internal reset
signal is generated. However, at the first write, if “1” and “x” are set for WDCS4 and
WDCS3 respectively and the watchdog timer is stopped, then the internal reset
signal does not occur even if the following are executed.
• Second write to WDTM
• 1-bit memory manipulation instruction to WDTE
• Writing of a value other than “ACH” to WDTE
3. WDTM cannot be set by a 1-bit memory manipulation instruction.
4. When using the flash memory self programming by self writing, set the overflow time
for the watchdog timer so that enough everflow time is secured (Example 1-byte
writing: 200 µs MIN., 1-block deletion: 10 ms MIN.).
Remarks 1. fRL: Low-speed internal oscillation clock oscillation frequency
2. fX: System clock oscillation frequency
3. ×: Don’t care
4. Figures in parentheses apply to operation at fRL = 480 kHz (MAX.), fX = 10 MHz.
(2) Watchdog timer enable register (WDTE)
Writing ACH to WDTE clears the watchdog timer counter and starts counting again.
This register can be set by an 8-bit memory manipulation instruction.
Reset signal generation sets this register to 9AH.
Figure 9-3. Format of Watchdog Timer Enable Register (WDTE)
Address: FF49H After reset: 9AH R/W
7
6
5
4
3
2
1
0
Symbol
WDTE
Cautions 1. If a value other than ACH is written to WDTE, an internal reset signal is generated.
2. If a 1-bit memory manipulation instruction is executed for WDTE, an internal reset
signal is generated.
3. The value read from WDTE is 9AH (this differs from the written value (ACH)).
148
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.4 Operation of Watchdog Timer
9.4.1 Watchdog timer operation when “low-speed internal oscillator cannot be stopped” is selected by
option byte
The operation clock of watchdog timer is fixed to low-speed internal oscillation clock.
After reset is released, operation is started at the maximum cycle (bits 2, 1, and 0 (WDCS2, WDCS1, WDCS0) of
the watchdog timer mode register (WDTM) = 1, 1, 1). The watchdog timer operation cannot be stopped.
The following shows the watchdog timer operation after reset release.
1. The status after reset release is as follows.
•
•
•
Operation clock: Low-speed internal oscillation clock
Cycle: 218/fRL (546.13 ms: operation with fRL = 480 kHz (MAX.))
Counting starts
2. The following should be set in the watchdog timer mode register (WDTM) by an 8-bit memory manipulation
instructionNotes 1, 2
Cycle: Set using bits 2 to 0 (WDCS2 to WDCS0)
.
•
3. After the above procedures are executed, writing ACH to WDTE clears the count to 0, enabling recounting.
Notes 1. The operation clock (low-speed internal oscillation clock) cannot be changed. If any value is written to
bits 3 and 4 (WDCS3, WDCS4) of WDTM, it is ignored.
2. As soon as WDTM is written, the counter of the watchdog timer is cleared.
Caution In this mode, operation of the watchdog timer cannot be stopped even during STOP instruction
execution. For 8-bit timer H1 (TMH1), a division of the low-speed internal oscillation clock can be
selected as the count source, so clear the watchdog timer using the interrupt request of TMH1
before the watchdog timer overflows after STOP instruction execution. If this processing is not
performed, an internal reset signal is generated when the watchdog timer overflows after STOP
instruction execution.
A status transition diagram is shown below
149
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
Figure 9-4. Status Transition Diagram When “Low-Speed Internal Oscillator Cannot Be Stopped”
Is Selected by Option Byte
Reset
WDT clock: fRL
Overflow time: 546.13 ms (MAX.)
WDTE = “ACH”
Clear WDT counter.
WDT clock is fixed to fRL
.
Select overflow time (settable only once).
WDT clock: fRL
Overflow time: 4.27 ms to 546.13 ms (MAX.)
WDT count continues.
HALT instruction
STOP instruction
Interrupt
Interrupt
HALT
WDT count continues.
STOP
WDT count continues.
150
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.4.2 Watchdog timer operation when “low-speed internal oscillator can be stopped by software” is
selected by option byte
The operation clock of the watchdog timer can be selected as either the low-speed internal oscillation clock or the
system clock.
After reset is released, operation is started at the maximum cycle of the low-speed internal oscillation clock (bits 2,
1, and 0 (WDCS2, WDCS1, WDCS0) of the watchdog timer mode register (WDTM) = 1, 1, 1).
The following shows the watchdog timer operation after reset release.
1. The status after reset release is as follows.
•
•
•
Operation clock: Low-speed internal oscillation clock
Cycle: 218/fRL (546.13 ms: operation with fRL = 480 kHz (MAX.))
Counting starts
2. The following should be set in the watchdog timer mode register (WDTM) by an 8-bit memory manipulation
instructionNotes 1, 2, 3
.
•
Operation clock: Any of the following can be selected using bits 3 and 4 (WDCS3 and WDCS4).
Low-speed internal oscillation clock (fRL)
System clock (fX)
Watchdog timer operation stopped
Cycle: Set using bits 2 to 0 (WDCS2 to WDCS0)
•
3. After the above procedures are executed, writing ACH to WDTE clears the count to 0, enabling recounting.
Notes 1. As soon as WDTM is written, the counter of the watchdog timer is cleared.
2. Set bits 7, 6, and 5 to 0, 1, 1, respectively. Do not set the other values.
3. At the first write, if the watchdog timer is stopped by setting WDCS4 and WDCS3 to 1 and ×,
respectively, an internal reset signal is not generated even if the following processing is performed.
•
•
•
WDTM is written a second time.
A 1-bit memory manipulation instruction is executed to WDTE.
A value other than ACH is written to WDTE.
Caution In this mode, watchdog timer operation is stopped during HALT/STOP instruction execution.
After HALT/STOP mode is released, counting is started again using the operation clock of the
watchdog timer set before HALT/STOP instruction execution by WDTM. At this time, the counter
is not cleared to 0 but holds its value.
For the watchdog timer operation during STOP mode and HALT mode in each status, see 9.4.3 Watchdog timer
operation in STOP mode and 9.4.4 Watchdog timer operation in HALT mode.
A status transition diagram is shown below.
151
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
Figure 9-5. Status Transition Diagram When “Low-Speed Internal Oscillator Can Be Stopped by
Software”
Is Selected by Option Byte
Reset
WDT clock: fRL
Overflow time: 546.13 ms (MAX.)
WDCS4 = 1
WDT clock = f
X
Select overflow time
(settable only once).
WDT clock = fRL
Select overflow time
(settable only once).
WDT operation stops.
WDTE = “ACH”
Clear WDT counter.
WDTE = “ACH”
Clear WDT counter.
WDTE = “ACH”
Clear WDT counter.
LSRSTOP = 1
LSRSTOP = 0
WDT clock: f
Overflow time: 213/f
WDT count continues.
X
WDT clock: fRL
Overflow time: 4.27 ms to 546.13 ms (MAX.)
WDT count continues.
to 220/f
X
WDT clock: fRL
WDT count stops.
X
HALT instruction
HALT
instruction
Interrupt
STOP
STOP
instruction
STOP
instruction
HALT
instruction
instruction
Interrupt
Interrupt
Interrupt
Interrupt
Interrupt
HALT
WDT count stops.
STOP
WDT count stops.
HALT
WDT count stops.
STOP
WDT count stops.
152
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.4.3
Watchdog timer operation in STOP mode (when “low-speed internal oscillator can be stopped by
software” is selected by option byte)
The watchdog timer stops counting during STOP instruction execution regardless of whether the system clock or
low-speed internal oscillation clock is being used.
(1) When the watchdog timer operation clock is the clock to peripheral hardware (fX) when the STOP
instruction is executed
When STOP instruction is executed, operation of the watchdog timer is stopped. After STOP mode is released,
operation stops for 34 µs (TYP.) (after waiting for the oscillation stabilization time set by the oscillation
stabilization time select register (OSTS) after operation stops in the case of crystal/ceramic oscillation) and then
counting is started again using the operation clock before the operation was stopped. At this time, the counter is
not cleared to 0 but holds its value.
Figure 9-6. Operation in STOP Mode (WDT Operation Clock: Clock to Peripheral Hardware)
<1> CPU clock: Crystal/ceramic oscillation clock
Operation
Normal
operation
stoppedNote Oscillation stabilization time
Normal operation
STOP
CPU operation
f
CPU
Oscillation stabilization time
(set by OSTS register)
Oscillation stopped
Watchdog timer
Operating
Operation stopped
Operating
<2> CPU clock: High-speed internal oscillation clock or external clock input
Normal
operation
Operation
stoppedNote
Normal operation
STOP
CPU operation
f
CPU
Oscillation stopped
Operation stopped
Watchdog timer
Operating
Operating
Note The operation stop time is 17 µs (MIN.), 34 µs (TYP.), and 67 µs (MAX.).
153
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
(2) When the watchdog timer operation clock is the low-speed internal oscillation clock (fRL) when the STOP
instruction is executed
When the STOP instruction is executed, operation of the watchdog timer is stopped. After STOP mode is
released, operation stops for 34 µs (TYP.) and then counting is started again using the operation clock before the
operation was stopped. At this time, the counter is not cleared to 0 but holds its value.
Figure 9-7. Operation in STOP Mode (WDT Operation Clock: Low-Speed Internal Oscillation Clock)
<1> CPU clock: Crystal/ceramic oscillation clock
Operation
Normal
operation
stoppedNote
STOP
Oscillation stabilization time
Normal operation
CPU operation
f
CPU
Oscillation stabilization time
(set by OSTS register)
Oscillation stopped
f
RL
Watchdog timer
Operating
Operation stopped
Operating
<2> CPU clock: High-speed internal oscillation clock or external clock input
Operation
Normal
operation
stoppedNote
CPU operation
STOP
Normal operation
fCPU
Oscillation stopped
fRL
Watchdog timer
Operating
Operation stopped
Operating
Note The operation stop time is 17 µs (MIN.), 34 µs (TYP.), and 67 µs (MAX.).
154
User’s Manual U16898EJ3V0UD
CHAPTER 9 WATCHDOG TIMER
9.4.4
Watchdog timer operation in HALT mode (when “low-speed internal oscillator can be stopped by
software” is selected by option byte)
The watchdog timer stops counting during HALT instruction execution regardless of whether the operation clock of
the watchdog timer is the system clock (fX) or low-speed internal oscillation clock (fRL). After HALT mode is released,
counting is started again using the operation clock before the operation was stopped. At this time, the counter is not
cleared to 0 but holds its value.
Figure 9-8. Operation in HALT Mode
Normal operation
HALT
Normal operation
CPU operation
f
CPU
fX or fRL
Watchdog timer
Operating Operation stopped
Operating
155
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.1 Functions of A/D Converter
The A/D converter converts an analog input signal into a digital value, and consists of up to four channels (ANI0 to
ANI3) with a resolution of 10 bits.
The A/D converter has the following function.
•
10-bit resolution A/D conversion
10-bit resolution A/D conversion is carried out repeatedly for one channel selected from analog inputs ANI0 to
ANI3. Each time an A/D conversion operation ends, an interrupt request (INTAD) is generated.
Figure 10-1 shows the timing of sampling and A/D conversion, and Table 10-1 shows the sampling time and A/D
conversion time.
Figure 10-1. Timing of A/D Converter Sampling and A/D Conversion
ADCS ← 1 or ADS rewrite
ADCS
Sampling
timing
INTAD
Note Sampling
Sampling
time
time
Conversion time
Conversion time
Note 2 or 3 clocks are required from the ADCS rising to sampling start.
156
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
Table 10-1. Sampling Time and A/D Conversion Time
Reference
Voltage
RangeNote 1
Sampling
TimeNote 2
Conversion
TimeNote 3
fXP = 8 MHz
fXP = 10 MHz
FR2
FR1
FR0
Sampling
TimeNote 2
Conversion
TimeNote 3
4.5 µs
Sampling
TimeNote 2
Conversion
TimeNote 3
3.6 µs
AVREF ≥ 4.5 V
AVREF ≥ 4.0 V
AVREF ≥ 2.85 V
12/fXP
24/fXP
96/fXP
48/fXP
48/fXP
24/fXP
36/fXP
72/fXP
144/fXP
96/fXP
72/fXP
48/fXP
1.5 µs
1.2 µs
0
1
1
1
0
0
0
0
1
0
1
0
0
0
0
1
0
1
3.0 µs
12.0 µs
6.0 µs
6.0 µs
3.0 µs
9.0 µs
18.0 µs
12.0 µs
9.0 µs
6.0 µs
2.4 µs
9.6 µs
4.8 µs
4.8 µs
7.2 µs
14.4 µs
9.6 µs
7.2 µs
Setting
Setting
prohibited
(2.4 µs)
17.6 µs
Setting
prohibited
(4.8 µs)
22.4 µs
AVREF ≥ 2.7 V
176/fXP
88/fXP
224/fXP
112/fXP
22.0 µs
11.0 µs
28.0 µs
14.0 µs
1
0
1
1
1
1
Setting
prohibited
(8.8 µs)
prohibited
(11.2 µs)
Notes 1. Be sure to set the FR2, FR1, and FR0, in accordance with the reference voltage so that Notes 2 and 3
below are satisfied.
Example When AVREF ≥ 2.7 V, fXP = 8 MHz
• The sampling time is 11.0 µs or more and the A/D conversion time is 14.0 µs or more and 100 µs or
less.
• Set FR2, FR1, and FR0 = 0, 1, 1 or 1, 1, 1.
2. Set the sampling time as follows.
• AVREF ≥ 4.5 V: 1.0 µs or more
• AVREF ≥ 4.0 V: 2.4 µs or more
• AVREF ≥ 2.85 V: 3.0 µs or more
• AVREF ≥ 2.7 V: 11.0 µs or more
3. Set the A/D conversion time as follows.
• AVREF ≥ 4.5 V: 3.0 µs or more and less than 100 µs
• AVREF ≥ 4.0 V: 4.8 µs or more and less than 100 µs
• AVREF ≥ 2.85 V: 6.0 µs or more and less than 100 µs
• AVREF ≥ 2.7 V: 14.0 µs or more and less than 100 µs
Caution The above sampling time and conversion time do not include the clock frequency error. Select the
sampling time and conversion time such that Notes 2 and 3 above are satisfied, while taking the
clock frequency error into consideration (an error margin maximum of 5% when using the high-
speed internal oscillator).
Remarks 1. fXP: Oscillation frequency of clock to peripheral hardware
2. The conversion time refers to the total of the sampling time and the time from successively comparing
with the sampling value until the conversion result is output.
157
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
Figure 10-2 shows the block diagram of A/D converter.
Figure 10-2. Block Diagram of A/D Converter
ANI0/P20
ANI1/P21
ANI2/P22
Sample & hold circuit
Voltage comparator
AVREF
D/A converter
VSS
VSS
ANI3/P23
Successive
approximation
register (SAR)
INTAD
Controller
A/D conversion result register
(ADCR, ADCRH)
2
3
ADS1 ADS0
ADCS
FR2
FR1
FR0
ADCE
Analog input
channel specification
register (ADS)
A/D converter mode
register (ADM)
Internal bus
Caution In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be
sure to connect VSS to a stabilized GND (= 0 V).
10.2 Configuration of A/D Converter
The A/D converter consists of the following hardware.
(1) ANI0 to ANI3 pins
These are the analog input pins of the 4-channel A/D converter. They input analog signals to be converted into
digital signals. Pins other than the one selected as the analog input pin by the analog input channel specification
register (ADS) can be used as input port pins.
(2) 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.
(3) D/A converter
The D/A converter is connected between AVREF and VSS, and generates a voltage to be compared with the
analog input signal.
(4) Voltage comparator
The voltage comparator compares the sampled analog input voltage and the output voltage of the D/A converter.
158
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(5) Successive approximation register (SAR)
This register compares the sampled analog voltage and the voltage of the D/A converter, and converts the result,
starting from the most significant bit (MSB).
When the voltage value is converted into a digital value down to the least significant bit (LSB) (end of A/D
conversion), the contents of the SAR register are transferred to the A/D conversion result register (ADCR).
(6) 10-bit A/D conversion result register (ADCR)
The result of A/D conversion is loaded from the successive approximation register to this register each time A/D
conversion is completed, and the ADCR register holds the result of A/D conversion in its lower 10 bits (the higher
6 bits are fixed to 0).
(7) 8-bit A/D conversion result register (ADCRH)
The result of A/D conversion is loaded from the successive approximation register to this register each time A/D
conversion is completed, and the ADCRH register holds the result of A/D conversion in its higher 8 bits.
(8) Controller
When A/D conversion has been completed, INTAD is generated.
(9) AVREF pin
This pin inputs an analog power/reference voltage to the A/D converter. When the A/D converter is not used,
connect this pin to VDD.
The signal input to ANI0 to ANI3 is converted into a digital signal, based on the voltage applied across AVREF and
VSS.
(10) VSS pin
This is the ground potential pin.
In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to connect
VSS to a stabilized GND (= 0 V).
(11) A/D converter mode register (ADM)
This register is used to set the conversion time of the analog input signal to be converted, and to start or stop the
conversion operation.
(12) Analog input channel specification register (ADS)
This register is used to specify the port that inputs the analog voltage to be converted into a digital signal.
(13) Port mode control register 2 (PMC2)
This register is used when the P20/ANI0 to P23/ANI3 pins are used as the analog input pins of the A/D converter.
159
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.3 Registers Used by A/D Converter
The A/D converter uses the following six registers.
•
•
•
•
•
•
A/D converter mode register (ADM)
Analog input channel specification register (ADS)
10-bit A/D conversion result register (ADCR)
8-bit A/D conversion result register (ADCRH)
Port mode control register 2 (PMC2)
Port mode register 2 (PM2)
160
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(1) A/D converter mode register (ADM)
This register sets the conversion time for analog input to be A/D converted, and starts/stops conversion.
ADM can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
Figure 10-3. Format of A/D Converter Mode Register (ADM)
Address: FF80H After reset: 00H R/W
Symbol
ADM
<7>
6
0
5
4
3
2
0
1
0
<0>
ADCS
FR2
FR1
FR0
ADCE
ADCS
0
1Note 1
A/D conversion operation control
Stops conversion operation
Starts conversion operation
FR2
FR1
FR0
Reference
Voltage
RangeNote 2
Sampling
TimeNote 3
Conversion
TimeNote 4
fXP = 8 MHz
fXP = 10 MHz
Sampling
TimeNote 3
Conversion
TimeNote 4
4.5 µs
Sampling
TimeNote 3
1.2 µs
Conversion
TimeNote 4
3.6 µs
0
1
0
0
0
0
AVREF
4.5 V
≥
12/fXP
24/fXP
36/fXP
72/fXP
1.5 µs
AVREF
3.0 µs
9.0 µs
2.4 µs
7.2 µs
≥
4.0 V
1
1
0
0
1
0
1
0
0
1
0
1
AVREF
2.85 V
≥
96/fXP
48/fXP
48/fXP
24/fXP
144/fXP
96/fXP
72/fXP
48/fXP
12.0 µs
6.0 µs
6.0 µs
3.0 µs
18.0 µs
12.0 µs
9.0 µs
9.6 µs
4.8 µs
4.8 µs
14.4 µs
9.6 µs
7.2 µs
6.0 µs
Setting
prohibited
(2.4 µs)
17.6 µs
Setting
Setting
prohibited
(4.8 µs)
1
0
1
1
1
1
AVREF
176/fXP
88/fXP
224/fXP
112/fXP
22.0 µs
11.0 µs
28.0 µs
14.0 µs
22.4 µs
Setting
≥
2.7 V
prohibited
prohibited
(8.8
µs)
(11.2 µs)
ADCE
0Note 1
1
Comparator operation controlNote 5
Stops operation of comparator
Enables operation of comparator
Remarks 1. fXP: Oscillation frequency of clock to peripheral hardware
2. The conversion time refers to the total of the sampling time and the time from successively
comparing with the sampling value until the conversion result is output.
Notes 1. Even when the ADCE = 0 (comparator operation stopped), the A/D conversion operation starts if
the ADCS is set to 1. However, the first conversion data is out of the guaranteed-value range, so
ignore it.
161
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
Notes 2. Be sure to set the FR2, FR1, and FR0, in accordance with the reference voltage so that Notes 2
and 3 below are satisfied.
Example When AVREF ≥ 2.7 V, fXP = 8 MHz
• The sampling time is 11.0 µs or more and the A/D conversion time is 14.0 µs or
more and 100 µs or less.
• Set FR2, FR1, and FR0 = 0, 1, 1 or 1, 1, 1.
3. Set the sampling time as follows.
• AVREF ≥ 4.5 V: 1.0 µs or more
• AVREF ≥ 4.0 V: 2.4 µs or more
• AVREF ≥ 2.85 V: 3.0 µs or more
• AVREF ≥ 2.7 V: 11.0 µs or more
4. Set the A/D conversion time as follows.
• AVREF ≥ 4.5 V: 3.0 µs or more and less than 100 µs
• AVREF ≥ 4.0 V: 4.8 µs or more and less than 100 µs
• AVREF ≥ 2.85 V: 6.0 µs or more and less than 100 µs
• AVREF ≥ 2.7 V: 14.0 µs or more and less than 100 µs
5. The operation of the comparator is controlled by ADCS and ADCE, and it takes 1 µs from
operation start to operation stabilization. Therefore, when ADCS is set to 1 after 1 µs or more
has elapsed from the time ADCE is set to 1, the conversion result at that time has priority over
the first conversion result. If the ADCS is set to 1 without waiting for 1 µs or longer, ignore the
first conversion data.
Table 10-2. Settings of ADCS and ADCE
ADCS
ADCE
A/D Conversion Operation
Stop status (DC power consumption path does not exist)
Conversion waiting mode (only comparator consumes power)
Conversion mode
0
0
1
0
1
×
Figure 10-4. Timing Chart When Comparator Is Used
Comparator operating
ADCE
Comparator
ADCS
Conversion
operation
Conversion
waiting
Conversion
operation
Conversion stopped
Note
Note The time from the rising of the ADCE bit to the rising of the ADCS bit must be 1 µs or longer to stabilize the
internal circuit.
Cautions 1. The above sampling time and conversion time do not include the clock frequency error.
Select the conversion time taking the clock frequency error into consideration (an error
margin maximum of 5% when using the high-speed internal oscillator).
162
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
Cautions 2. If a bit other than ADCS of ADM is manipulated while A/D conversion is stopped (ADCS = 0)
and then A/D conversion is started, execute two NOP instructions or an instruction
equivalent to two machine cycles, and set ADCS to 1.
3. A/D conversion must be stopped (ADCS = 0) before rewriting bits FR0 to FR2.
4. Be sure to clear bits 6, 2, and 1 to 0.
(2) Analog input channel specification register (ADS)
This register specifies the input port of the analog voltage to be A/D converted.
ADS can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
Figure 10-5. Format of Analog Input Channel Specification Register (ADS)
Address: FF81H After reset: 00H R/W
Symbol
ADS
7
0
6
0
5
0
4
0
3
0
2
0
1
0
ADS1
ADS0
ADS1 ADS0
Analog input channel specification
0
0
1
1
0
1
0
1
ANI0
ANI1
ANI2
ANI3
Caution Be sure to clear bits 2 to 7 of ADS to 0.
(3) 10-bit A/D conversion result register (ADCR)
This register is a 16-bit register that stores the A/D conversion result. The higher six bits are fixed to 0. Each
time A/D conversion ends, the conversion result is loaded from the successive approximation register, and is
stored in ADCR in order starting from bit 1 of FF19H. FF19H indicates the higher 2 bits of the conversion result,
and FF18H indicates the lower 8 bits of the conversion result.
ADCR can be read by a 16-bit memory manipulation instruction.
Reset signal generation makes ADCR undefined.
Figure 10-6. Format of 10-Bit A/D Conversion Result Register (ADCR)
Address: FF18H, FF19H After reset: Undefined
FF19H
R
FF18H
Symbol
ADCR
0
0
0
0
0
0
Caution When writing to the A/D converter mode register (ADM) and analog input channel specification
register (ADS), the contents of ADCR may become undefined. Read the conversion result
following conversion completion before writing to ADM and ADS. Using timing other than the
above may cause an incorrect conversion result to be read.
163
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(4) 8-bit A/D conversion result register (ADCRH)
This register is an 8-bit register that stores the A/D conversion result. It stores the higher 8 bits of a 10-bit
resolution result.
ADCRH can be read by an 8-bit memory manipulation instruction.
Reset signal generation makes ADCRH undefined.
Figure 10-7. Format of 8-Bit A/D Conversion Result Register (ADCRH)
Address: FF1AH After reset: Undefined
R
Symbol
ADCRH
7
6
5
4
3
2
1
0
(5) Port mode control register 2 (PMC2) and port mode register 2 (PM2)
When using the P20/ANI0 to P23/ANI3 pins for analog input, set PMC20 to PMC23 and PM20 to PM23 to 1. At
this time, the output latches of P20 to P23 may be 0 or 1.
PMC2 and PM2 are set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears PMC2 to 00H and sets PM2 to FFH.
Figure 10-8. Format of Port Mode Control Register 2 (PMC2)
Address: FF84H After reset: 00H R/W
Symbol
PMC2
7
0
6
0
5
0
4
0
3
2
1
0
PMC23
PMC22
PMC21
PMC20
PMC2n
Operation mode specification (n = 0 to 3)
0
1
Port mode
A/D converter mode
Figure 10-9. Format of Port Mode Register 2 (PM2)
Address: FF22H After reset: FFH R/W
Symbol
PM2
7
1
6
1
5
1
4
1
3
2
1
0
PM23
PM22
PM21
PM20
PM2n
P2n pin I/O mode selection (n = 0 to 3)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
Caution When PMC20 to PMC23 are set to 1, the P20/ANI0 to P23/ANI3 pins cannot be used as port
pins.
164
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.4 A/D Converter Operations
10.4.1 Basic operations of A/D converter
<1> Set ADCE to 1.
<2> Select one channel for A/D conversion using the analog input channel specification register (ADS), and
select the conversion time using FR2 to FR0.
<3> Execute two NOP instructions or an instruction equivalent to two machine cycles.
<4> Set ADCS to 1 and start the conversion operation.
(<5> to <11> are operations performed by hardware.)
<5> The voltage input to the selected analog input channel is sampled by the sample & hold circuit.
<6> 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 has ended.
<7> Bit 9 of the successive approximation register (SAR) is set. The D/A converter voltage tap is set to (1/2)
AVREF by the tap selector.
<8> The voltage difference between the D/A converter 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 to 1. If the analog
input is smaller than (1/2) AVREF, the MSB is reset to 0.
<9> Next, bit 8 of SAR is automatically set to 1, and the operation proceeds to the next comparison. The D/A
converter 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
<10> Comparison is continued in this way up to bit 0 of SAR.
<11> Upon completion of the comparison of 10 bits, an effective digital result value remains in SAR, and the result
value is transferred to the A/D conversion result register (ADCR, ADCRH) and then latched.
At the same time, the A/D conversion end interrupt request (INTAD) can also be generated.
<12> Repeat steps <5> to <11>, until ADCS is cleared to 0.
To stop the A/D converter, clear ADCS to 0.
To restart A/D conversion from the status of ADCE = 1, start from <3>. To restart A/D conversion from the
status of ADCE = 0, however, start from <1> (when not changing the channel and conversion time, skip step
<2>).
Cautions 1. Make sure the period of <1> to <4> is 1 µs or more.
2. It is no problem if the order of <1> and <2> is reversed.
Remark The following two types of A/D conversion result registers can be used.
<1> ADCR (16 bits): Stores a 10-bit A/D conversion value.
<2> ADCRH (8 bits): Stores an 8-bit A/D conversion value.
165
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
Figure 10-10. Basic Operation of A/D Converter
Conversion time
Sampling time
Sampling
A/D converter
operation
A/D conversion
Conversion
result
Undefined
SAR
ADCR,
ADCRH
Conversion
result
INTAD
A/D conversion operations are performed continuously until bit 7 (ADCS) of the A/D converter mode register (ADM)
is reset (0) by software.
If a write operation is performed to ADM or the analog input channel specification register (ADS) during an A/D
conversion operation, the conversion operation is initialized, and if the ADCS bit is set (1), conversion starts again
from the beginning.
Reset signal generation makes the A/D conversion result register (ADCR, ADCRH) undefined.
166
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.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 the 10-bit A/D conversion result register (ADCR)) is shown by the following
expression.
VAIN
AVREF
ADCR = INT (
× 1024 + 0.5)
or
AVREF
1024
AVREF
1024
(ADCR − 0.5) ×
≤ VAIN < (ADCR + 0.5) ×
where, INT( ): Function which returns integer part of value in parentheses
VAIN: Analog input voltage
AVREF: AVREF pin voltage
ADCR: 10-bit A/D conversion result register (ADCR) value
Figure 10-11 shows the relationship between the analog input voltage and the A/D conversion result.
Figure 10-11. Relationship Between Analog Input Voltage and A/D Conversion Result
SAR
ADCR
1023
03FFH
1022
03FEH
03FDH
0003H
0002H
0001H
0000H
1021
A/D conversion result
3
2
1
0
1
1
3
2
5
3
2043 1022 2045 1023 2047
2048 1024 2048 1024 2048
1
2048 1024 2048 1024 2048 1024
Input voltage/AVREF
167
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.4.3 A/D converter operation mode
The operation mode of the A/D converter is the select mode. One channel of analog input is selected from ANI0 to
ANI3 by the analog input channel specification register (ADS) and A/D conversion is executed.
(1) A/D conversion operation
By setting bit 7 (ADCS) of the A/D converter mode register (ADM) to 1, the A/D conversion operation of the
voltage, which is applied to the analog input pin specified by the analog input channel specification register
(ADS), is started.
When A/D conversion has been completed, the result of the A/D conversion is stored in the A/D conversion result
register (ADCR, ADCRH), and an interrupt request signal (INTAD) is generated. Once the A/D conversion has
started and when one A/D conversion has been completed, the next A/D conversion operation is immediately
started. The A/D conversion operations are repeated until new data is written to ADS.
If ADM or ADS is written during A/D conversion, the A/D conversion operation under execution is stopped and
restarted from the beginning.
If 0 is written to ADCS during A/D conversion, A/D conversion is immediately stopped. At this time, the
conversion result is undefined.
Figure 10-12. A/D Conversion Operation
Rewriting ADM
ADCS = 1
Rewriting ADS
ANIn
ADCS = 0
A/D conversion
ANIn
ANIn
ANIm
ANIm
Conversion is stopped
Conversion result is not retained
Stopped
ADCR,
ADCRH
ANIn
ANIn
ANIm
INTAD
Remarks 1. n = 0 to 3
2. m = 0 to 3
168
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
The setting method is described below.
<1> Set bit 0 (ADCE) of the A/D converter mode register (ADM) to 1.
<2> Select the channel and conversion time using bits 1 and 0 (ADS1, ADS0) of the analog input channel
specification register (ADS) and bits 5 to 3 (FR2 to FR0) of ADM.
<3> Execute two NOP instructions or an instruction equivalent to two machine cycles.
<4> Set bit 7 (ADCS) of ADM to 1 to start A/D conversion.
<5> An interrupt request signal (INTAD) is generated.
<6> Transfer the A/D conversion data to the A/D conversion result register (ADCR, ADCRH).
<Change the channel>
<7> Change the channel using bits 1 and 0 (ADS1, ADS0) of ADS.
<8> An interrupt request signal (INTAD) is generated.
<9> Transfer the A/D conversion data to the A/D conversion result register (ADCR, ADCRH).
<Complete A/D conversion>
<10> Clear ADCS to 0.
<11> Clear ADCE to 0.
Cautions 1. Make sure the period of <1> to <4> is 1 µs or more.
2. It is no problem if the order of <1> and <2> is reversed.
3. <1> can be omitted. However, ignore the data resulting from the first conversion after
<4> in this case.
4. The period from <5> to <8> differs from the conversion time set using bits 5 to 3 (FR2 to
FR0) of ADM. The period from <7> to <8> is the conversion time set using FR2 to FR0.
169
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.5 How to Read A/D Converter Characteristics Table
Here, special terms unique to the A/D converter are explained.
(1) Resolution
This is the minimum analog input voltage that can be identified. That is, the percentage of the analog input
voltage per 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).
1LSB is as follows 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, and differential linearity errors that are combinations of
these express the overall error.
Note that the quantization error is not included in the overall error in the characteristics table.
(3) Quantization error
When analog values are converted to digital values, a 1/2LSB error naturally occurs. In an A/D converter, an
analog input voltage in a range of 1/2LSB is converted to the same digital code, so a quantization error cannot
be avoided.
Note that the quantization error 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 10-13. Overall Error
Figure 10-14. 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
(4) Zero-scale error
This shows the difference between the actual measurement 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 measurement value is greater than the theoretical value, it shows the difference between the actual
measurement value of the analog input voltage and the theoretical value (3/2LSB) when the digital output
changes from 0……001 to 0……010.
170
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(5) Full-scale error
This shows the difference between the actual measurement 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 measurement value and the ideal straight line
when the zero-scale error and full-scale error are 0.
(7) Differential linearity error
While the ideal width of code output is 1LSB, this indicates the difference between the actual measurement value
and the ideal value.
Figure 10-15. Zero-Scale Error
Figure 10-16. Full-Scale Error
111
Full-scale error
Ideal line
011
111
110
010
101
000
001
Ideal line
Zero-scale error
000
0
1
2
3
AVREF
0
AVREF−3 AVREF−2 AVREF−1 AVREF
Analog input (LSB)
Analog input (LSB)
Figure 10-17. Integral Linearity Error
Figure 10-18. Differential Linearity Error
……
1 1
……
1
1
Ideal 1LSB width
Ideal line
Differential
linearity error
Integral linearity
error
……
0 0
……
0
0
AVREF
AVREF
0
0
Analog input
Analog input
(8) Conversion time
This expresses the time from the start of sampling to when the digital output is obtained.
The 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
171
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
10.6 Cautions for A/D Converter
(1) Operating current in STOP mode
The A/D converter stops operating in the STOP mode. At this time, the operating current can be reduced by
clearing bit 7 (ADCS) and bit 0 (ADCE) of the A/D converter mode register (ADM) to 0.
(2) Input range of ANI0 to ANI3
Observe the rated range of the ANI0 to ANI3 input voltage. If a voltage of AVREF or higher and VSS or lower (even
in the range of absolute maximum ratings) is input to an analog input channel, the converted value of that channel
becomes undefined. In addition, the converted values of the other channels may also be affected.
(3) Conflicting operations
<1> Conflict between A/D conversion result register (ADCR, ADCRH) write and ADCR, ADCRH read by
instruction upon the end of conversion
ADCR, ADCRH read has priority. After the read operation, the new conversion result is written to ADCR,
ADCRH.
<2> Conflict between ADCR, ADCRH write and A/D converter mode register (ADM) write or analog input
channel specification register (ADS) write upon the end of conversion
ADM or ADS write has priority. ADCR, ADCRH write is not performed, nor is the conversion end interrupt
signal (INTAD) generated.
172
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(4) Noise countermeasures
To maintain the 10-bit resolution, attention must be paid to noise input to the AVREF pin and ANI0 to ANI3 pins.
<1> Connect a capacitor with a low equivalent resistance and a high frequency response to the power supply.
<2> Because the effect increases in proportion to the output impedance of the analog input source, it is
recommended that a capacitor be connected externally, as shown in Figure 9-19, to reduce noise.
<3> Do not switch the A/D conversion function of the ANI0 to ANI3 pins to their alternate functions during
conversion.
<4> The conversion accuracy can be improved by setting HALT mode immediately after the conversion starts.
Figure 10-19. Analog Input Pin Connection
If there is a possibility that noise equal to or higher than AVREF or
equal to or lower than VSS may enter, clamp with a diode with a
small V value (0.3 V or lower).
F
Reference
voltage
input
AVREF
ANI0 to ANI3
C = 0.01 to 0.1 µF
V
SS
(5) ANI0/P20 to ANI3/P23
<1> The analog input pins (ANI0 to ANI3) are also used as input port pins (P20 to P23).
When A/D conversion is performed with any of ANI0 to ANI3 selected, do not access P20 to P23 while
conversion is in progress; otherwise the conversion resolution may be degraded.
<2> If a digital pulse is applied to the pins adjacent to the pins currently used for A/D conversion, the expected
value of the A/D conversion may not be obtained due to coupling noise. Therefore, do not apply a pulse to
the pins adjacent to the pin undergoing A/D conversion.
(6) Input impedance of ANI0 to ANI3 pins
In this A/D converter, the internal sampling capacitor is charged and sampling is performed during sampling time.
Since only the leakage current flows other than during sampling and the current for charging the capacitor also
flows during sampling, the input impedance fluctuates both during sampling and otherwise.
If the shortest conversion time of the reference voltage is used, to perform sufficient sampling, it is recommended
to make the output impedance of the analog input source 1 kΩ or lower, or attach a capacitor of around 0.01 µF
to 0.1 µF to the ANI0 to ANI3 pins (see Figure 10-19).
173
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(7) Interrupt request flag (ADIF)
The interrupt request flag (ADIF) is not cleared even if the analog input channel specification register (ADS) is
changed.
Therefore, if an analog input pin is changed during A/D conversion, the A/D conversion result and ADIF for the
pre-change analog input may be set just before the ADS rewrite. Caution is therefore required since, at this time,
when ADIF is read immediately after the ADS rewrite, ADIF is set despite the fact A/D conversion for the post-
change analog input has not ended.
When A/D conversion is stopped and then resumed, clear ADIF before the A/D conversion operation is resumed.
Figure 10-20. Timing of A/D Conversion End Interrupt Request Generation
ADS rewrite
(start of ANIn conversion)
ADS rewrite
(start of ANIm conversion)
ADIF is set but ANIm conversion
has not ended.
A/D conversion
ANIn
ANIn
ANIm
ANIn
ANIm
ADCR,
ADCRH
ANIn
ANIm
ANIm
ADIF
Remarks 1. n = 0 to 3
2. m = 0 to 3
(8) Conversion results just after A/D conversion start
The first A/D conversion value immediately after A/D conversion starts may not fall within the rating range if the
ADCS bit is set to 1 within 1 µs after the ADCE bit was set to 1, or if the ADCS bit is set to 1 with the ADCE bit =
0. Take measures such as polling the A/D conversion end interrupt request (INTAD) and removing the first
conversion result.
(9) A/D conversion result register (ADCR, ADCRH) read operation
When a write operation is performed to the A/D converter mode register (ADM) and analog input channel
specification register (ADS), the contents of ADCR and ADCRH may become undefined. Read the conversion
result following conversion completion before writing to ADM and ADS. Using a timing other than the above may
cause an incorrect conversion result to be read.
174
User’s Manual U16898EJ3V0UD
CHAPTER 10 A/D CONVERTER
(10) Internal equivalent circuit
The equivalent circuit of the analog input block is shown below.
Figure 10-21. Internal Equivalent Circuit of ANIn Pin
ROUT
RIN
ANIn
COUT
CIN
LSI internal
Table 10-3. Resistance and Capacitance Values (Reference Values) of Equivalent Circuit
AVREF
ROUT
1 kΩ
1 kΩ
RIN
COUT
8 pF
8 pF
CIN
4.5 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.5 V
3 kΩ
60 kΩ
15 pF
15 pF
Remarks 1. The resistance and capacitance values shown in Table 10-3 are not guaranteed values.
2. n = 0 to 3
3. ROUT: Allowable signal source impedance
RIN: Analog input equivalent resistance
CIN: Analog input equivalent capacitance
COUT: Internal pin capacitance
175
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
11.1 Functions of Serial Interface UART6
Serial interface UART6 has the following two modes.
(1) Operation stop mode
This mode is used when serial communication is not executed and can enable a reduction in the power
consumption.
For details, see 11.4.1 Operation stop mode.
(2) Asynchronous serial interface (UART) mode
This mode supports the LIN (Local Interconnect Network)-bus. The functions of this mode are outlined below.
For details, see 11.4.2 Asynchronous serial interface (UART) mode and 11.4.3 Dedicated baud rate
generator.
•
Two-pin configuration TXD6: Transmit data output pin
RXD6: Receive data input pin
•
•
•
•
•
•
•
Data length of communication data can be selected from 7 or 8 bits.
Dedicated internal 8-bit baud rate generator allowing any baud rate to be set
Transmission and reception can be performed independently.
MSB- or LSB-first communication selectable
Inverted transmission operation
Synchronous break field transmission from 13 to 20 bits
More than 11 bits can be identified for synchronous break field reception (SBF reception flag provided).
Cautions 1. The TXD6 output inversion function inverts only the transmission side and not the reception
side. To use this function, the reception side must be ready for reception of inverted data.
2. If clock supply to serial interface UART6 is not stopped (e.g., in the HALT mode), normal
operation continues. If clock supply to serial interface UART6 is stopped (e.g., in the STOP
mode), each register stops operating, and holds the value immediately before clock supply
was stopped. The TXD6 pin also holds the value immediately before clock supply was
stopped and outputs it. However, the operation is not guaranteed after clock supply is
resumed. Therefore, reset the circuit so that POWER6 = 0, RXE6 = 0, and TXE6 = 0.
3. If data is continuously transmitted, the communication timing from the stop bit to the next
start bit is extended two operating clocks of the macro. However, this does not affect the
result of communication because the reception side initializes the timing when it has
detected a start bit. Do not use the continuous transmission function if the interface is
incorporated in LIN.
176
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Remark LIN stands for Local Interconnect Network and is a low-speed (1 to 20 kbps) serial communication
protocol intended to aid the cost reduction of an automotive network.
LIN communication is single-master communication, and up to 15 slaves can be connected to one
master.
The LIN slaves are used to control the switches, actuators, and sensors, and these are connected to the
LIN master via the LIN network.
Normally, the LIN master is connected to a network such as CAN (Controller Area Network).
In addition, the LIN bus uses a single-wire method and is connected to the nodes via a transceiver that
complies with ISO9141.
In the LIN protocol, the master transmits a frame with baud rate information and the slave receives it and
corrects the baud rate error. Therefore, communication is possible when the baud rate error in the slave
is 15% or less.
Figures 11-1 and 11-2 outline the transmission and reception operations of LIN.
Figure 11-1. LIN Transmission Operation
Wakeup
signal frame
Synchronous
break field
Synchronous
field
Identifier
field
Data field
Data field Checksum
field
LIN bus
13-bitNote 2 SBF
transmission
55H
Data
Data
Data
Data
8 bitsNote 1
transmission transmissiontransmissiontransmissiontransmission
TX6
INTST6Note 3
Notes 1. The wakeup signal frame is substituted by 80H transmission in the 8-bit mode.
2. The synchronous break field is output by hardware. The output width is equal to the bit length set by
bits 4 to 2 (SBL62 to SBL60) of asynchronous serial interface control register 6 (ASICL6) (see 11.4.2
(2) (h) SBF transmission).
3. INTST6 is output on completion of each transmission. It is also output when SBF is transmitted.
Remark The interval between each field is controlled by software.
177
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-2. LIN Reception Operation
Wakeup
signal frame
Synchronous
break field
Synchronous Identifier Data field Data field Checksum
field
field
field
LIN bus
13 bits
SF
ID
Data
Data
Data
reception
reception reception reception reception
SBF reception
<5>
<2>
RX6
Disable
Enable
<3>
Reception interrupt
(INTSR6)
<1>
Edge detection
(INTP0)
<4>
Capture timer
Disable
Enable
The flow for reception processing is described below.
<1> The wakeup signal is detected at the edge of the pin, and enables UART6 and sets the SBF reception mode.
<2> Reception continues until the STOP bit is detected. When an SBF with low-level data of 11 bits or more has
been detected, it is assumed that SBF reception has been completed correctly, and an interrupt request signal
is output. If an SBF with low-level data of less than 11 bits has been detected, it is assumed that an SBF
reception error has occurred. The interrupt request signal is not output and the SBF reception mode is
restored.
<3> If SBF reception has been completed correctly, an interrupt request signal is output. Start the 16-bit
timer/event counter 00 during SBF reception completion interrupt processing, and measure the bit width
(pulse width) of the sync field (refer to 6.4.3 Pulse width measurement operations). Detection of errors
OVE6, PE6, and FE6 is suppressed, and error detection processing of UART communication and data
transfer of the shift register and RXB6 is not performed. The shift register holds the reset value FFH.
<4> Calculate the baud rate error from the bit interval of the synchronous field, disable UART6 after SF reception,
and then re-set baud rate generator control register 6 (BRGC6).
<5> Distinguish the checksum field by software. Also perform processing by software to initialize UART6 after
reception of the checksum field and to set the SBF reception mode again.
Figure 11-3 is Port Configuration for LIN Reception Operation.
The wakeup signal transmitted from the LIN master is received by detecting the edge of the external interrupt
(INTP0). The length of the synchronous field transmitted from the LIN master can be measured using the external
event capture operation of 16-bit timer/event counter 00, and the baud rate error can be calculated.
The input signal of the reception port input (RxD6) can be input to the external interrupt (INTP0) and 16-bit
timer/event counter 00 by port input switch control (ISC0/ISC1), without connecting RxD6 and INTP0/TI000 externally.
178
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-3. Port Configuration for LIN Reception Operation
Selector
P44/R D6
X
RXD6 input
Port mode
(PM44)
Output latch
(P44)
Selector
Selector
P30/INTP0/TI000
INTP0 input
Port mode
(PM30)
Port input
selection control
(ISC0)
Output latch
(P30)
<ISC0>
0: Selects INTP0 (P30).
1: Selects RxD6 (P44).
Selector
TI000 input
Port input
selection control
(ISC1)
<ISC1>
0: Selects TI000 (P30).
1: Selects RxD6 (P44).
Remark ISC0, ISC1: Bits 0 and 1 of the input switch control register (ISC) (see Figure 11-11)
The peripheral functions used in the LIN communication operation are shown below.
<Peripheral functions used>
• External interrupt (INTP0); wakeup signal detection
Use: Detects the wakeup signal edges and detects start of communication.
• 16-bit timer/event counter 00 (TI000); baud rate error detection
Use: Detects the baud rate error (measures the TI000 input edge interval in the capture mode) by detecting the
synchronous field (SF) length and divides it by the number of bits.
• Serial interface UART6
179
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
11.2 Configuration of Serial Interface UART6
Serial interface UART6 consists of the following hardware.
Table 11-1. Configuration of Serial Interface UART6
Item
Registers
Configuration
Receive buffer register 6 (RXB6)
Receive shift register 6 (RXS6)
Transmit buffer register 6 (TXB6)
Transmit shift register 6 (TXS6)
Control registers
Asynchronous serial interface operation mode register 6 (ASIM6)
Asynchronous serial interface reception error status register 6 (ASIS6)
Asynchronous serial interface transmission status register 6 (ASIF6)
Clock selection register 6 (CKSR6)
Baud rate generator control register 6 (BRGC6)
Asynchronous serial interface control register 6 (ASICL6)
Input switch control register (ISC)
Port mode register 4 (PM4)
Port register 4 (P4)
180
User’s Manual U16898EJ3V0UD
Figure 11-4. Block Diagram of Serial Interface UART6
TI000, INTP0Note
Filter
RX
D6/
P44
INTSR6
Reception control
INTSRE6
Receive shift register 6
(RXS6)
f
XP
f
XP/2
f
f
f
f
f
f
f
f
XP/22
XP/23
XP/24
XP/25
XP/26
XP/27
XP/28
XP/29
Asynchronous serial
interface operation mode
register 6 (ASIM6)
Asynchronous serial
interface reception error
status register 6 (ASIS6)
Asynchronous serial interface
control register 6 (ASICL6)
Baud rate
generator
Receive buffer register 6
(RXB6)
Reception unit
Internal bus
f
f
XP/210
XP/211
Baud rate generator
control register 6
(BRGC6)
Asynchronous serial
Clock selection
register 6 (CKSR6)
Asynchronous serial interface
control register 6 (ASICL6)
Transmit buffer register 6
(TXB6)
Baud rate
generator
interface transmission
status register 6 (ASIF6)
8
8
Transmit shift register 6
(TXS6)
Transmission control
INTST6
T
X
D6/
Registers
INTP1/P43
Output latch
(P43)
PM43
Transmission unit
Note Selectable with input switch control register (ISC).
CHAPTER 11 SERIAL INTERFACE UART6
(1) Receive buffer register 6 (RXB6)
This 8-bit register stores parallel data converted by receive shift register 6 (RXS6).
Each time 1 byte of data has been received, new receive data is transferred to this register from receive shift
register 6 (RXS6). If the data length is set to 7 bits, data is transferred as follows.
•
In LSB-first reception, the receive data is transferred to bits 0 to 6 of RXB6 and the MSB of RXB6 is always 0.
In MSB-first reception, the receive data is transferred to bits 7 to 1 of RXB6 and the LSB of RXB6 is always 0.
•
If an overrun error (OVE6) occurs, the receive data is not transferred to RXB6.
RXB6 can be read by an 8-bit memory manipulation instruction. No data can be written to this register.
Reset signal generation sets this register to FFH.
(2) Receive shift register 6 (RXS6)
This register converts the serial data input to the RXD6 pin into parallel data.
RXS6 cannot be directly manipulated by a program.
(3) Transmit buffer register 6 (TXB6)
This buffer register is used to set transmit data. Transmission is started when data is written to TXB6.
If the data length is set to 7 bits:
•
•
In LSB-fast transmission, data is transferred to bits 0 to 6 of TXB6, and the MSB of TXB6 is not transmitted.
In MSB-fast transmission, data is transferred to bits 7 to 1 of TXB6, and the LSB of TXB6 is not transmitted.
This register can be read or written by an 8-bit memory manipulation instruction.
Reset signal generation sets this register to FFH.
Cautions 1. Do not write data to TXB6 when bit 1 (TXBF6) of asynchronous serial interface transmission
status register 6 (ASIF6) is 1.
2. Do not refresh (write the same value to) TXB6 by software during a communication
operation (when bit 7 (POWER6) and bit 6 (TXE6) of asynchronous serial interface operation
mode register 6 (ASIM6) are 1 or when bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 are 1).
(4) Transmit shift register 6 (TXS6)
This register transmits the data transferred from TXB6 from the TXD6 pin as serial data. Data is transferred from
TXB6 immediately after TXB6 is written for the first transmission, or immediately before INTST6 occurs after one
frame was transmitted for continuous transmission. Data is transferred from TXB6 and transmitted from the TXD6
pin at the falling edge of the base clock.
TXS6 cannot be directly manipulated by a program.
182
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
11.3 Registers Controlling Serial Interface UART6
Serial interface UART6 is controlled by the following nine registers.
•
•
•
•
•
•
•
•
•
Asynchronous serial interface operation mode register 6 (ASIM6)
Asynchronous serial interface reception error status register 6 (ASIS6)
Asynchronous serial interface transmission status register 6 (ASIF6)
Clock selection register 6 (CKSR6)
Baud rate generator control register 6 (BRGC6)
Asynchronous serial interface control register 6 (ASICL6)
Input switch control register (ISC)
Port mode register 4 (PM4)
Port register 4 (P4)
(1) Asynchronous serial interface operation mode register 6 (ASIM6)
This 8-bit register controls the serial communication operations of serial interface UART6.
This register can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets this register to 01H.
Remark ASIM6 can be refreshed (the same value is written) by software during a communication operation
(when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6
= 1).
Figure 11-5. Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) (1/2)
Address: FF90H After reset: 01H R/W
Symbol
ASIM6
<7>
<6>
<5>
4
3
2
1
0
POWER6
TXE6
RXE6
PS61
PS60
CL6
SL6
ISRM6
POWER6
0Note 1
Enabling/disabling operation of internal operation clock
Disable operation of the internal operation clock (fixes the clock to low level) and asynchronously
resets the internal circuitNote 2
Enable operation of the internal operation clock
.
1Note 3
TXE6
Enabling/disabling transmission
0
1
Disable transmission (synchronously reset the transmission circuit).
Enable transmission
Notes 1. The output of the TXD6 pin goes high and the input from the RXD6 pin is fixed to the high level when
POWER6 is cleared to 0 during a transmission 0.
2. Asynchronous serial interface reception error status register 6 (ASIS6), asynchronous serial interface
transmission status register 6 (ASIF6), bit 7 (SBRF6) and bit 6 (SBRT6) of asynchronous serial
interface control register 6 (ASICL6), and receive buffer register 6 (RXB6) are reset.
3. Operation of the 8-bit counter output is enabled at the second base clock after 1 is written to the
POWER6 bit.
183
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-5. Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) (2/2)
RXE6
Enabling/disabling reception
Disable reception (synchronously reset the reception circuit).
Enable reception
0
1
PS61
PS60
Transmission operation
Parity bit not output.
Reception operation
Reception without parity
Reception as 0 parityNote
Judge as odd parity.
Judge as even parity.
0
0
1
1
0
1
0
1
Output 0 parity.
Output odd parity.
Output even parity.
CL6
0
Specification of character length of transmit/receive data
Character length of data = 7 bits
Character length of data = 8 bits
1
SL6
0
Specification of number of stop bits of transmit data
Number of stop bits = 1
Number of stop bits = 2
1
ISRM6
Enabling/disabling occurrence of reception completion interrupt in case of error
0
1
“INTSRE6” occurs in case of error (at this time, INTSR6 does not occur).
“INTSR6” occurs in case of error (at this time, INTSRE6 does not occur).
Note If “reception as 0 parity” is selected, the parity is not judged. Therefore, bit 2 (PE6) of asynchronous serial
interface reception error status register 6 (ASIS6) is not set and the error interrupt does not occur.
Cautions 1. At startup, set POWER6 to 1 and then set TXE6 to 1. To stop the operation, clear TXE6 to 0,
and then clear POWER6 to 0.
2. At startup, set POWER6 to 1 and then set RXE6 to 1. To stop the operation, clear RXE6 to 0,
and then clear POWER6 to 0.
3. Set POWER6 to 1 and then set RXE6 to 1 while a high level is input to the RxD6 pin. If
POWER6 is set to 1 and RXE6 is set to 1 while a low level is input, reception is started.
4. Clear the TXE6 and RXE6 bits to 0 before rewriting the PS61, PS60, and CL6 bits.
5. Fix the PS61 and PS60 bits to 0 when mounting the device on LIN.
6. Make sure that TXE6 = 0 when rewriting the SL6 bit. Reception is always performed with “the
number of stop bits = 1”, and therefore, is not affected by the set value of the SL6 bit.
7. Make sure that RXE6 = 0 when rewriting the ISRM6 bit.
184
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(2) Asynchronous serial interface reception error status register 6 (ASIS6)
This register indicates an error status on completion of reception by serial interface UART6. It includes three
error flag bits (PE6, FE6, OVE6).
This register is read-only by an 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H if bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 = 0. 00H is read
when this register is read.
Figure 11-6. Format of Asynchronous Serial Interface Reception Error Status Register 6 (ASIS6)
Address: FF93H After reset: 00H R
Symbol
ASIS6
7
0
6
0
5
0
4
0
3
0
2
1
0
PE6
FE6
OVE6
PE6
0
Status flag indicating parity error
If POWER6 = 0 and RXE6 = 0, or if ASIS6 register is read
1
If the parity of transmit data does not match the parity bit on completion of reception
FE6
0
Status flag indicating framing error
If POWER6 = 0 and RXE6 = 0, or if ASIS6 register is read
If the stop bit is not detected on completion of reception
1
OVE6
Status flag indicating overrun error
0
1
If POWER6 = 0 and RXE6 = 0, or if ASIS6 register is read
If receive data is set to the RXB register and the next reception operation is completed before the
data is read.
Cautions 1. The operation of the PE6 bit differs depending on the set values of the PS61 and PS60 bits of
asynchronous serial interface operation mode register 6 (ASIM6).
2. The first bit of the receive data is checked as the stop bit, regardless of the number of stop
bits.
3. If an overrun error occurs, the next receive data is not written to receive buffer register 6
(RXB6) but discarded.
4. Be sure to read ASIS6 before reading receive buffer register 6 (RXB6).
185
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(3) Asynchronous serial interface transmission status register 6 (ASIF6)
This register indicates the status of transmission by serial interface UART6. It includes two status flag bits
(TXBF6 and TXSF6).
Transmission can be continued without disruption even during an interrupt period, by writing the next data to the
TXB6 register after data has been transferred from the TXB6 register to the TXS6 register.
This register is read-only by an 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H if bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 0.
Figure 11-7. Format of Asynchronous Serial Interface Transmission Status Register 6 (ASIF6)
Address: FF95H After reset: 00H R
Symbol
ASIF6
7
0
6
0
5
0
4
0
3
0
2
0
1
0
TXBF6
TXSF6
TXBF6
Transmit buffer data flag
0
1
If POWER6 = 0 or TXE6 = 0, or if data is transferred to transmit shift register 6 (TXS6)
If data is written to transmit buffer register 6 (TXB6) (if data exists in TXB6)
TXSF6
0
Transmit shift register data flag
If POWER6 = 0 or TXE6 = 0, or if the next data is not transferred from transmit buffer register 6
(TXB6) after completion of transfer
1
If data is transferred from transmit buffer register 6 (TXB6) (if data transmission is in progress)
Cautions 1. To transmit data continuously, write the first transmit data (first byte) to the TXB6 register.
Be sure to check that the TXBF6 flag is “0”. If so, write the next transmit data (second byte)
to the TXB6 register. If data is written to the TXB6 register while the TXBF6 flag is “1”, the
transmit data cannot be guaranteed.
2. To initialize the transmission unit upon completion of continuous transmission, be sure to
check that the TXSF6 flag is “0” after generation of the transmission completion interrupt,
and then execute initialization. If initialization is executed while the TXSF6 flag is “1”, the
transmit data cannot be guaranteed.
186
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(4) Clock selection register 6 (CKSR6)
This register selects the base clock of serial interface UART6.
CKSR6 can be set by an 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
Remark CKSR6 can be refreshed (the same value is written) by software during a communication operation
(when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6
= 1).
Figure 11-8. Format of Clock Selection Register 6 (CKSR6)
Address: FF96H After reset: 00H R/W
Symbol
CKSR6
7
0
6
0
5
0
4
0
3
2
1
0
TPS63
TPS62
TPS61
TPS60
TPS63
TPS62
TPS61
TPS60
Base clock (fXCLK6) selection
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
fXP (10 MHz)
fXP/2 (5 MHz)
fXP/22 (2.5 MHz)
fXP/23 (1.25 MHz)
fXP/24 (625 kHz)
fXP/25 (312.5 kHz)
fXP/26 (156.25 kHz)
fXP/27 (78.13 kHz)
fXP/28 (39.06 kHz)
fXP/29 (19.53 kHz)
fXP/210 (9.77 kHz)
fXP/211 (4.89 kHz)
Setting prohibited
Other than above
Caution Make sure POWER6 = 0 when rewriting TPS63 to TPS60.
Remarks 1. Figures in parentheses are for operation with fXP = 10 MHz
2. fXP: Oscillation frequency of clock to peripheral hardware
187
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(5) Baud rate generator control register 6 (BRGC6)
This register sets the division value of the 8-bit counter of serial interface UART6.
BRGC6 can be set by an 8-bit memory manipulation instruction.
Reset signal generation sets this register to FFH.
Remark BRGC6 can be refreshed (the same value is written) by software during a communication operation
(when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6
= 1).
Figure 11-9. Format of Baud Rate Generator Control Register 6 (BRGC6)
Address: FF97H After reset: FFH R/W
Symbol
BRGC6
7
6
5
4
3
2
1
0
MDL67 MDL66 MDL65 MDL64 MDL63 MDL62 MDL61 MDL60
MDL67 MDL66 MDL65 MDL64 MDL63 MDL62 MDL61 MDL60
k
Output clock selection of
8-bit counter
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
×
0
0
0
×
0
0
1
×
0
1
0
×
8
Setting prohibited
fXCLK6/8
9
fXCLK6/9
10
fXCLK6/10
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
0
1
0
1
252 fXCLK6/252
253 fXCLK6/253
254 fXCLK6/254
255 fXCLK6/255
Cautions 1. Make sure that bit 6 (TXE6) and bit 5 (RXE6) of the ASIM6 register = 0 when rewriting the
MDL67 to MDL60 bits.
2. The baud rate is the output clock of the 8-bit counter divided by 2.
Remarks 1. fXCLK6: Frequency of base clock selected by the TPS63 to TPS60 bits of CKSR6 register
2. k: Value set by MDL67 to MDL60 bits (k = 8, 9, 10, ..., 255)
3. ×: Don’t care
188
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(6) Asynchronous serial interface control register 6 (ASICL6)
This register controls the serial communication operations of serial interface UART6.
ASICL6 can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets this register to 16H.
Caution ASICL6 can be refreshed (the same value is written) by software during a communication
operation (when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1 or bit 7 (POWER6) and bit 5
(RXE6) of ASIM6 = 1). However, if the SBRT6 = 1 and SBTT = 1 are set in the refresh operation
during the SBF reception (SBRF6 = 1) or SBF transmission (between the SBTT6 setting (1) and
the INTST6 occurrence), it triggers the SBF reception and SBF transmission again, so do not
set.
Figure 11-10. Format of Asynchronous Serial Interface Control Register 6 (ASICL6) (1/2)
Address: FF98H After reset: 16H R/WNote
Symbol
ASICL6
<7>
<6>
5
4
3
2
1
0
SBRF6
SBRT6
SBTT6
SBL62
SBL61
SBL60
DIR6
TXDLV6
SBRF6
SBF reception status flag
0
1
If POWER6 = 0 and RXE6 = 0 or if SBF reception has been completed correctly
SBF reception in progress
SBRT6
SBF reception trigger
0
1
−
SBF reception trigger
SBTT6
SBF transmission trigger
0
1
−
SBF transmission trigger
Note Bit 7 is read-only.
189
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-10. Format of Asynchronous Serial Interface Control Register 6 (ASICL6) (2/2)
SBL62
SBL61
SBL60
SBF transmission output width control
SBF is output with 13-bit length.
1
1
1
0
0
0
0
1
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
SBF is output with 14-bit length.
SBF is output with 15-bit length.
SBF is output with 16-bit length.
SBF is output with 17-bit length.
SBF is output with 18-bit length.
SBF is output with 19-bit length.
SBF is output with 20-bit length.
DIR6
Specification of first bit
0
1
MSB
LSB
TXDLV6
Enabling/disabling inverting TXD6 output
0
1
Normal output of TXD6
Inverted output of TXD6
Cautions 1. In the case of an SBF reception error, return the mode to the SBF reception mode again and
hold (1) the status of the SBRF6 flag.
2. Before setting the SBRT6 bit to 1, make sure that bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 =
1. Moreover, after setting the SBRT6 bit to 1, do not clear the SBRT6 bit to 0 before the SBF
reception ends (an interrupt request signal is generated).
3. The read value of the SBRT6 bit is always 0. SBRT6 is automatically cleared to 0 after SBF
reception has been correctly completed.
4. Before setting the SBTT6 bit to 1, make sure that bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 =
1. Moreover, after setting the SBTT6 bit to 1, do not clear the SBTT6 bit to 0 before the SBF
transmission ends (an interrupt request signal is generated).
5. The read value of the SBTT6 bit is always 0. SBTT6 is automatically cleared to 0 at the end of
SBF transmission.
6. Before rewriting the DIR6 and TXDLV6 bits, clear the TXE6 and RXE6 bits to 0.
190
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(7) Input switch control register (ISC)
The input switch control register (ISC) is used to receive a status signal transmitted from the master during LIN
(Local Interconnect Network) reception.
By setting 1 to ISC0 and ISC1, the input source to INTP0 and TI000 switches to the input signal from the
P44/RxD6 pin.
This register can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
Figure 11-11. Format of Input Switch Control Register (ISC)
Address: FF8CH After reset: 00H R/W
Symbol
ISC
7
0
6
0
5
0
4
0
3
0
2
0
1
0
ISC1
ISC0
ISC1
TI000 input source selection
0
1
TI000 (P30)
RxD6 (P44)
ISC0
INTP0 input source selection
0
1
INTP0 (P30)
RxD6 (P44)
(8) Port mode register 4 (PM4)
This register sets port 4 input/output in 1-bit units.
When using the P43/TxD6/INTP1 pin for serial interface data output, clear PM43 to 0 and set the output latch of
P43 to 1.
When using the P44/RxD6 pin for serial interface data input, set PM44 to 1. The output latch of P44 at this time
may be 0 or 1.
PM4 can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets this register to FFH.
Figure 11-12. Format of Port Mode Register 4 (PM4)
Address: FF24H After reset: FFH R/W
Symbol
PM4
7
1
6
1
5
4
3
2
1
0
PM45
PM44
PM43
PM42
PM41
PM40
PM4n
P4n pin I/O mode selection (n = 0 to 5)
0
1
Output mode (output buffer on)
Input mode (output buffer off)
191
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
11.4 Operation of Serial Interface UART6
Serial interface UART6 has the following two modes.
• Operation stop mode
• Asynchronous serial interface (UART) mode
11.4.1 Operation stop mode
In this mode, serial communication cannot be executed; therefore, the power consumption can be reduced. In
addition, the pins can be used as ordinary port pins in this mode. To set the operation stop mode, clear bits 7, 6, and
5 (POWER6, TXE6, and RXE6) of ASIM6 to 0.
(1) Register used
The operation stop mode is set by asynchronous serial interface operation mode register 6 (ASIM6).
ASIM6 can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets this register to 01H.
Address: FF90H After reset: 01H R/W
Symbol
ASIM6
<7>
<6>
<5>
4
3
2
1
0
POWER6
TXE6
RXE6
PS61
PS60
CL6
SL6
ISRM6
POWER6
0Note 1
Enabling/disabling operation of internal operation clock
Disable operation of the internal operation clock (fix the clock to low level) and asynchronously
reset the internal circuitNote 2
.
TXE6
0
Enabling/disabling transmission
Disable transmission operation (synchronously reset the transmission circuit).
RXE6
0
Enabling/disabling reception
Disable reception (synchronously reset the reception circuit).
Notes 1. The output of the TXD6 pin goes high and the input from the RXD6 pin is fixed to high level when
POWER6 = 0 during a transmission.
2. Asynchronous serial interface reception error status register 6 (ASIS6), asynchronous serial interface
transmission status register 6 (ASIF6), bit 7 (SBRF6) and bit 6 (SBRT6) of asynchronous serial
interface control register 6 (ASICL6), and receive buffer register 6 (RXB6) are reset.
Caution Clear POWER6 to 0 after clearing TXE6 and RXE6 to 0 to set the operation stop mode.
To start the operation, set POWER6 to 1, and then set TXE6 and RXE6 to 1.
Remark To use the RxD6/P44 and TxD6/INTP1/P43 pins as general-purpose port pins, see CHAPTER 4 PORT
FUNCTIONS.
192
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
11.4.2 Asynchronous serial interface (UART) mode
In this mode, data of 1 byte is transmitted/received following a start bit, and a full-duplex operation can be
performed.
A dedicated UART baud rate generator is incorporated, so that communication can be executed at a wide range of
baud rates.
(1) Registers used
• Asynchronous serial interface operation mode register 6 (ASIM6)
• Asynchronous serial interface reception error status register 6 (ASIS6)
• Asynchronous serial interface transmission status register 6 (ASIF6)
• Clock selection register 6 (CKSR6)
• Baud rate generator control register 6 (BRGC6)
• Asynchronous serial interface control register 6 (ASICL6)
• Input switch control register (ISC)
• Port mode register 4 (PM4)
• Port register 4 (P4)
The basic procedure of setting an operation in the UART mode is as follows.
<1> Set the CKSR6 register (see Figure 11-8).
<2> Set the BRGC6 register (see Figure 11-9).
<3> Set bits 0 to 4 (ISRM6, SL6, CL6, PS60, PS61) of the ASIM6 register (see Figure 11-5).
<4> Set bits 0 and 1 (TXDLV6, DIR6) of the ASICL6 register (see Figure 11-10).
<5> Set bit 7 (POWER6) of the ASIM6 register to 1.
<6> Set bit 6 (TXE6) of the ASIM6 register to 1. → Transmission is enabled.
Set bit 5 (RXE6) of the ASIM6 register to 1. → Reception is enabled.
<7> Write data to transmit buffer register 6 (TXB6). → Data transmission is started.
Caution Take relationship with the other party of communication into consideration when setting the
port mode register and port register.
193
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
The relationship between the register settings and pins is shown below.
Table 11-2. Relationship Between Register Settings and Pins
POWER6 TXE6
RXE6
PM43
P43
PM44
P44
UART6
Operation
Pin Function
TxD6/INTP1/P43
RxD6/P44
P44
Note
Note
Note
Note
0
1
0
0
1
1
0
1
0
1
×
×
×
×
Stop
P43
P43
Note
Note
×
×
1
Note
×
Note
Reception
Transmission
RxD6
P44
0
0
1
1
×
×
TxD6
TxD6
1
×
Transmission/
reception
RxD6
Note Can be set as port function.
Remark ×:
don’t care
POWER6: Bit 7 of asynchronous serial interface operation mode register 6 (ASIM6)
TXE6:
RXE6:
PM4×:
P4×:
Bit 6 of ASIM6
Bit 5 of ASIM6
Port mode register
Port output latch
194
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(2) Communication operation
(a) Format and waveform example of normal transmit/receive data
Figures 11-13 and 11-14 show the format and waveform example of the normal transmit/receive data.
Figure 11-13. Format of Normal UART Transmit/Receive Data
1. LSB-first transmission/reception
1 data frame
Start
bit
Parity
bit
D0
D1
D2
D3
D4
D5
D6
D7
Stop bit
Character bits
2. MSB-first transmission/reception
1 data frame
Start
bit
Parity
bit
D7
D6
D5
D4
D3
D2
D1
D0
Stop bit
Character bits
One data frame consists of the following bits.
• Start bit ... 1 bit
• Character bits ... 7 or 8 bits
• Parity bit ... Even parity, odd parity, 0 parity, or no parity
• Stop bit ... 1 or 2 bits
The character bit length, parity, and stop bit length in one data frame are specified by asynchronous serial
interface operation mode register 6 (ASIM6).
Whether data is communicated with the LSB or MSB first is specified by bit 1 (DIR6) of asynchronous serial
interface control register 6 (ASICL6).
Whether the TXD6 pin outputs normal or inverted data is specified by bit 0 (TXDLV6) of ASICL6.
195
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-14. Example of Normal UART Transmit/Receive Data Waveform
1. Data length: 8 bits, LSB first, Parity: Even parity, Stop bit: 1 bit, Communication data: 55H
1 data frame
Start
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Stop
2. Data length: 8 bits, MSB first, Parity: Even parity, Stop bit: 1 bit, Communication data: 55H
1 data frame
Start
D7
D6
D5
D4
D3
D2
D1
D0
Parity
Stop
3. Data length: 8 bits, MSB first, Parity: Even parity, Stop bit: 1 bit, Communication data: 55H, TXD6 pin
inverted output
1 data frame
Start
D7
D6
D5
D4
D3
D2
D1
D0
Parity
Stop
4. Data length: 7 bits, LSB first, Parity: Odd parity, Stop bit: 2 bits, Communication data: 36H
1 data frame
Start
D0
D1
D2
D3
D4
D5
D6
Parity
Stop
Stop
5. Data length: 8 bits, LSB first, Parity: None, Stop bit: 1 bit, Communication data: 87H
1 data frame
Start
D0
D1
D2
D3
D4
D5
D6
D7
Stop
196
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(b) Parity types and operation
The parity bit is used to detect a bit error in communication data. Usually, the same type of parity bit is used
on both the transmission and reception sides. With even parity and odd parity, a 1-bit (odd number) error
can be detected. With zero parity and no parity, an error cannot be detected.
Caution Fix the PS61 and PS60 bits to 0 when the device is incorporated in LIN.
(i) Even parity
• Transmission
Transmit data, including the parity bit, is controlled so that the number of bits that are “1” is even.
The value of the parity bit is as follows.
If transmit data has an odd number of bits that are “1”:
1
If transmit data has an even number of bits that are “1”: 0
• Reception
The number of bits that are “1” in the receive data, including the parity bit, is counted. If it is odd, a
parity error occurs.
(ii) Odd parity
• Transmission
Unlike even parity, transmit data, including the parity bit, is controlled so that the number of bits that
are “1” is odd.
If transmit data has an odd number of bits that are “1”:
0
If transmit data has an even number of bits that are “1”: 1
• Reception
The number of bits that are “1” in the receive data, including the parity bit, is counted. If it is even, a
parity error occurs.
(iii) 0 parity
The parity bit is cleared to 0 when data is transmitted, regardless of the transmit data.
The parity bit is not detected when the data is received. Therefore, a parity error does not occur
regardless of whether the parity bit is “0” or “1”.
(iv) No parity
No parity bit is appended to the transmit data.
Reception is performed assuming that there is no parity bit when data is received. Because there is no
parity bit, a parity error does not occur.
197
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(c) Normal transmission
When bit 7 (POWER6) of asynchronous serial interface operation mode register 6 (ASIM6) is set to 1, and
then bit 6 (TXE6) of ASIM6 is set to 1, transmission is enabled. Transmission can be started by writing
transmit data to transmit buffer register 6 (TXB6). The start bit, parity bit, and stop bit are automatically
appended to the data.
When transmission is started, the data in TXB6 is transferred to transmit shift register 6 (TXS6). After that,
the data is sequentially output from TXS6 to the TXD6 pin. When transmission is completed, the parity and
stop bits set by ASIM6 are appended and a transmission completion interrupt request (INTST6) is generated.
Transmission is stopped until the data to be transmitted next is written to TXB6.
Figure 11-15 shows the timing of the transmission completion interrupt request (INTST6). This interrupt
occurs as soon as the last stop bit has been output.
Figure 11-15. Normal Transmission Completion Interrupt Request Timing
1. Stop bit length: 1
Parity
T
X
D6 (output)
INTST6
Start
D0
D1
D2
D6
D7
Stop
2. Stop bit length: 2
T
X
D6 (output)
INTST6
Start
D0
D1
D2
D6
D7
Parity
Stop
198
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(d) Continuous transmission
The next transmit data can be written to transmit buffer register 6 (TXB6) as soon as transmit shift register 6
(TXS6) has started its shift operation. Consequently, even while the INTST6 interrupt is being serviced after
transmission of one data frame, data can be continuously transmitted and an efficient communication rate
can be realized. In addition, the TXB6 register can be efficiently written twice (2 bytes) without having to wait
for the transmission time of one data frame, by reading bit 0 (TXSF6) of asynchronous serial interface
transmission status register 6 (ASIF6) when the transmission completion interrupt has occurred.
To transmit data continuously, be sure to reference the ASIF6 register to check the transmission status and
whether the TXB6 register can be written, and then write the data.
Cautions 1. The TXBF6 and TXSF6 flags of the ASIF6 register change from “10” to “11”, and to “01”
during continuous transmission. To check the status, therefore, do not use a
combination of the TXBF6 and TXSF6 flags for judgment. Judge whether continuous
transmission is possible or not by reading only the TXBF flag.
2. When the device is incorporated in a LIN, the continuous transmission function cannot
be used. Make sure that asynchronous serial interface transmission status register 6
(ASIF6) is 00H before writing transmit data to transmit buffer register 6 (TXB6).
TXBF6
Writing to TXB6 Register
0
1
Writing enabled
Writing disabled
Caution To transmit data continuously, write the first transmit data (first byte) to the TXB6
register. Be sure to check that the TXBF6 flag is “0”. If so, write the next transmit
data (second byte) to the TXB6 register. If data is written to the TXB6 register while
the TXBF6 flag is “1”, the transmit data cannot be guaranteed.
The communication status can be checked using the TXSF6 flag.
TXSF6
Transmission Status
0
1
Transmission is completed.
Transmission is in progress.
Cautions 1. To initialize the transmission unit upon completion of continuous transmission,
be sure to check that the TXSF6 flag is “0” after generation of the transmission
completion interrupt, and then execute initialization. If initialization is executed
while the TXSF6 flag is “1”, the transmit data cannot be guaranteed.
2. During continuous transmission, an error may occur such that the next
transmission is completed before execution of INTST6 interrupt servicing after
transmission of one data frame. As a countermeasure, such an error can be
detected by developing a program that can count the number of transmit data and
by referencing the TXSF6 flag.
199
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-16 shows an example of the continuous transmission processing flow.
Figure 11-16. Example of Continuous Transmission Processing Flow
Set registers.
Write TXB6.
Transfer
executed necessary
number of times?
Yes
No
No
Read ASIF6
TXBF6 = 0?
Yes
Write TXB6.
Transmission
completion interrupt
occurred?
No
Yes
Transfer
executed necessary
number of times?
Yes
No
No
Read ASIF6
TXSF6 = 0?
Yes
Yes
Completion of
transmission processing
Remark TXB6: Transmit buffer register 6
ASIF6: Asynchronous serial interface transmission status register 6
TXBF6: Bit 1 of ASIF6 (transmit buffer data flag)
TXSF6: Bit 0 of ASIF6 (transmit shift register data flag)
200
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-17 shows the timing of starting continuous transmission, and Figure 11-18 shows the timing of
ending continuous transmission.
Figure 11-17. Timing of Starting Continuous Transmission
Start
Start
Start
T
X
D6
Data (1)
Parity Stop
Data (2)
Parity
Stop
INTST6
TXB6
FF
FF
Data (1)
Data (2)
Data (3)
TXS6
Data (1)
Data (2)
Data (3)
TXBF6
TXSF6
Note
Note When ASIF6 is read, there is a period in which TXBF6 and TXSF6 = 1, 1. Therefore, judge whether
writing is enabled using only the TXBF6 bit.
Remark TXD6:
TXD6 pin (output)
INTST6: Interrupt request signal
TXB6:
TXS6:
Transmit buffer register 6
Transmit shift register 6
ASIF6: Asynchronous serial interface transmission status register 6
TXBF6: Bit 1 of ASIF6
TXSF6: Bit 0 of ASIF6
201
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-18. Timing of Ending Continuous Transmission
Start
Start
T
X
D6
Data (n)
Parity
Stop
Data (n − 1) Parity
Stop
Stop
INTST6
TXB6
Data (n − 1)
Data (n)
TXS6
FF
Data (n − 1)
Data (n)
TXBF6
TXSF6
POWER6 or TXE6
Remark TXD6:
INTST6:
TXD6 pin (output)
Interrupt request signal
Transmit buffer register 6
Transmit shift register 6
TXB6:
TXS6:
ASIF6:
TXBF6:
TXSF6:
Asynchronous serial interface transmission status register 6
Bit 1 of ASIF6
Bit 0 of ASIF6
POWER6: Bit 7 of asynchronous serial interface operation mode register (ASIM6)
TXE6:
Bit 6 of asynchronous serial interface operation mode register (ASIM6)
202
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(e) Normal reception
Reception is enabled and the RXD6 pin input is sampled when bit 7 (POWER6) of asynchronous serial
interface operation mode register 6 (ASIM6) is set to 1 and then bit 5 (RXE6) of ASIM6 is set to 1.
The 8-bit counter of the baud rate generator starts counting when the falling edge of the RXD6 pin input is
detected. When the set value of baud rate generator control register 6 (BRGC6) has been counted, the
RXD6 pin input is sampled again ( in Figure 11-19). If the RXD6 pin is low level at this time, it is recognized
as a start bit.
When the start bit is detected, reception is started, and serial data is sequentially stored in the receive shift
register (RXS6) at the set baud rate. When the stop bit has been received, the reception completion interrupt
(INTSR6) is generated and the data of RXS6 is written to receive buffer register 6 (RXB6). If an overrun
error (OVE6) occurs, however, the receive data is not written to RXB6.
Even if a parity error (PE6) occurs while reception is in progress, reception continues to the reception
position of the stop bit, and an error interrupt (INTSR6/INTSRE6) is generated on completion of reception.
Figure 11-19. Reception Completion Interrupt Request Timing
Start
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Stop
RX
D6 (input)
INTSR6
RXB6
Cautions 1. Be sure to read receive buffer register 6 (RXB6) even if a reception error occurs.
Otherwise, an overrun error will occur when the next data is received, and the reception
error status will persist.
2. Reception is always performed with the “number of stop bits = 1”. The second stop bit
is ignored.
3. Be sure to read asynchronous serial interface reception error status register 6 (ASIS6)
before reading RXB6.
203
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(f) Reception error
Three types of errors may occur during reception: a parity error, framing error, or overrun error. If the error
flag of asynchronous serial interface reception error status register 6 (ASIS6) is set as a result of data
reception, a reception error interrupt request (INTSR6/INTSRE6) is generated.
Which error has occurred during reception can be identified by reading the contents of ASIS6 in the reception
error interrupt servicing (INTSR6/INTSRE6) (see Figure 11-6).
The contents of ASIS6 are reset to 0 when ASIS6 is read.
Table 11-3. Cause of Reception Error
Reception Error
Parity error
Cause
The parity specified for transmission does not match the parity of the receive data.
Stop bit is not detected.
Framing error
Overrun error
Reception of the next data is completed before data is read from receive buffer
register 6 (RXB6).
The error interrupt can be separated into reception completion interrupt (INTSR6) and error interrupt
(INTSRE6) by clearing bit 0 (ISRM6) of asynchronous serial interface operation mode register 6 (ASIM6) to
0.
Figure 11-20. Reception Error Interrupt
1. If ISRM6 is cleared to 0 (reception completion interrupt (INTSR6) and error interrupt (INTSRE6) are
separated)
(a) No error during reception
INTSR6
(b) Error during reception
INTSR6
INTSRE6
INTSRE6
2. If ISRM6 is set to 1 (error interrupt is included in INTSR6)
(a) No error during reception
(b) Error during reception
INTSR6
INTSR6
INTSRE6
INTSRE6
204
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(g) Noise filter of receive data
The RXD6 signal is sampled with the base clock output by the prescaler block.
If two sampled values are the same, the output of the match detector changes, and the data is sampled as
input data.
Because the circuit is configured as shown in Figure 11-21, the internal processing of the reception operation
is delayed by two clocks from the external signal status.
Figure 11-21. Noise Filter Circuit
Base clock
Internal signal A
RX
D6/P44
Internal signal B
In
Q
In
Q
LD_EN
Match detector
(h) SBF transmission
When the device is incorporated in LIN, the SBF (Synchronous Break Field) transmission control function is
used for transmission. For the transmission operation of LIN, see Figure 11-1 LIN Transmission
Operation.
When bit 7 (POWER6) of asynchronous serial interface mode register 6 (ASIM6) is set to 1, the TxD6 pin
outputs high level. Next, when bit 6 (TXE6) of ASIM6 is set to 1, the transmission enabled status is entered,
and SBF transmission is started by setting bit 5 (SBTT6) of asynchronous serial interface control register 6
(ASICL6) to 1.
Thereafter, a low level of bits 13 to 20 (set by bits 4 to 2 (SBL62 to SBL60) of ASICL6) is output. Following
the end of SBF transmission, the transmission completion interrupt request (INTST6) is generated and
SBTT6 is automatically cleared. Thereafter, the normal transmission mode is restored.
Transmission is suspended until the data to be transmitted next is written to transmit buffer register 6 (TXB6),
or until SBTT6 is set to 1.
Figure 11-22. SBF Transmission
1
2
3
4
5
6
7
8
9
10
11
12
13 Stop
TXD6
INTST6
SBTT6
Remark TXD6:
TXD6 pin (output)
INTST6: Transmission completion interrupt request
SBTT6: Bit 5 of asynchronous serial interface control register 6 (ASICL6)
205
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(i) SBF reception
When the device is incorporated in LIN, the SBF (Synchronous Break Field) reception control function is
used for reception. For the reception operation of LIN, see Figure 11-2 LIN Reception Operation.
Reception is enabled when bit 7 (POWER6) of asynchronous serial interface operation mode register 6
(ASIM6) is set to 1 and then bit 5 (RXE6) of ASIM6 is set to 1. SBF reception is enabled when bit 6 (SBRT6)
of asynchronous serial interface control register 6 (ASICL6) is set to 1. In the SBF reception enabled status,
the RXD6 pin is sampled and the start bit is detected in the same manner as the normal reception enable
status.
When the start bit has been detected, reception is started, and serial data is sequentially stored in the
receive shift register 6 (RXS6) at the set baud rate. When the stop bit is received and if the width of SBF is
11 bits or more, a reception completion interrupt request (INTSR6) is generated as normal processing. At
this time, the SBRF6 and SBRT6 bits are automatically cleared, and SBF reception ends. Detection of
errors, such as OVE6, PE6, and FE6 (bits 0 to 2 of asynchronous serial interface reception error status
register 6 (ASIS6)) is suppressed, and error detection processing of UART communication is not performed.
In addition, data transfer between receive shift register 6 (RXS6) and receive buffer register 6 (RXB6) is not
performed, and the reset value of FFH is retained. If the width of SBF is 10 bits or less, an interrupt does not
occur as error processing after the stop bit has been received, and the SBF reception mode is restored. In
this case, the SBRF6 and SBRT6 bits are not cleared.
Figure 11-23. SBF Reception
1. Normal SBF reception (stop bit is detected with a width of more than 10.5 bits)
1
2
3
4
5
6
7
8
9
10
11
RXD6
SBRT6
/SBRF6
INTSR6
2. SBF reception error (stop bit is detected with a width of 10.5 bits or less)
1
2
3
4
5
6
7
8
9
10
RXD6
SBRT6
/SBRF6
INTSR6
“0”
Remark RXD6:
RXD6 pin (input)
SBRT6: Bit 6 of asynchronous serial interface control register 6 (ASICL6)
SBRF6: Bit 7 of ASICL6
INTSR6: Reception completion interrupt request
206
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
11.4.3 Dedicated baud rate generator
The dedicated baud rate generator consists of a source clock selector and an 8-bit programmable counter, and
generates a serial clock for transmission/reception of UART6.
Separate 8-bit counters are provided for transmission and reception.
(1) Configuration of baud rate generator
•
Base clock
The clock selected by bits 3 to 0 (TPS63 to TPS60) of clock selection register 6 (CKSR6) is supplied to
each module when bit 7 (POWER6) of asynchronous serial interface operation mode register 6 (ASIM6) is
1. This clock is called the base clock and its frequency is called fXCLK6. The base clock is fixed to low level
when POWER6 = 0.
•
Transmission counter
This counter stops operation, cleared to 0, when bit 7 (POWER6) or bit 6 (TXE6) of asynchronous serial
interface operation mode register 6 (ASIM6) is 0.
It starts counting when POWER6 = 1 and TXE6 = 1.
The counter is cleared to 0 when the first data transmitted is written to transmit buffer register 6 (TXB6).
If data are continuously transmitted, the counter is cleared to 0 again when one frame of data has been
completely transmitted. If there is no data to be transmitted next, the counter is not cleared to 0 and continues
counting until POWER6 or TXE6 is cleared to 0.
•
Reception counter
This counter stops operation, cleared to 0, when bit 7 (POWER6) or bit 5 (RXE6) of asynchronous serial
interface operation mode register 6 (ASIM6) is 0.
It starts counting when the start bit has been detected.
The counter stops operation after one frame has been received, until the next start bit is detected.
207
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
Figure 11-24. Configuration of Baud Rate Generator
POWER6
f
XP
Baud rate generator
f
XP/2
f
f
f
f
f
f
f
f
XP/22
XP/23
XP/24
XP/25
XP/26
XP/27
XP/28
XP/29
POWER6, TXE6 (or RXE6)
Selector
8-bit counter
f
XCLK6
f
f
XP/210
XP/211
Match detector
Baud rate
1/2
CKSR6: TPS63 to TPS60
BRGC6: MDL67 to MDL60
Remark POWER6: Bit 7 of asynchronous serial interface operation mode register 6 (ASIM6)
TXE6:
Bit 6 of ASIM6
RXE6:
Bit 5 of ASIM6
CKSR6:
BRGC6:
Clock selection register 6
Baud rate generator control register 6
208
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(2) Generation of serial clock
A serial clock can be generated by using clock selection register 6 (CKSR6) and baud rate generator control
register 6 (BRGC6).
Select the clock to be input to the 8-bit counter by using bits 3 to 0 (TPS63 to TPS60) of CKSR6.
Bits 7 to 0 (MDL67 to MDL60) of BRGC6 can be used to select the division value of the 8-bit counter.
(a) Baud rate
The baud rate can be calculated by the following expression.
fXCLK6
• Baud rate =
[bps]
2 × k
fXCLK6: Frequency of base clock selected by TPS63 to TPS60 bits of CKSR6 register
k: Value set by MDL67 to MDL60 bits of BRGC6 register (k = 8, 9, 10, ..., 255)
(b) Error of baud rate
The baud rate error can be calculated by the following expression.
Actual baud rate (baud rate with error)
Desired baud rate (correct baud rate)
• Error (%) =
− 1 × 100 [%]
Cautions 1. Keep the baud rate error during transmission to within the permissible error range at
the reception destination.
2. Make sure that the baud rate error during reception satisfies the range shown in (4)
Permissible baud rate range during reception.
Example: Frequency of base clock = 10 MHz = 10,000,000 Hz
Set value of MDL67 to MDL60 bits of BRGC6 register = 00100001B (k = 33)
Target baud rate = 153600 bps
Baud rate = 10 M/(2 × 33)
= 10000000/(2 × 33) = 151,515 [bps]
Error = (151515/153600 − 1) × 100
= −1.357 [%]
209
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(3) Example of setting baud rate
Table 11-4. Set Data of Baud Rate Generator
Baud Rate
[bps]
fXP = 10.0 MHz
fXP = 8.38 MHz
fXP = 4.19 MHz
TPS63 to
TPS60
k
Calculated ERR[%] TPS63 to
k
Calculated ERR[%] TPS63 to
k
Calculated ERR[%]
Value
TPS60
6H
5H
4H
3H
2H
1H
1H
0H
0H
0H
0H
0H
0H
Value
TPS60
5H
4H
3H
2H
1H
1H
0H
0H
0H
0H
0H
0H
0H
Value
600
1200
6H
5H
4H
3H
2H
1H
1H
0H
0H
0H
0H
0H
0H
130
130
130
130
130
240
130
160
130
65
601
1202
0.16
0.16
0.16
0.16
0.16
0.16
0.16
0.00
0.16
0.16
0.94
−1.36
−1.36
109
109
109
109
109
201
109
134
109
55
601
0.11
0.11
0.11
0.11
0.11
0.22
0.11
0.06
0.11
−0.80
1.03
1.03
1.03
109
109
109
109
109
101
109
67
601
0.11
0.11
0.11
0.11
0.11
−0.28
0.11
0.06
−0.80
1.03
1.03
−2.58
1.03
1201
1201
2400
2404
2403
2403
4800
4808
4805
4805
9600
9615
9610
9610
10400
19200
31250
38400
76800
115200
153600
230400
10417
19231
31250
38462
76923
116279
151515
227272
10423
19220
31268
38440
76182
116389
155185
232778
10475
19220
31268
38090
77693
116389
149643
232778
55
27
43
36
18
33
27
14
22
18
9
Remark TPS63 to TPS60: Bits 3 to 0 of clock selection register 6 (CKSR6) (setting of base clock (fXCLK6))
k:
Value set by MDL67 to MDL60 bits of baud rate generator control register 6
(BRGC6) (k = 8, 9, 10, ..., 255)
fXP:
ERR:
Oscillation frequency of clock to peripheral hardware
Baud rate error
210
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(4) Permissible baud rate range during reception
The permissible error from the baud rate at the transmission destination during reception is shown below.
Caution Make sure that the baud rate error during reception is within the permissible error range, by
using the calculation expression shown below.
Figure 11-25. Permissible Baud Rate Range During Reception
Latch timing
Data frame length
Start bit
Start bit
Start bit
Bit 0
FL
Bit 1
Bit 7
Parity bit
Stop bit
of UART6
1 data frame (11 × FL)
Minimum permissible
data frame length
Bit 0
Bit 1
Bit 7
Parity bit
Stop bit
FLmin
Maximum permissible
data frame length
Bit 0
Bit 1
Bit 7
Parity bit
Stop bit
FLmax
As shown in Figure 11-25, the latch timing of the receive data is determined by the counter set by baud rate
generator control register 6 (BRGC6) after the start bit has been detected. If the last data (stop bit) meets this
latch timing, the data can be correctly received.
Assuming that 11-bit data is received, the theoretical values can be calculated as follows.
1
FL = (Brate)−
Brate: Baud rate of UART6
k:
FL:
Set value of BRGC6
1-bit data length
Margin of latch timing: 2 clocks
211
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
21k + 2
2k
k − 2
2k
Minimum permissible data frame length: FLmin = 11 × FL −
× FL =
FL
Therefore, the maximum receivable baud rate at the transmission destination is as follows.
22k
21k + 2
1
BRmax = (FLmin/11)−
=
Brate
Similarly, the maximum permissible data frame length can be calculated as follows.
10
11
k + 2
2 × k
21k − 2
2 × k
× FLmax = 11 × FL −
× FL =
FL
21k – 2
20k
FLmax =
FL × 11
Therefore, the minimum receivable baud rate at the transmission destination is as follows.
20k
21k − 2
1
BRmin = (FLmax/11)−
=
Brate
The permissible baud rate error between UART6 and the transmission destination can be calculated from the
above minimum and maximum baud rate expressions, as follows.
Table 11-5. Maximum/Minimum Permissible Baud Rate Error
Division Ratio (k)
Maximum Permissible Baud Rate Error
Minimum Permissible Baud Rate Error
8
+3.53%
+4.26%
+4.56%
+4.66%
+4.72%
−3.61%
−4.31%
−4.58%
−4.67%
−4.73%
20
50
100
255
Remarks 1. The permissible error of reception depends on the number of bits in one frame, input clock
frequency, and division ratio (k). The higher the input clock frequency and the higher the division
ratio (k), the higher the permissible error.
2. k: Set value of BRGC6
212
User’s Manual U16898EJ3V0UD
CHAPTER 11 SERIAL INTERFACE UART6
(5) Data frame length during continuous transmission
When data is continuously transmitted, the data frame length from a stop bit to the next start bit is extended by
two clocks of base clock from the normal value. However, the result of communication is not affected because
the timing is initialized on the reception side when the start bit is detected.
Figure 11-26. Data Frame Length During Continuous Transmission
Start bit of
1 data frame
second byte
Bit 0
FL
Bit 1
FL
Bit 7
FL
Bit 0
FL
Start bit
FL
Start bit
FL
Parity bit
FL
Stop bit
FLstp
Where the 1-bit data length is FL, the stop bit length is FLstp, and base clock frequency is fXCLK6, the following
expression is satisfied.
FLstp = FL + 2/fXCLK6
Therefore, the data frame length during continuous transmission is:
Data frame length = 11 × FL + 2/fXCLK6
213
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
12.1 Interrupt Function Types
There are two types of interrupts: maskable interrupts and resets.
•
Maskable interrupts
These interrupts undergo mask control. When an interrupt request occurs, the standby release signal occurs,
and if an interrupt can be acknowledged then the program corresponding to the address written in the vector
table address is executed (vector interrupt servicing). When several interrupt requests are generated at the
same time, processing takes place in the priority order of the vector interrupt servicing. For details on the
priority order, see Table 12-1.
There are nine internal sources and four external sources of maskable interrupts.
•
Reset
The CPU and SFR are returned to their initial states by the reset signal. The causes for reset signal
occurrences are shown in Table 12-1.
When a reset signal occurs, program execution starts from the programs at the addresses written in addresses
0000H and 0001H.
12.2 Interrupt Sources and Configuration
There are a total of 13 maskable interrupt sources, and up to four reset sources (see Table 12-1).
214
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
Table 12-1. Interrupt Sources
Interrupt Type
Maskable
PriorityNote 1
Interrupt Source
Trigger
Internal/
External
Vector Table
Address
Basic
Configuration
Name
INTLVI
TypeNote 2
1
2
3
4
Low-voltage detectionNote 3
Pin input edge detection
Internal
0006H
0008H
000AH
000CH
(A)
(B)
INTP0
External
INTP1
INTTMH1
Match between TMH1 and CMP01
(when compare register is specified)
Internal
(A)
5
INTTM000
INTTM010
Match between TM00 and CR000
(when compare register is specified),
TI010 pin valid edge detection (when
capture register is specified)
000EH
6
Match between TM00 and CR010
(when compare register is specified),
TI000 pin valid edge detection (when
capture register is specified)
0010H
7
8
INTAD
INTP2
INTP3
INTTM80
INTSRE6
INTSR6
INTST6
RESET
POC
End of A/D conversion
Pin input edge detection
0012H
0016H
0018H
001AH
001CH
001EH
0020H
0000H
External
Internal
(B)
(A)
9
10
11
12
13
−
Match between TM80 and CR80
UART6 reception error occurrence
End of UART6 reception
End of UART6 transmission
Reset input
Reset
−
−
Power-on-clear
LVI
Low-voltage detectionNote 4
WDT
WDT overflow
Notes 1. Priority is the vector interrupt servicing priority order when several maskable interrupt requests are
generated at the same time. 1 is the highest and 13 is the lowest.
2. Basic configuration types (A) and (B) correspond to (A) and (B) in Figure 12-1.
3. When bit 1 (LVIMD) of low-voltage detection register (LVIM) = 0 is selected.
4. When bit 1 (LVIMD) of low-voltage detection register (LVIM) = 1 is selected.
Caution No interrupt sources correspond to the vector table address 0014H.
215
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
Figure 12-1. Basic Configuration of Interrupt Function
(A) Internal maskable interrupt
Internal bus
IE
MK
Vector table
address generator
Interrupt request
IF
Standby release signal
(B) External maskable interrupt
Internal bus
External interrupt mode
register (INTM0, INTM1)
MK
IE
Vector table
address generator
Edge
detector
Interrupt
request
IF
Standby
release signal
IF: Interrupt request flag
IE: Interrupt enable flag
MK: Interrupt mask flag
216
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
12.3 Interrupt Function Control Registers
The interrupt functions are controlled by the following four types of registers.
• Interrupt request flag registers (IF0, IF1)
• Interrupt mask flag registers (MK0, MK1)
• External interrupt mode registers (INTM0, INTM1)
• Program status word (PSW)
Table 12-2 lists interrupt requests, the corresponding interrupt request flags, and interrupt mask flags.
Table 12-2. Interrupt Request Signals and Corresponding Flags
Interrupt Request Signal
Interrupt Request Flag
Interrupt Mask Flag
INTLVI
INTP0
INTP1
LVIIF
LVIMK
PIF0
PMK0
PIF1
PMK1
INTTMH1
INTTM000
INTTM010
INTAD
TMIFH1
TMIF000
TMIF010
ADIF
TMMKH1
TMMK000
TMMK010
ADMK
INTP2
PIF2
PMK2
INTP3
PIF3
PMK3
INTTM80
INTSRE6
INTSR6
INTST6
TMIF80
SREIF6
SRIF6
STIF6
TMMK80
SREMK6
SRMK6
STMK6
217
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
(1) Interrupt request flag registers (IF0, IF1)
An interrupt request flag is set to 1 when the corresponding interrupt request is issued, or when the
instruction is executed. It is cleared to 0 by executing an instruction when the interrupt request is
acknowledged or when a reset signal is input.
IF0 and IF1 are set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears IF0 and IF1 to 00H.
Figure 12-2. Format of Interrupt Request Flag Registers (IF0, IF1)
Address: FFE0H After reset: 00H R/W
Symbol
IF0
<7>
<6>
<5>
<4>
<3>
<2>
<1>
0
0
ADIF
TMIF010 TMIF000 TMIFH1
PIF1
PIF0
LVIIF
Address: FFE1H After reset: 00H R/W
Symbol
IF1
7
0
<6>
<5>
<4>
<3>
<2>
<1>
0
0
STIF6
SRIF6
SREIF6
TMIF80
PIF3
PIF2
××IF×
Interrupt request flag
No interrupt request signal has been issued.
An interrupt request signal has been issued; an interrupt request status.
0
1
Caution Because P30, P31, P41, and P43 have an alternate function as external interrupt inputs,
when the output level is changed by specifying the output mode of the port function, an
interrupt request flag is set. Therefore, the interrupt mask flag should be set to 1 before
using the output mode.
218
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
(2) Interrupt mask flag registers (MK0, MK1)
The interrupt mask flag is used to enable and disable the corresponding maskable interrupts.
MK0 and MK1 are set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets MK0 and MK1 to FFH.
Figure 12-3. Format of Interrupt Mask Flag Registers (MK0, MK1)
Address: FFE4H After reset: FFH R/W
Symbol
MK0
<7>
<6>
<5>
<4>
<3>
<2>
<1>
0
1
ADMK
TMMK010 TMMK000 TMMKH1
PMK1
PMK0
LVIMK
Address: FFE5H After reset: FFH R/W
Symbol
MK1
7
1
<6>
<5>
<4>
<3>
<2>
<1>
0
1
STMK6
SRMK6 SREMK6 TMMK80
PMK3
PMK2
××MK×
Interrupt servicing control
0
1
Enables interrupt servicing.
Disables interrupt servicing.
Caution Because P30, P31, P41, and P43 have an alternate function as external interrupt inputs,
when the output level is changed by specifying the output mode of the port function, an
interrupt request flag is set. Therefore, the interrupt mask flag should be set to 1 before
using the output mode.
219
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
(3) External interrupt mode register 0 (INTM0)
This register is used to set the valid edge of INTP0 to INTP2.
INTM0 is set with an 8-bit memory manipulation instruction.
Reset signal generation clears INTM0 to 00H.
Figure 12-4. Format of External Interrupt Mode Register 0 (INTM0)
Address: FFECH After reset: 00H R/W
Symbol
INTM0
7
6
5
4
3
2
1
0
0
0
ES21
ES20
ES11
ES10
ES01
ES00
ES21
ES20
INTP2 valid edge selection
INTP1 valid edge selection
INTP0 valid edge selection
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
ES11
ES10
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
ES01
ES00
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
Cautions 1. Be sure to clear bits 0 and 1 to 0.
2. Before setting the INTM0 register, be sure to set the corresponding interrupt mask flag
(××MK× = 1) to disable interrupts. After setting the INTM0 register, clear the interrupt
request flag (××IF× = 0), then clear the interrupt mask flag (××MK× = 0), which will
enable interrupts.
220
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
(4) External interrupt mode register 1 (INTM1)
INTM1 is used to specify the valid edge for INTP3.
INTM1 is set with an 8-bit memory manipulation instruction.
Reset signal generation clears INTM1 to 00H.
Figure 12-5. Format of External Interrupt Mode Register 1 (INTM1)
Address: FFEDH After reset: 00H R/W
Symbol
INTM1
7
0
6
0
5
0
4
0
3
0
2
0
1
0
ES31
ES30
ES31
ES30
INTP3 valid edge selection
0
0
1
1
0
1
0
1
Falling edge
Rising edge
Setting prohibited
Both rising and falling edges
Cautions 1. Be sure to clear bits 2 to 7 to 0.
2. Before setting INTM1, set PMK3 to 1 to disable interrupts.
To enable interrupts, clear PIF3 to 0, then clear PMK3 to 0.
(5) Program status word (PSW)
The program status word is used to hold the instruction execution result and the current status of the interrupt
requests. The IE flag, used to enable and disable maskable interrupts, is mapped to PSW.
PSW can be read- and write-accessed in 8-bit units, as well as using bit manipulation instructions and
dedicated instructions (EI and DI). When a vectored interrupt is acknowledged, the PSW is automatically
saved to a stack, and the IE flag is reset to 0.
Reset signal generation sets PSW to 02H.
Figure 12-6. Program Status Word (PSW) Configuration
Symbol
PSW
7
6
Z
5
0
4
3
0
2
0
1
1
0
After reset
02H
IE
AC
CY
Used in the execution of ordinary instructions
IE
0
Whether to enable/disable interrupt acknowledgment
Disabled
Enabled
1
221
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
12.4 Interrupt Servicing Operation
12.4.1 Maskable interrupt request acknowledgment operation
A maskable interrupt request can be acknowledged when the interrupt request flag is set to 1 and the
corresponding interrupt mask flag is cleared to 0. If the interrupt enabled status is in effect (when the IE flag is set to
1), then the request is acknowledged as a vector interrupt.
The time required to start the vectored interrupt servicing after a maskable interrupt request has been generated is
shown in Table 12-3.
See Figures 12-8 and 12-9 for the interrupt request acknowledgment timing.
Table 12-3. Time from Generation of Maskable Interrupt Request to Servicing
Minimum Time
9 clocks
Maximum TimeNote
19 clocks
Note The wait time is maximum when an interrupt
request is generated immediately before BT and
BF instructions.
1
fCPU
Remark 1 clock:
(fCPU: CPU clock)
When two or more maskable interrupt requests are generated at the same time, they are acknowledged starting
from the interrupt request assigned the highest priority.
A pending interrupt is acknowledged when a status in which it can be acknowledged is set.
Figure 12-7 shows the algorithm of interrupt request acknowledgment.
When a maskable interrupt request is acknowledged, the contents of the PSW and PC are saved to the stack in
that order, the IE flag is reset to 0, and the data in the vector table determined for each interrupt request is loaded to
the PC, and execution branches.
To return from interrupt servicing, use the RETI instruction.
222
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
Figure 12-7. Interrupt Request Acknowledgment Processing Algorithm
Start
No
××IF = 1?
Yes (Interrupt request generated)
No
××MK = 0?
Yes
Interrupt request pending
Interrupt request pending
No
IE = 1?
Yes
Vectored interrupt
servicing
××IF:
Interrupt request flag
××MK: Interrupt mask flag
IE:
Flag to control maskable interrupt request acknowledgment (1 = enable, 0 = disable)
Figure 12-8. Interrupt Request Acknowledgment Timing (Example of MOV A, r)
8 clocks
Clock
Saving PSW and PC, jump
Interrupt servicing program
CPU
MOV A, r
to interrupt servicing
Interrupt
If an interrupt request flag (××IF) is set before an instruction clock n (n = 4 to 10) under execution becomes n − 1,
the interrupt is acknowledged after the instruction under execution is complete. Figure 12-8 shows an example of the
interrupt request acknowledgment timing for an 8-bit data transfer instruction MOV A, r. Since this instruction is
executed for 4 clocks, if an interrupt occurs for 3 clocks after the instruction fetch starts, the interrupt acknowledgment
processing is performed after the MOV A, r instruction is executed.
223
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
Figure 12-9. Interrupt Request Acknowledgment Timing (When Interrupt Request Flag Is Set at Last
Clock During Instruction Execution)
8 clocks
Clock
Interrupt
Saving PSW and PC, jump
servicing
CPU
NOP
MOV A, r
to interrupt servicing
program
Interrupt
If an interrupt request flag (××IF) is set at the last clock of the instruction, the interrupt acknowledgment processing
starts after the next instruction is executed.
Figure 12-9 shows an example of the interrupt request acknowledgment timing for an interrupt request flag that is
set at the second clock of NOP (2-clock instruction). In this case, the MOV A, r instruction after the NOP instruction is
executed, and then the interrupt acknowledgment processing is performed.
Caution Interrupt requests will be held pending while the interrupt request flag registers (IF0, IF1) or
interrupt mask flag registers (MK0, MK1) are being accessed.
12.4.2 Multiple interrupt servicing
In order to perform multiple interrupt servicing in which another interrupt is acknowledged while an interrupt is
being serviced, the interrupt mask function must be used to mask interrupts for which a low priority is to be set.
224
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
Figure 12-10. Example of Multiple Interrupts (1/2)
Example 1. Multiple interrupts are acknowledged
INTxx servicing
INTyy servicing
Main processing
IE = 0
IE = 0
EI
EI
INTxx
INTyy
RETI
RETI
During interrupt INTxx servicing, interrupt request INTyy is acknowledged, and multiple interrupts are generated.
Before each interrupt request acknowledgement, the EI instruction is issued, the interrupt mask is released, and the
interrupt request acknowledgement enable state is set.
Caution Multiple interrupts can be acknowledged even for low-priority interrupts.
Example 2. Multiple interrupts are not generated because interrupts are not enabled
INTxx servicing
INTyy servicing
Main processing
EI
IE = 0
INTyy is held pending
INTyy
RETI
INTxx
IE = 0
RETI
Because interrupts are not enabled in interrupt INTxx servicing (the EI instruction is not issued), interrupt request
INTyy is not acknowledged, and multiple interrupts are not generated. The INTyy request is held pending and
acknowledged after the INTxx servicing is performed.
IE = 0: Interrupt request acknowledgment disabled
225
User’s Manual U16898EJ3V0UD
CHAPTER 12 INTERRUPT FUNCTIONS
Figure 12-10. Example of Multiple Interrupts (2/2)
Example 3. A priority is controlled by the Multiple interrupts
The vector interrupt enable state is set for INTP0, INTP1, and INTTMH1.
(Interruption priority INTP0 > INTP1 > INTTMH1 (refer to Table12-1))
INTTNH1 servicing
Main processing
INTP1 servicing
EI
IE = 0
PMK0 = 1
EI
IE = 0
INTTMH1
INTP0
INTP1
RETI
INTP0 servicing
PMK0 = 0
IE = 0
RETI
RETI
In the interrupt INTTMH1 servicing, servicing is performed such that the INTP1 interrupt is given priority, since the
INTP0 interrupt was first masked.
Afterwards, once the interrupt mask for INTP0 is released, INTP0 processing through multiple interrupts is
performed.
IE = 0: Interrupt request acknowledgment disabled
12.4.3 Interrupt request pending
Some instructions may keep pending the acknowledgment of an instruction request until the completion of the
execution of the next instruction even if the interrupt request (maskable interrupt and external interrupt) is generated
during the execution. The following shows such instructions (interrupt request pending instruction).
• Manipulation instruction for interrupt request flag registers (IF0, IF1)
• Manipulation instruction for interrupt mask flag registers (MK0, MK1)
226
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
13.1 Standby Function and Configuration
13.1.1 Standby function
Table 13-1. Relationship Between Operation Clocks in Each Operation Status
Status
Low-Speed Internal Oscillator
Note 2
System Clock
Clock Supplied to
Peripheral
Note 1
Hardware
Operation Mode
LSRSTOP = 0
LSRSTOP = 1
Reset
STOP
HALT
Stopped
Oscillating
Stopped
Stopped
OscillatingNote 3
Stopped
Oscillating
Oscillating
Notes 1. When “Cannot be stopped” is selected for low-speed internal oscillator by the option byte.
2. When it is selected that the low-speed internal oscillator “can be stopped by software”, oscillation of the
low-speed internal oscillator can be stopped by LSRSTOP.
3. If the operating clock of the watchdog timer is the low-speed internal oscillation clock, the watchdog
timer is stopped.
Caution The LSRSTOP setting is valid only when “Can be stopped by software” is set for the low-speed
internal oscillator by the option byte.
Remark LSRSTOP: Bit 0 of the low-speed internal oscillation mode register (LSRCM)
The standby function is designed to reduce the operating current of the system. The following two modes are
available.
(1) HALT mode
HALT instruction execution sets the HALT mode. In the HALT mode, the CPU operation clock is stopped.
Oscillation of the system clock oscillator continues. If the low-speed internal oscillator is operating before the
HALT mode is set, oscillation of the clock of the low-speed internal oscillator continues (refer to Table 13-1.
Oscillation of the low-speed internal oscillation clock (whether it cannot be stopped or can be stopped by
software) is set by the option byte). In this mode, the operating current is not decreased as much as in the
STOP mode, but the HALT mode is effective for restarting operation immediately upon interrupt request
generation and frequently carrying out intermittent operations.
227
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
(2) STOP mode
STOP instruction execution sets the STOP mode. In the STOP mode, the system clock oscillator stops,
stopping the whole system, thereby considerably reducing the CPU operating current.
Because this mode can be cleared by an interrupt request, it enables intermittent operations to be carried out.
However, select the HALT mode if processing must be immediately started by an interrupt request when the
operation stop timeNote is generated after the STOP mode is released (because an additional wait time for
stabilizing oscillation elapses when crystal/ceramic oscillation is used).
Note The operation stop time is 17 µs (MIN.), 34 µs (TYP.), and 67 µs (MAX.).
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 latches and output buffer statuses are also held.
Cautions 1. When shifting to the STOP mode, be sure to stop the peripheral hardware operation before
executing STOP instruction (except the peripheral hardware that operates on the low-speed
internal oscillation clock).
2. The following sequence is recommended for operating current reduction of the A/D converter
when the standby function is used: First clear bit 7 (ADCS) and bit 0 (ADCE) of the A/D
converter mode register (ADM) to 0 to stop the A/D conversion operation, and then execute
the HALT or STOP instruction.
3. If the low-speed internal oscillator is operating before the STOP mode is set, oscillation of the
low-speed internal oscillation clock cannot be stopped in the STOP mode (refer to Table 13-1).
228
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
13.1.2 Registers used during standby
The oscillation stabilization time after the standby mode is released is controlled by the oscillation stabilization time
select register (OSTS).
Remark For the registers that start, stop, or select the clock, see CHAPTER 5 CLOCK GENERATORS.
(1) Oscillation stabilization time select register (OSTS)
This register is used to select oscillation stabilization time of the clock supplied from the oscillator when the
STOP mode is released. The wait time set by OSTS is valid only when the crystal/ceramic oscillation clock is
selected as the system clock and after the STOP mode is released. If the high-speed internal oscillation or
external clock input is selected as the system clock source, no wait time elapses.
The system clock oscillator and the oscillation stabilization time that elapses after power application or release
of reset are selected by the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
OSTS is set by using the 8-bit memory manipulation instruction.
Figure 13-1. Format of Oscillation Stabilization Time Select Register (OSTS)
Address: FFF4H After reset: Undefined R/W
Symbol
OSTS
7
0
6
0
5
0
4
0
3
0
2
0
1
0
OSTS1
OSTS0
OSTS1
OSTS0
Selection of oscillation stabilization time
0
0
1
1
0
1
0
1
210/fX (102.4 µs)
212/fX (409.6 µs)
215/fX (3.27 ms)
217/fX (13.1 ms)
Cautions 1. To set and then release the STOP mode, set the oscillation stabilization time as follows.
Expected oscillation stabilization time of resonator ≤ Oscillation stabilization time set
by OSTS
2. The wait time after the STOP mode is released does not include the time from the
release of the STOP mode to the start of clock oscillation (“a” in the figure below),
regardless of whether STOP mode was released by reset signal generation or interrupt
generation.
STOP mode is released
Voltage
waveform
of X1 pin
a
3. The oscillation stabilization time that elapses on power application or after release of
reset is selected by the option byte. For details, refer to CHAPTER 17 OPTION BYTE.
Remarks 1. ( ): fX = 10 MHz
2. Determine the oscillation stabilization time of the resonator by checking the characteristics of
the resonator to be used.
229
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
13.2 Standby Function Operation
13.2.1 HALT mode
(1) HALT mode
The HALT mode is set by executing the HALT instruction.
The operating statuses in the HALT mode are shown below.
Caution Because an 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 clear, the standby mode
is immediately cleared if set.
Table 13-2. Operating Statuses in HALT Mode
Setting of HALT Mode
Low-Speed Internal
Oscillator Cannot Be
StoppedNote
Low-Speed Internal Oscillator Can Be StoppedNote
When Low-Speed Internal When Low-Speed Internal
Item
Oscillation Continues
Oscillation Stops
System clock
CPU
Clock supply to CPU is stopped.
Operation stops.
Port (latch)
Holds status before HALT mode was set.
16-bit timer/event counter 00
8-bit timer 80
Operable
Operable
8-bit timer
H1
Sets count clock to fXP to fXP/212 Operable
Sets count clock to fRL/27
Operable
Operable
Operation stops.
Watchdog
timer
System clock selected as
operating clock
Setting prohibited
Operation stops.
“Low-speed internal oscillation
clock” selected as operating
clock
Operable (Operation
continues.)
Operation stops.
A/D converter
Operable
Serial interface UART6
Power-on-clear circuit
Low-voltage detector
External interrupt
Operable
Always operates.
Operable
Operable
Note “Cannot be stopped” or “Stopped by software” is selected for low-speed internal oscillator by the option byte
(for the option byte, see CHAPTER 17 OPTION BYTE).
230
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
(2) HALT mode release
The HALT mode can be released by the following two sources.
(a) Release by unmasked interrupt request
When an unmasked interrupt request is generated, the HALT mode is released. If interrupt
acknowledgement is enabled, vectored interrupt servicing is carried out. If interrupt acknowledgement is
disabled, the next address instruction is executed.
Figure 13-2. HALT Mode Release by Interrupt Request Generation
Interrupt
request
HALT
instruction
Wait
Wait
Standby
release signal
Operating mode
HALT mode
Operating mode
Status of CPU
Oscillation
System clock
oscillation
Remarks 1. The broken lines indicate the case when the interrupt request which has released the
standby mode is acknowledged.
2. The wait time is as follows:
• When vectored interrupt servicing is carried out: 11 to 13 clocks
• When vectored interrupt servicing is not carried out: 3 to 5 clocks
231
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
(b) Release by reset signal generation
When the reset signal is generated, HALT mode is released, and then, as in the case with a normal reset
operation, the program is executed after branching to the reset vector address.
Figure 13-3. HALT Mode Release by Reset Signal Generation
(1) When CPU clock is high-speed internal oscillation clock or external input clock
HALT
instruction
Reset signal
Operation
stopsNote
Reset
period
Operation
mode
CPU status
HALT mode
Oscillates
Operation mode
Oscillates
Oscillation stops
System clock
oscillation
Note Operation is stopped (277 µs (MIN.), 544 µs (TYP.), 1.075 ms (MAX.)) because the option byte is
referenced.
(2) When CPU clock is crystal/ceramic oscillation clock
HALT
instruction
Reset signal
Oscillation
stabilization waits
Operation
stopsNote
Reset
period
Operation
mode
Operation
mode
CPU status
HALT mode
Oscillates
Oscillation stops
Oscillates
System clock
oscillation
Oscillation stabilization time
(210/f to 217/f
X
X
)
Note Operation is stopped (276 µs (MIN.), 544 µs (TYP.), 1.074 ms (MAX.)) because the option byte is
referenced.
Remark fX: System clock oscillation frequency
Table 13-3. Operation in Response to Interrupt Request in HALT Mode
Release Source
MK××
IE
0
Operation
Next address instruction execution
Interrupt servicing execution
HALT mode held
Maskable interrupt request
0
0
1
−
1
×
Reset signal generation
×
Reset processing
×: don’t care
232
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
13.2.2 STOP mode
(1) STOP mode setting and operating statuses
The STOP mode is set by executing the STOP instruction.
Caution Because an 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, in the STOP mode, the normal operation mode is
restored after the STOP instruction is executed and then the operation is stopped for 34 µs
(TYP.) (after an additional wait time for stabilizing the oscillation set by the oscillation
stabilization time select register (OSTS) has elapsed when crystal/ceramic oscillation is
used).
The operating statuses in the STOP mode are shown below.
Table 13-4. Operating Statuses in STOP Mode
Setting of HALT Mode
Low-Speed Internal
Oscillator Cannot Be
StoppedNote
Low-Speed Internal Oscillator Can Be StoppedNote
When Low-Speed Internal When Low-Speed Internal
Item
Oscillation Continues
Oscillation Stops
System clock
CPU
Oscillation stops.
Operation stops.
Port (latch)
Holds status before STOP mode is set.
Operation stops.
16-bit timer/event counter 00
8-bit timer 80
Operation stops.
8-bit timer
H1
Sets count clock to fXP to fXP/212 Operation stops.
Sets count clock to fRL/27
Operable
Operable
Operation stops.
Watchdog
timer
“Clock to peripheral hardware” Setting prohibited
selected as operating clock
Operation stops.
“Low-speed internal oscillation Operable (Operation
Operation stops.
clock” selected as operating
clock
continues.)
A/D converter
Operation stops.
Operation stops.
Always operates.
Operable
Serial interface UART6
Power-on-clear circuit
Low-voltage detector
External interrupt
Operable
Note “Cannot be stopped” or “Stopped by software” is selected for low-speed internal oscillator by the option byte
(for the option byte, see CHAPTER 17 OPTION BYTE).
233
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
(2) STOP mode release
Figure 13-4. Operation Timing When STOP Mode Is Released
<1> If high-speed internal oscillation clock or external input clock is selected as system clock to be supplied
STOP mode
is released.
STOP mode
System clock
oscillation
CPU clock
Operation
High-speed internal oscillation clock or external clock input
stopsNote
.
<2> If crystal/ceramic oscillation clock is selected as system clock to be supplied
STOP mode
is released.
STOP mode
System clock
oscillation
CPU clock
HALT status
(oscillation stabilization time set by OSTS)
Operation
stopsNote
Crystal/ceramic oscillation clock
.
Note The operation stop time is 17 µs (MIN.), 34 µs (TYP.), and 67 µs (MAX.).
The STOP mode can be released by the following two sources.
234
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
(a) Release by unmasked interrupt request
When an unmasked interrupt request (8-bit timer H1, low-voltage detector, external interrupt request) is
generated, the STOP mode is released. After the oscillation stabilization time has elapsed, if interrupt
acknowledgment is enabled, vectored interrupt servicing is carried out. If interrupt acknowledgment is
disabled, the next address instruction is executed.
Note Only when sets count clock to fRL/27
Figure 13-5. STOP Mode Release by Interrupt Request Generation
(1) If CPU clock is high-speed internal oscillation clock or external input clock
Interrupt
request
STOP
instruction
Standby release
signal
Operation
mode
Operation
stopsNote
STOP mode
Operation mode
Oscillation
.
CPU status
Oscillation stops.
Oscillation
System clock
oscillation
(2) If CPU clock is crystal/ceramic oscillation clock
Interrupt
request
STOP
instruction
Standby release
signal
Operation
Operation
mode
Waiting for stabilization
.
of oscillation
Operation
mode
stopsNote
CPU status
STOP mode
(HALT mode status)
Oscillation
Oscillation stops.
Oscillation
System clock
Oscillation stabilization time
(set by OSTS)
Note The operation stop time is 17 µs (MIN.), 34 µs (TYP.), and 67 µs (MAX.).
Remark The broken lines indicate the case when the interrupt request that has released the standby mode is
acknowledged.
235
User’s Manual U16898EJ3V0UD
CHAPTER 13 STANDBY FUNCTION
(b) Release by reset signal generation
When the reset signal is generated, STOP mode is released and a reset operation is performed after the
oscillation stabilization time has elapsed.
Figure 13-6. STOP Mode Release by Reset Signal Generation
(1) If CPU clock is high-speed internal oscillation clock or external input clock
STOP
instruction
Reset signal
Operation
stopsNote
Reset
period
Operation
mode
CPU status
STOP mode
.
Operation mode
Oscillation
System clock
oscillation
Oscillation
Oscillation stops.
Note Operation is stopped (277 µs (MIN.), 544 µs (TYP.), 1.075 ms (MAX.)) because the option byte is
referenced.
(2) If CPU clock is crystal/ceramic oscillation clock
STOP
instruction
Reset signal
Reset
period
Oscillation
Operation
Operation
mode
Operation
mode
stopsNote
.
stabilization waits
CPU status
STOP mode
Oscillation
Oscillation stops.
Oscillation
System clock
oscillation
Oscillation stabilization time
(210/f to 217/f
X
X
)
Note Operation is stopped (276 µs (MIN.), 544 µs (TYP.), 1.074 ms (MAX.)) because the option byte is
referenced.
Remark fX: System clock oscillation frequency
Table 13-5. Operation in Response to Interrupt Request in STOP Mode
Release Source
MK××
IE
0
Operation
Next address instruction execution
Interrupt servicing execution
STOP mode held
Maskable interrupt request
0
0
1
−
1
×
Reset signal generation
×
Reset processing
×: don’t care
236
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
The following four operations are available to generate a reset signal.
(1) External reset input via RESET pin
(2) Internal reset by watchdog timer overflows
(3) Internal reset by comparison of supply voltage and detection voltage of power-on-clear (POC) circuit
(4) Internal reset by comparison of supply voltage and detection voltage of low-power-supply detector (LVI)
External and internal resets have no functional differences. In both cases, program execution starts from the
programs at the address written in addresses 0000H and 0001H when the reset signal is generated.
A reset is applied when a low level is input to the RESET pin, the watchdog timer overflows, or by POC and LVI
circuit voltage detection, and each item of hardware is set to the status shown in Table 14-1. Each pin is high
impedance during reset signal generation or during the oscillation stabilization time just after reset release, except for
P130, which is low-level output.
When a low level is input to the RESET pin, a reset occurs, and when a high level is input to the RESET pin, the
reset is released and the CPU starts program execution after referencing the option byte (after the option byte is
referenced and the clock oscillation stabilization time elapses if crystal/ceramic oscillation is selected). A reset
generated by the watchdog timer source is automatically released after the reset, and the CPU starts program
execution after referencing the option byte (after the option byte is referenced and the clock oscillation stabilization
time elapses if crystal/ceramic oscillation is selected). (see Figures 14-2 to 14-4). Reset by POC and LVI circuit
power supply detection is automatically released when VDD > VPOC or VDD > VLVI after the reset, and the CPU starts
program execution after referencing the option byte (after the option byte is referenced and the clock oscillation
stabilization time elapses if crystal/ceramic oscillation is selected) (see CHAPTER 15 POWER-ON-CLEAR CIRCUIT
and CHAPTER 16 LOW-VOLTAGE DETECTOR).
Cautions 1. For an external reset, input a low level for 2 µs or more to the RESET pin.
2. During reset signal generation, the system clock and low-speed internal oscillation clock
stop oscillating.
3. When the RESET pin is used as an input-only port pin (P34), the 78K0S/KA1+ is reset if a low
level is input to the RESET pin after reset is released by the POC circuit and before the option
byte is referenced again. The reset status is retained until a high level is input to the RESET
pin.
237
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
Figure 14-1. Block Diagram of Reset Function
Internal bus
Reset control flag register (RESF)
WDTRF
Clear
LVIRF
Set
Set Clear
Reset signal of WDT
Reset signal to LVIM/LVIS register
RESET
Reset signal of POC
Reset signal of LVI
Internal reset signal
Caution The LVI circuit is not reset by the internal reset signal of the LVI circuit.
Remarks 1. LVIM: Low-voltage detect register
2. LVIS: Low-voltage detection level select register
238
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
Figure 14-2. Timing of Reset by RESET Input
<1> With high-speed internal oscillation clock or external clock input
High-speed internal oscillation clock or
external clock input
Normal operation
in progress
Reset period
(oscillation stops)
CPU clock
Normal operation (reset processing, CPU clock)
Operation stops because option
RESET
byte is referencedNote 1
.
Internal reset signal
Delay
Delay
100 ns (TYP.)
100 ns (TYP.)
Hi-Z
Port pin
(except P130)
Port pin
(P130)
Note 2
Notes 1. The operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
2. Set high level output using software.
Remark When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
<2> With crystal/ceramic oscillation clock
Crystal/ceramic
oscillation clock
Oscillation stabilization
Normal operation
(reset processing, CPU clock)
Normal operation
in progress
Reset period
(oscillation stops)
time (210/f
X
to 217/f
)
X
RESET
Operation stops because option
byte is referencedNote 1
.
Internal reset signal
Delay
100 ns (TYP.)
Delay
100 ns (TYP.)
Hi-Z
Port pin
(except P130)
Port pin
(P130)
Note 2
Notes 1. The operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. Set high level output using software.
Remark 1. fX: System clock oscillation frequency
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
239
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
Figure 14-3. Timing of Reset by Overflow of Watchdog Timer
<1> With high-speed internal oscillation clock or external clock input
High-speed internal oscillation clock or
external clock input
Reset period
(oscillation stops)
Normal operation
in progress
Normal operation (reset processing, CPU clock)
Operation stops because option
CPU clock
Watchdog overflow
byte is referencedNote 1
.
Internal reset signal
Port pin
Hi-Z
(except P130)
Port pin
(P130)
Note 2
Notes 1. The operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
2. Set high level output using software.
Caution The watchdog timer is also reset in the case of an internal reset of the watchdog timer.
Remark When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
<2> With crystal/ceramic oscillation clock
Crystal/ceramic
oscillation clock
Normal operation
(reset processing, CPU clock)
Normal operation
in progress
Reset period
(oscillation stops)
Oscillation stabilization
CPU clock
time (210/f
X
to 217/f
X)
Operation stops because option
byte is referencedNote 1
Watchdog overflow
.
Internal reset signal
Hi-Z
Port pin
(except P130)
Port pin
(P130)
Note 2
Notes 1. The operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. Set high level output using software.
Caution The watchdog timer is also reset in the case of an internal reset of the watchdog timer.
Remark 1. fX: System clock oscillation frequency
2. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
240
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
Figure 14-4. Reset Timing by RESET Input in STOP Mode
<1> With high-speed internal oscillation clock or external clock input
STOP instruction is executed.
High-speed internal oscillation clock or
external clock input
Normal
operation
in progress
Stop status
Reset period
(oscillation stops) (oscillation stops)
Normal operation (reset processing, CPU clock)
Operation stops because option
CPU clock
RESET
byte is referencedNote 1
.
Internal reset signal
Delay
100 ns (TYP.)
Delay
100 ns (TYP.)
Hi-Z
Port pin
(except P130)
Port pin
(P130)
Note 2
Notes 1. The operation stop time is 277 µs (MIN.), 544 µs (TYP.), and 1.075 ms (MAX.).
2. Set high level output using software.
Remark When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
<2> With crystal/ceramic oscillation clock
STOP instruction is executed.
High-speed internal oscillation clock or
external clock input
Normal
operation
in progress
Oscillation stabilization
Stop status
(oscillation stops)
Reset period
(oscillation stops)
Normal operation
(reset processing, CPU clock)
CPU clock
RESET
time (210/f
X
to 217/f
X)
Operation stops because option
byte is referencedNote 1
.
Internal reset signal
Delay
Delay
100 ns (TYP.)
100 ns (TYP.)
Hi-Z
Port pin
(except P130)
Port pin
(P130)
Note 2
Notes 1. The operation stop time is 276 µs (MIN.), 544 µs (TYP.), and 1.074 ms (MAX.).
2. Set high level output using software.
241
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
Remarks 1. For the reset timing of the power-on-clear circuit and low-voltage detector, refer to CHAPTER 15
POWER-ON-CLEAR CIRCUIT and CHAPTER 16 LOW-VOLTAGE DETECTOR.
2. fX: System clock oscillation frequency
3. When reset is effected, P130 outputs a low level. If P130 is set to output a high level before reset is
effected, the output signal of P130 can be dummy-output as the reset signal to the CPU.
Table 14-1. Hardware Statuses After Reset Acknowledgment (1/2)
Hardware
Status After Reset
Note 1
Program counter (PC)
Stack pointer (SP)
Contents of reset vector
table (0000H and
0001H) are set.
Undefined
02H
Program status word (PSW)
RAM
Note 2
Undefined
Data memory
General-purpose registers
Note 2
Undefined
Ports (P2 to P4, P12, P13) (output latches)
Port mode registers (PM2 to PM4, PM12)
Port mode control register (PMC2)
00H
FFH
00H
Pull-up resistor option registers (PU2, PU3, PU4, PU12)
Processor clock control register (PCC)
00H
02H
Preprocessor clock control register (PPCC)
Low-speed internal oscillation mode register (LSRCM)
Oscillation stabilization time select register (OSTS)
02H
00H
Undefined
0000H
0000H
00H
16-bit timer 00
Timer counter 00 (TM00)
Capture/compare registers 000, 010 (CR000, CR010)
Mode control register 00 (TMC00)
Prescaler mode register 00 (PRM00)
Capture/compare control register 00 (CRC00)
00H
00H
Timer output control register 00 (TOC00)
Timer counter 80 (TM80)
00H
8-bit timer 80
00H
Compare register (CR80)
Undefined
00H
Mode control register 80 (TMC80)
Compare registers (CMP01, CMP11)
Mode register 1 (TMHMD1)
8-bit timer H1
Watchdog timer
A/D converter
00H
00H
Mode register (WDTM)
67H
Enable register (WDTE)
9AH
Conversion result registers (ADCR, ADCRH)
Mode register (ADM)
Undefined
00H
Analog input channel specification register (ADS)
00H
Notes 1. Only the contents of PC are undefined while reset signal generation and while the oscillation stabilization
time elapses. The statuses of the other hardware units remain unchanged.
2. The status after reset is held in the standby mode.
242
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
Table 14-1. Hardware Statuses After Reset Acknowledgment (2/2)
Hardware
Status After Reset
FFH
FFH
Serial interface UART6
Receive buffer register 6 (RXB6)
Transmit buffer register 6 (TXB6)
Asynchronous serial interface operation mode register 6 (ASIM6)
01H
00H
Asynchronous serial interface reception error status register 6
(ASIS6)
Asynchronous serial interface transmission error status register 6
(ASIF6)
00H
Clock select register 6 (CKSR6)
00H
FFH
16H
00H
Baud rate generator control register 6 (BRGC6)
Asynchronous serial interface control register 6 (ASICL6)
Input select control register (ISC)
Note
00H
00H
00H
00H
Reset function
Reset control flag register (RESF)
Note
Note
Low-voltage detector
Low-voltage detection register (LVIM)
Low-voltage detection level select register (LVIS)
Request flag registers (IF0, IF1)
Interrupt
Mask flag registers (MK0, MK1)
FFH
External interrupt mode registers (INTM0, INTM1)
Flash protect command register (PFCMD)
Flash status register (PFS)
00H
Flash memory
Undefined
00H
Flash programming mode control register (FLPMC)
Flash programming command register (FLCMD)
Flash address pointer L (FLAPL)
Undefined
00H
Undefined
Flash address pointer H (FLAPH)
Flash address pointer H compare register (FLAPHC)
Flash address pointer L compare register (FLAPLC)
Flash write buffer register (FLW)
00H
00H
00H
Note These values change as follows depending on the reset source.
Reset Source
RESET Input
Cleared (0)
Reset by POC
Cleared (0)
Reset by WDT
Reset by LVI
Register
RESF
WDTRF
LVIRF
Set (1)
Held
Held
Set (1)
Held
LVIM
LVIS
Cleared (00H)
Cleared (00H)
Cleared (00H)
243
User’s Manual U16898EJ3V0UD
CHAPTER 14 RESET FUNCTION
14.1 Register for Confirming Reset Source
Many internal reset generation sources exist in the 78K0S/KA1+. The reset control flag register (RESF) is used to
store which source has generated the reset request.
RESF can be read by an 8-bit memory manipulation instruction.
RESET input, reset input by power-on-clear (POC) circuit, and reading RESF clear RESF to 00H.
Figure 14-5. Format of Reset Control Flag Register (RESF)
Note
Address: FF54H After reset: 00H
R
Symbol
RESF
7
0
6
0
5
0
4
3
0
2
0
1
0
0
WDTRF
LVIRF
WDTRF
Internal reset request by watchdog timer (WDT)
0
1
Internal reset request is not generated, or RESF is cleared.
Internal reset request is generated.
LVIRF
Internal reset request by low-voltage detector (LVI)
Internal reset request is not generated, or RESF is cleared.
Internal reset request is generated.
0
1
Note The value after reset varies depending on the reset source.
Caution Do not read data by a 1-bit memory manipulation instruction.
The status of RESF when a reset request is generated is shown in Table 14-2.
Table 14-2. RESF Status When Reset Request Is Generated
Reset Source
RESET Input
Cleared (0)
Reset by POC
Cleared (0)
Reset by WDT
Reset by LVI
Flag
WDTRF
LVIRF
Set (1)
Held
Held
Set (1)
244
User’s Manual U16898EJ3V0UD
CHAPTER 15 POWER-ON-CLEAR CIRCUIT
15.1 Functions of Power-on-Clear Circuit
The power-on-clear circuit (POC) has the following functions.
•
•
Generates internal reset signal at power on.
Compares supply voltage (VDD) and detection voltage (VPOC = 2.1 V 0.1 V), and generates internal reset signal
when VDD < VPOC.
•
Compares supply voltage (VDD) and detection voltage (VPOC = 2.1 V 0.1 V), and releases internal reset signal
when VDD ≥ VPOC.
Cautions 1. If an internal reset signal is generated in the POC circuit, the reset control flag register
(RESF) is cleared to 00H.
2. Because the detection voltage (VPOC) of the POC circuit is in a range of 2.1 V 0.1 V, use a
voltage in the range of 2.2 to 5.5 V.
Remark This product incorporates multiple hardware functions that generate an internal reset signal. A flag that
indicates the reset cause is located in the reset control flag register (RESF) for when an internal reset
signal is generated by the watchdog timer (WDT) or low-voltage-detection (LVI) circuit. RESF is not
cleared to 00H and the flag is set to 1 when an internal reset signal is generated by WDT or LVI.
For details of RESF, see CHAPTER 14 RESET FUNCTION.
245
Manual U16898EJ3V0UD
CHAPTER 15 POWER-ON-CLEAR CIRCUIT
15.2 Configuration of Power-on-Clear Circuit
The block diagram of the power-on-clear circuit is shown in Figure 15-1.
Figure 15-1. Block Diagram of Power-on-Clear Circuit
V
DD
V
DD
+
Internal reset signal
−
Reference
voltage
source
15.3 Operation of Power-on-Clear Circuit
In the power-on-clear circuit, the supply voltage (VDD) and detection voltage (VPOC = 2.1 V 0.1 V) are compared,
and an internal reset signal is generated when VDD < VPOC, and an internal reset is released when VDD ≥ VPOC.
Figure 15-2. Timing of Internal Reset Signal Generation in Power-on-Clear Circuit
Supply voltage (VDD
)
POC detection voltage
(VPOC = 2.1 V ±0.1 V)
Time
Internal reset signal
246
User’s Manual U16898EJ3V0UD
CHAPTER 15 POWER-ON-CLEAR CIRCUIT
15.4 Cautions for Power-on-Clear Circuit
In a system where the supply voltage (VDD) fluctuates for a certain period in the vicinity of the POC detection
voltage (VPOC), the system may be repeatedly reset and released from the reset status. In this case, the time from
release of reset to the start of the operation of the microcontroller can be arbitrarily set by taking the following action.
<Action>
After releasing the reset signal, wait for the supply voltage fluctuation period of each system by means of a
software counter that uses a timer, and then initialize the ports.
Figure 15-3. Example of Software Processing After Release of Reset (1/2)
• If supply voltage fluctuation is 50 ms or less in vicinity of POC detection voltage
Reset
; Check reset source Note 2
Initialization of ports
processing <1>
Setting WDT
Initialization
Power-on clear
; fXP = High-speed internal oscillation clock (8.4 MHz (MAX.)) /22 (default value)
Source : fRL (2.1 MHz (MAX.)) /212,
Setting 8-bit timer H1
51 ms when the compare value is 25
(50 ms is measured)
Timer starts (TMHE1 = 1)
Clears WDT
Note 1
No
50 ms has passed?
(TMIFH1 = 1?)
Yes
; Specify the division ratio of the system clock,
Initialization
processing <2>
setting Timaer, setting A/D Converter, etc.
Notes 1. If reset is generated again during this period, initialization processing <2> is not started.
2. A flowchart is shown on the next page.
247
User’s Manual U16898EJ3V0UD
CHAPTER 15 POWER-ON-CLEAR CIRCUIT
Figure 15-3. Example of Software Processing After Release of Reset (2/2)
• Checking reset cause
Check reset source
Yes
WDTRF of RESF
register = 1?
No
Reset processing by
watchdog timer
Yes
LVIRF of RESF
register = 1?
No
Reset processing by low-voltage
detector
Power-on clear/external
reset generated
248
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
16.1 Functions of Low-Voltage Detector
The low-voltage detector (LVI) has following functions.
•
Compares supply voltage (VDD) and detection voltage (VLVI), and generates an internal interrupt signal or
internal reset signal when VDD < VLVI.
•
•
•
Detection levels (ten levels) of supply voltage can be changed by software.
Interrupt or reset function can be selected by software.
Operable in STOP mode.
When the low-voltage detector is used to reset, bit 0 (LVIRF) of the reset control flag register (RESF) is set to 1 if
reset occurs. For details of RESF, refer to CHAPTER 14 RESET FUNCTION.
16.2 Configuration of Low-Voltage Detector
The block diagram of the low-voltage detector is shown in Figure 16-1.
Figure 16-1. Block Diagram of Low-Voltage Detector
VDD
VDD
N-ch
Internal reset signal
+
−
INTLVI
Reference
voltage source
4
LVION LVIMD LVIF
LVIS3 LVIS2 LVIS1 LVIS0
Low-voltage detection
Low-voltage detect
register (LVIM)
level select register (LVIS)
Internal bus
249
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
16.3 Registers Controlling Low-Voltage Detector
The low-voltage detector is controlled by the following registers.
•
•
Low-voltage detect register (LVIM)
Low-voltage detection level select register (LVIS)
(1) Low-voltage detect register (LVIM)
This register sets low-voltage detection and the operation mode.
This register can be set by a 1-bit or 8-bit memory manipulation instruction.
Reset input clears this register to 00HNote 1
.
Figure 16-2. Format of Low-Voltage Detect Register (LVIM)
Address: FF50H After reset: 00HNote 1 R/WNote 2
<7>
6
0
5
0
4
0
3
0
2
0
<1>
<0>
Symbol
LVIM
LVION
LVIMD
LVIF
LVIONNote 3
Enabling low-voltage detection operation
0
1
Disable operation
Enable operation
LVIMD
Low-voltage detection operation mode selection
Generate interrupt signal when supply voltage (VDD) < detection voltage (VLVI)
0
1
Generate internal reset signal when supply voltage (VDD) < detection voltage (VLVI)
LVIFNote 4
Low-voltage detection flag
Supply voltage (VDD) ≥ detection voltage (VLVI), or when operation is disabled
Supply voltage (VDD) < detection voltage (VLVI)
0
1
Notes 1. For a reset by LVI, the value of LVIM is not initialized.
2. Bit 0 is a read-only bit.
3. When LVION is set to 1, operation of the comparator in the LVI circuit is started. Use
software to instigate a wait of at least 0.2 ms from when LVION is set to 1 until the voltage is
confirmed at LVIF.
4. The value of LVIF is output as the interrupt request signal INTLVI when LVION = 1 and
LVIMD = 0.
Cautions 1. To stop LVI, follow either of the procedures below.
• When using 8-bit manipulation instruction: Write 00H to LVIM.
• When using 1-bit memory manipulation instruction: Clear LVION to 0.
2. Be sure to set bits 2 to 6 to 0.
250
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
(2) Low-voltage detection level select register (LVIS)
This register selects the low-voltage detection level.
This register can be set by an 8-bit memory manipulation instruction.
Reset input clears this register to 00HNote
.
Figure 16-3. Format of Low-Voltage Detection Level Select Register (LVIS)
Address: FF51H, After reset: 00HNote R/W
Symbol
LVIS
7
0
6
0
5
0
4
0
3
2
1
0
LVIS3
LVIS2
LVIS1
LVIS0
LVIS3
LVIS2
LVIS1
LVIS0
Detection level
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
0
1
0
1
VLVI0 (4.3 V ±0.2 V)
VLVI1 (4.1 V ±0.2 V)
VLVI2 (3.9 V ±0.2 V)
VLVI3 (3.7 V ±0.2 V)
VLVI4 (3.5 V ±0.2 V)
VLVI5 (3.3 V ±0.15 V)
VLVI6 (3.1 V ±0.15 V)
VLVI7 (2.85 V ±0.15 V)
VLVI8 (2.6 V ±0.1 V)
VLVI9 (2.35 V ±0.1 V)
Setting prohibited
Other than above
Note For a reset by LVI, the value of LVIM is not initialized.
Caution Bits 4 to 7 must be set to 0.
251
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
16.4 Operation of Low-Voltage Detector
The low-voltage detector can be used in the following two modes.
•
Used as reset
Compares the supply voltage (VDD) and detection voltage (VLVI), and generates an internal reset signal when
VDD < VLVI, and releases internal reset when VDD ≥ VLVI.
•
Used as interrupt
Compares the supply voltage (VDD) and detection voltage (VLVI), and generates an interrupt signal (INTLVI)
when VDD < VLVI.
The operation is set as follows.
(1) When used as reset
•
When starting operation
<1> Mask the LVI interrupt (LVIMK = 1).
<2> Set the detection voltage using bits 3 to 0 (LVIS3 to LVIS0) of the low-voltage detection level select
register (LVIS).
<3> Set bit 7 (LVION) of LVIM to 1 (enables LVI operation).
<4> Use software to instigate a wait of at least 0.2 ms.
<5> Wait until “supply voltage (VDD) ≥ detection voltage (VLVI)” at bit 0 (LVIF) of LVIM is confirmed.
<6> Set bit 1 (LVIMD) of LVIM to 1 (generates internal reset signal when supply voltage (VDD) < detection
voltage (VLVI)).
Figure 16-4 shows the timing of generating the internal reset signal of the low-voltage detector. Numbers <1>
to <6> in this figure correspond to <1> to <6> above.
Cautions 1. <1> must always be executed. When LVIMK = 0, an interrupt may occur immediately
after the processing in <3>.
2. If supply voltage (VDD) ≥ detection voltage (VLVI) when LVIM is set to 1, an internal reset
signal is not generated.
•
When stopping operation
Either of the following procedures must be executed.
•
When using 8-bit memory manipulation instruction: Write 00H to LVIM.
•
When using 1-bit memory manipulation instruction: Clear LVIMD to 0 and LVION to 0 in that order.
252
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
Figure 16-4. Timing of Low-Voltage Detector Internal Reset Signal Generation
Supply voltage (VDD
)
LVI detection voltage
(VLVI
POC detection voltage
(VPOC
)
)
<2>
H
Time
LVIMK flag
(set by software)
<1>
Note 1
LVION flag
(set by software)
Not cleared
Not cleared
<3>
Clear
<4> 0.2 ms or longer
LVIF flag
<5>
Clear
Clear
Note 2
LVIMD flag
(set by software)
Not cleared
Not cleared
<6>
LVIRF flagNote 3
LVI reset signal
Cleared by
software
Cleared by
software
POC reset signal
Internal reset signal
Notes 1. The LVIMK flag is set to “1” by reset input.
2. The LVIF flag may be set (1).
3. LVIRF is bit 0 of the reset control flag register (RESF). For details of RESF, refer to CHAPTER 14
RESET FUNCTION.
Remark <1> to <6> in Figure 16-4 above correspond to <1> to <6> in the description of “when starting operation”
in 16.4 (1) When used as reset.
253
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
(2) When used as interrupt
When starting operation
•
<1> Mask the LVI interrupt (LVIMK = 1).
<2> Set the detection voltage using bits 3 to 0 (LVIS3 to LVIS0) of the low-voltage detection level select
register (LVIS).
<3> Set bit 7 (LVION) of LVIM to 1 (enables LVI operation).
<4> Use software to instigate a wait of at least 0.2 ms.
<5> Wait until “supply voltage (VDD) ≥ detection voltage (VLVI)” at bit 0 (LVIF) of LVIM is confirmed.
<6> Clear the interrupt request flag of LVI (LVIIF) to 0.
<7> Release the interrupt mask flag of LVI (LVIMK).
<8> Execute the EI instruction (when vector interrupts are used).
Figure 16-5 shows the timing of generating the interrupt signal of the low-voltage detector. Numbers <1> to
<7> in this figure correspond to <1> to <7> above.
•
When stopping operation
Either of the following procedures must be executed.
• When using 8-bit memory manipulation instruction: Write 00H to LVIM.
• When using 1-bit memory manipulation instruction: Clear LVION to 0.
254
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
Figure 16-5. Timing of Low-Voltage Detector Interrupt Signal Generation
Supply voltage (VDD
)
LVI detection voltage
(VLVI
)
)
POC detection voltage
(VPOC
Time
<2>
LVIMK flag
(set by software)
<1>
Note 1
<7> Cleared by software
LVION flag
(set by software)
<3>
<4> 0.2 ms or longer
LVIF flag
INTLVI
<5>
Note 2
Note 2
LVIIF flag
<6>
Cleared by software
Note 2
Internal reset signal
Notes 1. The LVIMK flag is set to “1” by reset signal generation.
2. An interrupt request signal (INTLVI) may be generated, and the LVIF and LVIIF flags may be set to 1.
Remark <1> to <7> in Figure 16-5 above correspond to <1> to <7> in the description of “when starting operation”
in 16.4 (2) When used as interrupt.
255
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
16.5 Cautions for Low-Voltage Detector
In a system where the supply voltage (VDD) fluctuates for a certain period in the vicinity of the LVI detection voltage
(VLVI), the operation is as follows depending on how the low-voltage detector is used.
<1> When used as reset
The system may be repeatedly reset and released from the reset status.
In this case, the time from release of reset to the start of the operation of the microcontroller can be arbitrarily
set by taking action (1) below.
<2> When used as interrupt
Interrupt requests may be frequently generated. Take (b) of action (2) below.
In this system, take the following actions.
<Action>
(1) When used as reset
After releasing the reset signal, wait for the supply voltage fluctuation period of each system by means of a
software counter that uses a timer, and then initialize the ports (see Figure 16-6).
(2) When used as interrupt
(a) Perform the processingNote for low voltage detection. Check that “supply voltage (VDD) ≥ detection voltage
(VLVI)” in the servicing routine of the LVI interrupt by using bit 0 (LVIF) of the low-voltage detection register
(LVIM). Clear bit 1 (LVIIF) of interrupt request flag register 0 (IF0) to 0.
(b) In a system where the supply voltage fluctuation period is long in the vicinity of the LVI detection voltage, wait
for the supply voltage fluctuation period, check that “supply voltage (VDD) ≥ detection voltage (VLVI)” using the
LVIF flag and clear LVIIF flag to 0.
Note For low voltage detection processing, the CPU clock speed is switched to slow speed and the A/D
converter is stopped, etc.
256
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
Figure 16-6. Example of Software Processing After Release of Reset (1/2)
• If supply voltage fluctuation is 50 ms or less in vicinity of LVI detection voltage
Reset
; Check reset source Note
Initialization
Initialization of ports
processing <1>
Setting WDT
LVI reset
; The detection level is set with LVIS.
The low-voltage detector is operated (LVION = 1)
Setting LVI
; fXP = High-speed internal oscillation clock (8.4 MHz (MAX.)) /22 (default value)
Source : fRL (2.1 MHz (MAX.)) /212,
51 ms when the compare value is 25
Timer starts (TMHE1 = 1)
Setting 8-bit timer H1
(50 ms is measured)
Clears WDT
Yes
Detection voltage or more
(LVIF = 0 ?)
No
; Clear low-voltage detection flag.
LVIF = 0
Restarting the timaer H1
(TMHE1 = 0 TMHE1 = 1)
; Clear timaer counter and timer starts.
No
50 ms has passed?
(TMIFH1 = 1?)
Yes
; Specify the division ratio of the system clock,
Initialization
setting Timaer, setting A/D Converter, etc.
processing <2>
Notes A flowchart is shown on the next page.
257
User’s Manual U16898EJ3V0UD
CHAPTER 16 LOW-VOLTAGE DETECTOR
Figure 16-6. Example of Software Processing After Release of Reset (2/2)
• Checking reset source
Check reset source
Yes
WDTRF of RESF
register = 1?
No
Reset processing by
watchdog timer
No
LVIRF of RESF
register = 1?
Yes
Power-on-clear/external
reset generated
Reset processing by
low-voltage detector
258
User’s Manual U16898EJ3V0UD
CHAPTER 17 OPTION BYTE
17.1 Functions of Option Byte
The address 0080H of the flash memory of the 78K0S/KA1+ is an option byte area. When power is supplied or
when starting after a reset, the option byte is automatically referenced, and settings for the specified functions are
performed. When using the product, be sure to set the following functions by using the option byte.
(1) Selection of system clock source
• High-speed internal oscillation clock
• Crystal/ceramic oscillation clock
• External clock input
(2) Low-speed internal oscillation clock oscillation
• Cannot be stopped.
• Can be stopped by software.
(3) Control of RESET pin
• Used as RESET pin
• RESET pin is used as an input port pin (P34).
(4) Oscillation stabilization time on power application or after reset release
• 210/fX
• 212/fX
• 215/fX
• 217/fX
Figure 17-1. Positioning of Option Byte
07FFH/0FFFH
Flash memory
2048/4096 × 8 bits)
0080H
Option byte
DEF
OSTS1 OSTS0
DEF
1
1
RMCE OSCSEL1 OSCSEL0 LIOCP
0000H
259
User’s Manual U16898EJ3V0UD
CHAPTER 17 OPTION BYTE
17.2 Format of Option Byte
Format of option bytes is shown below.
Figure 17-2. Format of Option Byte (1/2)
Address: 0080H
7
6
5
4
1
3
2
1
0
1
DEFOSTS1 DEFOSTS0
RMCE
OSCSEL1
OSCSEL0
LIOCP
DEFOSTS1 DEFOSTS0
Oscillation stabilization time on power application or after reset release
210/fx (102.4 µs)
212/fx (409.6 µs)
215/fx (3.27 ms)
217/fx (13.1 ms)
0
0
1
1
0
1
0
1
Caution The setting of this option is valid only when the crystal/ceramic oscillation clock is selected
as the system clock source. No wait time elapses if the high-speed internal oscillation clock
or external clock input is selected as the system clock source.
RMCE
Control of RESET pin
1
0
RESET pin is used as is.
RESET pin is used as input port pin (P34).
Caution Because the option byte is referenced after reset release, if a low level is input to the RESET
pin before the option byte is referenced, then the reset state is not released.
Also, when setting 0 to RMCE, connect the pull-up resistor.
OSCSEL1
OSCSEL0
Selection of system clock source
Crystal/ceramic oscillation clock
0
0
1
0
1
×
External clock input
High-speed internal oscillation clock
Caution Because the X1 and X2 pins are also used as the P121 and P122 pins, the conditions under
which the X1 and X2 pins can be used differ depending on the selected system clock source.
(1) Crystal/ceramic oscillation clock is selected
The X1 and X2 pins cannot be used as I/O port pins because they are used as clock input
pins.
(2) External clock input is selected
Because the X1 pin is used as an external clock input pin, P121 cannot be used as an I/O
port pin.
(3) High-speed internal oscillation clock is selected
P121 and P122 can be used as I/O port pins.
Remark × : don’t care
260
User’s Manual U16898EJ3V0UD
CHAPTER 17 OPTION BYTE
Figure 17-2. Format of Option Byte (2/2)
LIOCP
Low-speed internal oscillates
1
0
Cannot be stopped (oscillation does not stop even if 1 is written to the LSRSTOP bit)
Can be stopped by software (oscillation stops when 1 is written to the LSRSTOP bit)
Cautions 1. If it is selected that low-speed internal oscillator cannot be stopped, the count clock to
the watchdog timer (WDT) is fixed to low-speed internal oscillation clock.
2. If it is selected that low-speed internal oscillator can be stopped by software, supply of
the count clock to WDT is stopped in the HALT/STOP mode, regardless of the setting of
bit 0 (LSRSTOP) of the low-speed internal oscillation mode register (LSRCM). Similarly,
clock supply is also stopped when a clock other than the low-speed internal oscillation
clock is selected as a count clock to WDT.
While the low-speed internal oscillator is operating (LSRSTOP = 0), the clock can be
supplied to the 8-bit timer H1 even in the STOP mode.
Remarks 1. ( ): fX = 10 MHz
2. For the oscillation stabilization time of the resonator, refer to the characteristics of the resonator
to be used.
3. An example of software coding for setting the option bytes is shown below.
OPB OSEG AT 0080H
DB 10010001B
; Set to option byte
; Low-speed internal oscillator cannot be stopped
; The system clock is a crystal or ceramic resonator.
; The RESET pin is used as an input-only port pin (P34).
; Minimum oscillation stabilization time (210/fX
)
4. For details on the timing at which the option byte is referenced, see CHAPTER 14 RESET
FUNCTION.
261
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.1 Features
The internal flash memory of the 78K0S/KA1+ has the following features.
{ Erase/write even without preparing a separate dedicated power supply
{ Capacity: 2 KB/4 KB
• Erase unit: 1 block (256 bytes)
• Write unit: 1 block (at onboard/offboard programming time), 1 byte (at self programming time)
{ Rewriting method
• Rewriting by communication with dedicated flash programmer (on-board/off-board programming)
• Rewriting flash memory by user program (self programming)
{ Supports rewriting of the flash memory at onboard/offboard programming time through security functions
{ Supports security functions in block units at self programming time through protect bytes
262
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.2 Memory Configuration
The 2/4 KB internal flash memory area is divided into 8/16 blocks and can be programmed/erased in block units.
All the blocks can also be erased at once, by using a dedicated flash programmer.
Figure 18-1. Flash Memory Mapping
•
µ
PD78F2222
0FFFH
Block 15 (256 bytes)
0F00H
0EFFH
Block 14 (256 bytes)
Block 13 (256 bytes)
Block 12 (256 bytes)
Block 11 (256 bytes)
Block 10 (256 bytes)
0E00H
0DFFH
FFFFH
0D00H
0CFFH
Special function resister
(256 byte)
0C00H
0BFFH
FF00H
FEFFH
0B00H
0AFFH
Internal high-speed RAM
(128/256 byte)
0A00H
09FFH
Block 9 (256 bytes)
Block 8 (256 bytes)
0900H
08FFH
•
µ
PD78F9221
0800H
07FFH
Use prohibited
Block 7 (256 bytes)
Block 7 (256 bytes)
Block 6 (256 bytes)
0700H
06FFH
Block 6 (256 bytes)
Block 5 (256 bytes)
Block 4 (256 bytes)
Block 3 (256 bytes)
Block 2 (256 bytes)
0600H
05FFH
Block 5 (256 bytes)
Block 4 (256 bytes)
Block 3 (256 bytes)
Block 2 (256 bytes)
0500H
04FFH
0400H
03FFH
0300H
02FFH
Flash memory
(2/4 KB)
0200H
01FFH
Block 1 (256 bytes)
Block 1 (256 bytes)
0100H
00FFH
Block 0 (256 bytes)
2 KB
Block 0 (256 bytes)
4 KB
0000H
0000H
263
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.3 Functional Outline
The internal flash memory of the 78K0S/KA1+ can be rewritten by using the rewrite function of the dedicated flash
programmer, regardless of whether the 78K0S/KA1+ has already been mounted on the target system or not (on-
board/off-board programming).
The function for rewriting a program with the user program (self programming), which is ideal for an application
when it is assumed that the program is changed after production/shipment of the target system, is provided.
Refer to Figure 18-1 for the flash memory writing control function.
In addition, a security function that prohibits rewriting the user program written to the internal flash memory is also
supported, so that the program cannot be changed by an unauthorized person.
Refer to 18.7.3 Security settings for details on the security function.
Table 18-1. Rewrite Method
Rewrite Method
Functional Outline
Operation Mode
Flash memory
programming mode
On-board programming
Flash memory can be rewritten after the device is mounted on the
target system, by using a dedicated flash programmer.
Off-board programming
Self programming
Flash memory can be rewritten before the device is mounted on the
target system, by using a dedicated flash programmer and a dedicated
program adapter board (FA series).
Flash memory can be rewritten by executing a user program that has
been written to the flash memory in advance by means of on-board/off-
board programming.
Self programming mode
Remarks 1. The FA series is a product of Naito Densei Machida Mfg. Co., Ltd.
2. Refer to the following sections for details on the flash memory writing control function.
• 18.7 On-Board and Off-Board Flash Memory Programming
• 18.8 Flash Memory Programming by Self Writing
264
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.4 Writing with Flash Programmer
The following two types of dedicated flash programmers can be used for writing data to the internal flash memory
of the 78K0S/KA1+.
• FlashPro4 (PG-FP4, FL-PR4)
• PG-FPL2
Data can be written to the flash memory on-board or off-board, by using a dedicated flash programmer.
(1) On-board programming
The contents of the flash memory can be rewritten after the 78K0S/KA1+ has been mounted on the target
system. The connectors that connect the dedicated flash programmer and the test pad must be mounted on
the target system. The test pad is required only when writing data with the crystal/ceramic resonator mounted
(refer to Figure 18-6 for mounting of the test pad).
(2) Off-board programming
Data can be written to the flash memory with a dedicated program adapter (FA series) before the 78K0S/KA1+
is mounted on the target system.
Remark The FL-PR4 and FA series are products of Naito Densei Machida Mfg. Co., Ltd.
265
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.5 Programming Environment
The environment required for writing a program to the flash memory is illustrated below.
Figure 18-2. Environment for Writing Program to Flash Memory (FlashPro4)
V
DD
SS
V
FlashPro4
RESET
Axxxx
RS-232-C
USB
Bxxxxx
Cxxxxxx
(FSlTaATsVEh Pro4)
PG-FP4
SI/RxD
SO/TxD
CLK
FLMD0
78K0S/KA1+
Host machine
Dedicated flash programmer
Figure 18-3. Environment for Writing Program to Flash Memory (PG-FPL2)
V
DD
SS
PG-FPL2
V
MODE
USB
Target 3V
RESET
PG-FPL2
Power Status
Target
DGCLKNote
DGDATANote
Dedicated flash programmer
78K0S/KA1+
Host machine
Note DGCLK is a clock for communication, while DGDATA is a transmit/receive signal for communication data.
A host machine that controls the dedicated flash programmer is necessary. When using the PG-FP4 or FL-PR4,
data can be written with just the dedicated flash programmer after downloading the program from the host machine.
UART is used for manipulation such as writing and erasing when interfacing between the dedicated flash
programmer and the 78K0S/KA1+. To write the flash memory off-board, a dedicated program adapter (FA series) is
necessary.
Download the latest programmer firmware, GUI, and parameter file from the download site for development tools
(http://www.necel.com/micro/ods/jpn/index.html).
266
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Table 18-2. Wiring Between 78K0S/KA1+ and FlashPro4
FlashPro4 Connection Pin
Pin Function
78K0S/KA1+ Connection Pin
Pin Name Pin No.
X1/P121
Pin Name
CLKNote
I/O
Output
Output
Input
Output
Output
–
Clock to 78K0S/KA1+
On-board mode signal
Receive signal
2
3
FLMD0Note
SI/RxDNote
SO/TxDNote
/RESET
VDD
X2/P122
Receive signal/on-board mode signal
Reset signal
RESET/P34
VDD
6
5
1
VDD voltage generation/voltage monitor
Ground
GND
–
VSS
Note In the 78K0S/KA1+, the CLK and FLMD0 signals are connected to the X1 pin and the SI/RxD and SO/TxD
signals to the X2 signal; therefore, these signals need to be directly connected.
Figure 18-4. Wiring diagram with FlashPro4
FlashPro4
signal name
CLK
1
2
3
4
5
6
7
8
9
20
19
18
17
16
15
14
13
12
11
FLMD0
SI/RxD
SO/TxD
/RESET
VDD
10
78K0S/KA1+
GND
Table 18-3. Wiring Between 78K0S/KA1+ and PG-FPL2
PG-FPL2 Connection Pin
Pin Function
78K0S/KA1+ Connection Pin
Pin Name Pin No.
X1/P121
Pin Name
CLK
I/O
Output
Clock to 78K0S/KA1+
Transmit/receive signal, on-board mode signal
Reset signal
2
3
6
5
1
DGDATA
/RESET
VDD
I/O
X2/P122
RESET/P34
VDD
Output
–
–
VDD voltage generation
Ground
GND
VSS
Figure 18-5. Wiring diagram with PG-FPL2
PG-FPL2
signal name
1
2
3
4
5
6
7
8
9
20
19
18
17
16
15
14
13
12
11
DGCLK
DGDATA
/RESET
VDD
10
GND
78K0S/KA1+
267
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.6 Pin Connection on Board
To write the flash memory on-board, connectors that connect the dedicated flash programmer must be provided on
the target system. First provide a function that selects the normal operation mode or flash memory programming
mode on the board.
When the flash memory programming mode is set, all the pins not used for programming the flash memory are in
the same status as immediately after reset. Therefore, if the external device does not recognize the state immediately
after reset, the pins must be processed as described below.
The state of the pins in the self programming mode is the same as that in the HALT mode.
18.6.1 X1 and X2 pins
The X1 and X2 pins are used as the serial interface of flash memory programming. Therefore, if the X1 and X2
pins are connected to an external device, a signal conflict occurs. To prevent the conflict of signals, isolate the
connection with the external device.
Perform the following processing (1) and (2) when on-board writing is performed with the resonator mounted, when
it is difficult to isolate the resonator, while a crystal or ceramic resonator is selected as the system clock.
(1) Mount the minimum-possible test pads between the device and the resonator, and connect the flash
programmer via the test pad. Keep the wiring as short as possible (refer to Figure 18-6 and Table 18-4).
(2) Set the oscillation frequency of the communication clock for writing using the GUI software of the dedicated
flash programmer. Research the series/parallel resonant and antiresonant frequencies of the resonator used,
and set the oscillation frequency so that it is outside the range of the resonant frequency 10% (refer to Figure
18-7 and Table 18-5).
Figure 18-6. Example of Mounting Test Pads
Test pad
VSS
X1
X2
Table 18-4. Clock to Be Used and Mounting of Test Pads
Clock to Be Used
High-speed internal oscillation clock
External clock
Mounting of Test Pads
Not required
Crystal/ceramic oscillation
clock
Before resonator is mounted
After resonator is mounted
Required
268
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-7. PG-FP4 GUI Software Setting Example
Set oscillation frequency
Click
(Standard tab in Device setup window)
(Main window)
Table 18-5. Oscillation Frequency and PG-FP4 GUI Software Setting Value Example
Oscillation Frequency
PG-FP4 GUI Software Setting Value Example
(Communication Frequency)
1 MHz ≤ fX < 4 MHz
8 MHz
4 MHz ≤ fX < 8 MHz
8 MHz ≤ fX < 9 MHz
9 MHz ≤ fX ≤ 10 MHz
9 MHz
10 MHz
8 MHz
Caution The above values are recommended values. Depending on the usage environment
these values may change, so set them after having performed sufficient evaluations.
18.6.2 RESET pin
If the reset signal of the dedicated flash programmer is connected to the RESET pin that is connected to the reset
signal generator on the board, signal collision takes place. To prevent this collision, isolate the connection with the
reset signal generator.
If the reset signal is input from the user system while the flash memory programming mode is set, the flash
memory will not be correctly programmed. Do not input any signal other than the reset signal of the dedicated flash
programmer.
269
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-8. Signal Collision (RESET Pin)
78K0S/KA1+
RESET
Dedicated flash programmer
Signal collision
connection signal
Reset signal generator
Output pin
In the flash memory programming mode, the signal output by the reset
signal generator collides with the signal output by the dedicated flash
programmer. Therefore, isolate the signal of the reset signal generator.
18.6.3 Port pins
When the flash memory programming mode is set, all the pins not used for flash memory programming enter the
same status as that immediately after reset. If external devices connected to the ports do not recognize the port
status immediately after reset, the port pin must be connected to VDD or VSS via a resistor.
The state of the pins in the self programming mode is the same as that in the HALT mode.
18.6.4 Power supply
Connect the VDD pin to VDD of the flash programmer, and the VSS pin to VSS of the flash programmer.
Supply AVREF with the same power supply as that in the normal operation mode.
270
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.7 On-Board and Off-Board Flash Memory Programming
18.7.1 Flash memory programming mode
To rewrite the contents of the flash memory by using the dedicated flash programmer, set the 78K0S/KA1+ in the
flash memory programming mode. When the 78K0S/KA1+ is connected to the flash programmer and a
communication command is transmitted to the microcontroller, the microcontroller is set in the flash memory
programming mode.
Change the mode by using a jumper when writing the flash memory on-board.
18.7.2 Communication commands
The dedicated flash programmer controls the 78K0S/KA1+ by using commands. The signals sent from the flash
programmer to the 78K0S/KA1+ are called communication commands, and the commands sent from the 78K0S/KA1+
to the dedicated flash programmer are called response.
Figure 18-9. Communication Commands
FlashPro4
Axxxx
Bxxxxx
Cxxxxxx
(FSlTash Pro4)
A
TVE
PG-FP4
Communication
Command
PG-FPL2
Response
MODE
Target 3V
PG-FPL2
78K0S/KA1+
Power Status
Target
Dedicated flash programmer
Communication commands are listed in the table below. All these communication commands are issued from the
programmer and the 78K0S/KA1+ perform processing corresponding to the respective communication commands.
Table 18-6. Communication Commands
Classification
Command Name
Batch erase (chip erase) command
Block erase command
Function
Erase
Write
Erases the contents of the entire memory
Erases the contents of the memory of the specified block
Write command
Writes to the specified address range and executes a verify
check of the contents.
Checksum
Checksum command
Reads the checksum of the specified address range and
compares with the written data.
Blank check
Security
Blank check command
Confirms the erasure status of the entire memory.
Security setting command
Prohibits batch erase (chip erase) command, block erase
command, and write command to prevent operation by third
parties.
The 78K0S/KA1+ returns a response for the communication command issued by the dedicated flash programmer.
The response name sent from the 78K0S/KA1+ are listed below.
271
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Table 18-7. Response Name
Response Name
Function
ACK
NAK
Acknowledges command/data.
Acknowledges illegal command/data.
18.7.3 Security settings
The operations shown below can be prohibited using the security setting command.
• Batch erase (chip erase) is prohibited
Execution of the block erase and batch erase (chip erase) commands for entire blocks in the flash memory is
prohibited. Once execution of the batch erase (chip erase) command is prohibited, all the prohibition settings
can no longer be cancelled.
Caution After the security setting of the batch erase is set, erasure cannot be performed for the device.
In addition, even if a write command is executed, data different from that which has already
been written to the flash memory cannot be written because the erase command is disabled.
• Block erase is prohibited
Execution of the block erase command in the flash memory is prohibited. This prohibition setting can be
cancelled using the batch erase (chip erase) command.
• Write is prohibited
Execution of the write and block erase commands for entire blocks in the flash memory is prohibited. This
prohibition setting can be cancelled using the batch erase (chip erase) command.
Remark The security setting is valid when the programming mode is set next time.
The batch erase (chip erase), block erase, and write commands are enabled by the default setting when the flash
memory is shipped. The above security settings are possible only for on-board/off-board programming. Each security
setting can be used in combination.
Table 18-8 shows the relationship between the erase and write commands when the 78K0S/KA1+ security function
is enabled.
Table 18-8. Relationship Between Commands When Security Function Is Enabled
Command Batch Erase (Chip
Erase) Command
Block Erase
Command
Write Command
Security
When batch erase (chip erase) security
operation is enabled
Disabled
Disabled
EnabledNote
Enabled
When block erase security operation is
enabled
Enabled
When write security operation is enabled
Disabled
Note Since the erase command is disabled, data different from that which has already been written to the
flash memory cannot be written.
272
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Table 18-9 shows the relationship between the security setting and the operation in each programming mode.
Table 18-9. Relationship Between Security Setting and Operation In Each Programming Mode
Programming Mode
Security Setting
On-Board/Off-Board Programming
Self Programming
Security Setting
Possible
Security Operation
ValidNote 1
Security Setting
Impossible
Security Operation
InvalidNote 2
Batch erase (chip erase)
Block erase
Write
Notes 1. Execution of each command is prohibited by the security setting.
2. Execution of self programming command is possible regardless of the security setting.
18.8 Flash Memory Programming by Self Writing
The 78K0S/KA1+ supports a self programming function that can be used to rewrite the flash memory via a user
program, making it possible to upgrade programs in the field.
Caution Self programming processing must be included in the program before performing self writing.
Remark To use the internal flash memory of the 78K0S/KA1+ as the external EEPROM for storing data, refer to
“78K0S/Kx1+ EEPROM Emulation AN” (U17379E).
18.8.1 Outline of self programming
To execute self programming, shift the mode from the normal operation of the user program (normal mode) to the
self programming mode. Write/erase processing for the flash memory, which has been set to the register in advance,
is performed by executing the HALT instruction during self programming mode. The HALT state is automatically
released when processing is completed.
To shift to the self programming mode, execute a specific sequence for a specific register. Refer to 18.8.4
Example of shifting normal mode to self programming for details.
Remark Data written by self programming can be referenced with the MOV instruction.
Table 18-10. Self Programming Mode
Mode
User Program Execution
Execution of Write/erase for Flash
Memory with HALT Instruction
Normal mode
Self programming mode
Enabled
EnabledNote
−
Enabled
Note Maskable interrupt servicing is disabled during self programming mode.
Figure 18-10 shows a block diagram for self programming, Figure 18-11 shows the self programming state
transition diagram, Table 18-11 lists the commands for controlling self programming.
273
User’s Manual U16898EJ3V0UD
Figure 18-10. Block Diagram of Self Programming
Internal bus
Flash programming command
register (FLCMD)
Protect byte
Flash programming mode
control register (FLPMC)
Flash protect command
register (PFCMD)
PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0
FLCMD2 FLCMD1 FLCMD0
Self programming mode
setting sequencer
Self programming mode setting register
5
3
HALT signal
Self programming command execution
Flash memory controller
Erase
circuit
Write
circuit
Verify
circuit
Increment
circuit
HALT release signal
Flash address
pointer H (FLAPH)
Flash memory
Match
Flash address
pointer L (FLAPL)
Unmatch
Match
Flash address pointer H
compare register
(FLAPHC)
Flash address pointer L
compare register
(FLAPLC)
Flash write buffer register
(FLW)
WEPRERR VCERR FPRERR
Flash status register (PFS)
Internal bus
CHAPTER 18 FLASH MEMORY
Figure 18-11. Self Programming State Transition Diagram
User program
Operation setting
Normal mode
Specific sequence
Operation
setting
Register for
Self programming mode
self programming
Self programming command
execution by HALT instruction
Self programming
command completion/error
Flash memory
control block (hardware)
Operation reference
Self programming
command under execution
Flash memory
Table 18-11. Self Programming Controlling Commands
Command Name
Function
Time Taken from HALT Instruction Execution
to Command Execution End
Internal verify
This command is used to check if data has been
correctly written to the flash memory. After data has
Internal verify for 1 block (internal verify
command executed once): 6.8 ms
been written to the memory, specify the block number, Internal verify for 1 byte:
the start address, and the end address, then execute
this command.
27 µs
Block erasure
This command is used to erase a specified block.
Specify the block number before execution.
8.5 ms
Block blank check
This command is used to check if data in a specified
block has been erased. Specify the block number,
then execute this command.
480 µs
Byte write
This command is used to write 1-byte data to the
specified address in the flash memory. Specify the
write address and write data, then execute this
command.
150 µs
275
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.2 Cautions on self programming function
• No instructions can be executed while a self programming command is being executed. Therefore, clear and
restart the watchdog timer counter in advance so that the watchdog timer does not overflow during self
programming. Refer to Table 18-11 for the time taken for the execution of self programming.
• Interrupts that occur during self programming can be acknowledged after self programming mode ends. To avoid
this operation, disable interrupt servicing (by setting MK0 and MK1 to FFH, and executing the DI instruction)
before a mode is shifted from the normal mode to the self programming mode with a specific sequence.
• RAM is not used while a self programming command is being executed.
• If the supply voltage drops or the reset signal is input while the flash memory is being written or erased,
writing/erasing is not guaranteed.
• The value of the blank data set during block erasure is FFH.
• When the oscillator or the external clock is selected as the main clock, a wait time of 16 µs is required starting
from the setting of the self programming mode to the execution of the HALT instruction.
• The state of the pins in self programming mode is the same as that in HALT mode.
• Since the security function set via on-board/off-board programming is disabled in self programming mode, the
self programming command can be executed regardless of the security function setting. To disable write or
erase processing during self programming, set the protect byte.
• Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash address pointer H compare register
(FLAPHC) to 0 before executing the self programming command. If the value of these bits is 1 when executing
the self programming command.
18.8.3 Registers used for self programming function
The following registers are used for the self programming function.
• Flash programming mode control register (FLPMC)
• Flash protect command register (PFCMD)
• Flash status register (PFS)
• Flash programming command register (FLCMD)
• Flash address pointers H and L (FLAPH and FLAPL)
• Flash address pointer H compare register and flash address pointer L compare register (FLAPHC and FLAPLC)
• Flash write buffer register (FLW)
The 78K0S/KA1+ has an area called a protect byte at address 0081H of the flash memory.
(1) Flash programming mode control register (FLPMC)
This register is used to set the operation mode when data is written to the flash memory in the self
programming mode, and to read the set value of the protect byte.
Data can be written to FLPMC only in a specific sequence (refer to 18.8.3 (2) Flash protect command
register (PFCMD)) so that the application system does not stop by accident because of malfunctions due to
noise or program hang-ups.
This register is set with an 8-bit memory manipulation instruction.
Reset signal generation makes the contents of this register undefined.
276
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-12. Format of Flash Programming Mode Control Register (FLPMC)
Address: FFA2H
After reset: UndefinedNote 1
R/WNote 2
Symbol
FLPMC
7
6
5
4
3
2
1
0
0
0
PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0
FLSPM
FLSPM
0
Selection of operation mode during self programming mode
Normal mode
Flash memory instructions can be fetched from all addresses.
Self programming mode
1
Before executing the HALT instruction, set the command, address offset, write
data, and set FLSPM to 1. After setting these items, execute the HALT
instruction; the flash memory mode is then shifted from the normal mode to the
flash memory programming mode.
The set value of the protect byte
is read to these bits.
PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0
Notes 1. Bit 0 (FLSPM) is cleared to 0 when reset is released. The set value of the protect
byte is read to bits 2 to 6 (PRSELF0 to PRSELF4) after reset is released.
2. Bits 2 to 6 (PRSELF0 to PRSELF4) are read-only.
Cautions 1. Cautions in the case of setting the self programming mode, refer to 18.8.2
Cautions on self programming function.
2. When the oscillator or the external clock is selected as the main clock, a
wait time of 16 µs is required from setting FLSPM to 1 to execution of the
HALT instruction.
(2) Flash protect command register (PFCMD)
If the application system stops inadvertently due to malfunction caused by noise or program hang-up, an
operation to write the flash programming mode control register (FLPMC) may have a serious effect on the
system. PFCMD is used to protect FLPMC from being written, so that the application system does not stop
inadvertently.
Writing FLPMC is enabled only when a write operation is performed in the following specific sequence.
<1> Write a specific value to PFCMD (A5H)
<2> Write the value to be set to bit 0 (FLSPM) of the FLPMC (writing in this step is invalid)
<3> Write the inverted value of the value to be set to bit 0 (FLSPM) of the FLPMC (writing in this step is
invalid)
<4> Write the value to be set to bit 0 (FLSPM) of the FLPMC (writing in this step is valid)
Caution Disable interrupt servicing (by setting MK0 and MK1 to FFH and executing the DI instruction)
while the specific sequence is under execution.
This rewrites the value of the register, so that the register cannot be written illegally.
Occurrence of an illegal store operation can be checked by bit 0 (FPRERR) of the flash status register (PFS).
A5H must be written to PFCMD each time the value of FLPMC is changed.
PFCMD can be set with an 8-bit memory manipulation instruction.
Reset signal generation makes PFCMD undefined.
277
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-13. Format of Flash Protect Command Register (PFCMD)
Address: FFA0H
After reset: Undefined
W
4
Symbol
PFCMD
7
6
5
3
2
1
0
REG7
REG6
REG5
REG4
REG3
REG2
REG1
REG0
(3) Flash status register (PFS)
If data is not written to the flash programming mode control register (FLPMC), which is protected, in the correct
sequence (writing the flash protect command register (PFCMD)), FLPMC is not written and a protection error
occurs. If this happens, bit 0 of PFS (FPRERR) is set to 1.
When FPRERR is 1, it can be cleared to 0 by writing 0 to it.
Errors that may occur during self programming are reflected in bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
VCERR or WEPRERR can be cleared by writing 0 to them.
All the flags of the PFS register must be pre-cleared to 0 to check if the operation is performed correctly.
PFS can be set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears PFS to 00H.
Figure 18-14. Format of Flash Status Register (PFS)
Address: FFA1H
After reset: 00H
R/W
Symbol
PFS
7
6
0
5
0
4
0
3
0
2
1
0
0
WEPRERR
VCERR
FPRERR
1. Operating conditions of FPRERR flag
<Setting conditions>
• If PFCMD is written when the store instruction operation recently performed on a peripheral register is not to
write a specific value (A5H) to FLPMC
• If the first store instruction operation after <1> is on a peripheral register other than FLPMC
• If the first store instruction operation after <2> is on a peripheral register other than FLPMC
• If a value other than the inverted value of the value to be set to FLPMC is written by the first store instruction
after <2>
• If the first store instruction operation after <3> is on a peripheral register other than FLPMC
• If a value other than the value to be set to FLPMC (value written in <2>) is written by the first store instruction
after <3>
Remark The numbers in angle brackets above correspond to the those in (2) Flash protect command
register (PFCMD).
<Reset conditions>
• If 0 is written to the FPRERR flag
• If the reset signal is generated
2. Operating conditions of VCERR flag
<Setting conditions>
• Erasure verification error
• Internal writing verification error
278
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
If VCERR is set, it means that the flash memory has not been erased or written correctly. Erase or write the
memory again in the specified procedure.
Remark The VCERR flag may also be set if an erase or write protect error occurs.
<Reset conditions>
• When 0 is written to the VCERR flag
• When the reset signal is generated
3. Operating conditions of WEPRERR flag
<Setting conditions>
• If the area specified by the protect byte to be protected from erasing or writing is specified by the flash
address pointer H (FLAPH) and a command is executed to this area
• If 1 is written to a bit that has not been erased (a bit for which the data is 0).
<Reset conditions>
• When 0 is written to the WEPRERR flag
• When the reset signal is generated
(4) Flash programming command register (FLCMD)
This register is used to specify whether the flash memory is erased, written, or verified in the self programming
mode.
This register is set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears this register to 00H.
279
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-15. Format of Flash Programming Command Register (FLCMD)
Address: FFA3H
After reset: 00H
R/W
Symbol
FLCMD
7
6
0
5
0
4
0
3
0
2
1
0
0
FLCMD2 FLCMD1 FLCMD0
FLCMD2 FLCMD1 FLCMD0 Command Name
Function
0
0
1
Internal verify
This command is used to check if
data has been correctly written to the
flash memory. After data has been
written to the memory, execute this
command by specifying a block
number, start address, and end
address. If an error occurs, bit 1
(VCERR) or bit 2 (WEPRERR) of the
flash status register (PFS) is set to 1.
This command is used to erase
specified block. It is used both in the
on-board mode and self
0
1
1
Block erase
programming mode.
1
1
0
0
0
1
Block blank check This command is used to check if the
specified block has been erased.
Byte write
This command is used to write 1-byte
data to the specified address in the
flash memory. Specify the write
address and write data, then execute
this command.
If 1 is written to a bit that has not
been erased (a bit for which the data
is 0), then bit 2 (WEPRERR) of the
flash status register (PFS) becomes
1.
Other than aboveNote
Setting prohibited
Note If a value other than the above is set and the self programming mode is set, the self programming
mode is canceled immediately and no execution occurs. At this time, the flag of the PFS register is
not set.
(5) Flash address pointers H and L (FLAPH and FLAPL)
These registers are used to specify the start address of the flash memory when the memory is erased, written,
or verified in the self programming mode.
FLAPH and FLAPL consist of counters, and they are incremented until the values match with those of
FLAPHC and FLAPLC when the programming command is not executed. When the programming command
is executed, therefore, set the value again.
These registers are set with a 1-bit or 8-bit memory manipulation instruction.
reset signal generation makes these registers undefined.
280
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-16. Format of Flash Address Pointer H/L (FLAPH/FLAPL)
Address: FFA4H, FFA5H
After reset: Undefined
R/W
FLAPH (FFA5H)
FLAPL (FFA4H)
0
0
0
0
FLA FLA FLA FLA FLA FLA FLA FLA FLA FLA FLA FLA
P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0
Caution Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash address pointer H
compare register (FLAPHC) to 0 before executing the self programming command. If the
value of these bits is 1 when executing the self programming command.
(6) Flash address pointer H compare register and flash address pointer L compare register (FLAPHC and
FLAPLC)
These registers are used to specify the address range in which the internal sequencer operates when the flash
memory is verified in the self programming mode.
Set FLAPHC to the same value as that of FLAPH. Set the last address of the range in which verification is to
be executed to FLAPLC.
These registers are set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears these registers to 00H.
Figure 18-17. Format of Flash Address Pointer H/L Compare Registers (FLAPHC/FLAPLC)
Address: FFA6H, FFA7H
After reset: 00H
R/W
FLAPHC (FFA7H)
FLAPLC (FFA6H)
0
0
0
0
FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP FLAP
C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0
Cautions 1. Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash address
pointer H compare register (FLAPHC) to 0 before executing the self programming
command. If the value of these bits is 1 when executing the self programming
command.
2. Set the number of the block subject to a block erase, verify, or blank check (same
value as FLAPH) to FLAPHC.
3. Clear FLAPLC to 00H when a block erase is performed, and FFH when a blank check is
performed.
281
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
(7) Flash write buffer register (FLW)
This register is used to store the data to be written to the flash memory.
This register is set with a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation clears these registers to 00H.
Figure 18-18. Format of Flash Write Buffer Register (FLW)
Address: FFA8H
After reset: 00H
6
R/W
Symbol
FLW
7
5
4
3
2
1
0
FLW7
FLW6
FLW5
FLW4
FLW3
FLW2
FLW1
FLW0
(8) Protect byte
This protect byte is used to specify the area that is to be protected from writing or erasing. The specified area
is valid only in the self programming mode. Because self programming of the protected area is invalid, the
data written to the protected area is guaranteed.
282
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-19. Format of Protect Byte
Address: 0081H
7
1
6
5
4
3
2
1
1
0
1
PRSELF4
PRSELF3
PRSELF2
PRSELF1
PRSELF0
• µPD78F9221
PRSELF4
PRSELF3
1
PRSELF2
1
PRSELF1
0
PRSELF0
0
Status
0
Blocks 7 to 0 are protected.
Blocks 5 to 0 are protected.
0
1
1
1
1
1
0
1
1
0
Blocks 6 and 7 can be written or erased.
Blocks 3 to 0 are protected.
0
Blocks 4 to 7 can be written or erased.
Blocks 1 and 0 are protected.
0
1
1
1
1
1
1
1
Blocks 2 to 7 can be written or erased.
All blocks can be written or erased.
Setting prohibited
1
Other than above
• µPD78F9222
PRSELF4
PRSELF3
1
PRSELF2
0
PRSELF1
0
PRSELF0
0
Status
0
Blocks 15 to 0 are protected.
Blocks 13 to 0 are protected.
0
1
1
1
1
1
1
0
0
0
1
1
1
1
0
1
1
0
0
1
1
0
1
0
1
0
Blocks 14 and 15 can be written or erased.
Blocks 11 to 0 are protected.
0
0
0
0
0
Blocks 12 to 15 can be written or erased.
Blocks 9 to 0 are protected.
Blocks 10 to 15 can be written or erased.
Blocks 7 to 0 are protected.
Blocks 8 to 15 can be written or erased.
Blocks 5 to 0 are protected.
Blocks 6 to 15 can be written or erased.
Blocks 3 to 0 are protected.
Blocks 4 to 15 can be written or erased.
Blocks 1 and 0 are protected.
0
1
1
1
1
1
1
1
Blocks 2 to 15 can be written or erased.
All blocks can be written or erased.
Setting prohibited
1
Other than above
283
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.4 Example of shifting normal mode to self programming mode
The operating mode must be shifted from normal mode to self programming mode before performing self
programming.
An example of shifting to self programming mode is explained below.
<1> Disable interrupts if the interrupt function is used (by setting the interrupt mask flag registers (MK0, MK1) to
FFH and executing the DI instruction).
<2> Clear the flash status register (PFS).
<3> Set self programming mode using a specific sequence.
• Write a specific value (A5H) to PFCMD.
• Write 01H to FLPMC (writing in this step is invalid).
• Write 0FEH (inverted value of 01H) to FLPMC (writing in this step is invalid).
• Write 01H to FLPMC (writing in this step is valid).
<4> Check the execution result of the specific sequence using bit 0 (FPRERR) of PFS.
Abnormal → <2>, normal → <5>
<5> Mode shift is completed.
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
284
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-20. Example of Shifting to Self Programming Mode
Shift to self programming mode
<1> Disable interrupts (by setting MK0
and MK1 to FFH and executing
; When interrupt function is used
DI instruction)
<2> Clear PFS
PFCMD = A5H
FLPMC = 01H (set value)
FLPMC = 0FEH (inverted set value)
FLPMC = 01H (set value)
; Set value is invalid
<3>
; Set value is valid
Abnormal
<4> Check execution result
(FPRERR flag)
Normal
<5> Termination
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
Remark <1> to <5> in Figure 18-20 correspond to <1> to <5> in 18.8.4 (previous page).
285
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of the program that shifts the mode to self programming mode is shown below.
;----------------------------
;START
;----------------------------
MOV
MOV
MK0,#11111111B
MK1,#11111111B
; Masks all interrupts
DI
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#01H
FLPMC,#0FEH
FLPMC,#01H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode with FLPMC register
; control (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs.
;----------------------------
;END
;----------------------------
286
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.5 Example of shifting self programming mode to normal mode
The operating mode must be returned from self programming mode to normal mode after performing self
programming.
An example of shifting to normal mode is explained below.
<1> Clear the flash status register (PFS).
<2> Set normal mode using a specific sequence.
• Write the specific value (A5H) to PFCMD.
• Write 00H to FLPMC (writing in this step is invalid)
• Write 0FFH (inverted value of 00H) to FLPMC (writing in this step is invalid)
• Write 00H to FLPMC (writing in this step is valid)
<3> Check the execution result of the specific sequence using bit 0 (FPRERR) of PFS.
Abnormal → <1>, normal → <4>
<4> Enable interrupt servicing (by executing the EI instruction and changing MK0 and MK1) to restore the original
state.
<5> Mode shift is completed
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
287
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-21. Example of Shifting to Normal Mode
Shift to normal mode
<1> Clear PFS
PFCMD = A5H
FLPMC = 00H (set value)
FLPMC = 0FFH (inverted set value)
FLPMC = 00H (set value)
; Set value is invalid
<2>
; Set value is valid
Abnormal
<3> Check execution result
(FPRERR flag)
Normal
<4> Enable interrupts (by executing
EI instruction and changing
MK0, MK1)
; When interrupt function is used
<5> Termination
Caution Be sure to perform the series of operations described above using the user program at an
address where data is not erased nor written.
Remark <1> to <5> in Figure 18-21 correspond to <1> to <5> in 18.8.5 (previous page).
288
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program that shifts the mode to normal mode is shown below.
;----------------------------
;START
;----------------------------
ModeOffLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#00H
FLPMC,#0FFH
FLPMC,#00H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets normal mode via FLPMC register control (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOffLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
MOV
MOV
MK0,#INT_MK0
MK1,#INT_MK1
; Restores interrupt mask flag
EI
;----------------------------
;END
;----------------------------
289
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.6 Example of block erase operation in self programming mode
An example of the block erase operation in self programming mode is explained below.
<1> Set 03H (block erase) to the flash program command register (FLCMD).
<2> Set the block number to be erased, to flash address pointer H (FLAPH).
<3> Set flash address pointer L (FLAPL) to 00H.
<4> Write the same value as FLAPH to the flash address pointer H compare register (FLAPHC).
<5> Set the flash address pointer L compare register (FLAPLC) to 00H.
<6> Clear the flash status register (PFS).
<7> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note
.
<8> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<9> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <10>
Normal
→ <11>
<10> Block erase processing is abnormally terminated.
<11> Block erase processing is normally terminated.
Note This setting is not required when the watchdog timer is not used.
290
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-22. Example of Block Erase Operation in Self Programming Mode
Block erasure
<1> Set erase command
(FLCMD = 03H)
<2> Set no. of block to be erased
to FLAPH
<3> Set FLAPL to 00H
<4> Set the same value as
that of FLAPH to FLAPHC
<5> Set FLAPLC to 00H
<6> Clear PFS
<7> Clear & restart WDT counter
(WDTE = ACH)Note
<8> Execute HALT instruction
<9> Check execution result
(VCERR and WEPRERR flags)
Abnormal
Normal
<11> Normal termination
<10> Abnormal termination
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <11> in Figure 18-22 correspond to <1> to <11> in 18.8.6 (previous page).
291
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program that performs a block erase in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashBlockErase:
MOV
MOV
MOV
MOV
MOV
FLCMD,#03H
FLAPH,#07H
FLAPL,#00H
FLAPHC,#07H
FLAPLC,#00H
; Sets flash control command (block erase)
; Sets number of block to be erased (block 7 is specified here)
; Fixes FLAPL to “00H”
; Sets erase block compare number (same value as that of FLAPH)
; Fixes FLAPLC to “00H”
MOV
MOV
HALT
MOV
MOV
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
CmdStatus,A
; Execution result is stored in variable
; (CmdStatus = 0: normal termination, other than 0: abnormal
; termination)
;----------------------------
;END
;----------------------------
292
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.7 Example of block blank check operation in self programming mode
An example of the block blank check operation in self programming mode is explained below.
<1> Set 04H (block blank check) to the flash program command register (FLCMD).
<2> Set the number of block for which a blank check is performed, to flash address pointer H (FLAPH).
<3> Set flash address pointer L (FLAPL) to 00H.
<4> Write the same value as FLAPH to the flash address pointer H compare register (FLAPHC).
<5> Set the flash address pointer L compare register (FLAPLC) to FFH.
<6> Clear the flash status register (PFS).
<7> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note
.
<8> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<9> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <10>
Normal
→ <11>
<10> Block blank check is abnormally terminated.
<11> Block blank check is normally terminated.
Note This setting is not required when the watchdog timer is not used.
293
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-23. Example of Block Blank Check Operation in Self Programming Mode
Block blank check
<1> Set block blank check
command (FLCMD = 04H)
<2> Set no. of block for
blank check to FLAPH
<3> Set FLAPL to 00H
<4> Set the same value as
that of FLAPH to FLAPHC
<5> Set FLAPLC to 00H
<6> Clear PFS
<7> Clear & restart WDT counter
(WDTE = ACH)Note
<8> Execute HALT instruction
Abnormal
<9> Check execution result
(VCERR and WEPRERR flags)
Normal
<10> Abnormal termination
<11> Normal termination
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <11>in Figure 18-23 correspond to <1> to <11> in 18.8.7 (previous page).
294
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program that performs a block blank check in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashBlockBlankCheck:
MOV
MOV
FLCMD,#04H
FLAPH,#07H
; Sets flash control command (block blank check)
; Sets number of block for blank check (block 7 is specified
; here)
MOV
MOV
FLAPL,#00H
; Fixes FLAPL to “00H”
FLAPHC,#07H
; Sets blank check block compare number (same value as that of
; FLAPH)
MOV
FLAPLC,#0FFH
; Fixes FLAPLC to “FFH”
MOV
MOV
HALT
MOV
MOV
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
CmdStatus,A
; Execution result is stored in variable
; (CmdStatus = 0: normal termination, other than 0: abnormal
; termination)
;----------------------------
;END
;----------------------------
295
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.8 Example of byte write operation in self programming mode
An example of the byte write operation in self programming mode is explained below.
<1> Set 05H (byte write) to the flash program command register (FLCMD).
<2> Set the number of block to which data is to be written, to flash address pointer H (FLAPH).
<3> Set the address at which data is to be written, to flash address pointer L (FLAPL).
<4> Set the data to be written, to the flash write buffer register (FLW).
<5> Clear the flash status register (PFS).
<6> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note
.
<7> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<8> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <9>
Normal
→ <10>
<9> Byte write processing is abnormally terminated.
<10> Byte write processing is normally terminated.
Note This setting is not required when the watchdog timer is not used.
Caution If a write results in failure, erase the block once and write to it again.
296
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-24. Example of Byte Write Operation in Self Programming Mode
Byte write
<1> Set byte write command
(FLCMD = 05H)
<2> Set no. of block to be
written, to FLAPH
<3> Set address at which data
is to be written, to FLAPL
<4> Set data to be written to FLW
<5> Clear PFS
<6> Clear & restart WDT counter
(WDTE = ACH)Note
<7> Execute HALT instruction
Abnormal
<8> Check execution result
(VCERR and WEPRERR flags)
Normal
<10> Normal termination
<9> Abnormal termination
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <10> in Figure 18-24 correspond to <1> to <10> in 18.8.8 (previous page).
297
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program that performs a byte write in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashWrite:
MOV
MOV
FLCMD,#05H
FLAPH,#07H
; Sets flash control command (byte write)
; Sets address to which data is to be written, with
; FLAPH (block 7 is specified here)
MOV
MOV
FLAPL,#20H
FLW,#10H
; Sets address to which data is to be written, with
; FLAPL (address 20H is specified here)
; Sets data to be written (10H is specified here)
MOV
MOV
HALT
MOV
MOV
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
CmdStatus,A
; Execution result is stored in variable
; (CmdStatus = 0: normal termination, other than 0: abnormal
; termination)
;----------------------------
;END
;----------------------------
298
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.9 Example of internal verify operation in self programming mode
An example of the internal verify operation in self programming mode is explained below.
<1> Set 01H (internal verify) to the flash program command register (FLCMD).
<2> Set the number of block for which internal verify is performed, to flash address pointer H (FLAPH).
<3> Sets the verify start address to flash address pointer L (FLAPL).
<4> Write the same value as that of FLAPH to the flash address pointer H compare register (FLAPHC).
<5> Sets the verify end address to the flash address pointer L compare register (FLAPLC).
<6> Clear the flash status register (PFS).
<7> Write ACH to the watchdog timer enable register (WDTE) (clear and restart the watchdog timer counter)Note
.
<8> Execute the HALT instruction then start self programming. (Execute an instruction immediately after the
HALT instruction if self programming has been executed.)
<9> Check if a self programming error has occurred using bit 1 (VCERR) and bit 2 (WEPRERR) of PFS.
Abnormal → <10>
Normal → <11>
<10> Internal verify processing is abnormally terminated.
<11> Internal verify processing is normally terminated.
Note This setting is not required when the watchdog timer is not used.
299
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-25. Example of Internal Verify Operation in Self Programming Mode
Internal verify
<1> Set internal verify
command (FLCMD = 01H)
<2> Set no. of block for
internal verify, to FLAPH
<3> Set start address to FLAPL
<4> Set the same value as
that of FLAPH to FLAPHC
<5> Set end address to FLAPLC
<6> Clear PFS
<7> Clear & restart WDT counter
(WDTE = ACH)Note
<8> Execute HALT instruction
Abnormal
<9> Check execution result
(VCERR and WEPRERR flags)
Normal
<11> Normal termination
<10> Abnormal termination
Note This setting is not required when the watchdog timer is not used.
Remark <1> to <11> in Figure 18-25 correspond to <1> to <11> in 18.8.9 (previous page).
300
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program that performs an internal verify in self programming mode is shown below.
;----------------------------
;START
;----------------------------
FlashVerify:
MOV
MOV
FLCMD,#01H
FLAPH,#07H
; Sets flash control command (internal verify)
; Sets verify start address with FLAPH (block 7 is specified
; here)
MOV
FLAPL,#00H
; Sets verify start address with FLAPL (Address 00H is
; specified here)
MOV
MOV
FLAPHC,#07H
FLAPLC,#20H
; Sets verify end address
MOV
MOV
HALT
MOV
MOV
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
CmdStatus,A
; Execution result is stored in variable
; (CmdStatus = 0: normal termination, other than 0: abnormal
; termination)
;----------------------------
;END
;----------------------------
301
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.10 Examples of operation when command execution time should be minimized in self programming
mode
Examples of operation when the command execution time should be minimized in self programming mode are
explained below.
(1) Erasure to blank check
<1> Mode is shifted from normal mode to self programming mode (<1> to <5> in 18.8.4)
<2> Execution of block erase → Error check (<1> to <11> in 18.8.6)
<3> Execution of block blank check → Error check (<1> to <11> in 18.8.7)
<4> Mode is shifted from self programming mode to normal mode (<1> to <5> in 18.8.5)
Figure 18-26. Example of Operation When Command Execution Time Should Be Minimized
(from Erasure to Blank Check)
Erasure to blank check
Figure 18-20
<1> to <5>
<1> Shift to self programming
mode
<2> Execute block erase
Figure 18-22
<1> to <11>
Abnormal
<2> Check execution result
(VCERR and WEPRERR flags)
Normal
<3> Execute block blank check
Figure 18-23
<1> to <11>
Abnormal
<3> Check execution result
(VCERR and WEPRERR flags)
Normal
Figure 18-21
<1> to <5>
<4> Shift to normal mode
Normal termination
Abnormal terminationNote
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <4> in Figure 18-26 correspond to <1> to <4> in 18.8.10 (1) above.
302
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program when the command execution time (from erasure to black check) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
MOV
MOV
MK0,#11111111B
MK1,#11111111B
; Masks all interrupts
DI
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#01H
FLPMC,#0FEH
FLPMC,#01H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode with FLPMC register control (sets
; value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
FlashBlockErase:
MOV
MOV
FLCMD,#03H
FLAPH,#07H
; Sets flash control command (block erase)
; Sets number of block to be erased (block 7 is specified
; here)
MOV
MOV
FLAPL,#00H
; Fixes FLAPL to “00H”
FLAPHC,#07H
; Sets erase block compare number (same value as that of
; FLAPH)
MOV
FLAPLC,#00H
WDTE,#0ACH
; Fixes FLAPLC to “00H”
MOV
HALT
MOV
CMP
BNZ
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks erase error
; Performs abnormal termination processing when an error
; occurs.
FlashBlockBlankCheck:
MOV
MOV
FLCMD,#04H
; Sets flash control command (block blank check)
; Sets number of block for blank check (block 7 is specified
; here)
FLAPH,#07H
FLAPL,#00H
MOV
; Fixes FLAPL to “00H”
303
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
MOV
FLAPHC,#07H
; Sets blank check block compare number (same value as of
; FLAPH)
MOV
MOV
HALT
MOV
CMP
BNZ
FLAPLC,#0FFH
WDTE,#0ACH
; Fixes FLAPLC to “FFH”
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks blank check error
; Performs abnormal termination processing when an error
; occurs.
ModeOffLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#00H
FLPMC,#0FFH
FLPMC,#00H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets normal mode via FLPMC register control (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOffLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
MOV
MOV
MK0,#INT_MK0
MK1,#INT_MK1
; Restores interrupt mask flag
EI
BR
StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
304
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
(2) Write to internal verify
<1> Mode is shifted from normal mode to self programming mode (<1> to <5> in 18.8.4)
<2> Specification of source data for write
<3> Execution of byte write → Error check (<1> to <10> in 18.8.8)
<4> <3> is repeated until all data are written.
<5> Execution of internal verify → Error check (<1> to <11> in 18.8.9)
<6> Mode is shifted from self programming mode to normal mode (<1> to <5> in 18.8.5)
Figure 18-27. Example of Operation When Command Execution Time Should Be Minimized
(from Write to Internal Verify)
Write to internal verify
<1> Shift to self programming
mode
Figure 18-20
<1> to <5>
<2> Set source data for write
<3> Execute byte write command
Figure 18-24
<1> to <10>
<3> Check execution result
(VCERR and WEPRERR flags)
Abnormal
Normal
Yes
<4> All data written?
No
<5> Execute internal verify command
Figure 18-25
<1> to <11>
Abnormal
<5> Check execution result
(VCERR and WEPRERR flags)
Normal
Figure 18-21
<1> to <5>
<6> Shift to normal mode
Normal termination
Abnormal terminationNote
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <6> in Figure 18-27 correspond to <1> to <6> in 18.8.10 (2) above.
305
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program when the command execution time (from write to internal verify) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
MOV
MOV
MK0,#11111111B
MK1,#11111111B
; Masks all interrupts
DI
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#01H
FLPMC,#0FEH
FLPMC,#01H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode with FLPMC register control
; (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
FlashWrite:
MOVW
HL,#DataAdrTop
DE,#WriteAdr
; Sets address at which data to be written is located
; Sets address at which data is to be written
MOVW
FlashWriteLoop:
MOV
MOV
MOV
MOV
MOV
MOV
MOV
FLCMD,#05H
A,D
; Sets flash control command (byte write)
; Sets address at which data is to be written
; Sets address at which data is to be written
; Sets data to be written
FLAPH,A
A,E
FLAPL,A
A,[HL]
FLW,A
MOV
HALT
MOV
CMP
BNZ
WDTE,#0ACH
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks write error
; Performs abnormal termination processing when an error
; occurs.
INCW
MOVW
CMPW
BNC
HL
; address at which data to be written is located + 1
AX,HL
AX,#DataAdrBtm
$FlashVerify
; Performs internal verify processing
; if write of all data is completed
306
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
INCW
BR
DE
; Address at which data is to be written + 1
FlashWriteLoop
FlashVerify:
MOVW
HL,#WriteAdr
; Sets verify address
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
FLCMD,#01H
A,H
; Sets flash control command (internal verify)
; Sets verify start address
; Sets verify start address
; Sets verify end address
FLAPH,A
A,L
FLAPL,A
A,D
FLAPHC,A
A,E
FLAPLC,A
; Sets verify end address
MOV
HALT
MOV
CMP
BNZ
WDTE,#0ACH
; Clears & restarts WDT
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks internal verify error
; Performs abnormal termination processing when an error
; occurs.
ModeOffLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#00H
FLPMC,#0FFH
FLPMC,#00H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets normal mode via FLPMC register control (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOffLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
MOV
MOV
MK0,#INT_MK0
MK1,#INT_MK1
; Restores interrupt mask flag
EI
BR
StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
307
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
; Data to be written
;---------------------------------------------------------------------
DataAdrTop:
DB
DB
DB
DB
XXH
XXH
XXH
XXH
:
:
DB
XXH
DataAdrBtm:
;---------------------------------------------------------------------
308
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
18.8.11 Examples of operation when interrupt-disabled time should be minimized in self programming mode
Examples of operation when the interrupt-disabled time should be minimized in self programming mode are
explained below.
(1) Erasure to blank check
<1> Specification of block erase command (<1> to <5> in 18.8.6)
<2> Mode is shifted from normal mode to self programming mode (<1> to <5> in 18.8.4)
<3> Execution of block erase command → Error check (<6> to <11> in 18.8.6)
<4> Mode is shifted from self programming mode to normal mode (<1> to <5> in 18.8.5)
<5> Specification of block blank check command (<1> to <5> in 18.8.7)
<6> Mode is shifted from normal mode to self programming mode (<1> to <5> in 18.8.4)
<7> Execution of block blank check command → Error check (<6> to <11> in 18.8.7)
<8> Mode is shifted from self programming mode to normal mode (<1> to <5> in 18.8.5)
309
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-28. Example of Operation When Interrupt-Disabled Time Should Be Minimized
(from Erasure to Blank Check)
Erasure to blank check
Figure 18-22
<1> to <5>
<1> Specify block erase command
<2> Shift to self programming
mode
Figure 18-20
<1> to <5>
<3> Execute block erase command
Figure 18-22
<6> to <11>
Abnormal
<3> Check execution result
(VCERR and WEPRERR flags)
Normal
Figure 18-21
<1> to <5>
<4> Shift to normal mode
<5> Specify block blank
check command
Figure 18-23
<1> to <5>
<6> Shift to self programming
mode
Figure 18-20
<1> to <5>
<7> Execute block blank
check command
Figure 18-23
<6> to <11>
<7> Check execution result
Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 18-21
<1> to <5>
<8> Shift to normal mode
Normal termination
Abnormal terminationNote
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <8> in Figure 18-28 correspond to <1> to <8> in 18.8.11 (1) (previous page).
310
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program when the interrupt-disabled time (from erasure to blank check) should be minimized in
self programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
FlashBlockErase:
; Sets erase command
MOV
MOV
MOV
MOV
MOV
FLCMD,#03H
FLAPH,#07H
FLAPL,#00H
FLAPHC,#07H
FLAPLC,#00H
; Sets flash control command (block erase)
; Sets number of block to be erased (block 7 is specified here)
; Fixes FLAPL to “00H”
; Sets erase block compare number (same value as that of FLAPH)
; Fixes FLAPLC to “00H”
CALL
!ModeOn
; Shift to self programming mode
; Execution of erase command
MOV
MOV
HALT
MOV
CMP
BNZ
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks erase error
; Performs abnormal termination processing when an error
; occurs.
CALL
!ModeOff
; Shift to normal mode
; Sets blank check command
MOV
MOV
MOV
MOV
FLCMD,#04H
FLAPH,#07H
FLAPL,#00H
FLAPHC,#07H
; Sets flash control command (block blank check)
; Sets block number for blank check (block 7 is specified here)
; Fixes FLAPL to “00H”
; Sets blank check block compare number (same value as that of
; FLAPH)
MOV
FLAPLC,#0FFH
!ModeOn
; Fixes FLAPLC to “FFH”
CALL
; Shift to self programming mode
; Execution of blank check command
MOV
MOV
HALT
MOV
CMP
BNZ
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks blank check error
; Performs abnormal termination processing when an error occurs
311
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
CALL
BR
!ModeOff
; Shift to normal mode
StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
MOV
MOV
MK0,#11111111B
MK1,#11111111B
; Masks all interrupts
DI
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#01H
FLPMC,#0FEH
FLPMC,#01H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode via FLPMC register control (sets
; value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
RET
;---------------------------------------------------------------------
; Processing to shift to normal mode
;---------------------------------------------------------------------
ModeOff:
MOV
MOV
MOV
PFS,#00H
PFCMD,#0A5H
FLPMC,#00H
; PFCMD register control
; FLPMC register control (sets value)
312
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
MOV
MOV
FLPMC,#0FFH
FLPMC,#00H
; FLPMC register control (inverts set value)
; Sets normal mode via FLPMC register control (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOff
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
MOV
MOV
MK0,#INT_MK0
MK1,#INT_MK1
; Restores interrupt mask flag
EI
RET
313
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
(2) Write to internal verify
<1> Specification of source data for write
<2> Specification of byte write command (<1> to <4> in 18.8.8)
<3> Mode is shifted from normal mode to self programming mode (<1> to <5> in 18.8.4)
<4> Execution of byte write command → Error check (<5> to <10> in 18.8.8)
<5> Mode is shifted from self programming mode to normal mode (<1> to <5> in 18.8.5)
<6> <2> to <5> is repeated until all data are written.
<7> The internal verify command is specified (<1> to <5> in 18.8.9)
<8> Mode is shifted from normal mode to self programming mode (<1> to <5> in 18.8.4)
<9> Execution of internal verify command → Error check (<6> to <11> in 18.8.9)
<10> Mode is shifted from self programming mode to normal mode (<1> to <5> in 18.8.5)
314
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
Figure 18-29. Example of Operation When Interrupt-Disabled Time Should Be Minimized
(from Write to Internal Verify)
Write to internal verify
<1> Set source data for write
Figure 18-24
<1> to <4>
<2> Specify byte write command
<3> Shift to self programming
mode
Figure 18-20
<1> to <5>
<4> Execute byte write command
Figure 18-24
<5> to <10>
Abnormal
<4> Check execution result
(VCERR and WEPRERR flags)
Normal
Figure 18-21
<1> to <5>
<5> Shift to normal mode
Yes
<6> All data written?
No
Figure 18-25
<1> to <5>
<7> Specify internal verify command
<8> Shift to self programming
mode
Figure 18-20
<1> to <5>
<9> Execute internal verify command
Figure 18-25
<6> to <10>
<9> Check execution result
Abnormal
(VCERR and WEPRERR flags)
Normal
Figure 18-21
<1> to <5>
<10> Shift to normal mode
Normal termination
Abnormal terminationNote
Note Perform processing to shift to normal mode in order to return to normal processing.
Remark <1> to <10> in Figure 18-29 correspond to <1> to <10> in 18.8.11 (2) (previous page).
315
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
An example of a program when the interrupt-disabled time (from write to internal verify) should be minimized in self
programming mode is shown below.
;---------------------------------------------------------------------
;START
;---------------------------------------------------------------------
; Sets write command
FlashWrite:
MOVW
MOVW
HL,#DataAdrTop ; Sets address at which data to be written is located
DE,#WriteAdr
; Sets address at which data is to be written
FlashWriteLoop:
MOV
MOV
MOV
MOV
MOV
MOV
MOV
FLCMD,#05H
A,D
; Sets flash control command (byte write)
; Sets address at which data is to be written
; Sets address at which data is to be written
; Sets data to be written
FLAPH,A
A,E
FLAPL,A
A,[HL]
FLW,A
CALL
!ModeOn
; Shift to self programming mode
; Execution of write command
MOV
MOV
HALT
MOV
CMP
BNZ
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks write error
; Performs abnormal termination processing when an error
; occurs.
CALL
!ModeOff
; Shift to normal mode
MOV
MOV
MK0,#INT_MK0
MK1,#INT_MK1
; Restores interrupt mask flag
EI
; Judgment of writing all data
INCW
MOVW
CMPW
BNC
HL
; Address at which data to be written is located + 1
AX,HL
AX,#DataAdrBtm ; Performs internal verify processing
$FlashVerify
; if write of all data is completed
INCW
BR
DE
; Address at which data is to be written + 1
FlashWriteLoop
316
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
; Setting internal verify command
FlashVerify:
MOVW
HL,#WriteAdr
; Sets verify address
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
FLCMD,#01H
A,H
; Sets flash control command (internal verify)
; Sets verify start address
; Sets verify start address
; Sets verify end address
FLAPH,A
A,L
FLAPL,A
A,D
FLAPHC,A
A,E
FLAPLC,A
; Sets verify end address
CALL
!ModeOn
; Shift to self programming mode
; Execution of internal verify command
MOV
MOV
HALT
MOV
CMP
BNZ
PFS,#00H
; Clears flash status register
; Clears & restarts WDT
WDTE,#0ACH
; Self programming is started
A,PFS
A,#00H
$StatusError
; Checks internal verify error
; Performs abnormal termination processing when an error occurs
CALL
BR
!ModeOff
; Shift to normal mode
StatusNormal
;---------------------------------------------------------------------
;END (abnormal termination processing); Perform processing to shift to
normal mode in order to return to normal processing
;---------------------------------------------------------------------
StatusError:
;---------------------------------------------------------------------
;END (normal termination processing)
;---------------------------------------------------------------------
StatusNormal:
;---------------------------------------------------------------------
;Processing to shift to self programming mode
;---------------------------------------------------------------------
ModeOn:
MOV
MOV
MK0,#11111111B ; Masks all interrupts
MK1,#11111111B
317
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
DI
ModeOnLoop:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#01H
FLPMC,#0FEH
FLPMC,#01H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets self programming mode via FLPMC register control (sets
; value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOnLoop
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
RET
;---------------------------------------------------------------------
; Processing to shift to normal mode
;---------------------------------------------------------------------
ModeOff:
MOV
MOV
MOV
MOV
MOV
PFS,#00H
; Clears flash status register
PFCMD,#0A5H
FLPMC,#00H
FLPMC,#0FFH
FLPMC,#00H
; PFCMD register control
; FLPMC register control (sets value)
; FLPMC register control (inverts set value)
; Sets normal mode via FLPMC register control (sets value)
MOV
CMP
BNZ
A,PFS
A,#00H
$ModeOff
; Checks completion of write to specific registers
; Repeats the same processing when an error occurs
MOV
MOV
MK0,#INT_MK0
MK1,#INT_MK1
; Restores interrupt mask flag
EI
RET
;---------------------------------------------------------------------
;Data to be written
;---------------------------------------------------------------------
DataAdrTop:
DB
DB
XXH
XXH
318
User’s Manual U16898EJ3V0UD
CHAPTER 18 FLASH MEMORY
DB
DB
XXH
XXH
:
:
DB
XXH
DataAdrBtm:
;---------------------------------------------------------------------
319
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
This chapter lists the instruction set of the 78K0S/KA1+. For details of the operation and machine language
(instruction code) of each instruction, refer to 78K/0S Series Instructions User’s Manual (U11047E).
19.1 Operation
19.1.1 Operand identifiers and description methods
Operands are described in “Operand” column of each instruction in accordance with the description method of the
instruction operand identifier (refer to the assembler specifications for details). When there are two or more
description methods, select one of them. Uppercase letters and the symbols #, !, $, and [ ] are key words and are
described 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
describe 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 description.
Table 19-1. Operand Identifiers and Description Methods
Identifier
Description Method
r
rp
sfr
X (R0), A (R1), C (R2), B (R3), E (R4), D (R5), L (R6), H (R7)
AX (RP0), BC (RP1), DE (RP2), HL (RP3)
Special function register symbol
saddr
FE20H to FF1FH Immediate data or labels
saddrp
FE20H to FF1FH Immediate data or labels (even addresses only)
addr16
addr5
0000H to FFFFH Immediate data or labels (only even addresses for 16-bit data transfer instructions)
0040H to 007FH Immediate data or labels (even addresses only)
word
byte
bit
16-bit immediate data or label
8-bit immediate data or label
3-bit immediate data or label
Remark For symbols of special function registers, see Table 4-3 Special Function Registers.
320
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
19.1.2 Description of “Operation” column
A:
A register; 8-bit accumulator
X:
X register
B:
B register
C:
C register
D:
D register
E:
E register
H:
H register
L:
L register
AX:
BC:
DE:
HL:
PC:
SP:
PSW:
CY:
AC:
Z:
AX register pair; 16-bit accumulator
BC register pair
DE register pair
HL register pair
Program counter
Stack pointer
Program status word
Carry flag
Auxiliary carry flag
Zero flag
IE:
( ):
×H, ×L:
∧:
Interrupt request enable flag
Memory contents indicated by address or register contents in parentheses
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” column
(Blank): Unchanged
0:
1:
×:
R:
Cleared to 0
Set to 1
Set/cleared according to the result
Previously saved value is stored
321
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
19.2 Operation List
Mnemonic
Operand
Bytes Clocks
Operation
Flag
Z
AC CY
MOV
r, #byte
3
3
3
2
6
6
6
4
r ← byte
saddr, #byte
sfr, #byte
(saddr) ← byte
sfr ← byte
A ← r
Note
Note
A, r
1
r, A
2
4
r ← A
1
A, saddr
saddr, A
A, sfr
2
2
2
2
3
3
3
2
2
1
1
1
1
2
2
1
2
4
4
4
4
8
8
6
4
4
6
6
6
6
6
6
4
6
A ← (saddr)
(saddr) ← A
A ← sfr
sfr, A
sfr ← A
A, !addr16
!addr16, A
PSW, #byte
A, PSW
PSW, A
A, [DE]
A ← (addr16)
(addr16) ← A
PSW ← byte
A ← PSW
PSW ← A
A ← (DE)
×
×
×
×
×
×
[DE], A
(DE) ← A
A, [HL]
A ← (HL)
[HL], A
(HL) ← A
A, [HL + byte]
[HL + byte], A
A, X
A ← (HL + byte)
(HL + byte) ← A
A ↔ X
XCH
Note
A, r
A ↔ r
2
A, saddr
A, sfr
2
2
1
1
2
6
6
8
8
8
A ↔ (saddr)
A ↔ sfr
A, [DE]
A ↔ (DE)
A, [HL]
A ↔ (HL)
A, [HL, byte]
A ↔ (HL + byte)
Notes 1. Except r = A.
2. Except r = A, X.
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
322
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
Mnemonic
MOVW
Operand
Bytes Clocks
Operation
Flag
Z
AC CY
rp, #word
3
2
2
1
1
1
2
3
2
2
3
1
2
2
3
2
2
3
1
2
2
3
2
2
3
1
2
6
6
8
4
4
8
4
6
4
4
8
6
6
4
6
4
4
8
6
6
4
6
4
4
8
6
6
rp ← word
AX, saddrp
saddrp, AX
AX, rp
AX ← (saddrp)
(saddrp) ← AX
Note
Note
Note
AX ← rp
rp, AX
rp ← AX
XCHW
ADD
AX, rp
AX ↔ rp
A, #byte
saddr, #byte
A, r
A, CY ← A + byte
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
(saddr), CY ← (saddr) + byte
A, CY ← A + r
A, saddr
A, !addr16
A, [HL]
A, CY ← A + (saddr)
A, CY ← A + (addr16)
A, CY ← A + (HL)
A, [HL + byte]
A, #byte
saddr, #byte
A, r
A, CY ← A + (HL + byte)
A, CY ← A + byte + CY
(saddr), CY ← (saddr) + byte + CY
A, CY ← A + r + CY
A, CY ← A + (saddr) + CY
A, CY ← A + (addr16) + CY
A, CY ← A + (HL) + CY
A, CY ← A + (HL + byte) + CY
A, CY ← A − byte
ADDC
A, saddr
A, !addr16
A, [HL]
A, [HL + byte]
A, #byte
saddr, #byte
A, r
SUB
(saddr), CY ← (saddr) − byte
A, CY ← A − r
A, saddr
A, !addr16
A, [HL]
A, CY ← A − (saddr)
A, CY ← A − (addr16)
A, CY ← A − (HL)
A, [HL + byte]
A, CY ← A − (HL + byte)
Note Only when rp = BC, DE, or HL.
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
323
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
Mnemonic
SUBC
Operand
Bytes Clocks
Operation
Flag
Z
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
AC CY
A, #byte
2
3
2
2
3
1
2
2
3
2
2
3
1
2
2
3
2
2
3
1
2
2
3
2
2
3
1
2
4
6
4
4
8
6
6
4
6
4
4
8
6
6
4
6
4
4
8
6
6
4
6
4
4
8
6
6
A, CY ← A − byte − CY
(saddr), CY ← (saddr) − byte − CY
A, CY ← A − r − CY
A, CY ← A − (saddr) − CY
A, CY ← A − (addr16) − CY
A, CY ← A − (HL) − CY
A, CY ← A − (HL + byte) − CY
A ← A ∧ byte
×
×
×
×
×
×
×
×
×
×
×
×
×
×
saddr, #byte
A, r
A, saddr
A, !addr16
A, [HL]
A, [HL + byte]
A, #byte
AND
saddr, #byte
A, r
(saddr) ← (saddr) ∧ byte
A ← A ∧ r
A, saddr
A, !addr16
A, [HL]
A ← A ∧ (saddr)
A ← A ∧ (addr16)
A ← A ∧ (HL)
A, [HL + byte]
A, #byte
A ← A ∧ (HL + byte)
A ← A ∨ byte
OR
saddr, #byte
A, r
(saddr) ← (saddr) ∨ byte
A ← A ∨ r
A, saddr
A, !addr16
A, [HL]
A ← A ∨ (saddr)
A ← A ∨ (addr16)
A ← A ∨ (HL)
A, [HL + byte]
A, #byte
A ← A ∨ (HL + byte)
A ← A ∨ byte
XOR
saddr, #byte
A, r
(saddr) ← (saddr) ∨ byte
A ← A ∨ r
A, saddr
A, !addr16
A, [HL]
A ← A ∨ (saddr)
A ← A ∨ (addr16)
A ← A ∨ (HL)
A, [HL + byte]
A ← A ∨ (HL + byte)
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
324
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
Mnemonic
CMP
Operand
Bytes Clocks
Operation
Flag
Z
×
×
×
×
×
×
×
×
×
×
×
×
×
×
AC CY
A, #byte
2
3
2
2
3
1
2
3
3
3
2
2
2
2
1
1
1
1
1
1
3
3
2
3
2
3
3
2
3
2
1
1
1
4
6
4
4
8
6
6
6
6
6
4
4
4
4
4
4
2
2
2
2
6
6
4
6
10
6
6
4
6
10
2
2
2
A − byte
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
×
saddr, #byte
A, r
(saddr) − byte
A − r
A, saddr
A, !addr16
A, [HL]
A, [HL + byte]
AX, #word
AX, #word
AX, #word
r
A − (saddr)
A − (addr16)
A − (HL)
A − (HL + byte)
AX, CY ← AX + word
AX, CY ← AX − word
AX − word
ADDW
SUBW
CMPW
INC
r ← r + 1
saddr
r
(saddr) ← (saddr) + 1
r ← r − 1
DEC
saddr
rp
(saddr) ← (saddr) − 1
rp ← rp + 1
INCW
DECW
ROR
rp
rp ← rp − 1
A, 1
(CY, A7 ← A0, Am−1 ← Am) × 1
(CY, A0 ← A7, Am+1 ← Am) × 1
(CY ← A0, A7 ← CY, Am−1 ← Am) × 1
(CY ← A7, A0 ← CY, Am+1 ← Am) × 1
(saddr.bit) ← 1
sfr.bit ← 1
×
×
×
×
ROL
A, 1
RORC
ROLC
SET1
A, 1
A, 1
saddr.bit
sfr.bit
A.bit
A.bit ← 1
PSW.bit
[HL].bit
saddr.bit
sfr.bit
PSW.bit ← 1
×
×
×
×
×
(HL).bit ← 1
CLR1
(saddr.bit) ← 0
sfr.bit ← 0
A.bit
A.bit ← 0
PSW.bit
[HL].bit
CY
PSW.bit ← 0
×
(HL).bit ← 0
SET1
CLR1
NOT1
CY ← 1
1
0
×
CY
CY ← 0
CY
CY ← CY
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
325
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
Mnemonic
Operand
Bytes Clocks
Operation
Flag
Z
AC CY
CALL
!addr16
[addr5]
3
1
6
8
(SP − 1) ← (PC + 3)H, (SP − 2) ← (PC + 3)L,
PC ← addr16, SP ← SP − 2
CALLT
(SP − 1) ← (PC + 1)H, (SP − 2) ← (PC + 1)L,
PCH ← (00000000, addr5 + 1),
PCL ← (00000000, addr5), SP ← SP − 2
RET
1
1
6
8
PCH ← (SP + 1), PCL ← (SP), SP ← SP + 2
RETI
PCH ← (SP + 1), PCL ← (SP), PSW ← (SP + 2),
SP ← SP + 3
R
R
R
R
R
R
PUSH
POP
PSW
1
1
1
1
2
2
3
2
1
2
2
2
2
4
4
3
4
4
4
3
4
2
2
3
2
4
(SP − 1) ← PSW, SP ← SP − 1
(SP − 1) ← rpH, (SP − 2) ← rpL, SP ← SP − 2
PSW ← (SP), SP ← SP + 1
rp
PSW
4
rp
6
rpH ← (SP + 1), rpL ← (SP), SP ← SP + 2
SP ← AX
MOVW
BR
SP, AX
AX, SP
!addr16
$addr16
AX
8
6
AX ← SP
6
PC ← addr16
6
PC ← PC + 2 + jdisp8
6
PCH ← A, PCL ← X
BC
$saddr16
$saddr16
$saddr16
$saddr16
6
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
PC ← PC + 4 + jdisp8 if (saddr.bit) = 1
PC ← PC + 4 + jdisp8 if sfr.bit = 1
PC ← PC + 3 + jdisp8 if A.bit = 1
PC ← PC + 4 + jdisp8 if PSW.bit = 1
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
B ← B − 1, then PC ← PC + 2 + jdisp8 if B ≠ 0
C ← C − 1, then PC ← PC + 2 + jdisp8 if C ≠ 0
BNC
BZ
6
6
BNZ
BT
6
saddr.bit, $addr16
sfr.bit, $addr16
A.bit, $addr16
PSW.bit, $addr16
saddr.bit, $addr16
sfr.bit, $addr16
A.bit, $addr16
PSW.bit, $addr16
B, $addr16
10
10
8
10
10
10
8
BF
10
6
DBNZ
C, $addr16
6
saddr, $addr16
8
(saddr) ← (saddr) − 1, then
PC ← PC + 3 + jdisp8 if (saddr) ≠ 0
NOP
EI
1
3
3
1
1
2
6
6
2
2
No Operation
IE ← 1 (Enable Interrupt)
IE ← 0 (Disable Interrupt)
Set HALT Mode
DI
HALT
STOP
Set STOP Mode
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control
register (PCC).
326
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
19.3 Instructions Listed by Addressing Type
(1) 8-bit instructions
MOV, XCH, ADD, ADDC, SUB, SUBC, AND, OR, XOR, CMP, INC, DEC, ROR, ROL, RORC, ROLC, PUSH,
POP, DBNZ
2nd Operand
1st Operand
A
#byte
A
r
sfr
saddr !addr16 PSW
[DE]
[HL]
$addr16
1
None
[HL + byte]
ADD
ADDC
SUB
SUBC
AND
OR
MOVNot MOV
MOV
XCH
ADD
ADDC
SUB
SUBC
AND
OR
MOV
MOV
MOV
XCH
MOV
XCH
ADD
ADDC
SUB
SUBC
AND
OR
MOV
XCH
ADD
ADDC
SUB
SUBC
AND
OR
ROR
e
XCH
ROL
XCHNot
ADD
ADDC
SUB
SUBC
AND
OR
RORC
ROLC
e
ADD
ADDC
SUB
SUBC
AND
OR
XOR
CMP
XOR
CMP
XOR
CMP
XOR
CMP
XOR
CMP
XOR
CMP
r
MOV
MOV
MOV
INC
DEC
B, C
sfr
DBNZ
DBNZ
MOV
MOV
saddr
MOV
ADD
ADDC
SUB
SUBC
AND
OR
INC
DEC
XOR
CMP
!addr16
PSW
MOV
MOV
MOV
PUSH
POP
[DE]
MOV
MOV
MOV
[HL]
[HL + byte]
Note Except r = A.
327
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
(2) 16-bit instructions
MOVW, XCHW, ADDW, SUBW, CMPW, PUSH, POP, INCW, DECW
2nd Operand
1st Operand
#word
AX
rpNote
saddrp
SP
None
AX
ADDW SUBW
CMPW
MOVW
XCHW
MOVW
MOVW
rp
MOVW
MOVWNote
INCW
DECW
PUSH
POP
saddrp
sp
MOVW
MOVW
Note Only when rp = BC, DE, or HL.
(3) Bit manipulation instructions
SET1, CLR1, NOT1, BT, BF
2nd Operand
1st Operand
$addr16
None
A.bit
BT
BF
SET1
CLR1
sfr.bit
BT
BF
SET1
CLR1
saddr.bit
PSW.bit
[HL].bit
CY
BT
BF
SET1
CLR1
BT
BF
SET1
CLR1
SET1
CLR1
SET1
CLR1
NOT1
328
User’s Manual U16898EJ3V0UD
CHAPTER 19 INSTRUCTION SET OVERVIEW
(4) Call instructions/branch instructions
CALL, CALLT, BR, BC, BNC, BZ, BNZ, DBNZ
2nd Operand
1st Operand
AX
!addr16
[addr5]
$addr16
Basic instructions
BR
CALL
BR
CALLT
BR
BC
BNC
BZ
BNZ
Compound instructions
DBNZ
(5) Other instructions
RET, RETI, NOP, EI, DI, HALT, STOP
329
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
Caution For (A) products, the specifications are target values, and may change after device evaluation.
Absolute Maximum Ratings (TA = 25°C)
Parameter
Supply voltage
Symbol
Conditions
Ratings
Unit
V
VDD
−0.3 to +6.5
VSS
AVREF
VI1
−0.3 to +0.3
V
−0.3 to VDD + 0.3Note
−0.3 to VDD + 0.3Note
V
Input voltage
P30, P31, P34, P40 to P45, P121 to P123
P20 to 23
V
VI2
− 0.3 to AVREF + 0.3Note
V
and −0.3 to VDD + 0.3Note
Output voltage
VO
−0.3 to VDD + 0.3Note
V
V
Analog input voltage
VAN
− 0.3 to AVREF + 0.3Note
and −0.3 to VDD + 0.3Note
Output current, high
Output current, low
IOH
Per pin
−10.0
−44.0
mA
mA
mA
mA
mA
°C
Total of pins other than P20 to P23
Total of P20 to P23
−44.0
IOL
TA
Per pin
20.0
Total of all pins
44.0
Operating ambient
temperature
In normal operation mode
During flash memory programming
Flash memory blank status
Flash memory programming already performed
−40 to +85
Storage temperature
Tstg
−65 to +150
−40 to +125
°C
°C
Note Must be 6.5 V or lower
Caution Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any
parameter. That is, the absolute maximum ratings are rated values at which the product is on the
verge of suffering physical damage, and therefore the product must be used under conditions that
ensure that the absolute maximum ratings are not exceeded.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
330
Preliminary User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
X1 Oscillator Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator Recommended Circuit
Parameter
Conditions
MIN.
1
TYP. MAX.
10.0
Unit
Ceramic
resonator
Oscillation
MHz
V
SS X1
C1
X2
frequency (fX)Note 2
C2
C2
Crystal
resonator
Oscillation
1
10.0
MHz
V
SS X1
C1
X2
frequency (fX)Note 2
External
clock
X1 input
2.7 V ≤ VDD ≤ 5.5 V
1
1
10.0
5.0
0.5
MHz
X1
frequency (fX)Note 2
2.0 V ≤ VDD < 2.7 V
2.7 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 2.7 V
X1 input high-
/low-level width
(tXH, tXL)
0.045
0.09
µs
0.5
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V 0.1 V.
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Caution When using the X1 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 VSS.
• Do not ground the capacitor to a ground pattern through which a high current flows.
• Do not fetch signals from the oscillator.
Remark For the resonator selection and oscillator constant, users are required to either evaluate the oscillation
themselves or apply to the resonator manufacturer for evaluation.
331
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
High-Speed Internal Oscillator Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator
High-speed internal Oscillation frequency (fX = 8
oscillator
MHzNote 2) deviation
Parameter
Conditions
2.7 V ≤ VDD ≤ 5.5 V TA = −10 to +80°C
TA = −40 to +85°C
MIN.
TYP. MAX.
Unit
%
3
5
%
Oscillation frequency (fX)Note 2 2.0 V ≤ VDD < 2.7 V
5.5
MHz
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V 0.1 V.
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Low-Speed Internal Oscillator Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
Resonator
Parameter
Conditions
MIN.
120
TYP. MAX.
240 480
Unit
kHz
Low-speed internal Oscillation frequency (fRL)
oscillator
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V 0.1 V.
332
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
DC Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V) (1/2)
Parameter
Symbol
Conditions
MIN.
TYP.
MAX.
–5
Unit
mA
mA
mA
mA
mA
mA
mA
mA
V
Output current, high
IOH1
Pins other than Per pin 2.0 V ≤ VDD ≤ 5.5 V
P20 to P23
Total
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
–25
–15
IOH2
P20 to P23
Per pin 2.0 V ≤ AVREF ≤ 5.5 V
–5
Total
2.0 V ≤ AVREF ≤ 5.5 V
2.0 V ≤ VDD ≤ 5.5 V
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
–15
Output current, low
Input voltage, high
Input voltage, low
Output voltage, high
IOL
Per pin
10
Total of all pins
30
15
VIH1
VIH2
VIH3
VIL1
VIL2
VIL3
VOH1
P30, P31, P34, P40 to P45, P123
P20 to P23
0.8VDD
VDD
0.7AVREF
AVREF
VDD
V
P121, P122
0.8VDD
V
P30, P31, P34, P40 to P45, P123
P20 to P23
0
0.2VDD
0.3AVREF
0.3VDD
V
0
0
V
P121, P122
V
Total of pins other than
P20 to P23
4.0 V ≤ VDD ≤ 5.5 V
IOH1 = –5 mA
VDD − 1.0
V
IOH1 = –15 mA
IOH1 = –100 µA
2.0 V ≤ VDD < 4.0 V
VDD – 0.5
V
V
VOH2
Total of pins P20 to P23 4.0 V ≤ AVREF ≤ 5.5 V AVREF – 1.0
IOH2 = –10 mA
IOH2 = –5 mA
2.0 V ≤ AVREF < 4.0 V AVREF – 0.5
IOH2 = –5 mA
V
V
V
Output voltage, low
VOL
Total of pins
IOL = 30 mA
4.0 V ≤ VDD ≤ 5.5 V
IOL = 10 mA
1.3
0.4
2.0 V ≤ VDD ≤ 4.0 V
IOL = 400 µA
Input leakage current, high ILIH1
Input leakage current, low ILIL1
Output leakage current, high ILOH
Output leakage current, low ILOL
VI = VDD
Pins other than X1
Pins other than X1
Pins other than X2
Pins other than X2
10
3
–3
3
µA
µA
µA
µA
kΩ
kΩ
VI = 0 V
VO = VDD
VO = 0 V
–3
100
100
Pull-up resistance
RPU
RPD
VI = 0 V
30
30
Pull-down resistance
P121, P122, reset status
10
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V 0.1 V.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
333
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
DC Characteristics (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V) (2/2)
Parameter
Symbol
Conditions
MIN. TYP. MAX. Unit
6.1 12.2 mA
7.6 15.2
Note 3
Supply
IDD1
Crystal/ceramic
fX = 10 MHz
When A/D converter is stopped
When A/D converter is operatingNote 8
When A/D converter is stopped
When A/D converter is operatingNote 8
When A/D converter is stopped
When A/D converter is operatingNote 8
When peripheral functions are stopped
When peripheral functions are operating
When peripheral functions are stopped
When peripheral functions are operating
When peripheral functions are stopped
When peripheral functions are operating
When A/D converter is stopped
When A/D converter is operatingNote 8
currentNote 2
oscillation, external VDD = 5.0 V 10%Note 4
clock input
fX = 6 MHz
5.5 11.0 mA
14.0
oscillation operating
VDD = 5.0 V 10%Note 4
modeNote 6
fX = 5 MHz
3.0
4.5
1.7
6.0
9.0
3.8
6.7
3.0
6.0
1
mA
mA
mA
mA
VDD = 3.0 V 10%Note 5
IDD2
Crystal/ceramic
fX = 10 MHz
oscillation, external VDD = 5.0 V 10%Note 4
clock input HALT
fX = 6 MHz
modeNote 6
1.3
VDD = 5.0 V 10%Note 4
fX = 5 MHz
0.48
VDD = 3.0 V 10%Note 5
2.1
Note 3
IDD3
IDD4
IDD5
High-speed internal
oscillation operating
modeNote 7
fX = 8 MHz
5.0 10.0 mA
6.5 13.0
VDD = 5.0 V 10%Note 4
High-speed internal fX = 8 MHz
When peripheral functions are stopped
When peripheral functions are operating
1.4
3.2
5.9
mA
oscillation HALT
VDD = 5.0 V 10%Note 4
modeNote 7
STOP mode
VDD = 5.0 V 10%
VDD = 3.0 V 10%
When low-speed internal oscillation
is stopped
3.5 35.5 µA
17.5 63.5
When low-speed internal oscillation
is operating
When low-speed internal oscillation
is stopped
3.5 15.5 µA
11.0 30.5
When low-speed internal oscillation
is operating
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V 0.1 V.
2. Total current flowing through the internal power supply (VDD). Peripheral operation current is included
(however, the current that flows through the pull-up resistors of ports is not included).
3. IDD1 includes peripheral operation current.
4. When the processor clock control register (PCC) is set to 00H.
5. When the processor clock control register (PCC) is set to 02H.
6. When crystal/ceramic oscillation clock, external clock input is selected as the system clock source using
the option byte.
7. When the high-speed internal oscillation clock is selected as the system clock source using the option
byte.
8. The current that flows through the AVREF pin is included.
334
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
AC Characteristics
(1) Basic operation (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Parameter
Symbol
TCY
Conditions
MIN.
0.2
TYP.
MAX.
16
Unit
µs
µs
µs
µs
µs
µs
µs
µs
Cycle time (minimum
instruction execution time)
Crystal/ceramic oscillation
clock, external clock input
4.0 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.0 V
2.7 V ≤ VDD < 3.0 V
2.0 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
2.7 V ≤ VDD < 4.0 V
2.0 V ≤ VDD < 2.7 V
0.33
0.4
16
16
1
16
High-speed internal
oscillation clock
0.23
0.47
0.95
4.22
4.22
4.22
TI000 input high-level width, tTIH,
low-level width
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
2/fsam+
0.1Note 2
tTIL
2/fsam+
0.2Note 2
µs
µs
Interrupt input high-level
width, low-level width
tINTH,
tINTL
tRSL
1
RESET input low-level
width
2
µs
Notes 1. Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.1 V 0.1 V.
2. Selection of fsam = fXP, fXP/4, or fXP/256 is possible using bits 0 and 1 (PRM000, PRM001) of prescaler
mode register 00 (PRM00). Note that when selecting the TI000 valid edge as the count clock, fsam = fXP.
335
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
TCY vs. VDD (Crystal/Ceramic Oscillation Clock, External Clock Input)
60
16
10
µ
Guaranteed
operation range
1.0
0.4
0.33
0.1
1
2
3
4
5
6
2.7
Supply voltage VDD [V]
5.5
TCY vs. VDD (High-speed internal ocillator Clock)
60
10
µ
4.22
Guaranteed
operation range
1.0
0.95
0.47
0.23
0.1
1
2
3
4
5
6
2.7
Supply voltage VDD [V]
5.5
336
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
(2) Serial interface (TA = −40 to +85°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
UART mode (UART6, dedicated baud rate generator output)
Parameter
Transfer rate
Symbol
Conditions
MIN.
TYP.
MAX.
312.5
Unit
kbps
Note Use this product in a voltage range of 2.2 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.1 V 0.1 V.
AC Timing Test Points (Excluding X1 Input)
0.8VDD
0.2VDD
0.8VDD
0.2VDD
Test points
Clock Timing
1/f
X
t
XL
t
XH
X1 input
TI000 Timing
t
TIL
t
TIH
TI000
Interrupt Input Timing
t
INTL
t
INTH
INTP0 to INTP3
RESET Input Timing
t
RSL
RESET
337
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
A/D Converter Characteristics (TA = −40 to +85°C, 2.7 V ≤ AVREF ≤ VDD ≤ 5.5 V, VSS = 0 VNote 1
)
Parameter
Symbol
Conditions
MIN.
10
TYP.
MAX.
10
Unit
bit
Resolution
10
Overall errorNotes 2, 3
AINL
4.0 V ≤ AVREF ≤ 5.5 V
0.2
0.3
0.4
%FSR
%FSR
µs
2.7 V ≤ AVREF < 4.0 V
4.5 V ≤ AVREF ≤ 5.5 V
4.0 V ≤ AVREF < 4.5 V
2.85 V ≤ AVREF < 4.0 V
2.7 V ≤ AVREF < 2.85 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
0.6
Conversion time
tCONV
3.0
4.8
100
100
100
100
0.4
µs
6.0
µs
14.0
µs
Zero-scale errorNotes 2, 3
Ezs
Efs
%FSR
%FSR
%FSR
%FSR
LSB
LSB
LSB
LSB
V
0.6
Full-scale errorNotes 2, 3
0.4
0.6
Integral non-linearity errorNote 2
Differential non-linearity errorNote 2
Analog input voltage
ILE
2.5
4.5
DLE
VAIN
1.5
2.0
Note 1
VSS
AVREF
Notes 1. In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to
connect VSS to a stabilized GND (= 0 V).
2. Excludes quantization error ( 1/2 LSB).
3. This value is indicated as a ratio (%FSR) to the full-scale value.
Caution The conversion accuracy may be degraded if the level of a port that is not used for A/D conversion
is changed during A/D conversion.
338
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
POC Circuit Characteristics (TA = −40 to +85°C)
Parameter
Detection voltage
Symbol
VPOC
Conditions
MIN.
2.0
TYP.
2.1
MAX.
2.2
Unit
V
Power supply boot time
tPTH
VDD: 0 V → 2.1 V
1.5
µs
Response delay time 1Note 1
tPTHD
When power supply rises, after reaching
detection voltage (MAX.)
3.0
1.0
ms
Response delay time 2Note 2
Minimum pulse width
tPD
ms
ms
When power supply falls
tPW
0.2
Notes 1. Time required from voltage detection to internal reset release.
2. Time required from voltage detection to internal reset signal generation.
POC Circuit Timing
Supply voltage
(VDD
)
Detection voltage (MAX.)
Detection voltage (TYP.)
Detection voltage (MIN.)
t
PW
t
PTH
t
PTHD
t
PD
Time
339
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
LVI Circuit Characteristics (TA = −40 to +85°C)
Parameter
Detection voltage
Symbol
Conditions
MIN.
4.1
TYP.
4.3
MAX.
4.5
Unit
V
VLVI0
VLVI1
VLVI2
VLVI3
VLVI4
VLVI5
VLVI6
VLVI7
VLVI8
VLVI9
tLD
3.9
4.1
4.3
V
3.7
3.9
4.1
V
3.5
3.7
3.9
V
3.3
3.5
3.7
V
3.15
2.95
2.7
3.3
3.45
3.25
3.0
V
3.1
V
2.85
2.6
V
2.5
2.7
V
2.25
2.35
0.2
2.45
2.0
V
Response timeNote 1
Minimum pulse width
ms
ms
ms
tLW
0.2
Operation stabilization wait timeNote 2 tLWAIT
0.1
0.2
Notes 1. Time required from voltage detection to interrupt output or internal reset signal generation.
2. Time required from setting LVION to 1 to operation stabilization.
Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 > VLVI5 > VLVI6 > VLVI7 > VLVI8 > VLVI9
2. VPOC < VLVIm (m = 0 to 9)
LVI Circuit Timing
Supply voltage
(VDD
)
Detection voltage (MAX.)
Detection voltage (TYP.)
Detection voltage (MIN.)
t
LW
t
LWAIT
t
LD
LVION
1
Time
Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = −40 to +85°C)
Parameter
Data retention supply voltage
Release signal set time
Symbol
VDDDR
tSREL
Conditions
MIN.
2.0
0
TYP.
MAX.
5.5
Unit
V
µs
340
User’s Manual U16898EJ3V0UD
CHAPTER 20 ELECTRICAL SPECIFICATIONS ((T) product, (S) product, (R) product, (A) product)
(T), (S), (R), (A) product TA = −40 to +85°C
Flash Memory Programming Characteristics (TA = –40 to +85°C, 2.7 V ≤ VDD ≤ 5.5 V, VSS = 0 V)
Parameter
Symbol
IDD
Conditions
MIN.
TYP.
MAX.
7.0
Unit
mA
Supply current
VDD = 5.5 V
Erasure countNote 1
(per 1 block)
NERASE
TA = −40 to +85°C
1000
Times
Chip erase time
TCERASE
TA = −10 to +85°C,
NERASE ≤ 100
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
0.8
1.0
1.2
4.8
5.2
6.1
1.6
1.8
2.0
9.1
10.1
12.3
0.4
0.5
0.6
2.6
2.8
3.3
0.9
1.0
1.1
4.9
5.4
6.6
150
6.8
27
s
s
s
TA = −10 to +85°C,
NERASE ≤ 1000
s
s
s
TA = −40 to +85°C,
NERASE ≤ 100
s
s
s
TA = −40 to +85°C,
NERASE ≤ 1000
s
s
s
Block erase time
TBERASE
TA = −10 to +85°C,
NERASE ≤ 100
s
s
s
TA = −10 to +85°C,
NERASE ≤ 1000
s
s
s
TA = −40 to +85°C,
NERASE ≤ 100
s
s
s
TA = −40 to +85°C,
NERASE ≤ 1000
s
s
s
Byte write time
Internal verify
TWRITE
TVERIFY
TA = −40 to +85°C, NERASE ≤ 1000
Per 1 block
µs
ms
µs
µs
Years
Per 1 byte
Blank check
TBLKCHK
Per 1 block
TA = 85°CNote 2, NERASE ≤ 1000
480
Retention years
10
Note 1. Depending on the erasure count (NERASE), the erase time varies. Refer to the chip erase time and block
erase time parameters.
2. When the average temperature when operating and not operating is 85°C.
Remark When a product is first written after shipment, “erase → write” and “write only” are both taken as one rewrite.
341
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
Caution These specifications show target values, which may change after device evaluation. The operating
voltage range may also change.
Absolute Maximum Ratings (TA = 25°C)
Parameter
Supply voltage
Symbol
Conditions
Ratings
Unit
V
VDD
−0.3 to +6.5
VSS
AVREF
VI1
−0.3 to +0.3
V
−0.3 to VDD + 0.3Note
−0.3 to VDD + 0.3Note
V
Input voltage
P30, P31, P34, P40 to P45, P121 to P123
P20 to 23
V
VI2
− 0.3 to AVREF + 0.3Note
V
and −0.3 to VDD + 0.3Note
Output voltage
VO
−0.3 to VDD + 0.3Note
V
V
Analog input voltage
VAN
− 0.3 to AVREF + 0.3Note
and −0.3 to VDD + 0.3Note
Output current, high
Output current, low
IOH
IOL
Per pin
−10.0
−44.0
mA
mA
mA
mA
mA
mW
mW
°C
Total of pins other than P20 to P23
Total of P20 to P23
−44.0
Per pin
20.0
Total of all pins
44.0
Note 2
PT
TA = −40 to +85°C
120
TA = +85 to +125°C
110
Operating ambient
temperature
TA
In normal operation mode
During flash memory programming
Flash memory blank status
Flash memory programming already performed
−40 to +125
−40 to +105
−65 to +150
−40 to +125
°C
Storage temperature
Tstg
°C
°C
Notes 1. Must be 6.5 V or lower
Caution Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any
parameter. That is, the absolute maximum ratings are rated values at which the product is on the
verge of suffering physical damage, and therefore the product must be used under conditions that
ensure that the absolute maximum ratings are not exceeded.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
(Notes 2 is listed on the next page.)
342
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
Notes 2. This varies depending on the allowable total loss (see the figure below).
150
120
110
100
50
-40
0
+40
+80
+120
+125
Temperature [˚C]
+85
Use the following formula to perform design such that the sum of the power consumption of the device is
less than or equal to the total loss PT (use at 80% or less of the rated value is recommended).
Total power consumption = VDD × {IDD − ∑IOH} + ∑{(VDD − VOH) × IOH} + ∑(VOH × IOL)
Caution When using the internal pull-up resistor, calculate and add the separate power
consumption.
343
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
X1 Oscillator Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator Recommended Circuit
Parameter
Oscillation
frequency (f
Conditions
MIN.
1
TYP. MAX.
8.0
Unit
Ceramic
resonator
MHz
VSS X1
C1
X2
Note 2
X
)
C2
C2
Crystal
resonator
Oscillation
1
8.0
MHz
V
SS X1
C1
X2
frequency (fX)Note 2
External
clock
X1 input
2.7 V ≤ VDD ≤ 5.5 V
1
1
8.0
5.0
0.5
0.5
MHz
X1
frequency (fX)Note 2
2.0 V ≤ VDD < 2.7 V
2.7 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 2.7 V
X1 input high-
/low-level width
(tXH, tXL)
0.057
0.09
µs
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Caution When using the X1 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 VSS
.
• Do not ground the capacitor to a ground pattern through which a high current flows.
• Do not fetch signals from the oscillator.
Remark For the resonator selection and oscillator constant, users are required to either evaluate the oscillation
themselves or apply to the resonator manufacturer for evaluation.
344
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
High-Speed Internal Oscillator Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator
High-speed internal Oscillation frequency (fX = 8
oscillator
MHzNote 2) deviation
Parameter
Conditions
2.7 V ≤ VDD ≤ 5.5 V TA = −10 to +80°C
TA = −40 to +125°C
MIN.
TYP. MAX.
Unit
%
3
5
%
Oscillation frequency (fX)Note 2 2.0 V ≤ VDD < 2.7 V
5.5
MHz
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Low-Speed Internal Oscillator Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
Resonator
Parameter
Conditions
MIN.
120
TYP. MAX.
240 495
Unit
kHz
Low-speed internal Oscillation frequency (fRL)
oscillator
Note Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.26 V (MAX.).
345
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
DC Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V) (1/2)
Parameter
Symbol
Conditions
MIN.
TYP.
MAX.
–3.5
Unit
mA
mA
mA
mA
mA
mA
mA
mA
V
Output current, high
IOH1
Pins other than Per pin 2.0 V ≤ VDD ≤ 5.5 V
P20 to P23
Total
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
–17.5
–10.5
–3.5
IOH2
P20 to P23
Per pin 2.0 V ≤ AVREF ≤ 5.5 V
Total
2.0 V ≤ AVREF ≤ 5.5 V
2.0 V ≤ VDD ≤ 5.5 V
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
–10.5
7.0
Output current, low
Input voltage, high
Input voltage, low
Output voltage, high
IOL
Per pin
Total of all pins
21.0
10.5
VIH1
VIH2
VIH3
VIL1
VIL2
VIL3
VOH1
P30, P31, P34, P40 to P45, P123
P20 to P23
0.8VDD
VDD
0.7AVREF
AVREF
VDD
V
P121, P122
0.8VDD
V
P30, P31, P34, P40 to P45, P123
P20 to P23
0
0.2VDD
0.3AVREF
0.3VDD
V
0
0
V
P121, P122
V
Total of pins other than
P20 to P23
4.0 V ≤ VDD ≤ 5.5 V
IOH1 = –3.5 mA
VDD − 1.0
V
IOH1 = –10.5 mA
IOH1 = –100 µA
2.0 V ≤ VDD < 4.0 V
VDD – 0.5
V
V
VOH2
Total of pins P20 to P23 4.0 V ≤ AVREF ≤ 5.5 V AVREF – 1.0
IOH2 = –7 mA
IOH2 = –3.5 mA
2.0 V ≤ AVREF < 4.0 V AVREF – 0.5
IOH2 = –3.5 mA
V
V
V
Output voltage, low
VOL
Total of pins
IOL = 21 mA
4.0 V ≤ VDD ≤ 5.5 V
IOL = 7 mA
1.3
0.4
2.0 V ≤ VDD ≤ 4.0 V
IOL = 400 µA
Input leakage current, high ILIH1
Input leakage current, low ILIL1
Output leakage current, high ILOH
Output leakage current, low ILOL
VI = VDD
Pins other than X1
Pins other than X1
Pins other than X2
Pins other than X2
10
10
–10
10
µA
µA
µA
µA
kΩ
kΩ
VI = 0 V
VO = VDD
VO = 0 V
–10
120
120
Pull-up resistance
RPU
RPD
VI = 0 V
30
30
Pull-down resistance
P121, P122, reset state
10
Note Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.26 (MAX.).
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
346
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
DC Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V) (2/2)
Parameter
Symbol
Conditions
MIN. TYP. MAX. Unit
5.8 11.6 mA
7.3 14.6
Note 3
Supply
IDD1
Crystal/ceramic
fX = 8 MHz
When A/D converter is stopped
When A/D converter is operatingNote 8
When A/D converter is stopped
When A/D converter is operatingNote 8
When A/D converter is stopped
When A/D converter is operatingNote 8
When peripheral functions are stopped
When peripheral functions are operating
When peripheral functions are stopped
When peripheral functions are operating
When peripheral functions are stopped
When peripheral functions are operating
When A/D converter is stopped
When A/D converter is operatingNote 8
currentNote 2
oscillation, external VDD = 5.0 V 10%Note 4
clock input
fX = 6 MHz
5.5 12.2 mA
15.2
oscillation operating
VDD = 5.0 V 10%Note 4
modeNote 6
fX = 5 MHz
3.0
4.5
1.5
6.6
9.6
3.4
6.4
4.2
7.2
mA
mA
mA
mA
VDD = 3.0 V 10%Note 5
IDD2
Crystal/ceramic
fX = 8 MHz
oscillation, external VDD = 5.0 V 10%Note 4
clock input HALT
fX = 6 MHz
modeNote 6
1.3
VDD = 5.0 V 10%Note 4
fX = 5 MHz
0.48 1.6
2.7
VDD = 3.0 V 10%Note 5
Note 3
IDD3
IDD4
IDD5
High-speed internal
oscillation operating
modeNote 7
fX = 8 MHz
5.0 12.2 mA
6.5 15.2
VDD = 5.0 V 10%Note 4
High-speed internal fX = 8 MHz
When peripheral functions are stopped
When peripheral functions are operating
1.4
4.4
7.1
mA
oscillation HALT
VDD = 5.0 V 10%Note 4
modeNote 7
STOP mode
VDD = 5.0 V 10%
VDD = 3.0 V 10%
When low-speed internal oscillation
is stopped
3.5 1200 µA
When low-speed internal oscillation
is operating
17.5 1300
When low-speed internal oscillation
is stopped
3.5 600
11.0 700
µA
When low-speed internal oscillation
is operating
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Total current flowing through the internal power supply (VDD). Peripheral operation current is included
(however, the current that flows through the pull-up resistors of ports is not included).
3. IDD1 includes peripheral operation current.
4. When the processor clock control register (PCC) is set to 00H.
5. When the processor clock control register (PCC) is set to 02H.
6. When crystal/ceramic oscillation clock, external clock input is selected as the system clock source using
the option byte.
7. When the high-speed internal oscillation clock is selected as the system clock source using the option
byte.
8. The current that flows through the AVREF pin is included.
347
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
AC Characteristics
(1) Basic operation (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Parameter
Symbol
TCY
Conditions
MIN.
0.25
0.33
0.4
TYP.
MAX.
16
Unit
µs
µs
µs
µs
µs
µs
µs
µs
Cycle time (minimum
instruction execution time)
Crystal/ceramic oscillation
clock, external clock input
4.0 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.0 V
2.7 V ≤ VDD < 3.0 V
2.0 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
2.7 V ≤ VDD < 4.0 V
2.0 V ≤ VDD < 2.7 V
16
16
1
16
High-speed internal
oscillation clock
0.23
0.47
0.95
4.22
4.22
4.22
TI000 input high-level width, tTIH,
low-level width
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
2/fsam+
0.1Note 2
tTIL
2/fsam+
0.2Note 2
µs
µs
Interrupt input high-level
width, low-level width
tINTH,
tINTL
tRSL
1
RESET input low-level
width
2
µs
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Selection of fsam = fXP, fXP/4, or fXP/256 is possible using bits 0 and 1 (PRM000, PRM001) of prescaler
mode register 00 (PRM00). Note that when selecting the TI000 valid edge as the count clock, fsam = fXP.
348
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
TCY vs. VDD (Crystal/Ceramic Oscillation Clock, External Clock Input)
60
16
10
µ
Guaranteed
operation range
1.0
0.4
0.33
0.25
0.1
1
2
3
4
5
6
2.7
Supply voltage VDD [V]
5.5
TCY vs. VDD (High-speed internal ocillator Clock)
60
10
µ
4.22
Guaranteed
operation range
1.0
0.95
0.47
0.23
0.1
1
2
3
4
5
6
2.7
Supply voltage VDD [V]
5.5
349
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
(2) Serial interface (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
UART mode (UART6, dedicated baud rate generator output)
Parameter
Transfer rate
Symbol
Conditions
MIN.
TYP.
MAX.
312.5
Unit
kbps
Note Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.26 V (MAX.).
AC Timing Test Points (Excluding X1 Input)
0.8VDD
0.2VDD
0.8VDD
0.2VDD
Test points
Clock Timing
1/f
X
t
XL
t
XH
X1 input
TI000 Timing
tTIL
tTIH
TI000
Interrupt Input Timing
t
INTL
t
INTH
INTP0 to INTP3
RESET Input Timing
t
RSL
RESET
350
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
A/D Converter Characteristics (TA = −40 to +125°C, 2.7 V ≤ AVREF ≤ VDD ≤ 5.5 V, VSS = 0 VNote 1
)
Parameter
Symbol
Conditions
MIN.
10
TYP.
10
MAX.
10
Unit
bit
Resolution
Overall errorNotes 2, 3
AINL
4.0 V ≤ AVREF ≤ 4.5 V
0.2
0.3
0.7
0.9
30
%FSR
%FSR
µs
2.7 V ≤ AVREF < 4.0 V
4.5 V ≤ AVREF ≤ 5.5 V
4.0 V ≤ AVREF < 4.5 V
2.85 V ≤ AVREF < 4.0 V
2.7 V ≤ AVREF < 2.85 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
Conversion time
tCONV
3.0
4.8
30
µs
6.0
30
µs
14.0
30
µs
Zero-scale errorNotes 2, 3
Ezs
Efs
0.7
0.9
0.7
0.9
5.5
7.5
2.5
3.0
AVREF
%FSR
%FSR
%FSR
%FSR
LSB
LSB
LSB
LSB
V
Full-scale errorNotes 2, 3
Integral non-linearity errorNote 2
Differential non-linearity errorNote 2
Analog input voltage
ILE
DLE
VAIN
Note 1
VSS
Notes 1. In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to
connect VSS to a stabilized GND (= 0 V).
2. Excludes quantization error ( 1/2 LSB).
3. This value is indicated as a ratio (%FSR) to the full-scale value.
Caution The conversion accuracy may be degraded if the level of a port that is not used for A/D conversion
is changed during A/D conversion.
351
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
POC Circuit Characteristics (TA = −40 to +125°C)
Parameter
Detection voltage
Symbol
VPOC
Conditions
MIN.
2.0
TYP.
2.1
MAX.
2.26
Unit
V
Power supply boot time
tPTH
VDD: 0 V → 2.1 V
1.5
µs
Response delay time 1Note 1
tPTHD
When power supply rises, after reaching
detection voltage (MAX.)
3.0
1.0
ms
Response delay time 2Note 2
Minimum pulse width
tPD
ms
ms
When power supply falls
tPW
0.2
Notes 1. Time required from voltage detection to internal reset release.
2. Time required from voltage detection to internal reset signal generation.
POC Circuit Timing
Supply voltage
(VDD
)
Detection voltage (MAX.)
Detection voltage (TYP.)
Detection voltage (MIN.)
t
PW
t
PTH
t
PTHD
t
PD
Time
352
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
LVI Circuit Characteristics (TA = −40 to +125°C)
Parameter
Detection voltage
Symbol
VLVI0
VLVI1
VLVI2
VLVI3
VLVI4
VLVI5
VLVI6
VLVI7
VLVI8
VLVI9
tLD
Conditions
MIN.
4.1
TYP.
4.3
MAX.
4.65
4.45
4.25
4.05
3.85
3.60
3.40
3.15
2.85
2.60
2.0
Unit
V
3.9
4.1
V
3.7
3.9
V
3.5
3.7
V
3.3
3.5
V
3.15
2.95
2.7
3.3
V
3.1
V
2.85
2.6
V
2.5
V
2.25
2.35
0.2
V
Response timeNote 1
Minimum pulse width
Operation stabilization wait timeNote 2 tLWAIT
ms
ms
ms
tLW
0.2
0.1
0.2
Notes 1. Time required from voltage detection to interrupt output or internal reset signal generation.
2. Time required from setting LVION to 1 to operation stabilization.
Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 > VLVI5 > VLVI6 > VLVI7 > VLVI8 > VLVI9
2. VPOC < VLVIm (m = 0 to 9)
LVI Circuit Timing
Supply voltage
(VDD
)
Detection voltage (MAX.)
Detection voltage (TYP.)
Detection voltage (MIN.)
t
LW
t
LWAIT
t
LD
LVION
1
Time
Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = −40 to +125°C)
Parameter
Data retention supply voltage
Release signal set time
Symbol
VDDDR
tSREL
Conditions
MIN.
2.0
0
TYP.
MAX.
5.5
Unit
V
µs
353
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
Flash Memory Programming Characteristics (TA = –40 to +105°C, 2.7 V ≤ VDD ≤ 5.5 V, VSS = 0 V)
Parameter
Symbol
IDD
Conditions
MIN.
TYP.
MAX.
7.0
Unit
mA
Supply current
VDD = 5.5 V
Erasure countNote 1
(per 1 block)
NERASE
TA = −40 to +105°C
1000
Times
Chip erase time
TCERASE
TA = −10 to +105°C,
NERASE ≤ 100
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
0.8
1.0
1.2
4.8
5.2
6.1
1.6
1.8
2.0
9.1
10.1
12.3
0.4
0.5
0.6
2.6
2.8
3.3
0.9
1.0
1.1
4.9
5.4
6.6
150
6.8
27
s
s
s
TA = −10 to +105°C,
NERASE ≤ 1000
s
s
s
TA = −40 to +105°C,
NERASE ≤ 100
s
s
s
TA = −40 to +105°C,
NERASE ≤ 1000
s
s
s
Block erase time
TBERASE
TA = −10 to +105°C,
NERASE ≤ 100
s
s
s
s
TA = −10 to +105°C,
NERASE ≤ 1000
s
s
TA = −40 to +105°C,
NERASE ≤ 100
s
s
s
TA = −40 to +105°C,
NERASE ≤ 1000
s
s
s
Byte write time
Internal verify
TWRITE
TVERIFY
TA = −40 to +105°C, NERASE ≤ 1000
Per 1 block
µs
ms
µs
µs
mW
Years
Per 1 byte
Blank check
Total loss
TBLKCHK
Per 1 block
480
120
Note 3
PT
TA = −40 to +105°C
TA = 85°CNote 2, NERASE ≤ 1000
Retention years
10
Note 1. Depending on the erasure count (NERASE), the erase time varies. Refer to the chip erase time and block
erase time parameters.
2. When the average temperature when operating and not operating is 85°C.
Remark When a product is first written after shipment, “erase → write” and “write only” are both taken as one rewrite.
(Notes 3 is listed on the next page.)
354
User’s Manual U16898EJ3V0UD
CHAPTER 21 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((T2) product)
(T2) product TA = −40 to +125°C
Note 3. When guaranteeing the flash self programming, use the following formula to perform design such that the
sum of the power consumption of the device is less than or equal to the total loss PT (use at 80% or less of
the rated value is recommended).
Total power consumption = VDD × {IDD − ∑IOH} + ∑{(VDD − VOH) × IOH} + ∑(VOH × IOL)
Caution When using the internal pull-up resistor, calculate and add the separate power
consumption.
Remark During flash memory programming, IDD = 7.0 mA (MAX.).
355
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
Caution These specifications show target values, which may change after device evaluation. The operating
voltage range may also change.
Absolute Maximum Ratings (TA = 25°C)
Parameter
Supply voltage
Symbol
Conditions
Ratings
Unit
V
VDD
−0.3 to +6.5
VSS
AVREF
VI1
−0.3 to +0.3
V
−0.3 to VDD + 0.3Note
−0.3 to VDD + 0.3Note
V
Input voltage
P30, P31, P34, P40 to P45, P121 to P123
P20 to 23
V
VI2
− 0.3 to AVREF + 0.3Note
V
and −0.3 to VDD + 0.3Note
Output voltage
VO
−0.3 to VDD + 0.3Note
V
V
Analog input voltage
VAN
− 0.3 to AVREF + 0.3Note
and −0.3 to VDD + 0.3Note
Output current, high
Output current, low
IOH
IOL
Per pin
−7.0
−30.0
mA
mA
mA
mA
mA
mW
mW
°C
Total of pins other than P20 to P23
Total of P20 to P23
−30.0
Per pin
14.0
Total of all pins
30.0
Note 2
PT
TA = −40 to +85°C
120
TA = +85 to +125°C
110
Operating ambient
temperature
TA
In normal operation mode
During flash memory programming
Flash memory blank status
Flash memory programming already performed
−40 to +125
−40 to +105
−65 to +150
−40 to +125
°C
Storage temperature
Tstg
°C
°C
Notes 1. Must be 6.5 V or lower
Caution Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any
parameter. That is, the absolute maximum ratings are rated values at which the product is on the
verge of suffering physical damage, and therefore the product must be used under conditions that
ensure that the absolute maximum ratings are not exceeded.
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
(Notes 2 is listed on the next page.)
356
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
Notes 2. This varies depending on the allowable total loss (see the figure below).
150
120
110
100
50
-40
0
+40
+80
+120
+125
Temperature [˚C]
+85
Use the following formula to perform design such that the sum of the power consumption of the device is
less than or equal to the total loss PT (use at 80% or less of the rated value is recommended).
Total power consumption = VDD × {IDD − ∑IOH} + ∑{(VDD − VOH) × IOH} + ∑(VOH × IOL)
Caution When using the internal pull-up resistor, calculate and add the separate power
consumption.
357
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
X1 Oscillator Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator Recommended Circuit
Parameter
Oscillation
frequency (f
Conditions
MIN.
1
TYP. MAX.
8.0
Unit
Ceramic
resonator
MHz
VSS X1
C1
X2
Note 2
X
)
C2
C2
Crystal
resonator
Oscillation
1
8.0
MHz
V
SS X1
C1
X2
frequency (fX)Note 2
External
clock
X1 input
2.7 V ≤ VDD ≤ 5.5 V
1
1
8.0
5.0
0.5
0.5
MHz
X1
frequency (fX)Note 2
2.0 V ≤ VDD < 2.7 V
2.7 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 2.7 V
X1 input high-
/low-level width
(tXH, tXL)
0.057
0.09
µs
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Caution When using the X1 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 VSS
.
• Do not ground the capacitor to a ground pattern through which a high current flows.
• Do not fetch signals from the oscillator.
Remark For the resonator selection and oscillator constant, users are required to either evaluate the oscillation
themselves or apply to the resonator manufacturer for evaluation.
358
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
High-Speed Internal Oscillator Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Resonator
High-speed internal Oscillation frequency (fX = 8
oscillator
MHzNote 2) deviation
Parameter
Conditions
2.7 V ≤ VDD ≤ 5.5 V TA = −10 to +80°C
TA = −40 to +125°C
MIN.
TYP. MAX.
Unit
%
3
5
%
Oscillation frequency (fX)Note 2 2.0 V ≤ VDD < 2.7 V
5.5
MHz
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time.
Low-Speed Internal Oscillator Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
Resonator
Parameter
Conditions
MIN.
120
TYP. MAX.
240 495
Unit
kHz
Low-speed internal Oscillation frequency (fRL)
oscillator
Note Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.26 V (MAX.).
359
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
DC Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V) (1/2)
Parameter
Symbol
Conditions
MIN.
TYP.
MAX.
–3.5
Unit
mA
mA
mA
mA
mA
mA
mA
mA
V
Output current, high
IOH1
Pins other than Per pin 2.0 V ≤ VDD ≤ 5.5 V
P20 to P23
Total
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
–17.5
–10.5
–3.5
IOH2
P20 to P23
Per pin 2.0 V ≤ AVREF ≤ 5.5 V
Total
2.0 V ≤ AVREF ≤ 5.5 V
2.0 V ≤ VDD ≤ 5.5 V
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
–10.5
7.0
Output current, low
Input voltage, high
Input voltage, low
Output voltage, high
IOL
Per pin
Total of all pins
21.0
10.5
VIH1
VIH2
VIH3
VIL1
VIL2
VIL3
VOH1
P30, P31, P34, P40 to P45, P123
P20 to P23
0.8VDD
VDD
0.7AVREF
AVREF
VDD
V
P121, P122
0.8VDD
V
P30, P31, P34, P40 to P45, P123
P20 to P23
0
0.2VDD
0.3AVREF
0.3VDD
V
0
0
V
P121, P122
V
Total of pins other than
P20 to P23
4.0 V ≤ VDD ≤ 5.5 V
IOH1 = –3.5 mA
VDD − 1.0
V
IOH1 = –10.5 mA
IOH1 = –100 µA
2.0 V ≤ VDD < 4.0 V
VDD – 0.5
V
V
VOH2
Total of pins P20 to P23 4.0 V ≤ AVREF ≤ 5.5 V AVREF – 1.0
IOH2 = –7 mA
IOH2 = –3.5 mA
2.0 V ≤ AVREF < 4.0 V AVREF – 0.5
IOH2 = –3.5 mA
V
V
V
Output voltage, low
VOL
Total of pins
IOL = 21 mA
4.0 V ≤ VDD ≤ 5.5 V
IOL = 7 mA
1.3
0.4
2.0 V ≤ VDD ≤ 4.0 V
IOL = 400 µA
Input leakage current, high ILIH1
Input leakage current, low ILIL1
Output leakage current, high ILOH
Output leakage current, low ILOL
VI = VDD
Pins other than X1
Pins other than X1
Pins other than X2
Pins other than X2
10
10
–10
10
µA
µA
µA
µA
kΩ
kΩ
VI = 0 V
VO = VDD
VO = 0 V
–10
120
120
Pull-up resistance
RPU
RPD
VI = 0 V
30
30
Pull-down resistance
P121, P122, reset state
10
Note Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.26 (MAX.).
Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins.
360
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
DC Characteristics (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V) (2/2)
Parameter
Symbol
Conditions
MIN. TYP. MAX. Unit
5.8 12.8 mA
7.3 15.8
Note 3
Supply
IDD1
Crystal/ceramic
fX = 8 MHz
When A/D converter is stopped
When A/D converter is operatingNote 8
When A/D converter is stopped
When A/D converter is operatingNote 8
When A/D converter is stopped
When A/D converter is operatingNote 8
When peripheral functions are stopped
When peripheral functions are operating
When peripheral functions are stopped
When peripheral functions are operating
When peripheral functions are stopped
When peripheral functions are operating
When A/D converter is stopped
When A/D converter is operatingNote 8
currentNote 2
oscillation, external VDD = 5.0 V 10%Note 4
clock input
fX = 6 MHz
5.5 12.2 mA
15.2
oscillation operating
VDD = 5.0 V 10%Note 4
modeNote 6
fX = 5 MHz
3.0
4.5
1.5
6.6
9.6
4.6
7.6
4.2
7.2
mA
mA
mA
mA
VDD = 3.0 V 10%Note 5
IDD2
Crystal/ceramic
fX = 8 MHz
oscillation, external VDD = 5.0 V 10%Note 4
clock input HALT
fX = 6 MHz
modeNote 6
1.3
VDD = 5.0 V 10%Note 4
fX = 5 MHz
0.48 1.6
2.7
VDD = 3.0 V 10%Note 5
Note 3
IDD3
IDD4
IDD5
High-speed internal
oscillation operating
modeNote 7
fX = 8 MHz
5.0 12.2 mA
6.5 15.2
VDD = 5.0 V 10%Note 4
High-speed internal fX = 8 MHz
When peripheral functions are stopped
When peripheral functions are operating
1.4
4.4
7.1
mA
oscillation HALT
VDD = 5.0 V 10%Note 4
modeNote 7
STOP mode
VDD = 5.0 V 10%
VDD = 3.0 V 10%
When low-speed internal oscillation
is stopped
3.5 1200 µA
When low-speed internal oscillation
is operating
17.5 1300
When low-speed internal oscillation
is stopped
3.5 600
11.0 700
µA
When low-speed internal oscillation
is operating
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Total current flowing through the internal power supply (VDD). Peripheral operation current is included
(however, the current that flows through the pull-up resistors of ports is not included).
3. IDD1 includes peripheral operation current.
4. When the processor clock control register (PCC) is set to 00H.
5. When the processor clock control register (PCC) is set to 02H.
6. When crystal/ceramic oscillation clock, external clock input is selected as the system clock source using
the option byte.
7. When the high-speed internal oscillation clock is selected as the system clock source using the option
byte.
8. The current that flows through the AVREF pin is included.
361
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
AC Characteristics
(1) Basic operation (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote 1, VSS = 0 V)
Parameter
Symbol
TCY
Conditions
MIN.
0.25
0.33
0.4
TYP.
MAX.
16
Unit
µs
µs
µs
µs
µs
µs
µs
µs
Cycle time (minimum
instruction execution time)
Crystal/ceramic oscillation
clock, external clock input
4.0 V ≤ VDD ≤ 5.5 V
3.0 V ≤ VDD < 4.0 V
2.7 V ≤ VDD < 3.0 V
2.0 V ≤ VDD < 2.7 V
4.0 V ≤ VDD ≤ 5.5 V
2.7 V ≤ VDD < 4.0 V
2.0 V ≤ VDD < 2.7 V
16
16
1
16
High-speed internal
oscillation clock
0.23
0.47
0.95
4.22
4.22
4.22
TI000 input high-level width, tTIH,
low-level width
4.0 V ≤ VDD ≤ 5.5 V
2.0 V ≤ VDD < 4.0 V
2/fsam+
0.1Note 2
tTIL
2/fsam+
0.2Note 2
µs
µs
Interrupt input high-level
width, low-level width
tINTH,
tINTL
tRSL
1
RESET input low-level
width
2
µs
Notes 1. Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-
clear (POC) circuit is 2.26 V (MAX.).
2. Selection of fsam = fXP, fXP/4, or fXP/256 is possible using bits 0 and 1 (PRM000, PRM001) of prescaler
mode register 00 (PRM00). Note that when selecting the TI000 valid edge as the count clock, fsam = fXP.
362
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
TCY vs. VDD (Crystal/Ceramic Oscillation Clock, External Clock Input)
60
16
10
µ
Guaranteed
operation range
1.0
0.4
0.33
0.25
0.1
1
2
3
4
5
6
2.7
Supply voltage VDD [V]
5.5
TCY vs. VDD (High-speed internal ocillator Clock)
60
10
µ
4.22
Guaranteed
operation range
1.0
0.95
0.47
0.23
0.1
1
2
3
4
5
6
2.7
Supply voltage VDD [V]
5.5
363
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
(2) Serial interface (TA = −40 to +125°C, VDD = 2.0 to 5.5 VNote, VSS = 0 V)
UART mode (UART6, dedicated baud rate generator output)
Parameter
Transfer rate
Symbol
Conditions
MIN.
TYP.
MAX.
312.5
Unit
kbps
Note Use this product in a voltage range of 2.26 to 5.5 V because the detection voltage (VPOC) of the power-on-clear
(POC) circuit is 2.26 V (MAX.).
AC Timing Test Points (Excluding X1 Input)
0.8VDD
0.2VDD
0.8VDD
0.2VDD
Test points
Clock Timing
1/f
X
t
XL
t
XH
X1 input
TI000 Timing
tTIL
tTIH
TI000
Interrupt Input Timing
t
INTL
t
INTH
INTP0 to INTP3
RESET Input Timing
t
RSL
RESET
364
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
A/D Converter Characteristics (TA = −40 to +125°C, 2.7 V ≤ AVREF ≤ VDD ≤ 5.5 V, VSS = 0 VNote 1
)
Parameter
Symbol
Conditions
MIN.
10
TYP.
10
MAX.
10
Unit
bit
Resolution
Overall errorNotes 2, 3
AINL
4.0 V ≤ AVREF ≤ 4.5 V
0.2
0.3
0.7
0.9
30
%FSR
%FSR
µs
2.7 V ≤ AVREF < 4.0 V
4.5 V ≤ AVREF ≤ 5.5 V
4.0 V ≤ AVREF < 4.5 V
2.85 V ≤ AVREF < 4.0 V
2.7 V ≤ AVREF < 2.85 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
4.0 V ≤ AVREF ≤ 5.5 V
2.7 V ≤ AVREF < 4.0 V
Conversion time
tCONV
3.0
4.8
30
µs
6.0
30
µs
14.0
30
µs
Zero-scale errorNotes 2, 3
Ezs
Efs
0.7
0.9
0.7
0.9
5.5
7.5
2.5
3.0
AVREF
%FSR
%FSR
%FSR
%FSR
LSB
LSB
LSB
LSB
V
Full-scale errorNotes 2, 3
Integral non-linearity errorNote 2
Differential non-linearity errorNote 2
Analog input voltage
ILE
DLE
VAIN
Note 1
VSS
Notes 1. In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D converter. Be sure to
connect VSS to a stabilized GND (= 0 V).
2. Excludes quantization error ( 1/2 LSB).
3. This value is indicated as a ratio (%FSR) to the full-scale value.
Caution The conversion accuracy may be degraded if the level of a port that is not used for A/D conversion is
changed during A/D conversion.
365
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
POC Circuit Characteristics (TA = −40 to +125°C)
Parameter
Detection voltage
Symbol
VPOC
Conditions
MIN.
2.0
TYP.
2.1
MAX.
2.26
Unit
V
Power supply boot time
tPTH
VDD: 0 V → 2.1 V
1.5
µs
Response delay time 1Note 1
tPTHD
When power supply rises, after reaching
detection voltage (MAX.)
3.0
1.0
ms
Response delay time 2Note 2
Minimum pulse width
tPD
ms
ms
When power supply falls
tPW
0.2
Notes 1. Time required from voltage detection to internal reset release.
2. Time required from voltage detection to internal reset signal generation.
POC Circuit Timing
Supply voltage
(VDD
)
Detection voltage (MAX.)
Detection voltage (TYP.)
Detection voltage (MIN.)
t
PW
t
PTH
t
PTHD
t
PD
Time
366
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
LVI Circuit Characteristics (TA = −40 to +125°C)
Parameter
Detection voltage
Symbol
VLVI0
VLVI1
VLVI2
VLVI3
VLVI4
VLVI5
VLVI6
VLVI7
VLVI8
VLVI9
tLD
Conditions
MIN.
4.1
TYP.
4.3
MAX.
4.65
4.45
4.25
4.05
3.85
3.60
3.40
3.15
2.85
2.60
2.0
Unit
V
3.9
4.1
V
3.7
3.9
V
3.5
3.7
V
3.3
3.5
V
3.15
2.95
2.7
3.3
V
3.1
V
2.85
2.6
V
2.5
V
2.25
2.35
0.2
V
Response timeNote 1
Minimum pulse width
Operation stabilization wait timeNote 2 tLWAIT
ms
ms
ms
tLW
0.2
0.1
0.2
Notes 1. Time required from voltage detection to interrupt output or internal reset signal generation.
2. Time required from setting LVION to 1 to operation stabilization.
Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 > VLVI5 > VLVI6 > VLVI7 > VLVI8 > VLVI9
2. VPOC < VLVIm (m = 0 to 9)
LVI Circuit Timing
Supply voltage
(VDD
)
Detection voltage (MAX.)
Detection voltage (TYP.)
Detection voltage (MIN.)
t
LW
t
LWAIT
t
LD
LVION
1
Time
Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = −40 to +125°C)
Parameter
Data retention supply voltage
Release signal set time
Symbol
VDDDR
tSREL
Conditions
MIN.
2.0
0
TYP.
MAX.
5.5
Unit
V
µs
367
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
Flash Memory Programming Characteristics (TA = –40 to +105°C, 2.7 V ≤ VDD ≤ 5.5 V, VSS = 0 V)
Parameter
Symbol
IDD
Conditions
MIN.
TYP.
MAX.
7.0
Unit
mA
Supply current
VDD = 5.5 V
Erasure countNote 1
(per 1 block)
NERASE
TA = −40 to +105°C
1000
Times
Chip erase time
TCERASE
TA = −10 to +105°C,
NERASE ≤ 100
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
4.5 V ≤ VDD ≤ 5.5 V
3.5 V ≤ VDD < 4.5 V
2.7 V ≤ VDD < 3.5 V
0.8
1.0
1.2
4.8
5.2
6.1
1.6
1.8
2.0
9.1
10.1
12.3
0.4
0.5
0.6
2.6
2.8
3.3
0.9
1.0
1.1
4.9
5.4
6.6
150
6.8
27
s
s
s
TA = −10 to +105°C,
NERASE ≤ 1000
s
s
s
TA = −40 to +105°C,
NERASE ≤ 100
s
s
s
TA = −40 to +105°C,
NERASE ≤ 1000
s
s
s
Block erase time
TBERASE
TA = −10 to +105°C,
NERASE ≤ 100
s
s
s
s
TA = −10 to +105°C,
NERASE ≤ 1000
s
s
TA = −40 to +105°C,
NERASE ≤ 100
s
s
s
TA = −40 to +105°C,
NERASE ≤ 1000
s
s
s
Byte write time
Internal verify
TWRITE
TVERIFY
TA = −40 to +105°C, NERASE ≤ 1000
Per 1 block
µs
ms
µs
µs
mW
Years
Per 1 byte
Blank check
Total loss
TBLKCHK
Per 1 block
480
120
Note 3
PT
TA = −40 to +105°C
TA = 85°CNote 2, NERASE ≤ 1000
Retention years
10
Note 1. Depending on the erasure count (NERASE), the erase time varies. Refer to the chip erase time and block
erase time parameters.
2. When the average temperature when operating and not operating is 85°C.
Remark When a product is first written after shipment, “erase → write” and “write only” are both taken as one rewrite.
(Notes 3 is listed on the next page.)
368
User’s Manual U16898EJ3V0UD
CHAPTER 22 ELECTRICAL SPECIFICATIONS (TARGET VALUES) ((A2) product)
(A2) product TA = −40 to +125°C
Note 3. When guaranteeing the flash self programming, use the following formula to perform design such that the
sum of the power consumption of the device is less than or equal to the total loss PT (use at 80% or less of
the rated value is recommended).
Total power consumption = VDD × {IDD − ∑IOH} + ∑{(VDD − VOH) × IOH} + ∑(VOH × IOL)
Caution When using the internal pull-up resistor, calculate and add the separate power
consumption.
Remark During flash memory programming, IDD = 7.0 mA (MAX.).
369
User’s Manual U16898EJ3V0UD
CHAPTER 23 PACKAGE DRAWING
20-PIN PLASTIC SSOP (7.62 mm (300))
20
11
detail of lead end
F
G
T
P
L
U
E
1
10
A
H
I
J
S
N
S
K
C
B
M
D
M
NOTE
ITEM MILLIMETERS
Each lead centerline is located within 0.13 mm of
its true position (T.P.) at maximum material condition.
A
B
C
6.65 0.15
0.475 MAX.
0.65 (T.P.)
+0.08
0.24
D
−0.07
E
F
G
H
I
0.1 0.05
1.3 0.1
1.2
8.1 0.2
6.1 0.2
1.0 0.2
0.17 0.03
0.5
J
K
L
M
N
0.13
0.10
+5°
3°
P
−3°
T
0.25
U
0.6 0.15
S20MC-65-5A4-2
370
User’s Manual U16898EJ3V0UD
CHAPTER 24 PACKAGE MARKING INFORMATION
• 20-pin plastic SSOP
(1) Blank products
<1> µPD78F9221
<2> µPD78F9222
F9221
ZZ
F9222
ZZ
Leed-free markNote
Index mark
Leed-free markNote
Index mark
YWWP
YWWP
(2) Products for which writing has already been performed
<1> µPD78F9221
<2> µPD78F9222
F9221
XXXZZ
YWWP
F9222
XXXZZ
YWWP
Leed-free markNote
Index mark
Leed-free markNote
Index mark
W:
Y:
Z :
Week code (2-digit number)
Last digit of year (1-digit number)
Grade indication
XXX : ROM code
P: In-house control code
Note The lead-free marking is applied only on lead-free products.
371
User’s Manual U16898EJ3V0UD
CHAPTER 25 RECOMMENDED SOLDERING CONDITIONS
These products should be soldered and mounted under the following recommended conditions.
For technical information, see the following website.
Semiconductor Device Mount Manual (http://www.necel.com/pkg/en/mount/index.html)
Cautions 1. Products whis –A at the end of the part number are lead-free products.
2. For soldering methods and conditions other than those recommended below, contact an NEC
Electronics sales representative.
Table 25-1. Surface Mounting Type Soldering Conditions (1/2)
20-pin plastic SSOP
µPD78F9221MC(T)-5A4, 78F9222MC(T)-5A4, 78F9221MC(T2)-5A4Note 1, 78F9222MC(T2)-5A4Note 1
µPD78F9221MC(S)-5A4, 78F9222MC(S)-5A4, 78F9221MC(R)-5A4, 78F9222MC(R)-5A4,
,
µPD78F9221MC(A)-5A4Note 1, 78F9222MC(A)-5A4Note 1, 78F9221MC(A2)-5A4Note 1, 78F9222MC(A2)-5A4Note 1
Soldering Method
Infrared reflow
Soldering Conditions
Recommended
Condition Symbol
Package peak temperature: 235°C, Time: 30 seconds max. (at 210°C or higher),
Count: 3 times or less, Exposure limit: 7 daysNote 2 (after that, prebake at 125°C for
20 hours)
IR35-207-3
VP15-207-3
WS60-207-1
Package peak temperature: 215°C, Time: 40 seconds max. (at 200°C or higher),
Count: 3 times or less, Exposure limit: 7 daysNote 2 (after that, prebake at 125°C
for 10 hours)
VPS
Wave soldering
Partial heating
Solder bath temperature: 260°C max., Time: 10 seconds max., Count: Once,
Preheating temperature: 120°C max. (package surface temperature), Exposure
limit: 7 daysNote 2 (after that, prebake at 125°C for 20 hours)
Pin temperature: 350°C max., Time: 3 seconds max. (per pin row)
−
Notes 1. Under development
2. 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).
372
User’s Manual U16898EJ3V0UD
CHAPTER 25 RECOMMENDED SOLDERING CONDITIONS
Table 25-1. Surface Mounting Type Soldering Conditions (2/2)
20-pin plastic SSOP (lead-free products)
µPD78F9221MC(T)-5A4-A, 78F9222MC(T)-5A4-A, 78F9221MC(T2)-5A4-ANote 1, 78F9222MC(T2)-5A4-ANote 1
µPD78F9221MC(S)-5A4-A, 78F9222MC(S)-5A4-A, 78F9221MC(R)-5A4-A, 78F9222MC(R)-5A4-A,
,
µPD78F9221MC(A)-5A4-ANote 1, 78F9222MC(A)-5A4-ANote 1, 78F9221MC(A2)-5A4-ANote 1
µPD78F9222MC(A2)-5A4-ANote 1
,
Soldering Method
Infrared reflow
Soldering Conditions
Recommended
Condition Symbol
Package peak temperature: 260°C, Time: 30 seconds max. (at 210°C or higher),
IR60-207-3
Count: 3 times or less, Exposure limit: 7 daysNote 2 (after that, prebake at 125°C for
20 hours)
Wave soldering
Partial heating
For details, contact an NEC Electronics sales representative.
−
−
Pin temperature: 350°C max., Time: 3 seconds max. (per pin row)
Notes 1. Under development
2. 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).
373
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
The following development tools are available for development of systems using the 78K0S/KA1+. Figure A-1
shows development tools.
• Compatibility with PC98-NX series
Unless stated otherwise, products which are supported by IBM PC/ATTM and compatibles can also be used with
the PC98-NX series. When using the PC98-NX series, therefore, refer to the explanations for IBM PC/AT and
compatibles.
• WindowsTM
Unless stated otherwise, “Windows” refers to the following operating systems.
• Windows 98
• Windows NTTM Ver. 4.0
• Windows 2000
• Windows XP
374
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
Figure A-1. Development Tools (1/2)
(1) When using the in-circuit emulator IE-78K0S-NS or IE-78K0S-NS-A
Software package
• Software package
Language processing software
Debugging software
• Assembler package
• C compiler package
• Device file
• Integrated debugger
• System simulator
• C library source fileNote 1
Control software
• Project Manager
(Windows version only)Note 2
Host machine
(PC or EWS)
Interface adapter
Power supply unit
Flash memory writing environment
Flash programmer
In-circuit emulatorNote 3
Emulation boardNote 4
Flash memory
writing adapter
Flash memory
Target cable or emulation probe
Pin header or
conversion socket
Target system
Notes 1. The C library source file is not included in the software package.
2. The Project Manager PM+ is included in the assembler package.
PM+ is used only in the Windows environment.
3. All products other than the in-circuit emulators IE-78K0S-NS and IE-78K0S-NS-A are optional.
4. The in-circuit emulator IE-789234-NS-EM1 is provided with the target cable.
375
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
Figure A-1. Development Tools (2/2)
(2) When using the in-circuit emulator QB-78K0SKX1MINI
Software package
• Software package
Language processing software
Debugging software
• Assembler package
• C compiler package
• Device file
• Integrated debugger
• System simulator
• C library source fileNote 1
Control software
• Project Manager
(Windows version only)Note 2
Host machine
(PC or EWS)
Interface adapter
Power supply unit
Flash memory writing environment
Flash programmer
In-circuit emulatorNote 3
QB-78K0SMINI
Debug adapter
Flash memory
writing adapter
Flash memory
Target cable or emulation probe
Pin header
Target system
Notes 1. The C library source file is not included in the software package.
2. The Project Manager PM+ is included in the assembler package.
PM+ is used only in the Windows environment.
3. The in-circuit emulator QB-78K0SKX1MINI is provided with the integrated debugger ID78K0S-QB, the
flash memory programmer PG-FPL2, a power supply unit, and a target cable. Other products are
optional.
376
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
A.1 Software Package
SP78K0S
Software package
This is a package that bundles the software tools required for development of the 78K/0S Series.
The following tools are included.
RA78K0S, CC78K0S, ID78K0S-NS, SM+ for 78K0SNote 1, SM78K0SNote 2, and device files.
Part number: µS××××SP78K0S
Notes 1. SM+ for 78K0S is not included in SP78K0S Ver. 2.00 or earlier.
2. The SM78K0S does not support the 78K0S/Kx1+.
3. The DF789234 is not included in SP78K0S Ver. 2.00 or earlier.
Remark ×××× in the part number differs depending on the operating system to be used.
µS××××SP78K0S
××××
AB17
BB17
Host Machine
OS
Supply Medium
CD-ROM
PC-9800 series, IBM PC/AT
and compatibles
Japanese Windows
English Windows
A.2 Language Processing Software
RA78K0S
Assembler package
Program that converts program written in mnemonic into object code that can be executed by
microcontroller.
In addition, automatic functions to generate symbol table and optimize branch instructions are also
provided. Used in combination with device file (DF789234) (sold separately).
<Caution when used in PC environment>
The assembler package is a DOS-based application but may be used under the Windows
environment by using PM+ (included in the assembler package).
Part number: µS××××RA78K0S
CC78K0S
C library package
Program that converts program written in C language into object codes that can be executed by
microcontroller.
Used in combination with assembler package (RA78K0S) and device file (DF789234) (both sold
separately).
<Caution when used in PC environment>
The C compiler package is a DOS-based application but may be used under the Windows
environment by using PM+ (included in the assembler package).
Part number: µS××××CC78K0S
DF789234Note 1
Device file
File containing the information inherent to the device.
Used in combination with other tools (RA78K0S, CC78K0S, ID78K0S-NS, ID78K0S-QB, or SM+ for
78K0S).
Part number: µS××××DF789234
CC78K0S-LNote 2
C library source file
Source file of functions constituting object library included in C compiler package. Necessary for
changing object library included in C compiler package according to customer’s specifications.
Since this is the source file, its working environment does not depend on any particular operating
system.
Part number: µS××××CC78K0S-L
Notes 1. DF789234 is a common file that can be used with RA78K0S, CC78K0S, ID78K0S-NS, ID78K0S-QB,
and SM+ for 78K0S.
377
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
Notes 2. CC78K0S-L is not included in the software package (SP78K0S).
Remark ×××× in the part number differs depending on the host machine and operating system to be used.
µS××××RA78K0S
µS××××CC78K0S
µS××××CC78K0S-L
××××
AB17
Host Machine
OS
Supply Media
CD-ROM
PC-9800 series, IBM PC/AT
and compatibles
Japanese Windows
English Windows
HP-UXTM (Rel. 10.10)
BB17
3P17
3K17
HP9000 series 700TM
SPARCstationTM
SunOSTM (Rel. 4.1.4),
SolarisTM (Rel. 2.5.1)
µS××××DF789234
××××
Host Machine
OS
Supply Media
3.5” 2HD FD
AB13
BB13
PC-9800 series, IBM PC/AT
and compatibles
Japanese Windows
English Windows
A.3 Control Software
PM+
Project manager
This is control software designed so that the user program can be efficiently developed
in the Windows environment. With this software, a series of user program
development operations, including starting the editor, build, and starting the debugger,
can be executed on PM+.
<Caution>
PM+ is included in the assembler package (RA78K0S). It can be used only in the
Windows environment.
A.4 Flash Memory Writing Tools
Flashpro IV (FL-PR4, PG-FP4)
Flash memory programmer
Flash programmer dedicated to the microcontrollers incorporating a flash memory
PG-FPL2
Flash memory programmer
Flash programmer dedicated to the microcontrollers incorporating a flash memory
Provided with the in-circuit emulator QB-78K0SKX1MINI.
FA-20MC
Flash memory writing adapter
Flash memory writing adapter. Used in connection with Flashpro IV.
Designed for use with a 20-pin plastic SSOP (MC-5A4 type).
Remark FL-PR4 and FA-20MC are products of Naito Densei Machida Mfg. Co., Ltd.
For further information, contact: Naito Densei Machida Mfg. Co., Ltd. (TEL +81-45-475-4191)
378
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
A.5 Debugging Tools (Hardware)
A.5.1 When using in-circuit emulator IE-78K0S-NS or IE-78K0S-NS-A
IE-78K0S-NS
In-circuit emulator for debugging hardware and software of application system using 78K/0S
In-circuit emulator
Series. Supports integrated debugger (ID78K0S-NS). Used in combination with AC adapter,
emulation probe, and interface adapter for connecting the host machine.
IE-78K0S-NS-A
In-circuit emulator
This in-circuit emulator has a coverage function in addition to the functions of the IE-78K0S-
NS, and enhanced debugging functions such as an enhanced tracer function and timer
function.
IE-70000-MC-PS-B
AC adapter
Adapter for supplying power from 100 to 240 VAC outlet.
IE-70000-CD-IF-A
PC card interface
PC card and interface cable required when using a notebook type PC as the host machine
(PCMCIA socket supported).
IE-70000-PC-IF-C
Interface adapter
Adapter required when using IBM PC/AT and compatibles as the host machine (ISA bus
supported).
IE-70000-PCI-IF-A
Interface adapter
Adapter required when using a personal computer incorporating the PCI bus is used as the
host machine.
IE-789234-NS-EM1
Emulation board
Emulation board for emulating the peripheral hardware inherent to the device.
Used in combination with in-circuit emulator. A target cable is provided.
NP-30MC
Emulation probe
This probe is used to connect the in-circuit emulator to the target system and is designed for
use with a 30-pin plastic SSOP (MC-5A4 type).
NSPACK20BK
YSPACK30BK
This conversion connector connects the NP-30MC to a target system board designed to mount
a 20-pin plastic SSOP (MC-5A4 type).
Conversion connector • NSPACK20BK: Connector for connecting target
• YSPACK30BK: Connector for connecting emulator
Specifications of pin header on 0.635 mm × 0.635 mm (height: 6 mm)
target system
Remarks 1. NP-30MC is a product of Naito Densei Machida Mfg. Co., Ltd.
For further information, contact: Naito Densei Machida Mfg. Co., Ltd. (TEL +81-45-475-4191)
2. NSPACK20BK and YSPACK30BK are products of TOKYO ELETECH CORPORATION.
For further information, contact Daimaru Kogyo Co., Ltd.
Tokyo Electronics Department (TEL: +81-3-3820-7112)
Osaka Electronics Department (TEL: +81-6-6244-6672)
A.5.2 When using in-circuit emulator QB-78K0SKX1MINI
QB-78K0SKX1MINI
In-circuit emulator
In-circuit emulator for debugging hardware and software of application system using
78K0S/Kx1+ Series. Supports integrated debugger (ID78K0S-QB). Used in combination with
AC adapter, target cable, and USB interface cable for connecting the host machine.
Specifications of pin header on 0.635 mm × 0.635 mm (height: 6 mm)
target system
379
User’s Manual U16898EJ3V0UD
APPENDIX A DEVELOPMENT TOOLS
A.6 Debugging Tools (Software)
ID78K0S-NS
This debugger supports the in-circuit emulators for the 78K/0S Series. ID78K0S-NS is Windows-
based software.
This debugger has enhanced debugging functions supporting C language. By using its window
integration function that associates the source program, disassemble display, and memory display
with trace results, the trace results can be displayed corresponding to the source program.
It is used with a device file (DF789234) (sold separately).
(supporting in-circuit
emulator IE-78K0S-NS/
IE-78K0S-NS-A)
Integrated debugger
Ordering number: µS××××ID78K0S-NS
ID78K0S-QB
(supporting in-circuit
emulator
QB-78K0SKX1MINI)
Integrated debugger
This debugger supports the in-circuit emulators for the 78K0S/Kx1+ Series. ID78K0S-QB is
Windows-based software.
Provided with the debug function supporting C language, source programming, disassemble
display, and memory display are possible. This is used with the device file (DF789234) (sold
separately).
It is provided with the in-circuit emulator QB-78K0SKX1MINI.
Ordering number: µS××××ID78K0S-QB (not for sale)
SM+ for 78K0S
System simulator
This is a system simulator for the 78K/0S series. SM+ for 78K0S is Windows-based software.
This simulator can execute C-source-level or assembler-level debugging while simulating the
operations of the target system on the host machine.
By using SM+ for 78K0S, the logic and performance of the application can be verified
independently of hardware development. Therefore, the development efficiency can be enhanced
and the software quality can be improved.
This simulator is used with a device file (DF789234) (sold separately).
Ordering number: µS××××SM789234-B
DF789234Note
Device file
This is a file that has device-specific information.
It is used with the RA78K0S, CC78K0S, ID78K0S-NS, ID78K0S-QB, and SM+ for 78K0S (all sold
separately).
Ordering numberµS××××DF789234
Note DF789234 is a common file that can be used with the RA78K0S, CC78K0S, ID78K0S-NS, ID78K0S-QB,
and SM+ for 78K0S.
Remark ×××× in the part number differs depending on the operating system to be used and the supply medium.
µS××××ID78K0S-NS
µS××××ID78K0S-QB
µS××××SM789234-B
××××
BB13
Host Machine
OS
Supply Medium
3.5” 2HD FD
CD-ROM
PC-9800 series, IBM PC/AT
and compatibles
English Windows
Japanese Windows
English Windows
AB17
BB17
µS××××DF789234
××××
Host Machine
OS
Supply Medium
3.5” 2HD FD
AB13
BB13
PC-9800 series, IBM PC/AT
and compatibles
Japanese Windows
English Windows
380
User’s Manual U16898EJ3V0UD
APPENDIX B NOTES ON TARGET SYSTEM DESIGN
The following show the conditions when connecting the emulation probe to the conversion connector and
conversion socket in the case using in-circuit emulator IE-78K0S-NS or IE-78K0S-NS-A. Follow the configuration
below and consider the shape of parts to be mounted on the target system when designing a system.
Figure B-1. Distance Between In-Circuit Emulator IE-78K0S-NS/IE-78K0S-NS-A
and Conversion Connector NP-30MC
In-circuit emulator
IE-78K0S-NS, IE-78K0S-NS-A
Target system
Emulation board
IE-789234-NS-EM1
150 mm
NP-30MC tip board
CN5
Emulation probe
NP-30MC
Conversion connector
YSPACK20BK,
NSPACK30BK
Remarks 1. The NP-30MC is a product made by Naito Densei Machida Mfg. Co., Ltd.
2. The YSPACK30BK and NSPACK20BK are products by Naito Densei Machida Mfg. Co., Ltd.
381
User’s Manual U16898EJ3V0UD
APPENDIX B NOTES ON TARGET SYSTEM DESIGN
Figure B-2. Condition for Connecting Target System
(When Using In-Circuit Emulator IE-78K0S-NS, IE-78K0S-NS-A)
Emulation board
IE-789234-NS-EM1
Emulation probe
NP-30MC
NP-30MC tip board
Guide pin
YQ-Guide
13 mm
Conversion connector
YSPACK30BK,
NSPACK20BK
5 mm
15 mm
31 mm
20 mm
37 mm
Target system
Remarks 1. The NP-30MC is a product made by Naito Densei Machida Mfg. Co., Ltd.
2. The YSPACK30BK and NSPACK20BK are products by Naito Densei Machida Mfg. Co., Ltd.
382
User’s Manual U16898EJ3V0UD
APPENDIX C REGISTER INDEX
C.1 Register Index (Register Name)
8-bit A/D conversion result register (ADCRH) … 164
8-bit compare register 80 (CR80) … 124
8-bit timer counter 80 (TM80) … 124
8-bit timer H compare register 01 (CMP01) … 131
8-bit timer H compare register 11 (CMP11) … 131
8-bit timer H mode register 1 (TMHMD1) … 132
8-bit timer mode control register 80 (TMC80) … 125
10-bit A/D conversion result register (ADCR) … 163
16-bit timer capture/compare register 000 (CR000) … 84
16-bit timer capture/compare register 010 (CR010) … 86
16-bit timer counter 00 (TM00) … 84
16-bit timer mode control register 00 (TMC00) … 87
16-bit timer output control register 00 (TOC00) … 90
[A]
A/D converter mode register (ADM) … 161
Analog input channel specify register (ADS) … 163
Asynchronous serial interface operation mode register 6 (ASIM6) … 183
Asynchronous serial interface reception error status register 6 (ASIS6) … 185
Asynchronous serial interface transmission status register 6 (ASIF6) … 186
Asynchronous serial interface control register 6 (ASICL6) … 189
[B]
Baud rate generator control register 6 (BRGC6) … 188
[C]
Capture/compare control register 00 (CRC00) … 89
Clock selection register 6 (CKSR6) … 187
[E]
External interrupt mode register 0 (INTM0) … 220
External interrupt mode register 1 (INTM1) … 221
[F]
Flash address pointer H (FLAPH) … 280
Flash address pointer L (FLAPL) … 280
Flash address pointer H compare register (FLAPHC) … 281
Flash address pointer L compare register (FLAPLC) … 281
Flash status register (PFS) … 278
Flash programming command register (FLCMD) … 279
Flash programming mode control register (FLPMC) … 276
Flash protect command register (PFCMD) … 277
Flash write buffer register (FLW) … 282
383
User’s Manual U16898EJ3V0UD
APPENDIX C REGISTER INDEX
[I]
Input switching control register (ISC) … 191
Interrupt mask flag register 0 (MK0) … 219
Interrupt mask flag register 1 (MK1) … 219
Interrupt request flag register 0 (IF0) … 218
Interrupt request flag register 1 (IF1) … 218
[L]
Low voltage detect register (LVIM) … 250
Low voltage detection level select register (LVIS) … 251
Low-speed internal oscillation mode register (LSRCM) … 70
[O]
Oscillation stabilization time selection register (OSTS) … 71, 229
[P]
Port mode control register 2 (PMC2) … 62, 164
Port mode register 2 (PM2) … 60, 164
Port mode register 3 (PM3) … 60, 92
Port mode register 4 (PM4) … 60, 134, 191
Port mode register 12 (PM12) … 60
Port register 2 (P2) … 61
Port register 3 (P3) … 61
Port register 4 (P4) … 61
Port register 12 (P12) … 61
Port register 13 (P13) … 61
Preprocessor clock control register (PPCC) … 69
Prescaler mode register 00 (PRM00) … 91
Processor clock control register (PCC) … 69
Pull-up resistance option register 2 (PU2) … 64
Pull-up resistance option register 3 (PU3) … 64
Pull-up resistance option register 4 (PU4) … 64
Pull-up resistance option register 12 (PU12) … 64
[R]
Receive buffer register 6 (RXB6) … 182
Reset control flag register (RESF) … 244
[T]
Transmit buffer register 6 (TXB6) … 182
[W]
Watchdog timer enable register (WDTE) … 148
Watchdog timer mode register (WDTM) … 147
384
User’s Manual U16898EJ3V0UD
APPENDIX C REGISTER INDEX
C.2 Register Index (Symbol)
[A]
ADCR:
ADCRH:
ADM:
10-bit A/D conversion result register … 163
8-bit A/D conversion result register … 164
A/D converter mode register … 161
ADS:
Analog input channel specify register … 163
ASICL6:
ASIF6:
ASIM6:
ASIS6:
Asynchronous serial interface control register 6 … 189
Asynchronous serial interface transmission status register 6 … 186
Asynchronous serial interface operation mode register 6 … 183
Asynchronous serial interface reception error status register 6 … 185
[B]
BRGC6:
Baud rate generator control register 6 … 188
[C]
CKSR6:
CMP01:
CMP11:
CR000:
CR010:
CR80:
Clock selection register 6 … 187
8-bit timer H compare register 01 … 131
8-bit timer H compare register 11 … 131
16-bit timer capture/compare register 000 … 84
16-bit timer capture/compare register 010 … 86
8-bit compare register 80 … 124
CRC00:
Capture/compare control register 00 … 89
[F]
FLAPH:
Flash address pointer H … 280
FLAPHC: Flash address pointer H compare register … 281
FLAPL: Flash address pointer L … 280
FLAPLC: Flash address pointer L compare register … 281
FLCMD:
FLPMC:
FLW:
Flash programming command register … 279
Flash programming mode control register … 276
Flash write buffer register … 282
[I]
IF0:
IF1:
INTM0:
INTM1:
ISC:
Interrupt request flag register 0 … 218
Interrupt request flag register 1 … 218
External interrupt mode register 0 … 220
External interrupt mode register 1 … 221
Input switching control register … 191
[L]
LSRCM:
LVIM:
LVIS:
Low-speed internal oscillation mode register … 70
Low voltage detect register … 250
Low voltage detection level select register … 251
[M]
MK0:
MK1:
Interrupt mask flag register 0 … 219
Interrupt mask flag register 1 … 219
385
User’s Manual U16898EJ3V0UD
APPENDIX C REGISTER INDEX
[O]
OSTS:
Oscillation stabilization time selection register … 71, 229
[P]
P2:
Port register 2 … 61
P3:
Port register 3 … 61
P4:
Port register 4 … 61
P12:
P13:
PCC:
Port register 12 … 61
Port register 13 … 61
Processor clock control register … 69
PFCMD: Flash protect command register … 277
PFS:
Flash status register … 278
PM2:
Port mode register 2 … 60, 164
PM3:
Port mode register 3 … 60, 92
PM4:
Port mode register 4 … 60, 134, 191
Port mode register 12 … 60
PM12:
PMC2:
PPCC:
PRM00:
PU2:
PU3:
PU4:
PU12:
Port mode control register 2 … 62, 164
Preprocessor clock control register … 69
Prescaler mode register 00 … 91
Pull-up resistance option register 2 … 64
Pull-up resistance option register 3 … 64
Pull-up resistance option register 4 … 64
Pull-up resistance option register 12 … 64
[R]
RESF:
RXB6:
Reset control flag register … 244
Receive buffer register 6 … 182
[T]
TM00:
TM80:
TMC00:
TMC80:
16-bit timer counter 00 … 84
8-bit timer counter 80 … 124
16-bit timer mode control register 00 … 87
8-bit timer mode control register 80 … 125
TMHMD1: 8-bit timer H mode register 1 … 132
TOC00:
TXB6:
16-bit timer output control register 00 … 90
Transmit buffer register 6 … 182
[W]
WDTE: Watchdog timer enable register … 148
WDTM: Watchdog timer mode register … 147
386
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
This appendix lists cautions described in this document.
“Classification (hard/soft)” in table is as follows.
Hard: Cautions for microcontroller internal/external hardware
Soft: Cautions for software such as register settings or programs
(1/17)
Function
Details of
Function
Cautions
Page
Pin
P121/X1,
The P121/X1 and P122/X2 pins are pulled down during reset.
No interrupt sources correspond to the vector table address 0014H.
pp. 21,
functions
P122/X2
22, 24, 25
Memory
space
Vector table
address
SP: stack
pointer
P121/X1,
P122/X2
p. 29
p. 33
p. 49
Since reset signal generation makes the SP contents undefined, be sure to
initialize the SP before using the stack memory.
The P121/X1 and P122/X2 pins are pulled down during reset.
Port
functions
P34
Because the P34 pin functions alternately as the RESET pin, if it is used as an p. 53
input port pin, the function to input an external reset signal to the RESET pin
cannot be used. The function of the port is selected by the option byte. For
details, refer to CHAPTER 17 OPTION BYTE.
Also, since the option byte is referenced after the reset release, if low level is
input to the RESET pin before the referencing, then the reset state is not
released. When it is used as an input port pin, connect the pull-up resistor.
P31, P31, P43 Because P30, P31, and P43 are also used as external interrupt pins, the
corresponding interrupt request flag is set if each of these pins is set to the
output mode and its output level is changed. To use the port pin in the output
mode, therefore, set the corresponding interrupt mask flag to 1 in advance.
p. 60
−
Although a 1-bit memory manipulation instruction manipulates 1 bit, it accesses p. 65
a port in 8-bit units. Therefore, the contents of the output latch of a pin in the
input mode, even if it is not subject to manipulation by the instruction, are
undefined in a port with a mixture of inputs and outputs.
Main clock OSTS:
To set and then release the STOP mode, set the oscillation stabilization time as p. 71
follows.
Expected oscillation stabilization time of resonator ≤ Oscillation stabilization
time set by OSTS
Oscillation
stabilization
time select
register
The wait time after the STOP mode is released does not include the time from
the release of the STOP mode to the start of clock oscillation (“a” in the figure
below), regardless of whether STOP mode was released by reset input or
interrupt generation.
The oscillation stabilization time that elapses on power application or after
release of reset is selected by the option byte. For details, refer to CHAPTER
17 OPTION BYTE.
p. 71
p. 71
387
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(2/17)
Function
Details of
Function
Cautions
Page
Crystal/
ceramic
oscillator
−
When using the crystal/ceramic oscillator, wire as follows in the area enclosed by p. 72
the broken lines in Figure 5-6 to avoid an adverse effect from wiring capacitance.
• Keep the wiring length as short as possible.
• Do not cross the wiring with the other signal lines. Do not route the wiring
near a signal line through which a high fluctuating current flows.
• Always make the ground point of the oscillator capacitor the same potential
as VSS. Do not ground the capacitor to a ground pattern through which a high
current flows.
• Do not fetch signals from the oscillator.
16-bit
timer/
event
counters
00
TM00: 16-bit
timer counter
00
Even if TM00 is read, the value is not captured by CR010.
pp. 84,
116
When TM00 is read, count misses do not occur, since the input of the count clock pp. 84,
is temporarily stopped and then resumed after the read.
116
pp. 85,
116
CR000: 16-bit
timer capture/
compare
Set CR000 to other than 0000H in the clear & start mode entered on match
between TM00 and CR000. This means a 1-pulse count operation cannot be
performed when this register is used as an external event counter.
In the free-running mode and in the clear & start mode using the valid edge of the p.116
TI000 pin, if CR000 is set to 0000H, an interrupt request (INTTM000) is generated
when CR000 changes from 0000H to 0001H following overflow (FFFFH).
register 000
If the new value of CR000 is less than the value of 16-bit timer counter 0 (TM00), pp. 85,
TM00 continues counting, overflows, and then starts counting from 0 again. If the 116
new value of CR000 is less than the old value, therefore, the timer must be reset
to be restarted after the value of CR000 is changed.
The value of CR000 after 16-bit timer/event counter 00 has stopped is not
guaranteed.
pp. 85,
117
The capture operation may not be performed for CR000 set in compare mode
even if a capture trigger is input.
pp. 85,
119
When P31 is used as the input pin for the valid edge of TI010, it cannot be used
as a timer output (TO00). Moreover, when P31 is used as TO00, it cannot be
used as the input pin for the valid edge of TI010.
pp. 85,
121
If the register read period and the input of the capture trigger conflict when CR000 pp. 85,
is used as a capture register, the capture trigger input takes precedence and the 119
read data is undefined. Also, if the count stop of the timer and the input of the
capture trigger conflict, the capture trigger is undefined.
Changing the CR000 setting may cause a malfunction. To change the setting,
refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00 (17) Changing
compare register during timer operation.
p. 85
CR010: 16-bit
capture/
In the free-running mode and in the clear & start mode using the valid edge of the pp. 86,
TI000 pin, if CR010 is set to 0000H, an interrupt request (INTTM010) is generated 116
when CR010 changes from 0000H to 0001H following overflow (FFFFH).
If the new value of CR010 is less than the value of 16-bit timer counter 0 (TM00), pp. 86,
TM00 continues counting, overflows, and then starts counting from 0 again. If the 116
new value of CR010 is less than the old value, therefore, the timer must be reset
to be restarted after the value of CR010 is changed.
compare
register 010
The value of CR010 after 16-bit timer/event counter 00 has stopped is not
guaranteed.
pp. 86,
117
The capture operation may not be performed for CR010 set in compare mode
even if a capture trigger is input.
pp. 86,
119
388
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(3/17)
Function
Details of
Function
Cautions
Page
16-bit
timer/
event
CR010: 16-bit
capture/
If the register read period and the input of the capture trigger conflict when CR010 pp. 86,
is used as a capture register, the capture trigger input takes precedence and the 119
read data is undefined. Also, if the timer count stop and the input of the capture
trigger conflict, the capture data is undefined.
Changing the CR010 setting during TM00 operation may cause a malfunction. To p. 86
change the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter
00 (17) Changing compare register during timer operation.
compare
counters register 010
00
TMC00: 16-bit
timer mode
16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and
TMC003 (operation stop mode) are set to a value other than 0, 0, respectively.
pp. 87,
116
control register Set TMC002 and TMC003 to 0, 0 to stop the operation.
00
The timer operation must be stopped before writing to bits other than the OVF00
flag.
pp. 88,
117
If the timer is stopped, timer counts and timer interrupts do not occur, even if a
signal is input to the TI000/TI010 pins.
pp. 88,
116
Except when TI000 pin valid edge is selected as the count clock, stop the timer
operation before setting STOP mode or system clock stop mode; otherwise the
timer may malfunction when the system clock starts.
pp. 88,
121
Set the valid edge of the TI000 pin with bits 4 and 5 of prescaler mode register 00 pp. 88,
(PRM00) after stopping the timer operation.
117
If the clear & start mode entered on a match between TM00 and CR000, clear &
start mode at the valid edge of the TI000 pin, or free-running mode is selected,
when the set value of CR000 is FFFFH and the TM00 value changes from FFFFH
to 0000H, the OVF00 flag is set to 1.
p. 88
Even if the OVF00 flag is cleared before the next count clock is counted (before
pp. 88,
TM00 becomes 0001H) after the occurrence of a TM00 overflow, the OVF00 flag 118
is re-set newly and clear is disabled.
The capture operation is performed at the fall of the count clock. An interrupt
request input (INTTM0n0), however, occurs at the rise of the next count clock.
pp. 88,
119
CRC00:
Capture/
The timer operation must be stopped before setting CRC00.
pp. 89,
117
compare control
register 00
When the clear & start mode entered on a match between TM00 and CR000 is
selected by 16-bit timer mode control register 00 (TMC00), CR000 should not be 116
specified as a capture register.
pp. 89,
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 00 (PRM00) (refer to Figure 6-17).
pp. 89,
119
TOC00: 16-bit
timer output
control register
00
Timer operation must be stopped before setting other than OSPT00.
pp. 90,
117
pp. 90,
117
If LVS00 and LVR00 are read, 0 is read.
OSPT00 is automatically cleared after data is set, so 0 is read.
Do not set OSPT00 to 1 other than in one-shot pulse output mode.
pp. 90,
117
pp. 90,
117
A write interval of two cycles or more of the count clock selected by prescaler
mode register 00 (PRM00) is required to write to OSPT00 successively.
pp. 90,
117
When the TOE00 is 0, set the TOE00, LVS00, and LVR00 at the same time with
the 8-bit memory manipulation instruction. When the TOE00 is 1, the LVS00 and
LVR00 can be set with the 1-bit memory manipulation instruction.
p. 90
389
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(4/17)
Function
Details of
Function
Cautions
Page
16-bit
timer/
event
counters
00
PRM00:
Prescaler mode
register 00
Always set data to PRM00 after stopping the timer operation.
pp. 92,
117
pp. 92,
119
pp. 92,
121
If the valid edge of the TI000 pin is to be set as the count clock, do not set the
clear/start mode and the capture trigger at the valid edge of the TI000 pin.
In the following cases, note with caution that the valid edge of the TI0n0 pin is
detected.
<1> Immediately after a system reset, if a high level is input to the TI0n0 pin, the
operation of the 16-bit timer counter 00 (TM00) is enabled
→If the rising edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a rising edge is detected immediately after the TM00
operation is enabled.
<2> If the TM00 operation is stopped while the TI0n0 pin is high level, TM00
operation is then enabled after a low level is input to the TI0n0 pin
→If the falling edge or both rising and falling edges are specified as the valid
edge of the TI0n0 pin, a falling edge is detected immediately after the TM00
operation is enabled.
<3> If the TM00 operation is stopped while the TI0n0 pin is low level, TM00
operation is then enabled after a high level is input to the TI0n0 pin
→If the rising edge or both rising and falling edges are specified as the valid edge
of the TI0n0 pin, a rising edge is detected immediately after the TM00
operation is enabled.
The sampling clock used to eliminate noise differs when a TI000 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 fXP, and in the latter case the count clock is selected by
prescaler mode register 00 (PRM00). 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.
pp. 92,
121
When using P31 as the input pin (TI010) of the valid edge, it cannot be used as a pp. 92,
timer output (TO00). When using P31 as the timer output pin (TO00), it cannot be 121
used as the input pin (TI010) of the valid edge.
Interval timer
Changing the CR000 setting during TM00 operation may cause a malfunction. To p. 93
change the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter
00 (17) Changing compare register during timer operation.
External event
counter
When reading the external event counter count value, TM00 should be read.
pp. 97,
121
Pulse width
measurement
To use two capture registers, set the TI000 and TI010 pins.
pp. 98,
119
The measurable pulse width in this operation example is up to 1 cycle of the timer pp. 99,
counter.
101, 102,
104
Square-wave
output
Changing the CR000 setting during TM00 operation may cause a malfunction. To p. 106
change the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event Counter
00 (17) Changing compare register during timer operation.
PPG output
Changing the CRC0n0 setting during TM00 operation may cause a malfunction.
To change the setting, refer to 6.5 Cautions Related to 16-Bit Timer/Event
Counter 00 (17) Changing compare register during timer operation.
p. 108
Values in the following range should be set in CR000 and CR010.
0000H < CR010 < CR000 ≤ FFFFH
pp. 109,
121
390
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(5/17)
Function
Details of
Function
Cautions
Page
16-bit
timer/
event
counters
00
PPG output
The cycle of the pulse generated through PPG output (CR000 setting value + 1)
has a duty of (CR010 setting value + 1)/(CR000 setting value + 1).
pp. 109,
121
One-shot pulse Do not set the OSPT00 bit to 1 again while the one-shot pulse is being output. To pp. 111,
output: software output the one-shot pulse again, wait until the current one-shot pulse output is
trigger
117
completed.
When using the one-shot pulse output of 16-bit timer/event counter 00 with a
software trigger, do not change the level of the TI000 pin or its alternate-function
port pin. Because the external trigger is valid even in this case, the timer is
cleared and started even at the level of the TI000 pin or its alternate-function port
pin, resulting in the output of a pulse at an undesired timing.
pp. 111,
117
Do not set 0000H to the CR000 and CR010 registers.
pp.112,
117
16-bit timer counter 00 starts operating as soon as a value other than 00
(operation stop mode) is set to the TMC003 and TMC002 bits.
pp. 113,
116
One-shot pulse Do not input the external trigger again while the one-shot pulse is output. To
output: external output the one-shot pulse again, wait until the current one-shot pulse output is
pp. 113,
118
trigger
completed.
Do not set the CR000 and CR010 registers to 0000H.
pp.114,
118
16-bit timer counter 00 starts operating as soon as a value other than 00
(operation stop mode) is set to the TMC002 and TMC003 bits.
pp. 115,
116
Timer start
errors
An error of up to one clock may occur in the time required for a match signal to be p. 116
generated after timer start. This is because 16-bit timer counter 00 (TM00) is
started asynchronously to the count clock.
One-shot pulse One-shot pulse output normally operates only in the free-running mode or in the
p. 117
output
clear & start mode at the valid edge of the TI000 pin. Because an overflow does
not occur in the clear & start mode on a match between TM00 and CR000, one-
shot pulse output is not possible.
Capture
operation
When the CRC001 bit value is 1, capture is not performed in the CR000 register if p. 119
both the rising and falling edges have been selected as the valid edges of the
TI000 pin.
When the CRC001 bit value is 1, the TM00 count value is not captured in the
CR000 register when a valid edge of the TI010 pin is detected, but the input from
the TI010 pin can be used as an external interrupt source because INTTM000 is
generated at that timing.
p. 119
Changing
With the 16-bit timer capture/compare register 0n0 (CR0n0) used as a compare
register, when changing CR0n0 around the timing of a match between 16-bit timer
counter 00 (TM00) and 16-bit timer capture/compare register 0n0 (CR0n0) during
p. 120
compare
register during
timer operation timer counting, the change timing may conflict with the timing of the match, so the
operation is not guaranteed in such cases. To change CR0n0 during timer
counting, INTTM000 interrupt servicing performs the following operation.
If CR010 is changed during timer counting without performing processing <1>
above, the value in CR010 may be rewritten twice or more, causing an inversion
of the output level of the TO00 pin at each rewrite.
p. 120
p. 121
External event
counter
The timing of the count start is after two valid edge detections.
391
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(6/17)
Function
Details of
Function
Cautions
Page
8-bit timer CR80: compare When changing the value of CR80, be sure to stop the timer operation. If the
p. 124
80
register 80
value of CR80 is changed with the timer operation enabled, a match interrupt
request signal is generated immediately and the timer may be cleared.
TMC80: 8-bit
timer mode
control register
80
Be sure to set TMC80 after stopping the timer operation.
p. 125
p. 125
Be sure to clear bits 0 and 6 to 0.
Iterval timer
When changing the value of CR80, be sure to stop the timer operation. If the
value of CR80 is changed with the timer operation enabled, a match interrupt
request signal may be generated immediately.
If the count clock of TMC80 is set and the operation of TM80 is enabled at the
same time by using an 8-bit memory manipulation instruction, the error of one
cycle after the timer is started may be 1 clock or more (refer to 7.5 (1) Error when
timer starts). Therefore, be sure to follow the above sequence when using TM80
as an interval timer.
p. 126
p. 126
Error when
timer start
The time from starting the timer to generation of the match signal includes an
error of up to 1.5 clocks. This is because, if the timer is started while the count
clock is high, the rising edge may be immediately detected and the counter may
be incremented (refer to Figure 7-6).
p. 128
CR80: compare 8-bit compare register 80 (CR80) can be set to 00H.
register 80
p. 128
p. 128
p. 131
Stting STOP
mode
Before executing the STOP instruction, be sure to stop the timer operation
(TCE80 = 0).
8-bit timer CMP01: 8-bit
CMP01 cannot be rewritten during timer count operation.
H1
timer H
compare
register 01
CMP11: 8-bit
timer H
In the PWM output mode, be sure to set CMP11 when starting the timer count
operation (TMHE1 = 1) after the timer count operation was stopped (TMHE1 = 0)
(be sure to set again even if setting the same value to CMP11).
p. 131
compare
register 11
TMHMD1: 8-bit When TMHE1 = 1, setting the other bits of the TMHMD1 register is prohibited.
p. 133
p. 133
timer H mode
register 1
In the PWM output mode, be sure to set 8-bit timer H compare register 11
(CMP11) when starting the timer count operation (TMHE1 = 1) after the timer
count operation was stopped (TMHE1 = 0) (be sure to set again even if setting
the same value to the CMP11 register).
PWM output
In PWM output mode, the setting value for the CMP11 register can be changed
during timer count operation. However, three operation clocks (signal selected
using the CKS12 to CKS10 bits of the TMHMD1 register) or more are required to
transfer the register value after rewriting the CMP11 register value.
Be sure to set the CMP11 register when starting the timer count operation
(TMHE1 = 1) after the timer count operation was stopped (TMHE1 = 0) (be sure
to set again even if setting the same value to the CMP11 register).
p. 139
p. 139
Make sure that the CMP11 register setting value (M) and CMP01 register setting p. 140
value (N) are within the following range.
00H ≤ CMP11 (M) < CMP01 (N) ≤ FFH
392
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(7/17)
Function
Details of
Function
Cautions
Page
Watchdog WDTM:
timer Watchdog timer
Set bits 7, 6, and 5 to 0, 1, and 1, respectively. Do not set the other values.
p. 148
p. 148
After reset is released, WDTM can be written only once by an 8-bit memory
manipulation instruction. If writing is attempted a second time, an internal reset
signal is generated. However, at the first write, if “1” and “x” are set for WDCS4
and WDCS3 respectively and the watchdog timer is stopped, then the internal
reset signal does not occur even if the following are executed.
mode register
• Second write to WDTM
• 1-bit memory manipulation instruction to WDTE
• Writing of a value other than “ACH” to WDTE
WDTM cannot be set by a 1-bit memory manipulation instruction.
When using the flash memory self programming by self writing, set the overflow
time for the watchdog timer so that enough everflow time is secured (Example 1-
byte writing: 200 µs MIN., 1-block deletion: 10 ms MIN.).
p. 148
p. 148
WDTE:
If a value other than ACH is written to WDTE, an internal reset signal is
p. 148
Watchdog timer generated.
enable register
If a 1-bit memory manipulation instruction is executed for WDTE, an internal reset p. 148
signal is generated.
The value read from WDTE is 9AH (this differs from the written value (ACH)).
In this mode, operation of the watchdog timer cannot be stopped even during
STOP instruction execution. For 8-bit timer H1 (TMH1), a division of the low-
p. 148
p. 149
When “low-
speed internal
oscillator cannot speed internal oscillation clock can be selected as the count source, so clear the
be stopped” is
selected by
option byte
watchdog timer using the interrupt request of TMH1 before the watchdog timer
overflows after STOP instruction execution. If this processing is not performed,
an internal reset signal is generated when the watchdog timer overflows after
STOP instruction execution.
when “low-
In this mode, watchdog timer operation is stopped during HALT/STOP instruction p. 151
execution. After HALT/STOP mode is released, counting is started again using
speed internal
oscillator can be the operation clock of the watchdog timer set before HALT/STOP instruction
stopped by
software” is
selected by
option byte
execution by WDTM. At this time, the counter is not cleared to 0 but holds its
value.
A/D
Sampling time
The above sampling time and conversion time do not include the clock frequency p. 157
error. Select the sampling time and conversion time such that Notes 2 and 3
converter and A/D
conversion time above are satisfied, while taking the clock frequency error into consideration (an
error margin maximum of 5% when using the high-speed internal oscillator).
Block Diagram In the 78K0S/KA1+, VSS functions alternately as the ground potential of the A/D
converter. Be sure to connect VSS to a stabilized GND (= 0 V).
p. 158
ADM: A/D
The above sampling time and conversion time do not include the clock frequency p. 162
converter mode error. Select the conversion time taking the clock frequency error into
register
consideration (an error margin maximum of 5% when using the high-speed
internal oscillator).
If a bit other than ADCS of ADM is manipulated while A/D conversion is stopped
(ADCS = 0) and then A/D conversion is started, execute two NOP instructions or
an instruction equivalent to two machine cycles, and set ADCS to 1.
p. 163
A/D conversion must be stopped (ADCS = 0) before rewriting bits FR0 to FR2.
Be sure to clear bits 6, 2, and 1 to 0.
Be sure to clear bits 2 to 7 of ADS to 0.
p. 163
p. 163
p. 163
ADS: Analog
input channel
specification
register
393
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(8/17)
Function
A/D
Details of
Function
Cautions
Page
ADCR: 10-bit
When writing to the A/D converter mode register (ADM) and analog input channel p. 163
Converter A/D conversion specification register (ADS), the contents of ADCR may become undefined. Read
result register
the conversion result following conversion completion before writing to ADM and
ADS. Using timing other than the above may cause an incorrect conversion
result to be read.
PMC2: Port
mode control
register 2
When PMC20 to PMC23 are set to 1, the P20/ANI0 to P23/ANI3 pins cannot be
used as port pins.
p. 164
A/D converter
operations
Make sure the period of <1> to <4> is 1 µs or more.
pp. 165,
169
It is no problem if the order of <1> and <2> is reversed.
pp.165,
169
<1> can be omitted. However, ignore the data resulting from the first conversion p. 169
after <4> in this case.
The period from <5> to <8> differs from the conversion time set using bits 5 to 3
(FR2 to FR0) of ADM. The period from <7> to <8> is the conversion time set
using FR2 to FR0.
p. 169
Operating
The A/D converter stops operating in the STOP mode. At this time, the operating p. 172
current in STOP current can be reduced by clearing bit 7 (ADCS) and bit 0 (ADCE) of the A/D
mode
converter mode register (ADM) to 0.
Input range of
ANI0 to ANI3
Observe the rated range of the ANI0 to ANI3 input voltage. If a voltage of AVREF
or higher and VSS or lower (even in the range of absolute maximum ratings) is
input to an analog input channel, the converted value of that channel becomes
undefined. In addition, the converted values of the other channels may also be
affected.
p. 172
Conflicting
operations
Conflict between A/D conversion result register (ADCR, ADCRH) write and
ADCR, ADCRH read by instruction upon the end of conversion ADCR, ADCRH
read has priority. After the read operation, the new conversion result is written to
ADCR, ADCRH.
Conflict between ADCR, ADCRH write and A/D converter mode register (ADM)
write or analog input channel specification register (ADS) write upon the end of
conversion ADM or ADS write has priority. ADCR, ADCRH write is not
performed, nor is the conversion end interrupt signal (INTAD) generated.
p. 172
p. 172
p. 173
Noise
To maintain the 10-bit resolution, attention must be paid to noise input to the
countermeasures AVREF pin and ANI0 to ANI3 pins.
<1> Connect a capacitor with a low equivalent resistance and a high frequency
response to the power supply.
<2> Because the effect increases in proportion to the output impedance of the
analog input source, it is recommended that a capacitor be connected
externally, as shown in Figure 9-19, to reduce noise.
<3> Do not switch the A/D conversion function of the ANI0 to ANI3 pins to their
alternate functions during conversion.
<4> The conversion accuracy can be improved by setting HALT mode
immediately after the conversion starts.
ANI0/P20 to
ANI3/P23
The analog input pins (ANI0 to ANI3) are also used as input port pins (P20 to
P23).
p. 173
When A/D conversion is performed with any of ANI0 to ANI3 selected, do not
access P20 to P23 while conversion is in progress; otherwise the conversion
resolution may be degraded.
394
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(9/17)
Function
A/D
Details of
Function
Cautions
Page
ANI0/P20 to
converter ANI3/P23
If a digital pulse is applied to the pins adjacent to the pins currently used for A/D
conversion, the expected value of the A/D conversion may not be obtained due to
coupling noise. Therefore, do not apply a pulse to the pins adjacent to the pin
undergoing A/D conversion.
In this A/D converter, the internal sampling capacitor is charged and sampling is
performed during sampling time.
Since only the leakage current flows other than during sampling and the current
for charging the capacitor also flows during sampling, the input impedance
fluctuates both during sampling and otherwise.
p. 173
Input
impedance of
ANI0 to ANI3
pins
p. 173
If the shortest conversion time of the reference voltage is used, to perform
sufficient sampling, it is recommended to make the output impedance of the
analog input source 1 kΩ or lower, or attach a capacitor of around 0.01 µF to 0.1
µF to the ANI0 to ANI3 pins (see Figure 10-19).
Interrupt
request flag
(ADIF)
The interrupt request flag (ADIF) is not cleared even if the analog input channel
specification register (ADS) is changed.
Therefore, if an analog input pin is changed during A/D conversion, the A/D
conversion result and ADIF for the pre-change analog input may be set just
before the ADS rewrite. Caution is therefore required since, at this time, when
ADIF is read immediately after the ADS rewrite, ADIF is set despite the fact A/D
conversion for the post-change analog input has not ended.
p. 174
When A/D conversion is stopped and then resumed, clear ADIF before the A/D
conversion operation is resumed.
Conversion
The first A/D conversion value immediately after A/D conversion starts may not
p. 174
p. 174
results just after fall within the rating range if the ADCS bit is set to 1 within 1 µs after the ADCE bit
A/D conversion was set to 1, or if the ADCS bit is set to 1 with the ADCE bit = 0. Take measures
start
such as polling the A/D conversion end interrupt request (INTAD) and removing
the first conversion result.
A/D conversion When a write operation is performed to the A/D converter mode register (ADM)
result register
(ADCR,
ADCRH) read
operation
and analog input channel specification register (ADS), the contents of ADCR and
ADCRH may become undefined. Read the conversion result following conversion
completion before writing to ADM and ADS. Using a timing other than the above
may cause an incorrect conversion result to be read.
Serial
Interface
UART6
UART mode
The TXD6 output inversion function inverts only the transmission side and not the p. 176
reception side. To use this function, the reception side must be ready for
reception of inverted data.
If clock supply to serial interface UART6 is not stopped (e.g., in the HALT mode), p. 176
normal operation continues. If clock supply to serial interface UART6 is stopped
(e.g., in the STOP mode), each register stops operating, and holds the value
immediately before clock supply was stopped. The TXD6 pin also holds the value
immediately before clock supply was stopped and outputs it. However, the
operation is not guaranteed after clock supply is resumed. Therefore, reset the
circuit so that POWER6 = 0, RXE6 = 0, and TXE6 = 0.
If data is continuously transmitted, the communication timing from the stop bit to
the next start bit is extended two operating clocks of the macro. However, this
does not affect the result of communication because the reception side initializes
the timing when it has detected a start bit. Do not use the continuous
transmission function if the interface is incorporated in LIN.
p. 176
TXB6: Transmit Do not write data to TXB6 when bit 1 (TXBF6) of asynchronous serial interface
buffer register 6 transmission status register 6 (ASIF6) is 1.
p. 182
395
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(10/17)
Page
Function
Serial
Details of
Function
Cautions
TXB6: Transmit Do not refresh (write the same value to) TXB6 by software during a
interface buffer register 6 communication operation (when bit 7 (POWER6) and bit 6 (TXE6) of
p. 182
UART6
asynchronous serial interface operation mode register 6 (ASIM6) are 1 or when
bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 are 1).
ASIM6:
At startup, set POWER6 to 1 and then set TXE6 to 1. To stop the operation,
clear TXE6 to 0, and then clear POWER6 to 0.
At startup, set POWER6 to 1 and then set RXE6 to 1. To stop the operation,
clear RXE6 to 0, and then clear POWER6 to 0.
Set POWER6 to 1 and then set RXE6 to 1 while a high level is input to the RxD6 p. 184
pin. If POWER6 is set to 1 and RXE6 is set to 1 while a low level is input,
reception is started.
p. 184
p. 184
Registers
controlling
serial interface
UART6
Clear the TXE6 and RXE6 bits to 0 before rewriting the PS61, PS60, and CL6 bits. p. 184
Fix the PS61 and PS60 bits to 0 when mounting the device on LIN.
p. 184
p. 184
Make sure that TXE6 = 0 when rewriting the SL6 bit. Reception is always
performed with “the number of stop bits = 1”, and therefore, is not affected by the
set value of the SL6 bit.
Make sure that RXE6 = 0 when rewriting the ISRM6 bit.
p. 184
ASIS6:
The operation of the PE6 bit differs depending on the set values of the PS61 and p. 185
PS60 bits of asynchronous serial interface operation mode register 6 (ASIM6).
Asynchronous
serial interface
reception error
status register 6
The first bit of the receive data is checked as the stop bit, regardless of the
number of stop bits.
p. 185
If an overrun error occurs, the next receive data is not written to receive buffer
register 6 (RXB6) but discarded.
p. 185
Be sure to read ASIS6 before reading receive buffer register 6 (RXB6).
pp.185,
203
ASIF6:
To transmit data continuously, write the first transmit data (first byte) to the TXB6 p. 186
register. Be sure to check that the TXBF6 flag is “0”. If so, write the next
Asynchronous
serial interface transmit data (second byte) to the TXB6 register. If data is written to the TXB6
transmission
status register 6
register while the TXBF6 flag is “1”, the transmit data cannot be guaranteed.
To initialize the transmission unit upon completion of continuous transmission, be p. 186
sure to check that the TXSF6 flag is “0” after generation of the transmission
completion interrupt, and then execute initialization. If initialization is executed
while the TXSF6 flag is “1”, the transmit data cannot be guaranteed.
CKSR6: Clock Make sure POWER6 = 0 when rewriting TPS63 to TPS60.
p. 187
selection
register 6
BRGC6: Baud
rate generator
control register
6
Make sure that bit 6 (TXE6) and bit 5 (RXE6) of the ASIM6 register = 0 when
rewriting the MDL67 to MDL60 bits.
p. 188
The baud rate is the output clock of the 8-bit counter divided by 2.
p. 188
p. 189
ASICL6:
Asynchronous
ASICL6 can be refreshed (the same value is written) by software during a
communication operation (when bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 1
serial interface or bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 = 1). However, if the SBRT6 = 1
control register and SBTT = 1 are set in the refresh operation during the SBF reception (SBRF6
6
= 1) or SBF transmission (between the SBTT6 setting (1) and the INTST6
occurrence), it triggers the SBF reception and SBF transmission again, so do not
set.
In the case of an SBF reception error, return the mode to the SBF reception
mode again and hold (1) the status of the SBRF6 flag.
p. 190
396
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(11/17)
Page
Function
Serial
Details of
Function
Cautions
ASICL6:
interface Asynchronous
Before setting the SBRT6 bit to 1, make sure that bit 7 (POWER6) and bit 5
(RXE6) of ASIM6 = 1. Moreover, after setting the SBRT6 bit to 1, do not clear the
p. 190
UART6
serial interface SBRT6 bit to 0 before the SBF reception ends (an interrupt request signal is
control register generated).
6
The read value of the SBRT6 bit is always 0. SBRT6 is automatically cleared to 0 p. 190
after SBF reception has been correctly completed.
Before setting the SBTT6 bit to 1, make sure that bit 7 (POWER6) and bit 6
(TXE6) of ASIM6 = 1. Moreover, after setting the SBTT6 bit to 1, do not clear the
SBTT6 bit to 0 before the SBF transmission ends (an interrupt request signal is
generated)
p. 190
The read value of the SBTT6 bit is always 0. SBTT6 is automatically cleared to 0 p. 190
at the end of SBF transmission.
Before rewriting the DIR6 and TXDLV6 bits, clear the TXE6 and RXE6 bits to 0.
p. 190
POWER6,
TXE6, and
Clear POWER6 to 0 after clearing TXE6 and RXE6 to 0 to set the operation stop p. 192
mode.
RXE6: 7, 6, and
5 of ASIM6
To start the operation, set POWER6 to 1, and then set TXE6 and RXE6 to 1.
UART mode
Take relationship with the other party of communication into consideration when
setting the port mode register and port register.
p. 193
p. 197
Parity types and Fix the PS61 and PS60 bits to 0 when the device is incorporated in LIN.
operation
Continuous
transmission
The TXBF6 and TXSF6 flags of the ASIF6 register change from “10” to “11”, and p. 199
to “01” during continuous transmission. To check the status, therefore, do not use
a combination of the TXBF6 and TXSF6 flags for judgment. Judge whether
continuous transmission is possible or not by reading only the TXBF flag.
When the device is incorporated in a LIN, the continuous transmission function
cannot be used. Make sure that asynchronous serial interface transmission
status register 6 (ASIF6) is 00H before writing transmit data to transmit buffer
register 6 (TXB6).
p. 199
TXBF6 during
continuous
transmission:
Bit 1 of ASIF6
To transmit data continuously, write the first transmit data (first byte) to the TXB6 p. 199
register. Be sure to check that the TXBF6 flag is “0”. If so, write the next transmit
data (second byte) to the TXB6 register. If data is written to the TXB6 register
while the TXBF6 flag is “1”, the transmit data cannot be guaranteed.
TXSF6 during
continuous
transmission:
Bit 0 of ASIF6
To initialize the transmission unit upon completion of continuous transmission, be p. 199
sure to check that the TXSF6 flag is “0” after generation of the transmission
completion interrupt, and then execute initialization. If initialization is executed
while the TXSF6 flag is “1”, the transmit data cannot be guaranteed.
During continuous transmission, an error may occur such that the next
transmission is completed before execution of INTST6 interrupt servicing after
transmission of one data frame. As a countermeasure, such an error can be
detected by developing a program that can count the number of transmit data and
by referencing the TXSF6 flag.
p. 199
Normal
reception
Be sure to read receive buffer register 6 (RXB6) even if a reception error occurs. p. 203
Otherwise, an overrun error will occur when the next data is received, and the
reception error status will persist.
Reception is always performed with the “number of stop bits = 1”. The second
stop bit is ignored.
p. 203
Be sure to read asynchronous serial interface reception error status register 6
(ASIS6) before reading RXB6.
p. 203
397
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(12/17)
Page
Function
Details of
Function
Cautions
Generation of
serial clock
Serial
interface
UART6
Keep the baud rate error during transmission to within the permissible error
range at the reception destination.
Make sure that the baud rate error during reception satisfies the range shown in p. 209
(4) Permissible baud rate range during reception.
Make sure that the baud rate error during reception is within the permissible error p. 211
range, by using the calculation expression shown below.
p. 209
Permissible
baud rate range
during reception
Vector table
Interrupt
No interrupt sources correspond to the vector table address 0014H.
p. 215
functions address
IF0, IF1:
Because P30, P31, P41, and P43 have an alternate function as external interrupt pp. 218,
Interrupt request inputs, when the output level is changed by specifying the output mode of the
219
flag registers,
MK0, MK1:
port function, an interrupt request flag is set. Therefore, the interrupt mask flag
should be set to 1 before using the output mode.
Interrupt mask
flag registers
INTM0: External Be sure to clear bits 0 and 1 to 0.
interrupt mode
register 0
p. 220
p. 220
INTM0: External Before setting the INTM0 register, be sure to set the corresponding interrupt
interrupt mode
register 0
mask flag (××MK× = 1) to disable interrupts. After setting the INTM0 register,
clear the interrupt request flag (××IF× = 0), then clear the interrupt mask flag
(××MK× = 0), which will enable interrupts.
INTM1: External Be sure to clear bits 2 to 7 to 0.
p. 221
p. 221
interrupt mode
register 1
Before setting INTM1, set PMK3 to 1 to disable interrupts.
To enable interrupts, clear PIF3 to 0, then clear PMK3 to 0.
Interrupt
requests are
held pending
Interrupt requests will be held pending while the interrupt request flag registers
(IF0, IF1) or interrupt mask flag registers (MK0, MK1) are being accessed.
p. 224
p. 225
Interrupt request Multiple interrupts can be acknowledged even for low-priority interrupts.
pending
Standby
Function
−
The LSRSTOP setting is valid only when “Can be stopped by software” is set for p. 227
the low-speed internal oscillator by the option byte.
STOP mode
When shifting to the STOP mode, be sure to stop the peripheral hardware
operation before executing STOP instruction (except the peripheral hardware
that operates on the low-speed internal oscillation clock).
p. 228
STOP mode,
HALT mode
The following sequence is recommended for operating current reduction of the
A/D converter when the standby function is used: First clear bit 7 (ADCS) and bit
0 (ADCE) of the A/D converter mode register (ADM) to 0 to stop the A/D
conversion operation, and then execute the HALT or STOP instruction.
p. 228
STOP mode
If the low-speed internal oscillator is operating before the STOP mode is set,
oscillation of the low-speed internal oscillation clock cannot be stopped in the
STOP mode (refer to Table 13-1).
p. 228
OSTS:
Oscillation
To set and then release the STOP mode, set the oscillation stabilization time as p. 229
follows.
stabilization time
select register
Expected oscillation stabilization time of resonator ≤ Oscillation stabilization time
set by OSTS
398
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(13/17)
Page
Function
Details of
Function
Cautions
Standby
function
OSTS:
The wait time after the STOP mode is released does not include the time from the p. 229
release of the STOP mode to the start of clock oscillation (“a” in the figure below),
regardless of whether STOP mode was released by reset signal generation or
interrupt generation.
Oscillation
stabilization
time select
register
The oscillation stabilization time that elapses on power application or after
release of reset is selected by the option byte. For details, refer to CHAPTER 17
OPTION BYTE.
p. 229
HALT mode
setting and
operating
statuses
Because an interrupt request signal is used to clear the standby mode, if there is p. 230
an interrupt source with the interrupt request flag set and the interrupt mask flag
clear, the standby mode is immediately cleared if set.
STOP mode
setting and
operating
statuses
Because an interrupt request signal is used to clear the standby mode, if there is p. 233
an interrupt source with the interrupt request flag set and the interrupt mask flag
reset, the standby mode is immediately cleared if set. Thus, in the STOP mode,
the normal operation mode is restored after the STOP instruction is executed and
then the operation is stopped for 34 µs (TYP.) (after an additional wait time for
stabilizing the oscillation set by the oscillation stabilization time select register
(OSTS) has elapsed when crystal/ceramic oscillation is used).
Reset
function
−
For an external reset, input a low level for 2 µs or more to the RESET pin.
During reset signal generation, the system clock and low-speed internal
oscillation clock stop oscillating.
p. 237
p. 237
When the RESET pin is used as an input-only port pin (P34), the 78K0S/KA1+ is p. 237
reset if a low level is input to the RESET pin after reset is released by the POC
circuit and before the option byte is referenced again. The reset status is
retained until a high level is input to the RESET pin.
The LVI circuit is not reset by the internal reset signal of the LVI circuit.
p. 238
Timing of reset The watchdog timer is also reset in the case of an internal reset of the watchdog p. 240
by overflow of
watchdog timer
timer.
RESF: Reset
control flag
register
Do not read data by a 1-bit memory manipulation instruction.
p. 244
p. 245
Power-
on-clear
circuit
Functions of
If an internal reset signal is generated in the POC circuit, the reset control flag
power-on-clear register (RESF) is cleared to 00H.
circuit
Because the detection voltage (VPOC) of the POC circuit is in a range of 2.1 V 0.1 p. 245
V, use a voltage in the range of 2.2 to 5.5 V.
Cautions for
In a system where the supply voltage (VDD) fluctuates for a certain period in the
p. 247
power-on-clear vicinity of the POC detection voltage (VPOC), the system may be repeatedly reset
circuit
and released from the reset status. In this case, the time from release of reset to
the start of the operation of the microcontroller can be arbitrarily set by taking the
following action.
Low-
voltage
detector
LVIM: Low-
voltage detect
register
To stop LVI, follow either of the procedures below.
• When using 8-bit manipulation instruction: Write 00H to LVIM.
• When using 1-bit memory manipulation instruction: Clear LVION to 0.
Be sure to set bits 2 to 6 to 0.
p. 250
p. 250
p. 251
LVIS: Low-
voltage
Bits 4 to 7 must be set to 0.
detection level
select register
399
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(14/17)
Page
Function
Details of
Function
Cautions
Low-
voltage
detector
When used as
reset
<1> must always be executed. When LVIMK = 0, an interrupt may occur
immediately after the processing in <3>.
If supply voltage (VDD) ≥ detection voltage (VLVI) when LVIM is set to 1, an internal p. 252
reset signal is not generated.
p. 252
Cautions for
low-voltage
detector
In a system where the supply voltage (VDD) fluctuates for a certain period in the
vicinity of the LVI detection voltage (VLVI), the operation is as follows depending
on how the low-voltage detector is used.
p. 256
<1> When used as reset
The system may be repeatedly reset and released from the reset status.
In this case, the time from release of reset to the start of the operation of the
microcontroller can be arbitrarily set by taking action (1) below.
<2> When used as interrupt
Interrupt requests may be frequently generated. Take (b) of action (2) below.
Option
byte
Oscillation
stabilization
time on power
application or
after reset
The setting of this option is valid only when the crystal/ceramic oscillation clock is
selected as the system clock source. No wait time elapses if the high-speed
internal oscillation clock or external clock input is selected as the system clock
source.
p. 260
release
Control of
Because the option byte is referenced after reset release, if a low level is input to
the RESET pin before the option byte is referenced, then the reset state is not
released.
p. 260
p. 260
RESET pin
Also, when setting 0 to RMCE, connect the pull-up resistor.
Selection of
system clock
source
Because the X1 and X2 pins are also used as the P121 and P122 pins, the
conditions under which the X1 and X2 pins can be used differ depending on the
selected system clock source.
(1) Crystal/ceramic oscillation clock is selected
The X1 and X2 pins cannot be used as I/O port pins because they are used as
clock input pins.
(2) External clock input is selected
Because the X1 pin is used as an external clock input pin, P121 cannot be used
as an I/O port pin.
(3) High-speed internal oscillation clock is selected
P121 and P122 can be used as I/O port pins.
Low-speed
internal
oscillates
If it is selected that low-speed internal oscillator cannot be stopped, the count
clock to the watchdog timer (WDT) is fixed to low-speed internal oscillation clock.
p. 261
p. 261
If it is selected that low-speed internal oscillator can be stopped by software,
supply of the count clock to WDT is stopped in the HALT/STOP mode, regardless
of the setting of bit 0 (LSRSTOP) of the low-speed internal oscillation mode
register (LSRCM). Similarly, clock supply is also stopped when a clock other than
the low-speed internal oscillation clock is selected as a count clock to WDT.
While the low-speed internal oscillator is operating (LSRSTOP = 0), the clock can
be supplied to the 8-bit timer H1 even in the STOP mode.
Flash
memory
PG-FP4 GUI
software setting
value example
The above values are recommended values. Depending on the usage
environment these values may change, so set them after having performed
sufficient evaluations.
p. 269
400
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(15/17)
Page
Function
Details of
Function
Cautions
Security
settings
After the security setting of the batch erase is set, erasure cannot be performed
for the device. In addition, even if a write command is executed, data different
from that which has already been written to the flash memory cannot be written
because the erase command is disabled.
Flash
memory
p. 272
The security setting is valid when the programming mode is set next time.
Self programming processing must be included in the program before performing
self writing.
p. 272
p. 273
Self
programming
function
No instructions can be executed while a self programming command is being
executed. Therefore, clear and restart the watchdog timer counter in advance so
that the watchdog timer does not overflow during self programming. Refer to
Table 18-11 for the time taken for the execution of self programming.
p. 276
Interrupts that occur during self programming can be acknowledged after self
programming mode ends. To avoid this operation, disable interrupt servicing (by
setting MK0 and MK1 to FFH, and executing the DI instruction) before a mode is
shifted from the normal mode to the self programming mode with a specific
sequence.
p. 276
RAM is not used while a self programming command is being executed.
If the supply voltage drops or the reset signal is input while the flash memory is
being written or erased, writing/erasing is not guaranteed.
p. 276
p. 276
The value of the blank data set during block erasure is FFH.
p. 276
When the oscillator or the external clock is selected as the main clock, a wait time p. 276
of 16 µs is required starting from the setting of the self programming mode to the
execution of the HALT instruction.
The state of the pins in self programming mode is the same as that in HALT
mode.
p. 276
Since the security function set via on-board/off-board programming is disabled in p. 276
self programming mode, the self programming command can be executed
regardless of the security function setting. To disable write or erase processing
during self programming, set the protect byte.
Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash address p. 276
pointer H compare register (FLAPHC) to 0 before executing the self programming
command. If the value of these bits is 1 when executing the self programming
command.
FLPMC: Flash
programming
mode control
register
Cautions in the case of setting the self programming mode, refer to 18.8.2
Cautions on self programming function.
When the oscillator or the external clock is selected as the main clock, a wait time p. 277
of 16 µs is required from setting FLSPM to 1 to execution of the HALT instruction.
p. 277
PFCMD: Flash Disable interrupt servicing (by setting MK0 and MK1 to FFH and executing the DI p. 277
protect
instruction) while the specific sequence is under execution.
command
register
FLAPH, FLAPL: Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash address p. 281
Flash address pointer H compare register (FLAPHC) to 0 before executing the self programming
pointers H and command. If the value of these bits is 1 when executing the self programming
command.
L
401
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(16/17)
Page
Function
Details of
Function
Cautions
Flash
memory
FLAPHC,
Be sure to clear bits 4 to 7 of flash address pointer H (FLAPH) and flash address p. 281
FLAPLC: Flash pointer H compare register (FLAPHC) to 0 before executing the self programming
address pointer command. If the value of these bits is 1 when executing the self programming
H/L compare
registers
command.
Set the number of the block subject to a block erase, verify, or blank check (same p. 281
value as FLAPH) to FLAPHC.
Clear FLAPLC to 00H when a block erase is performed, and FFH when a blank
check is performed.
p. 281
Shifting to self
programming
mode
Shifting to
normal mode
Be sure to perform the series of operations described above using the user
program at an address where data is not erased nor written.
pp. 284,
285, 287,
288
Byte write
If a write results in failure, erase the block once and write to it again.
For (A) products, the specifications are target values, and may change after
device evaluation.
p. 296
p. 330
Electrical
specificati
ons ((T)
product,
(S)
product,
(R)
product,
(A)
product)
−
Absolute
maximum
ratings
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.
p. 330
X1 oscillator
When using the X1 oscillator, wire as follows in the area enclosed by the broken p. 331
characteristics 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
VSS.
• Do not ground the capacitor to a ground pattern through which a high current
flows.
• Do not fetch signals from the oscillator.
A/D converter
The conversion accuracy may be degraded if the level of a port that is not used
for A/D conversion is changed during A/D conversion.
These specifications show target values, which may change after device
evaluation. The operating voltage range may also change.
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.
p. 338
p. 342
p. 342
Electrical
specificati
ons
−
Absolute
maximum
ratings
(target
values)
((T2)
product)
Allowable loss
When using the internal pull-up resistor, calculate and add the separate power
consumption.
pp. 343,
355
402
User’s Manual U16898EJ3V0UD
APPENDIX D LIST OF CAUTIONS
(17/17)
Page
Function
Details of
Function
Cautions
Electrical X1 oscillator
When using the X1 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.
p. 344
specificati characteristics
ons
(target
values)
((T2)
product)
• Always make the ground point of the oscillator capacitor the same potential as
VSS.
• Do not ground the capacitor to a ground pattern through which a high current
flows.
• Do not fetch signals from the oscillator.
A/D converter
The conversion accuracy may be degraded if the level of a port that is not used
for A/D conversion is changed during A/D conversion.
These specifications show target values, which may change after device
evaluation. The operating voltage range may also change.
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.
p. 351
p. 356
p. 356
Electrical
specificati
ons
−
Absolute
maximum
ratings
(target
values)
((A2)
product)
Allowable loss
When using the internal pull-up resistor, calculate and add the separate power
consumption.
pp. 357,
369
X1 oscillator
characteristics
When using the X1 oscillator, wire as follows in the area enclosed by the broken
lines in the above figures to avoid an adverse effect from wiring capacitance.
p. 358
• 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
VSS.
• Do not ground the capacitor to a ground pattern through which a high current
flows.
• Do not fetch signals from the oscillator.
A/D converter
The conversion accuracy may be degraded if the level of a port that is not used
for A/D conversion is changed during A/D conversion.
Products whis -A at the end of the part number are lead-free products.
p. 365
p. 372
p. 372
p. 372
Recomme Lead-free
nded
soldering
conditions
products
−
For soldering methods and conditions other than those recommended below,
contact an NEC Electronics sales representative.
Do not use different soldering methods together (except for partial heating).
403
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
E.1 Major Revisions in This Edition
(1/3)
Page
pp. 15, 18, 20
p. 16
Description
Modification of operating temperature range in CHAPTER 1 OVERVIEW
Addition of part number to 1.3 Ordering Information
pp. 21, 22
p. 23
Addition of Note to P34/RESET, P121/X1, and P122/X2 in 2.1 Pin Function List
Addition of description to 2.2.2 P30, P31, and P34 (Port 3)
Addition of description to 2.2.4 P121 to P123 (Port 12)
p. 24
p. 24
Addition of description to 2.2.6 RESET
p. 25
Addition of description to 2.2.7 X1 and X2
p. 41
Modification of description example in 3.4.1 Direct addressing
Modification of description and description example in 3.4.2 Short direct addressing
Addition of Illustration to 3.4.6 Based addressing
p. 42
p. 46
p. 47
Addition of Illustration to 3.4.7 Stack addressing
p. 49
Addition of Note to P34/RESET, P121/X1, and P122/X2 in Table 4-1. Port Functions
Addition of description to and modification of Cautions in 4.2.2 Port 3
Modification of Figure 4-10. Block Diagram of P121 and P122
pp. 51, 53
p. 58
p. 65
Addition of description to (2) In input mode in 4.4.1 Writing to I/O port and 4.4.3 Operations on I/O port
Modification of description in (2) External event counter in 6.1 Functions of 16-Bit Timer/Event Counter 00
Modification of Caution 2 in Figure 6-2. Format of 16-Bit Timer Counter 00 (TM00)
p. 82
p. 84
p. 88
Modification of Caution 2 in Figure 6-5. Format of 16-Bit Timer Mode Control Register 00 (TMC00)
p. 97
Addition of (1) INTTM000 generation timing immediately after operation starts to Figure 6-16. External
Event Counter Operation Timing (with Rising Edge Specified)
pp. 99, 101, 102, 104 Addition of Caution to (1), (2), (3), and (4) in 6.4.3 Pulse width measurement operations
p. 100
p. 100
p. 102
p. 103
p. 104
p. 105
p. 111
Modification of Figure 6-19. Configuration Diagram for Pulse Width Measurement by Free-Running
Counter
Modification of Figure 6-20. Timing of Pulse Width Measurement Operation by Free-Running Counter
and One Capture Register (with Both Edges Specified) and Note
Modification of Figure 6-22. Timing of Pulse Width Measurement Operation with Free-Running Counter
(with Both Edges Specified) and Note
Modification of Note in Figure 6-23. Control Register Settings for Pulse Width Measurement with Free-
Running Counter and Two Capture Registers (with Rising Edge Specified)
Modification of Figure 6-24. Timing of Pulse Width Measurement Operation by Free-Running Counter
and Two Capture Registers (with Rising Edge Specified) and Note
Modification of Figure 6-26. Timing of Pulse Width Measurement Operation by Means of Restart (with
Rising Edge Specified)
6.4.6 One-shot pulse output operation
• Modification of Caution 1 in (1) One-shot pulse output with software trigger
• Modification of Caution in (2) One-shot pulse output with external trigger
p. 116
Modification of <3> and <4> in (2) 16-bit timer counter 00 (TM00) operation of 6.5 Cautions Related to 16-
Bit Timer/Event Counter 00
404
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
(2/3)
Page
Description
p. 117
p. 118
Modification of <1> in (11) One-shot pulse output by software of 6.5 Cautions Related to 16-Bit
Timer/Event Counter 00
Modification of <1> in (12) One-shot pulse output with external trigger of 6.5 Cautions Related to 16-Bit
Timer/Event Counter 00
p. 119
p. 121
p. 124
p. 131
Modification of <3> in (15) Capture operation of 6.5 Cautions Related to 16-Bit Timer/Event Counter 00
Modification of <1> in (19) External event counter of 6.5 Cautions Related to 16-Bit Timer/Event Counter 00
Modification of Caution in (1) 8-bit compare register 80 (CR80) of 7.2 Configuration of 8-Bit Timer 80
Modification of description in (2) 8-bit timer H compare register 11 (CMP11) of 8.2 Configuration of 8-Bit
Timer H1
p. 139
p. 143
Modification of Caution 1 in 8.4.2 Operation as PWM output mode
Modification of (e) Operation by changing CMP11 (CMP11 = 02H → 03H, CMP01 = A5H) in Figure 8-9.
Operation Timing in PWM Output Mode
p. 148
p. 156
p. 157
Addition of description to Caution 2 in Figure 9-2. Format of Watchdog Timer Mode Register (WDTM)
Modification of Figure 10-1. Timing of A/D Converter Sampling and A/D Conversion
Modification of Table 10-1. Sampling Time and A/D Conversion Time and Note 1
Modification of Figure 10-3. Format of A/D Converter Mode Register (ADM) and Note 2
Modification of (4) Noise countermeasures in 10.6 Cautions for A/D Converter
Modification of (6) Input impedance of ANI0 to ANI3 pins in 10.6 Cautions for A/D Converter
Modification of Figure 11-1. LIN Transmission Operation
pp. 161, 162
p. 173
p. 173
p. 177
p. 178
Modification of Figure 11-2. LIN Reception Operation and description
p. 191
Addition of description to (7) Input switch control register (ISC) in 11.3 Registers Controlling Serial
Interface UART6
p. 210
p. 214
p. 224
p. 225
p. 226
p. 232
p. 233
p. 235
Modification of value in Table 11-4. Set Data of Baud Rate Generator
Modification of 12.1 Interrupt Function Types
Modification of 12.4.2 Multiple interrupt servicing
Addition of Caution to Example 1 in Figure 12-10. Example of Multiple Interrupts (1/2)
Addition of Example 3 to Figure 12-10. Example of Multiple Interrupts (1/2)
Modification of reset signal in Figure 13-3. HALT Mode Release by Reset Signal Generation
Modification of description in External interrupt of Table 13-4. Operating Statuses in STOP Mode
Modification of description in and addition of Note to (a) Release by unmasked interrupt request in (2) of
13.2.2 STOP mode
p. 236
Modification of reset signal in Figure 13-6. STOP Mode Release by Reset Signal Generation
Modification of Figure 14-1. Block Diagram of Reset Function
p. 238
pp. 239, 241
Addition of delay time of internal reset signal generation to Figure 14-2. Timing of Reset by RESET Input
and Figure 14-4. Reset Timing by RESET Input in STOP Mode
p. 247
p. 249
p. 250
p. 251
p. 255
Modification of Figure 15-3. Example of Software Processing After Release of Reset (1/2)
Modification of Figure 16-1. Block Diagram of Low-Voltage Detector
Modification of Note 1 in Figure 16-2. Format of Low-Voltage Detect Register (LVIM)
Modification of Note in Figure 16-3. Format of Low-Voltage Detection Level Select Register (LVIS)
Modification of INTLVI and Note 2 in Figure 16-5. Timing of Low-Voltage Detector Interrupt Signal
Generation
p. 256
Modification of (2) in <Action> of 16.5 Cautions for Low-Voltage Detector
405
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
(3/3)
Page
Description
p. 257
Modification of Figure 16-6. Example of Software Processing After Release of Reset (1/2)
Modification of description and configuration in CHAPTER 17 OPTION BYTE
Modification of Caution in Figure 17-2. Format of Option Byte (1/2)
Addition of Remark 3, 4 to Figure 17-2. Format of Option Byte (2/2)
Modification of and addition to 18.1 Features
pp. 259, 260
p. 259
p. 260
p. 262
p. 266
Figure 18-2. Environment for Writing Program to Flash Memory is divided into two figures, in the case of
FlashPro4 and in the case of PG-FPL2
p. 269
Modification of Caution in Table 18-5. Oscillation Frequency and PG-FP4 GUI Software Setting Value
Example
p. 267 in old
edition
Deletion of 18.7.1 Flash memory programming mode
p. 271
p. 276
p. 279
Modification of 18.7.2 Communication commands
Modification of and Addition to 18.8.2 Cautions on self programming function
Addition of <Setting conditions> in 3. Operating conditions of WEPRERR flag of 18.8.3 Registers used
for self programming function (3)
p. 280
p. 281
p. 281
Addition of description to Figure 18-15. Format of Flash Programming Command Register (FLCMD)
Modification of Caution in Figure 18-16. Format of Flash Address Pointer H/L (FLAPH/FLAPL)
Modification of Caution 1, 2 in Figure 18-17. Format of Flash Address Pointer H/L Compare Registers
(FLAPHC/FLAPLC)
p. 327 in old
edition
Complete revision of CHAPTER 20 ELECTRICAL SPECIFICATIONS (TARGET VALUES), and addition of
chapters
p. 371
p. 372
p. 377
p. 387
Addition of CHAPTER 24 PACKAGE MARKING INFORMATION
Addition of CHAPTER 25 RECOMMENDED SOLDERING CONDITIONS
Addition of included software tools to A.1 Software Package
Addition of APPENDIX D LIST OF CAUTIONS
406
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
E.2 Revision History up to Previous Editions
The following table shows the revision history up to this edition. The “Applied to:” column indicates the chapters of
each edition in which the revision was applied.
(1/4)
Edition
Description
Applied to:
2nd edition Addition of lead-free products
• µPD78F9221MC-5A4-A
Throughout
• µPD78F9222MC-5A4-A
Modification of watchdog timer operation clock
• Low-voltage internal oscillation clock (fRL) or clock to peripheral hardware (fXP)
→ Low-voltage internal oscillation clock (fRL) or system clock (fX)
Deletion of high-speed internal oscillation mode register (HSRCM)
Deletion of INTFLC (interrupt request)
Addition of Caution to 2.1 Pin Function List, 2.2.4 P121 to P123 (Port 12), and 2.2.7
X1 and X2
CHAPTER 2 PIN
FUNCTIONS
Modification of the following pin connections in Table 2-1 Types of Pin I/O Circuits and
Connection of Unused Pins
• P20/ANI0 to P23/ANI3
• P34/RESET
• P121/X1
• P122/X2
Modification of Figure 3-1 Memory Map (µPD78F9221) and Figure 3-2 Memory Map
(µPD78F9222)
CHAPTER 3 CPU
ARCHITECTURE
Addition of Caution to and modification of Table 3-2 Vector Table
Addition of (4) Protect byte area to 3.1.1 Internal program memory space
Addition of Note 3 to Table 3-3 Special Function Registers (1/2)
Addition of registers to be used for the self programming function to Table 3-3 Special
Function Registers (2/2)
Addition of Caution and modification of Remark 2 in Table 4-1 Port Functions
Addition of Figure 4-4 Block Diagram of P31
CHAPTER 4 PORT
FUNCTIONS
Modification of Figure 4-9 Block Diagram of P43
Modification of Figure 5-1 Block Diagram of Clock Generators
CHAPTER 5 CLOCK
GENERATORS
Modification of operation stop time in the following figures.
• Figure 5-8 Timing Chart of Default Start by High-Speed Internal Oscillator
• Figure 5-10 Timing Chart of Default Start by Crystal/Ceramic Oscillator
• Figure 5-12 Timing of Default Start by External Clock Input
Modification of Note in Figure 5-14 Status Transition of Low-Speed Internal oscillator
Addition of Cautions to 6.2 Configuration of 16-Bit Timer/Event Counter 00 (1) 16-bit
CHAPTER 6 16-BIT
timer counter 00 (TM00), (2) 16-bit timer capture/compare register 000 (CR000), and TIMER/EVENT
(3) 16-bit capture/compare register 010 (CR010)
COUNTER 00
Addition of Cautions in Figure 6-5 Format of 16-Bit Timer Mode Control Register 00
(TMC00)
Addition of Caution 6 to Figure 6-7 Format of 16-Bit Timer Output Control Register
00 (TOC00)
Modification of Caution 3 and addition of Caution 4 in Figure 6-8 Format of Prescaler
Mode Register 00 (PRM00)
407
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
(2/4)
Edition
Description
Applied to:
2nd edition Modification of output width of INTTM010 and INTTM000 in the following figures
• Figure 6-17 CR010 Capture Operation with Rising Edge Specified
• Figure 6-20 Timing of Pulse Width Measurement Operation by Free-Running
Counter and One Capture Register (with Both Edges Specified)
• Figure 6-22 Timing of Pulse Width Measurement Operation with Free-Running
Counter (with Both Edges Specified)
CHAPTER 6 16-BIT
TIMER/EVENT
COUNTER 00
• Figure 6-24 Timing of Pulse Width Measurement Operation by Free-Running
Counter and Two Capture Registers (with Rising Edge Specified)
• Figure 6-26 Timing of Pulse Width Measurement Operation by Means of Restart
(with Rising Edge Specified)
Modification of Caution 1 in Figure 6-29 Control Register Settings for PPG Output
Operation
Modification of Figure 6-33 Timing of One-Shot Pulse Output Operation with
Software Trigger
Modification and addition to 6.5 Cautions Related to 16-Bit Timer/Event Counter 00
Addition of Caution 2 to Figure 7-4 Format of 8-Bit Timer Mode Control Register 80
(TMC80)
CHAPTER 7 8-BIT
TIMER 80
Modification of Table 9-1 Loop Detection Time of Watchdog Timer
CHAPTER 9
WATCHDOG TIMER
Addition of Caution 4 and modification to Figure 9-2 Format of Watchdog Timer Mode
Register (WDTM)
Modification of Figure 9-4 Status Transition Diagram When “Low-Speed Internal
Oscillator Cannot Be Stopped” Is Selected by Option Byte
Modification of Figure 9-5 Status Transition Diagram When “Low-Speed Internal
Oscillator Can Be Stopped by Software” Is Selected by Option Byte
Addition of Note to and modification of Figure 10-1 Timing of A/D Converter Sampling CHAPTER 10 A/D
and A/D Conversion
CONVERTER
Addition of Note 1, Caution, and Remark 2 to and modification of Table 10-1 Sampling
Time and A/D Conversion Time
Modification of Figure 10-2 Block Diagram of A/D Converter
Modification of Note 5, addition of Notes 1, 2, Cautions 1, 2, 4 and Remark 2 to, and
modification of Figure 10-3 Format of A/D Converter Mode Register (ADM)
Modification of Note in Figure 10-4 Timing Chart When Comparator Is Used
Addition of explanation <3> to 10.4.1 Basic operations of A/D converter
Modification of Figure 10-11 Relationship Between Analog Input Voltage and A/D
Conversion Result
Addition of explanation <3> to 10.4.3 A/D converter operation mode
Partial modification of 10.6 (1) Operating current in STOP mode and (6) Input
impedance of ANI0 to ANI3 pins
Modification of capacitor value in Figure 10-19 Analog Input Pin Connection
Modification of Figure 10-21 Internal Equivalent Circuit of ANIn Pin and Table 10-4
Resistance and Capacitance Values (Reference Values) of Equivalent Circuit
Addition of description to 11.2 (3) Transmit buffer register 6 (TXB6)
CHAPTER 11 SERIAL
INTERFACE UART6
Modification of Note 1 in Figure 11-5 Format of Asynchronous Serial Interface
Operation Mode Register 6 (ASIM6) (1/2)
Modification of Caution in 11.3 (6) Asynchronous serial interface control register 6
(ASICL6)
Modification of Caution 1 in 11.4.2 (2) (d) Continuous transmission
408
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
(3/4)
Edition
Description
Applied to:
2nd edition Modification of 11.4.2 (2) (h) SBF transmission
Modification of Table 11-4 Set Data of Baud Rate Generator
Addition of Caution to and modification of Table 12-1 Interrupt Sources
CHAPTER 11 SERIAL
INTERFACE UART6
CHAPTER 12
INTERRUPT
FUNCTIONS
Modification of description on operation stop time in 13.1.1 (2) STOP mode
Modification of Table 13-2 Operating Statuses in HALT Mode
CHAPTER 13
STANDBY FUNCTION
Modification of Remark 2 in Figure 13-2 HALT Mode Release by Interrupt Request
Generation
Modification of Note in Figure 13-3 HALT Mode Release by Reset Input
Modification of Caution in 13.2.2 (1) STOP mode setting and operating statuses
Modification of Table 13-4 Operating Statuses in STOP Mode
Modification of operation stop time in the following figures.
• Figure 13-4 Operation Timing When STOP Mode Is Released
• Figure 13-5 STOP Mode Release by Interrupt Request Generation
Modification of the following figures
CHAPTER 14 RESET
FUNCTION
• Figure 14-1 Block Diagram of Reset Function
• Figure 14-2 Timing of Reset by RESET Input
• Figure 14-3 Timing of Reset by Overflow of Watchdog Timer
• Figure 14-4 Reset Timing by RESET Input in STOP Mode
Addition of registers to be used for self programming function in Table 14-1 Hardware
Statuses After Reset Acknowledgment
Addition of Note 1 to Figure 16-2 Format of Low-Voltage Detect Register (LVIM)
CHAPTER 16 LOW-
VOLTAGE DETECTOR
Addition of Note to Figure 16-3 Format of Low-Voltage Detection Level Select
Register (LVIS)
Addition of Notes 1 and 2 to and modification of Figure 16-4 Timing of Low-Voltage
Detector Internal Reset Signal Generation
Addition of Notes 1 and 2 to and modification of Figure 16-5 Timing of Low-Voltage
Detector Interrupt Signal Generation
Addition of Note to 16.5 Cautions for Low-Voltage Detector <Action> (2) When used
as interrupt
Revision of CHAPTER 18 FLASH MEMORY
CHAPTER 18 FLASH
MEMORY
Modification or addition of values in the following characteristics in CHAPTER 20
ELECTRICAL SPECIFICATIONS (TARGET VALUES)
• Absolute maximum ratings
CHAPTER 20
ELECTRICAL
SPECIFICATIONS
(TARGET VALUES)
Output current high, output current low, and operating ambient temperature
• X1 oscillator characteristics
• Low-speed internal oscillator characteristics
• DC characteristics
• AC characteristics
(1) Basic operation cycle time (minimum instruction execution time), RESET input
low-level width
• POC circuit characteristics
Condition for power supply boot time
• Flash memory programming characteristics
409
User’s Manual U16898EJ3V0UD
APPENDIX E REVISION HISTORY
(4/4)
Edition
Description
Applied to:
APPENDIX A
2nd edition Modification Figure A-1 Development Tools
DEVELOPMENT
TOOLS
Modification of device file names and Remark in A.2 Language Processing Software
Addition of project manager name to A.3 Control Software
Addition of PG-FPL2 to A.4 Flash Memory Writing Tools
Modification of emulation board name used when the IE-78K0S-NS or IE-78K0S-NS-A is
used, and deletion of NP-20GS and EV-9500GS-20, and addition of Specification of pin
header on target system to A.5.1 When using in-circuit emulator IE-78K0S-NS or IE-
78K0S-NS-A
Addition of A.5.2 When using in-circuit emulator QB-78K0KX1MINI
Modification of system simulator name, device file name, and Remark in and addition of
ID78K0S-QB to A.6 Debugging Tools (Software)
Modification of Figure B-1 Distance Between In-Circuit Emulator IE-78K0S-NS/IE-
78K0S-NS-A and Conversion Connector NP-30MC and Figure B-2 Condition for
Connecting Target System (When Using In-Circuit Emulator IE-78K0S-NS, IE-
78K0S-NS-A)
APPENDIX B NOTES
ON TARGET SYSTEM
DESIGN
Addition of APPENDIX D REVISION HISTORY
APPENDIX D
REVISION HISTORY
410
User’s Manual U16898EJ3V0UD
相关型号:
UPD78F9222MC(A)-5A4-A
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO20, 0.300 INCH, LEAD FREE, PLASTIC, SSOP-20
NEC
UPD78F9222MC(A2)-5A4
Microcontroller, 8-Bit, FLASH, 8MHz, CMOS, PDSO20, 0.300 INCH, PLASTIC, SSOP-20
NEC
UPD78F9222MC(S)-5A4-A
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO20, 0.300 INCH, LEAD FREE, PLASTIC, SSOP-20
NEC
UPD78F9222MC(T)-5A4
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO20, 0.300 INCH, PLASTIC, SSOP-20
NEC
UPD78F9222MC(T2)-5A4
Microcontroller, 8-Bit, FLASH, 8MHz, CMOS, PDSO20, 0.300 INCH, PLASTIC, SSOP-20
NEC
UPD78F9222MC(T2)-5A4-A
Microcontroller, 8-Bit, FLASH, 8MHz, CMOS, PDSO20, 0.300 INCH, LEAD FREE, PLASTIC, SSOP-20
NEC
UPD78F9232MC(A)-5A4
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO30, 7.62 MM, PLASTIC, SSOP-30
RENESAS
UPD78F9232MC(A)-5A4-A
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO30, 7.62 MM, LEAD FREE, PLASTIC, SSOP-30
RENESAS
UPD78F9232MC(A2)-5A4
8-BIT, FLASH, 10MHz, MICROCONTROLLER, PDSO30, 7.62 MM, PLASTIC, SSOP-30
RENESAS
UPD78F9232MC(A2)-5A4-A
Microcontroller, 8-Bit, FLASH, 10MHz, CMOS, PDSO30, 7.62 MM, LEAD FREE, PLASTIC, SSOP-30
RENESAS
©2020 ICPDF网 联系我们和版权申明